id stringlengths 24 24 | repo stringlengths 7 52 | path stringlengths 5 138 | func_name stringlengths 1 134 | url stringlengths 89 242 | split stringclasses 3
values | language stringclasses 1
value | docstring stringlengths 1 46.9k | code stringlengths 87 104k | text stringlengths 100 112k | token_count int32 25 38.1k | doc_chars int32 1 46.9k | code_chars int32 87 104k | license_basis stringclasses 1
value | source stringclasses 1
value | added stringdate 2026-12-05 00:00:00 2026-12-05 00:00:00 | record_sha256 stringlengths 64 64 | license stringclasses 9
values | license_class stringclasses 1
value | license_source stringlengths 46 99 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9e8bb0eec46acaaf0527fc95 | ramses-tech/ramses | ramses/utils.py | generate_model_name | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L76-L84 | train | python | Generate model name.
:param raml_resource: Instance of ramlfications.raml.ResourceNode. | def generate_model_name(raml_resource):
""" Generate model name.
:param raml_resource: Instance of ramlfications.raml.ResourceNode.
"""
resource_uri = get_resource_uri(raml_resource).strip('/')
resource_uri = re.sub('\W', ' ', resource_uri)
model_name = inflection.titleize(resource_uri)
ret... | Generate model name.
:param raml_resource: Instance of ramlfications.raml.ResourceNode.
def generate_model_name(raml_resource):
""" Generate model name.
:param raml_resource: Instance of ramlfications.raml.ResourceNode.
"""
resource_uri = get_resource_uri(raml_resource).strip('/')
resource_ur... | 110 | 92 | 375 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 570498976bfd69a62205fd37b130d5b2e8f4efe9e41c7531f071c6c9e4d81cc0 | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
f8e7df93c6d0988e9b06537b | ramses-tech/ramses | ramses/utils.py | dynamic_part_name | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L87-L109 | train | python | Generate a dynamic part for a resource :raml_resource:.
A dynamic part is generated using 2 parts: :route_name: of the
resource and the dynamic part of first dynamic child resources. If
:raml_resource: has no dynamic child resources, 'id' is used as the
2nd part.
E.g. if your dynamic part on route ... | def dynamic_part_name(raml_resource, route_name, pk_field):
""" Generate a dynamic part for a resource :raml_resource:.
A dynamic part is generated using 2 parts: :route_name: of the
resource and the dynamic part of first dynamic child resources. If
:raml_resource: has no dynamic child resources, 'id' ... | Generate a dynamic part for a resource :raml_resource:.
A dynamic part is generated using 2 parts: :route_name: of the
resource and the dynamic part of first dynamic child resources. If
:raml_resource: has no dynamic child resources, 'id' is used as the
2nd part.
E.g. if your dynamic part on route ... | 408 | 630 | 1,036 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 3f07babe6c31f4e271c514cd6a5209e8e6a167962ac630bff24452eb38a8fc4f | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
a07b9e51bdd665cc9d8e84e1 | ramses-tech/ramses | ramses/utils.py | extract_dynamic_part | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L112-L120 | train | python | Extract dynamic url part from :uri: string.
:param uri: URI string that may contain dynamic part. | def extract_dynamic_part(uri):
""" Extract dynamic url part from :uri: string.
:param uri: URI string that may contain dynamic part.
"""
for part in uri.split('/'):
part = part.strip()
if part.startswith('{') and part.endswith('}'):
return clean_dynamic_uri(part) | Extract dynamic url part from :uri: string.
:param uri: URI string that may contain dynamic part.
def extract_dynamic_part(uri):
""" Extract dynamic url part from :uri: string.
:param uri: URI string that may contain dynamic part.
"""
for part in uri.split('/'):
part = part.strip()
... | 89 | 102 | 308 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | ecc4e89beea2bc43d28179031bbf96e04c7432809c5a621ceca317f8cc5d6c88 | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
8c64b595b8f2472607902858 | ramses-tech/ramses | ramses/utils.py | resource_view_attrs | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L123-L156 | train | python | Generate view method names needed for `raml_resource` view.
Collects HTTP method names from resource siblings and dynamic children
if exist. Collected methods are then translated to
`nefertari.view.BaseView` method names, each of which is used to
process a particular HTTP method request.
Maps of ... | def resource_view_attrs(raml_resource, singular=False):
""" Generate view method names needed for `raml_resource` view.
Collects HTTP method names from resource siblings and dynamic children
if exist. Collected methods are then translated to
`nefertari.view.BaseView` method names, each of which is use... | Generate view method names needed for `raml_resource` view.
Collects HTTP method names from resource siblings and dynamic children
if exist. Collected methods are then translated to
`nefertari.view.BaseView` method names, each of which is used to
process a particular HTTP method request.
Maps of ... | 466 | 598 | 1,549 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c3a105f483d1233631c007226622be3aff0b0084cd6731500f3988d24201f9fa | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
fe5aab7ae33800a4d32f3274 | ramses-tech/ramses | ramses/utils.py | resource_schema | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L159-L178 | train | python | Get schema properties of RAML resource :raml_resource:.
Must be called with RAML resource that defines body schema. First
body that defines schema is used. Schema is converted on return using
'convert_schema'.
:param raml_resource: Instance of ramlfications.raml.ResourceNode of
POST method. | def resource_schema(raml_resource):
""" Get schema properties of RAML resource :raml_resource:.
Must be called with RAML resource that defines body schema. First
body that defines schema is used. Schema is converted on return using
'convert_schema'.
:param raml_resource: Instance of ramlfications.... | Get schema properties of RAML resource :raml_resource:.
Must be called with RAML resource that defines body schema. First
body that defines schema is used. Schema is converted on return using
'convert_schema'.
:param raml_resource: Instance of ramlfications.raml.ResourceNode of
POST method.
d... | 238 | 317 | 785 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | cbbb732b1f690e21c337f84153a17581e6aaf2457b0b824f8d1c22602f9ba245 | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
a5afdb465037624cea63b857 | ramses-tech/ramses | ramses/utils.py | get_static_parent | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L189-L214 | train | python | Get static parent resource of :raml_resource: with HTTP
method :method:.
:param raml_resource:Instance of ramlfications.raml.ResourceNode.
:param method: HTTP method name which matching static resource
must have. | def get_static_parent(raml_resource, method=None):
""" Get static parent resource of :raml_resource: with HTTP
method :method:.
:param raml_resource:Instance of ramlfications.raml.ResourceNode.
:param method: HTTP method name which matching static resource
must have.
"""
parent = raml_r... | Get static parent resource of :raml_resource: with HTTP
method :method:.
:param raml_resource:Instance of ramlfications.raml.ResourceNode.
:param method: HTTP method name which matching static resource
must have.
def get_static_parent(raml_resource, method=None):
""" Get static parent resource... | 219 | 233 | 775 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 84738fa82a6f52c93ca7015dbc0484e3ada5664da3d2de49f1db76e89f114c91 | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
9f03ad05e09a68993f6707b0 | ramses-tech/ramses | ramses/utils.py | attr_subresource | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L217-L231 | train | python | Determine if :raml_resource: is an attribute subresource.
:param raml_resource: Instance of ramlfications.raml.ResourceNode.
:param route_name: Name of the :raml_resource:. | def attr_subresource(raml_resource, route_name):
""" Determine if :raml_resource: is an attribute subresource.
:param raml_resource: Instance of ramlfications.raml.ResourceNode.
:param route_name: Name of the :raml_resource:.
"""
static_parent = get_static_parent(raml_resource, method='POST')
i... | Determine if :raml_resource: is an attribute subresource.
:param raml_resource: Instance of ramlfications.raml.ResourceNode.
:param route_name: Name of the :raml_resource:.
def attr_subresource(raml_resource, route_name):
""" Determine if :raml_resource: is an attribute subresource.
:param raml_resou... | 195 | 181 | 639 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 5a893685be660b531ee7628d12453ae4a8aa28a9f3370102cea416d2e9f0669e | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
cc801c9d052559f312cd4faa | ramses-tech/ramses | ramses/utils.py | singular_subresource | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L234-L251 | train | python | Determine if :raml_resource: is a singular subresource.
:param raml_resource: Instance of ramlfications.raml.ResourceNode.
:param route_name: Name of the :raml_resource:. | def singular_subresource(raml_resource, route_name):
""" Determine if :raml_resource: is a singular subresource.
:param raml_resource: Instance of ramlfications.raml.ResourceNode.
:param route_name: Name of the :raml_resource:.
"""
static_parent = get_static_parent(raml_resource, method='POST')
... | Determine if :raml_resource: is a singular subresource.
:param raml_resource: Instance of ramlfications.raml.ResourceNode.
:param route_name: Name of the :raml_resource:.
def singular_subresource(raml_resource, route_name):
""" Determine if :raml_resource: is a singular subresource.
:param raml_resou... | 217 | 179 | 729 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 9ef3c965a25e24a4310bb21fc393819bd6905b434f34b5a8786bbcf3560d8450 | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
78832d20567758859f328414 | ramses-tech/ramses | ramses/utils.py | is_callable_tag | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L254-L264 | train | python | Determine whether :tag: is a valid callable string tag.
String is assumed to be valid callable if it starts with '{{'
and ends with '}}'.
:param tag: String name of tag. | def is_callable_tag(tag):
""" Determine whether :tag: is a valid callable string tag.
String is assumed to be valid callable if it starts with '{{'
and ends with '}}'.
:param tag: String name of tag.
"""
return (isinstance(tag, six.string_types) and
tag.strip().startswith('{{') and... | Determine whether :tag: is a valid callable string tag.
String is assumed to be valid callable if it starts with '{{'
and ends with '}}'.
:param tag: String name of tag.
def is_callable_tag(tag):
""" Determine whether :tag: is a valid callable string tag.
String is assumed to be valid callable i... | 128 | 183 | 360 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 75ea77bb68271c4831ce84a3d422dc9a35924df3fa01307ac785c149b82dcb6c | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
1f91a30611748290bcd67a95 | ramses-tech/ramses | ramses/utils.py | resolve_to_callable | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L267-L285 | train | python | Resolve string :callable_name: to a callable.
:param callable_name: String representing callable name as registered
in ramses registry or dotted import path of callable. Can be
wrapped in double curly brackets, e.g. '{{my_callable}}'. | def resolve_to_callable(callable_name):
""" Resolve string :callable_name: to a callable.
:param callable_name: String representing callable name as registered
in ramses registry or dotted import path of callable. Can be
wrapped in double curly brackets, e.g. '{{my_callable}}'.
"""
from... | Resolve string :callable_name: to a callable.
:param callable_name: String representing callable name as registered
in ramses registry or dotted import path of callable. Can be
wrapped in double curly brackets, e.g. '{{my_callable}}'.
def resolve_to_callable(callable_name):
""" Resolve string ... | 204 | 255 | 762 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 5bedaf8df21381e9412daef5a373862f7b93a41036cf20e26d095db8ac394ea8 | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
8db7dd20f81939c5f84e54e3 | ramses-tech/ramses | ramses/utils.py | get_resource_siblings | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L288-L295 | train | python | Get siblings of :raml_resource:.
:param raml_resource: Instance of ramlfications.raml.ResourceNode. | def get_resource_siblings(raml_resource):
""" Get siblings of :raml_resource:.
:param raml_resource: Instance of ramlfications.raml.ResourceNode.
"""
path = raml_resource.path
return [res for res in raml_resource.root.resources
if res.path == path] | Get siblings of :raml_resource:.
:param raml_resource: Instance of ramlfications.raml.ResourceNode.
def get_resource_siblings(raml_resource):
""" Get siblings of :raml_resource:.
:param raml_resource: Instance of ramlfications.raml.ResourceNode.
"""
path = raml_resource.path
return [res for r... | 96 | 104 | 281 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | dbe30126abb9b480241627fd996c2fb93b16d22b2ab38d96aff1972f939df260 | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
c1ce97b04cc4cabd01f4c756 | ramses-tech/ramses | ramses/utils.py | get_resource_children | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L298-L305 | train | python | Get children of :raml_resource:.
:param raml_resource: Instance of ramlfications.raml.ResourceNode. | def get_resource_children(raml_resource):
""" Get children of :raml_resource:.
:param raml_resource: Instance of ramlfications.raml.ResourceNode.
"""
path = raml_resource.path
return [res for res in raml_resource.root.resources
if res.parent and res.parent.path == path] | Get children of :raml_resource:.
:param raml_resource: Instance of ramlfications.raml.ResourceNode.
def get_resource_children(raml_resource):
""" Get children of :raml_resource:.
:param raml_resource: Instance of ramlfications.raml.ResourceNode.
"""
path = raml_resource.path
return [res for r... | 99 | 104 | 303 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | be7e0cbe6460898536ec8128a974ab0dd4cf0c46622e0515647ac301d7520abf | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
0567db9cbe0ce8e05b242828 | ramses-tech/ramses | ramses/utils.py | get_events_map | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L308-L324 | train | python | Prepare map of event subscribers.
* Extends copies of BEFORE_EVENTS and AFTER_EVENTS maps with
'set' action.
* Returns map of {before/after: {action: event class(es)}} | def get_events_map():
""" Prepare map of event subscribers.
* Extends copies of BEFORE_EVENTS and AFTER_EVENTS maps with
'set' action.
* Returns map of {before/after: {action: event class(es)}}
"""
from nefertari import events
set_keys = ('create', 'update', 'replace', 'update_many', 'r... | Prepare map of event subscribers.
* Extends copies of BEFORE_EVENTS and AFTER_EVENTS maps with
'set' action.
* Returns map of {before/after: {action: event class(es)}}
def get_events_map():
""" Prepare map of event subscribers.
* Extends copies of BEFORE_EVENTS and AFTER_EVENTS maps with
... | 201 | 184 | 640 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 5b502ae467ca492723ecb258e161807f1ed588d1297a41756ec8d5e4311e03dd | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
fb68ae8c89c2474ccd50dec6 | ramses-tech/ramses | ramses/utils.py | patch_view_model | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L328-L342 | train | python | Patches view_cls.Model with model_cls.
:param view_cls: View class "Model" param of which should be
patched
:param model_cls: Model class which should be used to patch
view_cls.Model | def patch_view_model(view_cls, model_cls):
""" Patches view_cls.Model with model_cls.
:param view_cls: View class "Model" param of which should be
patched
:param model_cls: Model class which should be used to patch
view_cls.Model
"""
original_model = view_cls.Model
view_cls.Mode... | Patches view_cls.Model with model_cls.
:param view_cls: View class "Model" param of which should be
patched
:param model_cls: Model class which should be used to patch
view_cls.Model
def patch_view_model(view_cls, model_cls):
""" Patches view_cls.Model with model_cls.
:param view_cls:... | 144 | 207 | 410 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 227d97db1ddbda1e8b7265a57191409caadbc746583b5ffd642baf7100965e4f | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
f9408e56a984c3ffbc6d8d7a | ramses-tech/ramses | ramses/utils.py | get_route_name | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L345-L354 | train | python | Get route name from RAML resource URI.
:param resource_uri: String representing RAML resource URI.
:returns string: String with route name, which is :resource_uri:
stripped of non-word characters. | def get_route_name(resource_uri):
""" Get route name from RAML resource URI.
:param resource_uri: String representing RAML resource URI.
:returns string: String with route name, which is :resource_uri:
stripped of non-word characters.
"""
resource_uri = resource_uri.strip('/')
resource_... | Get route name from RAML resource URI.
:param resource_uri: String representing RAML resource URI.
:returns string: String with route name, which is :resource_uri:
stripped of non-word characters.
def get_route_name(resource_uri):
""" Get route name from RAML resource URI.
:param resource_uri... | 126 | 213 | 380 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 33f7700655cdf123bfa60e474ff0d6bd454be6042078e407c616e41dfbe46e9a | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
7189cd09c719601cdb8cf6a0 | ramses-tech/ramses | ramses/generators.py | generate_resource | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/generators.py#L32-L122 | train | python | Perform complete one resource configuration process
This function generates: ACL, view, route, resource, database
model for a given `raml_resource`. New nefertari resource is
attached to `parent_resource` class which is an instance of
`nefertari.resource.Resource`.
Things to consider:
* Top-... | def generate_resource(config, raml_resource, parent_resource):
""" Perform complete one resource configuration process
This function generates: ACL, view, route, resource, database
model for a given `raml_resource`. New nefertari resource is
attached to `parent_resource` class which is an instance of
... | Perform complete one resource configuration process
This function generates: ACL, view, route, resource, database
model for a given `raml_resource`. New nefertari resource is
attached to `parent_resource` class which is an instance of
`nefertari.resource.Resource`.
Things to consider:
* Top-... | 1,008 | 1,037 | 3,634 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a6f62918c4a35b021042ef51c816d6403000ae93b1e87179cf7596b818a4538d | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
9556cbb9d425c86180314dbd | ramses-tech/ramses | ramses/generators.py | generate_server | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/generators.py#L125-L151 | train | python | Handle server generation process.
:param raml_root: Instance of ramlfications.raml.RootNode.
:param config: Pyramid Configurator instance. | def generate_server(raml_root, config):
""" Handle server generation process.
:param raml_root: Instance of ramlfications.raml.RootNode.
:param config: Pyramid Configurator instance.
"""
log.info('Server generation started')
if not raml_root.resources:
return
root_resource = confi... | Handle server generation process.
:param raml_root: Instance of ramlfications.raml.RootNode.
:param config: Pyramid Configurator instance.
def generate_server(raml_root, config):
""" Handle server generation process.
:param raml_root: Instance of ramlfications.raml.RootNode.
:param config: Pyrami... | 217 | 147 | 899 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 680f980d0f9072beddc9cef7e6b64fd0cc5e26267316326496858a75757630db | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
914b3a4d7bd84bc0a2461f35 | ramses-tech/ramses | ramses/generators.py | generate_models | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/generators.py#L154-L186 | train | python | Generate model for each resource in :raml_resources:
The DB model name is generated using singular titled version of current
resource's url. E.g. for resource under url '/stories', model with
name 'Story' will be generated.
:param config: Pyramid Configurator instance.
:param raml_resources: List ... | def generate_models(config, raml_resources):
""" Generate model for each resource in :raml_resources:
The DB model name is generated using singular titled version of current
resource's url. E.g. for resource under url '/stories', model with
name 'Story' will be generated.
:param config: Pyramid Co... | Generate model for each resource in :raml_resources:
The DB model name is generated using singular titled version of current
resource's url. E.g. for resource under url '/stories', model with
name 'Story' will be generated.
:param config: Pyramid Configurator instance.
:param raml_resources: List ... | 368 | 355 | 1,381 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 805711e45b98f8351e52e6b66298b2dec5f0f4c0efdbbaf9e50227c6df4a8e0f | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
20abd67b2e7e39026fb58286 | ramses-tech/ramses | ramses/views.py | generate_rest_view | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L447-L491 | train | python | Generate REST view for a model class.
:param model_cls: Generated DB model class.
:param attr: List of strings that represent names of view methods, new
generated view should support. Not supported methods are replaced
with property that raises AttributeError to display MethodNotAllowed
... | def generate_rest_view(config, model_cls, attrs=None, es_based=True,
attr_view=False, singular=False):
""" Generate REST view for a model class.
:param model_cls: Generated DB model class.
:param attr: List of strings that represent names of view methods, new
generated view s... | Generate REST view for a model class.
:param model_cls: Generated DB model class.
:param attr: List of strings that represent names of view methods, new
generated view should support. Not supported methods are replaced
with property that raises AttributeError to display MethodNotAllowed
... | 525 | 798 | 1,747 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 487eaae0bfbdcf823481a42863cb0a2c819eb74e11212c7d0d6c73bfb02d6efd | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
cfe32e76db4fad321d4526fe | ramses-tech/ramses | ramses/views.py | SetObjectACLMixin.set_object_acl | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L37-L42 | train | python | Set object ACL on creation if not already present. | def set_object_acl(self, obj):
""" Set object ACL on creation if not already present. """
if not obj._acl:
from nefertari_guards import engine as guards_engine
acl = self._factory(self.request).generate_item_acl(obj)
obj._acl = guards_engine.ACLField.stringify_acl(acl... | Set object ACL on creation if not already present.
def set_object_acl(self, obj):
""" Set object ACL on creation if not already present. """
if not obj._acl:
from nefertari_guards import engine as guards_engine
acl = self._factory(self.request).generate_item_acl(obj)
... | 80 | 50 | 321 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a80ecbbf43db33f0eefd499e2a071d286d1350b1e77a1fcf3c5e630f958e8bc1 | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
d48d309d16836d3614532906 | ramses-tech/ramses | ramses/views.py | BaseView.resolve_kw | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L62-L72 | train | python | Resolve :kwargs: like `story_id: 1` to the form of `id: 1`. | def resolve_kw(self, kwargs):
""" Resolve :kwargs: like `story_id: 1` to the form of `id: 1`.
"""
resolved = {}
for key, value in kwargs.items():
split = key.split('_', 1)
if len(split) > 1:
key = split[1]
resolved[key] = value
... | Resolve :kwargs: like `story_id: 1` to the form of `id: 1`.
def resolve_kw(self, kwargs):
""" Resolve :kwargs: like `story_id: 1` to the form of `id: 1`.
"""
resolved = {}
for key, value in kwargs.items():
split = key.split('_', 1)
if len(split) > 1:
... | 103 | 59 | 336 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | cb693d8317250a701e2a7a610e448a9cd0920347ed2c11d855635917c86114c0 | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
878790a08002b55fdda057d7 | ramses-tech/ramses | ramses/views.py | BaseView._location | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L74-L83 | train | python | Get location of the `obj`
Arguments:
:obj: self.Model instance. | def _location(self, obj):
""" Get location of the `obj`
Arguments:
:obj: self.Model instance.
"""
field_name = self.clean_id_name
return self.request.route_url(
self._resource.uid,
**{self._resource.id_name: getattr(obj, field_name)}) | Get location of the `obj`
Arguments:
:obj: self.Model instance.
def _location(self, obj):
""" Get location of the `obj`
Arguments:
:obj: self.Model instance.
"""
field_name = self.clean_id_name
return self.request.route_url(
self._re... | 84 | 84 | 311 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 00180ce05b7e6085c1c6dc235e4b5016450de84f29cae1e8bd453c9ebef9f60a | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
b462f9a26b96bdfb17101a7d | ramses-tech/ramses | ramses/views.py | BaseView._parent_queryset | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L85-L101 | train | python | Get queryset of parent view.
Generated queryset is used to run queries in the current level view. | def _parent_queryset(self):
""" Get queryset of parent view.
Generated queryset is used to run queries in the current level view.
"""
parent = self._resource.parent
if hasattr(parent, 'view'):
req = self.request.blank(self.request.path)
req.registry = sel... | Get queryset of parent view.
Generated queryset is used to run queries in the current level view.
def _parent_queryset(self):
""" Get queryset of parent view.
Generated queryset is used to run queries in the current level view.
"""
parent = self._resource.parent
if has... | 161 | 106 | 740 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 1516d41689497d175c7956b1e9dac09e31c1f815904692912ee303e5ca6fe703 | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
52bf8c71fa31842c9bae6408 | ramses-tech/ramses | ramses/views.py | BaseView.get_collection | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L103-L117 | train | python | Get objects collection taking into account generated queryset
of parent view.
This method allows working with nested resources properly. Thus a
queryset returned by this method will be a subset of its parent
view's queryset, thus filtering out objects that don't belong to
the pa... | def get_collection(self, **kwargs):
""" Get objects collection taking into account generated queryset
of parent view.
This method allows working with nested resources properly. Thus a
queryset returned by this method will be a subset of its parent
view's queryset, thus filtering... | Get objects collection taking into account generated queryset
of parent view.
This method allows working with nested resources properly. Thus a
queryset returned by this method will be a subset of its parent
view's queryset, thus filtering out objects that don't belong to
the pa... | 185 | 332 | 664 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 461d811f2b4ca69c721754c350bea43a26311d0c239d4a3ef0c6807155e38e2a | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
37aabbc34237dcdf04b81cab | ramses-tech/ramses | ramses/views.py | BaseView.get_item | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L119-L139 | train | python | Get collection item taking into account generated queryset
of parent view.
This method allows working with nested resources properly. Thus an item
returned by this method will belong to its parent view's queryset, thus
filtering out objects that don't belong to the parent object.
... | def get_item(self, **kwargs):
""" Get collection item taking into account generated queryset
of parent view.
This method allows working with nested resources properly. Thus an item
returned by this method will belong to its parent view's queryset, thus
filtering out objects that... | Get collection item taking into account generated queryset
of parent view.
This method allows working with nested resources properly. Thus an item
returned by this method will belong to its parent view's queryset, thus
filtering out objects that don't belong to the parent object.
... | 242 | 422 | 855 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | cdd857472a2b9913374e5d04884c0bc3bb371a41ee254697e73211976f94a4ab | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
94d53fe1051ce15729bfc637 | ramses-tech/ramses | ramses/views.py | BaseView.reload_context | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L145-L168 | train | python | Reload `self.context` object into a DB or ES object.
A reload is performed by getting the object ID from :kwargs: and then
getting a context key item from the new instance of `self._factory`
which is an ACL class used by the current view.
Arguments:
:es_based: Boolean. Whet... | def reload_context(self, es_based, **kwargs):
""" Reload `self.context` object into a DB or ES object.
A reload is performed by getting the object ID from :kwargs: and then
getting a context key item from the new instance of `self._factory`
which is an ACL class used by the current view... | Reload `self.context` object into a DB or ES object.
A reload is performed by getting the object ID from :kwargs: and then
getting a context key item from the new instance of `self._factory`
which is an ACL class used by the current view.
Arguments:
:es_based: Boolean. Whet... | 322 | 534 | 962 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | ff4438c2cb645cd743072ddcc0e5081be4edc629da05d855836cc4cf3c130c2b | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
f2d3d63e0b7181557efe2a95 | ramses-tech/ramses | ramses/views.py | ESBaseView._parent_queryset_es | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L218-L234 | train | python | Get queryset (list of object IDs) of parent view.
The generated queryset is used to run queries in the current level's
view. | def _parent_queryset_es(self):
""" Get queryset (list of object IDs) of parent view.
The generated queryset is used to run queries in the current level's
view.
"""
parent = self._resource.parent
if hasattr(parent, 'view'):
req = self.request.blank(self.reques... | Get queryset (list of object IDs) of parent view.
The generated queryset is used to run queries in the current level's
view.
def _parent_queryset_es(self):
""" Get queryset (list of object IDs) of parent view.
The generated queryset is used to run queries in the current level's
... | 175 | 141 | 738 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 4a0b160883bb443d4d5f2349c44c4a0d7f618c9a062f841aca94d17245b567dd | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
d71486ec9e24237217df356f | ramses-tech/ramses | ramses/views.py | ESBaseView.get_es_object_ids | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L236-L240 | train | python | Return IDs of :objects: if they are not IDs already. | def get_es_object_ids(self, objects):
""" Return IDs of :objects: if they are not IDs already. """
id_field = self.clean_id_name
ids = [getattr(obj, id_field, obj) for obj in objects]
return list(set(str(id_) for id_ in ids)) | Return IDs of :objects: if they are not IDs already.
def get_es_object_ids(self, objects):
""" Return IDs of :objects: if they are not IDs already. """
id_field = self.clean_id_name
ids = [getattr(obj, id_field, obj) for obj in objects]
return list(set(str(id_) for id_ in ids)) | 77 | 52 | 257 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | ef986efab17ab95e06dac98d0cc601fa123d942912eaac4bfa36a9ac7698c027 | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
ae949b3a39671a3d61db4566 | ramses-tech/ramses | ramses/views.py | ESBaseView.get_collection_es | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L242-L259 | train | python | Get ES objects collection taking into account the generated
queryset of parent view.
This method allows working with nested resources properly. Thus a
queryset returned by this method will be a subset of its parent view's
queryset, thus filtering out objects that don't belong to the par... | def get_collection_es(self):
""" Get ES objects collection taking into account the generated
queryset of parent view.
This method allows working with nested resources properly. Thus a
queryset returned by this method will be a subset of its parent view's
queryset, thus filtering... | Get ES objects collection taking into account the generated
queryset of parent view.
This method allows working with nested resources properly. Thus a
queryset returned by this method will be a subset of its parent view's
queryset, thus filtering out objects that don't belong to the par... | 201 | 339 | 709 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 5e92dfd328605f446a45af2af38581e10251c005e3fa1ec24ba5bee72bba18f9 | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
d2b5d12009ced531a0f775b3 | ramses-tech/ramses | ramses/views.py | ESBaseView.get_item_es | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L261-L284 | train | python | Get ES collection item taking into account generated queryset
of parent view.
This method allows working with nested resources properly. Thus an item
returned by this method will belong to its parent view's queryset, thus
filtering out objects that don't belong to the parent object.
... | def get_item_es(self, **kwargs):
""" Get ES collection item taking into account generated queryset
of parent view.
This method allows working with nested resources properly. Thus an item
returned by this method will belong to its parent view's queryset, thus
filtering out object... | Get ES collection item taking into account generated queryset
of parent view.
This method allows working with nested resources properly. Thus an item
returned by this method will belong to its parent view's queryset, thus
filtering out objects that don't belong to the parent object.
... | 285 | 438 | 1,008 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c72e554697199d89549f5d5f4b15130dc354694e54fd54a4d7b200f83a25b1e5 | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
9bbe0f3e5a24c6d762d46c17 | ramses-tech/ramses | ramses/views.py | ESCollectionView.update | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L298-L303 | train | python | Explicitly reload context with DB usage to get access
to complete DB object. | def update(self, **kwargs):
""" Explicitly reload context with DB usage to get access
to complete DB object.
"""
self.reload_context(es_based=False, **kwargs)
return super(ESCollectionView, self).update(**kwargs) | Explicitly reload context with DB usage to get access
to complete DB object.
def update(self, **kwargs):
""" Explicitly reload context with DB usage to get access
to complete DB object.
"""
self.reload_context(es_based=False, **kwargs)
return super(ESCollectionView, self... | 69 | 84 | 252 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 980255cf87cfb07923329c6b31a597b00e70c9307e72515f4f4e2fa8bc8bfe64 | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
79c7f063f824082c031cbb78 | ramses-tech/ramses | ramses/views.py | ESCollectionView.delete | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L305-L310 | train | python | Explicitly reload context with DB usage to get access
to complete DB object. | def delete(self, **kwargs):
""" Explicitly reload context with DB usage to get access
to complete DB object.
"""
self.reload_context(es_based=False, **kwargs)
return super(ESCollectionView, self).delete(**kwargs) | Explicitly reload context with DB usage to get access
to complete DB object.
def delete(self, **kwargs):
""" Explicitly reload context with DB usage to get access
to complete DB object.
"""
self.reload_context(es_based=False, **kwargs)
return super(ESCollectionView, self... | 69 | 84 | 252 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | b7a0d0c7dd5ff56c7ccc012f6a6100e1340be26a2eb4af7282a8b7731d528112 | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
3dd26bd5fb40159a7c83ca79 | ramses-tech/ramses | ramses/views.py | ESCollectionView.get_dbcollection_with_es | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L312-L316 | train | python | Get DB objects collection by first querying ES. | def get_dbcollection_with_es(self, **kwargs):
""" Get DB objects collection by first querying ES. """
es_objects = self.get_collection_es()
db_objects = self.Model.filter_objects(es_objects)
return db_objects | Get DB objects collection by first querying ES.
def get_dbcollection_with_es(self, **kwargs):
""" Get DB objects collection by first querying ES. """
es_objects = self.get_collection_es()
db_objects = self.Model.filter_objects(es_objects)
return db_objects | 56 | 47 | 240 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | b18b6d90da023871cdbe6770cc8981d8ad1d86f742af3b26c3ac1b0cd08ef0cd | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
a713fa2b46c2cf7279ea5606 | ramses-tech/ramses | ramses/views.py | ESCollectionView.delete_many | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L318-L326 | train | python | Delete multiple objects from collection.
First ES is queried, then the results are used to query the DB.
This is done to make sure deleted objects are those filtered
by ES in the 'index' method (so user deletes what he saw). | def delete_many(self, **kwargs):
""" Delete multiple objects from collection.
First ES is queried, then the results are used to query the DB.
This is done to make sure deleted objects are those filtered
by ES in the 'index' method (so user deletes what he saw).
"""
db_ob... | Delete multiple objects from collection.
First ES is queried, then the results are used to query the DB.
This is done to make sure deleted objects are those filtered
by ES in the 'index' method (so user deletes what he saw).
def delete_many(self, **kwargs):
""" Delete multiple objects ... | 142 | 249 | 432 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 7bc561507280c4a8d87cd00ab2da70a0fc02abd61ab7ad8aadda80d8ae97a130 | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
c5ced335ce65634a11c6f696 | ramses-tech/ramses | ramses/views.py | ESCollectionView.update_many | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L328-L337 | train | python | Update multiple objects from collection.
First ES is queried, then the results are used to query DB.
This is done to make sure updated objects are those filtered
by ES in the 'index' method (so user updates what he saw). | def update_many(self, **kwargs):
""" Update multiple objects from collection.
First ES is queried, then the results are used to query DB.
This is done to make sure updated objects are those filtered
by ES in the 'index' method (so user updates what he saw).
"""
db_object... | Update multiple objects from collection.
First ES is queried, then the results are used to query DB.
This is done to make sure updated objects are those filtered
by ES in the 'index' method (so user updates what he saw).
def update_many(self, **kwargs):
""" Update multiple objects from... | 147 | 245 | 460 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c6719a3b97fa97dfbbdeb6a2c743b04ea5acffd49641f0b51403d76225f7c763 | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
ad78984750180492a901595e | ramses-tech/ramses | ramses/views.py | ItemSubresourceBaseView._get_context_key | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L359-L361 | train | python | Get value of `self._resource.parent.id_name` from :kwargs: | def _get_context_key(self, **kwargs):
""" Get value of `self._resource.parent.id_name` from :kwargs: """
return str(kwargs.get(self._resource.parent.id_name)) | Get value of `self._resource.parent.id_name` from :kwargs:
def _get_context_key(self, **kwargs):
""" Get value of `self._resource.parent.id_name` from :kwargs: """
return str(kwargs.get(self._resource.parent.id_name)) | 55 | 58 | 174 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | dbc9ce6a05a40365453026712c04e083a93a59c0de175c766bd9b92630ebb48b | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
10de0d1a55113e12bda185fa | ramses-tech/ramses | ramses/views.py | ItemSubresourceBaseView.get_item | https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/views.py#L363-L366 | train | python | Reload context on each access. | def get_item(self, **kwargs):
""" Reload context on each access. """
self.reload_context(es_based=False, **kwargs)
return super(ItemSubresourceBaseView, self).get_item(**kwargs) | Reload context on each access.
def get_item(self, **kwargs):
""" Reload context on each access. """
self.reload_context(es_based=False, **kwargs)
return super(ItemSubresourceBaseView, self).get_item(**kwargs) | 50 | 30 | 201 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | d69b30e823b4ab19e59cf0d5ab7fead47b0b5c5b774c0e281b7b5149c1075d3d | Apache-2.0 | permissive | https://github.com/ramses-tech/ramses/blob/master/LICENSE |
c33f4b49b0644c332354a8ac | rshk/python-libxdo | xdo/xdo.py | _errcheck | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/xdo.py#L37-L51 | train | python | Error checker for functions returning an integer indicating
success (0) / failure (1).
Raises a XdoException in case of error, otherwise just
returns ``None`` (returning the original code, 0, would be
useless anyways..) | def _errcheck(result, func, arguments):
"""
Error checker for functions returning an integer indicating
success (0) / failure (1).
Raises a XdoException in case of error, otherwise just
returns ``None`` (returning the original code, 0, would be
useless anyways..)
"""
if result != 0:
... | Error checker for functions returning an integer indicating
success (0) / failure (1).
Raises a XdoException in case of error, otherwise just
returns ``None`` (returning the original code, 0, would be
useless anyways..)
def _errcheck(result, func, arguments):
"""
Error checker for functions re... | 164 | 236 | 456 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 9f2df460ff40df5e9186acf7fdd98333c0cd71668098117422e57537637ed76b | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
9c9735b19a196612a7e9bf36 | rshk/python-libxdo | xdo/__init__.py | _gen_input_mask | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L43-L53 | train | python | Generate input mask from bytemask | def _gen_input_mask(mask):
"""Generate input mask from bytemask"""
return input_mask(
shift=bool(mask & MOD_Shift),
lock=bool(mask & MOD_Lock),
control=bool(mask & MOD_Control),
mod1=bool(mask & MOD_Mod1),
mod2=bool(mask & MOD_Mod2),
mod3=bool(mask & MOD_Mod3),
... | Generate input mask from bytemask
def _gen_input_mask(mask):
"""Generate input mask from bytemask"""
return input_mask(
shift=bool(mask & MOD_Shift),
lock=bool(mask & MOD_Lock),
control=bool(mask & MOD_Control),
mod1=bool(mask & MOD_Mod1),
mod2=bool(mask & MOD_Mod2),
... | 106 | 33 | 389 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 94cde3954cb2896f1427b72a550c11cdd39921568544d0edd8fa564135a75076 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
c021cbec432c9c4b91c7d5eb | rshk/python-libxdo | xdo/__init__.py | Xdo.move_mouse | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L83-L110 | train | python | Move the mouse to a specific location.
:param x: the target X coordinate on the screen in pixels.
:param y: the target Y coordinate on the screen in pixels.
:param screen: the screen (number) you want to move on. | def move_mouse(self, x, y, screen=0):
"""
Move the mouse to a specific location.
:param x: the target X coordinate on the screen in pixels.
:param y: the target Y coordinate on the screen in pixels.
:param screen: the screen (number) you want to move on.
"""
# to... | Move the mouse to a specific location.
:param x: the target X coordinate on the screen in pixels.
:param y: the target Y coordinate on the screen in pixels.
:param screen: the screen (number) you want to move on.
def move_mouse(self, x, y, screen=0):
"""
Move the mouse to a spe... | 320 | 237 | 1,057 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | e122e6b917a339be9c1fa13013b6e190abf46f8ccc86df9762cfee48b8d0367d | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
c40a5aeb38fec1312b728e43 | rshk/python-libxdo | xdo/__init__.py | Xdo.move_mouse_relative_to_window | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L112-L121 | train | python | Move the mouse to a specific location relative to the top-left corner
of a window.
:param x: the target X coordinate on the screen in pixels.
:param y: the target Y coordinate on the screen in pixels. | def move_mouse_relative_to_window(self, window, x, y):
"""
Move the mouse to a specific location relative to the top-left corner
of a window.
:param x: the target X coordinate on the screen in pixels.
:param y: the target Y coordinate on the screen in pixels.
"""
... | Move the mouse to a specific location relative to the top-left corner
of a window.
:param x: the target X coordinate on the screen in pixels.
:param y: the target Y coordinate on the screen in pixels.
def move_mouse_relative_to_window(self, window, x, y):
"""
Move the mouse to ... | 145 | 225 | 416 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 9d7f092317548106038b38c1cf3d883c1a3dde586d786217fc55220a7fab5d03 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
13094542be14ee13c7630cec | rshk/python-libxdo | xdo/__init__.py | Xdo.move_mouse_relative | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L123-L130 | train | python | Move the mouse relative to it's current position.
:param x: the distance in pixels to move on the X axis.
:param y: the distance in pixels to move on the Y axis. | def move_mouse_relative(self, x, y):
"""
Move the mouse relative to it's current position.
:param x: the distance in pixels to move on the X axis.
:param y: the distance in pixels to move on the Y axis.
"""
_libxdo.xdo_move_mouse_relative(self._xdo, x, y) | Move the mouse relative to it's current position.
:param x: the distance in pixels to move on the X axis.
:param y: the distance in pixels to move on the Y axis.
def move_mouse_relative(self, x, y):
"""
Move the mouse relative to it's current position.
:param x: the distance i... | 118 | 178 | 304 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a08f67dd14eb7904af39690819db85fb1c7e42b51874cc995e00ce1ee5a723ea | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
309c7ce9efe156d46eb95813 | rshk/python-libxdo | xdo/__init__.py | Xdo.mouse_down | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L132-L144 | train | python | Send a mouse press (aka mouse down) for a given button at
the current mouse location.
:param window:
The window you want to send the event to or CURRENTWINDOW
:param button:
The mouse button. Generally, 1 is left, 2 is middle, 3 is
right, 4 is wheel up, 5 is ... | def mouse_down(self, window, button):
"""
Send a mouse press (aka mouse down) for a given button at
the current mouse location.
:param window:
The window you want to send the event to or CURRENTWINDOW
:param button:
The mouse button. Generally, 1 is left,... | Send a mouse press (aka mouse down) for a given button at
the current mouse location.
:param window:
The window you want to send the event to or CURRENTWINDOW
:param button:
The mouse button. Generally, 1 is left, 2 is middle, 3 is
right, 4 is wheel up, 5 is ... | 202 | 331 | 502 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 03e1b8fb027a8b217f231f3cb2289357a838569c1ea16480460e7792374b5759 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
b23e8c706b1ec2a59a16dd5a | rshk/python-libxdo | xdo/__init__.py | Xdo.mouse_up | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L146-L158 | train | python | Send a mouse release (aka mouse up) for a given button at
the current mouse location.
:param window:
The window you want to send the event to or CURRENTWINDOW
:param button:
The mouse button. Generally, 1 is left, 2 is middle, 3 is
right, 4 is wheel up, 5 is ... | def mouse_up(self, window, button):
"""
Send a mouse release (aka mouse up) for a given button at
the current mouse location.
:param window:
The window you want to send the event to or CURRENTWINDOW
:param button:
The mouse button. Generally, 1 is left, 2... | Send a mouse release (aka mouse up) for a given button at
the current mouse location.
:param window:
The window you want to send the event to or CURRENTWINDOW
:param button:
The mouse button. Generally, 1 is left, 2 is middle, 3 is
right, 4 is wheel up, 5 is ... | 202 | 331 | 498 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 5dc310737b4a428d273a1330546e8ded287006cc16c1088d27503ce09274ef8b | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
2dbab4b8d075bdc0e3507b18 | rshk/python-libxdo | xdo/__init__.py | Xdo.get_mouse_location | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L160-L172 | train | python | Get the current mouse location (coordinates and screen number).
:return: a namedtuple with ``x``, ``y`` and ``screen_num`` fields | def get_mouse_location(self):
"""
Get the current mouse location (coordinates and screen number).
:return: a namedtuple with ``x``, ``y`` and ``screen_num`` fields
"""
x = ctypes.c_int(0)
y = ctypes.c_int(0)
screen_num = ctypes.c_int(0)
_libxdo.xdo_get_mo... | Get the current mouse location (coordinates and screen number).
:return: a namedtuple with ``x``, ``y`` and ``screen_num`` fields
def get_mouse_location(self):
"""
Get the current mouse location (coordinates and screen number).
:return: a namedtuple with ``x``, ``y`` and ``screen_num`... | 149 | 138 | 494 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 30d8d49eba40282f506526756de24b6450540d80ec12bfe2666d4a74031e6c74 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
3f014c3f1c946c9c819db93e | rshk/python-libxdo | xdo/__init__.py | Xdo.get_window_at_mouse | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L174-L180 | train | python | Get the window the mouse is currently over | def get_window_at_mouse(self):
"""
Get the window the mouse is currently over
"""
window_ret = ctypes.c_ulong(0)
_libxdo.xdo_get_window_at_mouse(self._xdo, ctypes.byref(window_ret))
return window_ret.value | Get the window the mouse is currently over
def get_window_at_mouse(self):
"""
Get the window the mouse is currently over
"""
window_ret = ctypes.c_ulong(0)
_libxdo.xdo_get_window_at_mouse(self._xdo, ctypes.byref(window_ret))
return window_ret.value | 67 | 42 | 253 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c0b18481e84f67d6e49d050c92eef748e7e0710b4220f08ce2da34cc1bd1f1c7 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
8002164c30bdc8ad1d55713e | rshk/python-libxdo | xdo/__init__.py | Xdo.get_mouse_location2 | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L182-L197 | train | python | Get all mouse location-related data.
:return: a namedtuple with ``x``, ``y``, ``screen_num``
and ``window`` fields | def get_mouse_location2(self):
"""
Get all mouse location-related data.
:return: a namedtuple with ``x``, ``y``, ``screen_num``
and ``window`` fields
"""
x = ctypes.c_int(0)
y = ctypes.c_int(0)
screen_num_ret = ctypes.c_ulong(0)
window_ret = c... | Get all mouse location-related data.
:return: a namedtuple with ``x``, ``y``, ``screen_num``
and ``window`` fields
def get_mouse_location2(self):
"""
Get all mouse location-related data.
:return: a namedtuple with ``x``, ``y``, ``screen_num``
and ``window`` fie... | 176 | 135 | 622 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 40fc90ce30d0cdc1b2f266501779186252eff9144e332aed130cba390c04ae17 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
4ee1293ea1774df8c2c2fae9 | rshk/python-libxdo | xdo/__init__.py | Xdo.wait_for_mouse_move_from | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L199-L207 | train | python | Wait for the mouse to move from a location. This function will block
until the condition has been satisified.
:param origin_x: the X position you expect the mouse to move from
:param origin_y: the Y position you expect the mouse to move from | def wait_for_mouse_move_from(self, origin_x, origin_y):
"""
Wait for the mouse to move from a location. This function will block
until the condition has been satisified.
:param origin_x: the X position you expect the mouse to move from
:param origin_y: the Y position you expect ... | Wait for the mouse to move from a location. This function will block
until the condition has been satisified.
:param origin_x: the X position you expect the mouse to move from
:param origin_y: the Y position you expect the mouse to move from
def wait_for_mouse_move_from(self, origin_x, origin_... | 160 | 266 | 430 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | b61ec7775712d6dc1062a536fc5dd8f2622e6014a06fddf47b77205cd8ea8dbc | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
04e205803be050aed0f91fd6 | rshk/python-libxdo | xdo/__init__.py | Xdo.wait_for_mouse_move_to | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L209-L217 | train | python | Wait for the mouse to move to a location. This function will block
until the condition has been satisified.
:param dest_x: the X position you expect the mouse to move to
:param dest_y: the Y position you expect the mouse to move to | def wait_for_mouse_move_to(self, dest_x, dest_y):
"""
Wait for the mouse to move to a location. This function will block
until the condition has been satisified.
:param dest_x: the X position you expect the mouse to move to
:param dest_y: the Y position you expect the mouse to m... | Wait for the mouse to move to a location. This function will block
until the condition has been satisified.
:param dest_x: the X position you expect the mouse to move to
:param dest_y: the Y position you expect the mouse to move to
def wait_for_mouse_move_to(self, dest_x, dest_y):
"""
... | 160 | 256 | 410 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 49e8f0f1f79adec83aeca000cdc47f9cba0e6bcccc98e239980d619238ee4e68 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
44cf7a96aaf75fc8a4fbe1e2 | rshk/python-libxdo | xdo/__init__.py | Xdo.click_window | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L219-L229 | train | python | Send a click for a specific mouse button at the current mouse location.
:param window:
The window you want to send the event to or CURRENTWINDOW
:param button:
The mouse button. Generally, 1 is left, 2 is middle, 3 is
right, 4 is wheel up, 5 is wheel down. | def click_window(self, window, button):
"""
Send a click for a specific mouse button at the current mouse location.
:param window:
The window you want to send the event to or CURRENTWINDOW
:param button:
The mouse button. Generally, 1 is left, 2 is middle, 3 is
... | Send a click for a specific mouse button at the current mouse location.
:param window:
The window you want to send the event to or CURRENTWINDOW
:param button:
The mouse button. Generally, 1 is left, 2 is middle, 3 is
right, 4 is wheel up, 5 is wheel down.
def click... | 180 | 309 | 441 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a58c3bfe2ef87e7d3240fc4c9d183b3cad8fd20d8f980ccc666737b72ad7bc8e | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
136f58ae75a3269e9f501b7a | rshk/python-libxdo | xdo/__init__.py | Xdo.click_window_multiple | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L231-L245 | train | python | Send a one or more clicks for a specific mouse button at the
current mouse location.
:param window:
The window you want to send the event to or CURRENTWINDOW
:param button:
The mouse button. Generally, 1 is left, 2 is middle, 3 is
right, 4 is wheel up, 5 is w... | def click_window_multiple(self, window, button, repeat=2, delay=100000):
"""
Send a one or more clicks for a specific mouse button at the
current mouse location.
:param window:
The window you want to send the event to or CURRENTWINDOW
:param button:
The m... | Send a one or more clicks for a specific mouse button at the
current mouse location.
:param window:
The window you want to send the event to or CURRENTWINDOW
:param button:
The mouse button. Generally, 1 is left, 2 is middle, 3 is
right, 4 is wheel up, 5 is w... | 271 | 464 | 666 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | aa59b4ad156abea609443e3bbe30e3c954a17f18547c06b94e5fb0e0d677e6f0 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
884394d861ad6191a0216f2b | rshk/python-libxdo | xdo/__init__.py | Xdo.enter_text_window | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L247-L262 | train | python | Type a string to the specified window.
If you want to send a specific key or key sequence, such as
"alt+l", you want instead ``send_keysequence_window(...)``.
:param window:
The window you want to send keystrokes to or CURRENTWINDOW
:param string:
The string to ... | def enter_text_window(self, window, string, delay=12000):
"""
Type a string to the specified window.
If you want to send a specific key or key sequence, such as
"alt+l", you want instead ``send_keysequence_window(...)``.
:param window:
The window you want to send ke... | Type a string to the specified window.
If you want to send a specific key or key sequence, such as
"alt+l", you want instead ``send_keysequence_window(...)``.
:param window:
The window you want to send keystrokes to or CURRENTWINDOW
:param string:
The string to ... | 252 | 493 | 662 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | bfb1404bd40901b49f6fb660dc2de1004e180546f5303c2af37150a6301fa062 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
d47e03f65d3fbf24a5fbb602 | rshk/python-libxdo | xdo/__init__.py | Xdo.send_keysequence_window | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L264-L287 | train | python | Send a keysequence to the specified window.
This allows you to send keysequences by symbol name. Any combination
of X11 KeySym names separated by '+' are valid. Single KeySym names
are valid, too.
Examples:
"l"
"semicolon"
"alt+Return"
"Alt_L+Tab... | def send_keysequence_window(self, window, keysequence, delay=12000):
"""
Send a keysequence to the specified window.
This allows you to send keysequences by symbol name. Any combination
of X11 KeySym names separated by '+' are valid. Single KeySym names
are valid, too.
... | Send a keysequence to the specified window.
This allows you to send keysequences by symbol name. Any combination
of X11 KeySym names separated by '+' are valid. Single KeySym names
are valid, too.
Examples:
"l"
"semicolon"
"alt+Return"
"Alt_L+Tab... | 341 | 664 | 861 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 3d40aff6fc81f2a6f48e68c0ebc50f4a94a8900c99980b441bb1a9fd0320c902 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
70bd342529a1f997a4d6d1d6 | rshk/python-libxdo | xdo/__init__.py | Xdo.send_keysequence_window_up | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L289-L292 | train | python | Send key release (up) events for the given key sequence | def send_keysequence_window_up(self, window, keysequence, delay=12000):
"""Send key release (up) events for the given key sequence"""
_libxdo.xdo_send_keysequence_window_up(
self._xdo, window, keysequence, ctypes.c_ulong(delay)) | Send key release (up) events for the given key sequence
def send_keysequence_window_up(self, window, keysequence, delay=12000):
"""Send key release (up) events for the given key sequence"""
_libxdo.xdo_send_keysequence_window_up(
self._xdo, window, keysequence, ctypes.c_ulong(delay)) | 75 | 55 | 256 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | fc0b30e92f224cbd0d14b19725aa1d857e7ad37390fef9b9f74c5a00c52c8f6f | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
ca67d7062d48e34cd26f4f79 | rshk/python-libxdo | xdo/__init__.py | Xdo.send_keysequence_window_down | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L294-L297 | train | python | Send key press (down) events for the given key sequence | def send_keysequence_window_down(self, window, keysequence, delay=12000):
"""Send key press (down) events for the given key sequence"""
_libxdo.xdo_send_keysequence_window_down(
self._xdo, window, keysequence, ctypes.c_ulong(delay)) | Send key press (down) events for the given key sequence
def send_keysequence_window_down(self, window, keysequence, delay=12000):
"""Send key press (down) events for the given key sequence"""
_libxdo.xdo_send_keysequence_window_down(
self._xdo, window, keysequence, ctypes.c_ulong(delay)) | 75 | 55 | 260 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 7fbb3133f836f152aec93bf44bf61490285e58f2ca0f7620ccbb62008b27678f | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
2c3ded999f79af2ce1c03f6a | rshk/python-libxdo | xdo/__init__.py | Xdo.send_keysequence_window_list_do | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L299-L316 | train | python | Send a series of keystrokes.
:param window: The window to send events to or CURRENTWINDOW
:param keys: The array of charcodemap_t entities to send.
:param pressed: 1 for key press, 0 for key release.
:param modifier:
Pointer to integer to record the modifiers
act... | def send_keysequence_window_list_do(
self, window, keys, pressed=1, modifier=None, delay=120000):
"""
Send a series of keystrokes.
:param window: The window to send events to or CURRENTWINDOW
:param keys: The array of charcodemap_t entities to send.
:param pressed: 1... | Send a series of keystrokes.
:param window: The window to send events to or CURRENTWINDOW
:param keys: The array of charcodemap_t entities to send.
:param pressed: 1 for key press, 0 for key release.
:param modifier:
Pointer to integer to record the modifiers
act... | 287 | 483 | 815 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 5738644ce965c580bb00555c95d473dc2340646b0a3ba3690f1323c441547bcf | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
d458ba7b8999d53184daed31 | rshk/python-libxdo | xdo/__init__.py | Xdo.get_active_keys_to_keycode_list | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L318-L333 | train | python | Get a list of active keys. Uses XQueryKeymap | def get_active_keys_to_keycode_list(self):
"""Get a list of active keys. Uses XQueryKeymap"""
try:
_libxdo.xdo_get_active_keys_to_keycode_list
except AttributeError:
# Apparently, this was implemented in a later version..
raise NotImplementedError()
... | Get a list of active keys. Uses XQueryKeymap
def get_active_keys_to_keycode_list(self):
"""Get a list of active keys. Uses XQueryKeymap"""
try:
_libxdo.xdo_get_active_keys_to_keycode_list
except AttributeError:
# Apparently, this was implemented in a later version..
... | 147 | 44 | 589 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 2a1883176a055dcf474e8666e5abf061fea8269365828791a533a03909d43083 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
4e2fd58ccd9249cd3ea686f9 | rshk/python-libxdo | xdo/__init__.py | Xdo.wait_for_window_map_state | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L335-L348 | train | python | Wait for a window to have a specific map state.
State possibilities:
IsUnmapped - window is not displayed.
IsViewable - window is mapped and shown (though may be
clipped by windows on top of it)
IsUnviewable - window is mapped but a parent window is unmapped.
... | def wait_for_window_map_state(self, window, state):
"""
Wait for a window to have a specific map state.
State possibilities:
IsUnmapped - window is not displayed.
IsViewable - window is mapped and shown (though may be
clipped by windows on top of it)
... | Wait for a window to have a specific map state.
State possibilities:
IsUnmapped - window is not displayed.
IsViewable - window is mapped and shown (though may be
clipped by windows on top of it)
IsUnviewable - window is mapped but a parent window is unmapped.
... | 218 | 414 | 570 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 8e5cb61903c4d2b0e8f5c2153f56737cbb5f3e3a003a5b6e65cc8308a43d652b | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
df87c4f36d23adef51abb105 | rshk/python-libxdo | xdo/__init__.py | Xdo.move_window | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L359-L369 | train | python | Move a window to a specific location.
The top left corner of the window will be moved to the x,y coordinate.
:param wid: the window to move
:param x: the X coordinate to move to.
:param y: the Y coordinate to move to. | def move_window(self, window, x, y):
"""
Move a window to a specific location.
The top left corner of the window will be moved to the x,y coordinate.
:param wid: the window to move
:param x: the X coordinate to move to.
:param y: the Y coordinate to move to.
"""... | Move a window to a specific location.
The top left corner of the window will be moved to the x,y coordinate.
:param wid: the window to move
:param x: the X coordinate to move to.
:param y: the Y coordinate to move to.
def move_window(self, window, x, y):
"""
Move a win... | 154 | 251 | 377 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | aef0594ff546eea7f53241aa54140adec43692bb771e0a601162c3690eceed1b | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
d6adddf361b218a3695a55bf | rshk/python-libxdo | xdo/__init__.py | Xdo.translate_window_with_sizehint | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L371-L389 | train | python | Apply a window's sizing hints (if any) to a given width and height.
This function wraps XGetWMNormalHints() and applies any
resize increment and base size to your given width and height values.
:param window: the window to use
:param width: the unit width you want to translate
... | def translate_window_with_sizehint(self, window, width, height):
"""
Apply a window's sizing hints (if any) to a given width and height.
This function wraps XGetWMNormalHints() and applies any
resize increment and base size to your given width and height values.
:param window: ... | Apply a window's sizing hints (if any) to a given width and height.
This function wraps XGetWMNormalHints() and applies any
resize increment and base size to your given width and height values.
:param window: the window to use
:param width: the unit width you want to translate
... | 267 | 405 | 799 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f220c10f2b09ac6dc11de8dbaee59e01aa6cdc6362cbfbee21ea190f86399f2b | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
4d2782d1b4efe41444e8ee2e | rshk/python-libxdo | xdo/__init__.py | Xdo.set_window_size | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L391-L401 | train | python | Change the window size.
:param wid: the window to resize
:param w: the new desired width
:param h: the new desired height
:param flags: if 0, use pixels for units. If SIZE_USEHINTS, then
the units will be relative to the window size hints. | def set_window_size(self, window, w, h, flags=0):
"""
Change the window size.
:param wid: the window to resize
:param w: the new desired width
:param h: the new desired height
:param flags: if 0, use pixels for units. If SIZE_USEHINTS, then
the units will be ... | Change the window size.
:param wid: the window to resize
:param w: the new desired width
:param h: the new desired height
:param flags: if 0, use pixels for units. If SIZE_USEHINTS, then
the units will be relative to the window size hints.
def set_window_size(self, window, ... | 184 | 284 | 434 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 66deb58365600ee14cf8dd3ef6bc91855d9891f8201bf296226661622a5f709e | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
7f6f7aa23ac0574e66f6aa6d | rshk/python-libxdo | xdo/__init__.py | Xdo.set_window_property | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L403-L413 | train | python | Change a window property.
Example properties you can change are WM_NAME, WM_ICON_NAME, etc.
:param wid: The window to change a property of.
:param name: the string name of the property.
:param value: the string value of the property. | def set_window_property(self, window, name, value):
"""
Change a window property.
Example properties you can change are WM_NAME, WM_ICON_NAME, etc.
:param wid: The window to change a property of.
:param name: the string name of the property.
:param value: the string val... | Change a window property.
Example properties you can change are WM_NAME, WM_ICON_NAME, etc.
:param wid: The window to change a property of.
:param name: the string name of the property.
:param value: the string value of the property.
def set_window_property(self, window, name, value):... | 154 | 267 | 423 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 205d0d09add9b647e968a58f5c8f347f09920dbe1dd66de074bdeb762ecfc7cc | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
a1fc79ddd5e4d3364cfb9a7e | rshk/python-libxdo | xdo/__init__.py | Xdo.set_window_class | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L415-L422 | train | python | Change the window's classname and or class.
:param name: The new class name. If ``None``, no change.
:param class_: The new class. If ``None``, no change. | def set_window_class(self, window, name, class_):
"""
Change the window's classname and or class.
:param name: The new class name. If ``None``, no change.
:param class_: The new class. If ``None``, no change.
"""
_libxdo.xdo_set_window_class(self._xdo, window, name, clas... | Change the window's classname and or class.
:param name: The new class name. If ``None``, no change.
:param class_: The new class. If ``None``, no change.
def set_window_class(self, window, name, class_):
"""
Change the window's classname and or class.
:param name: The new cla... | 123 | 171 | 323 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 10267100f8c02beb6b728dbb99a9ba3fb5e4ba02ac925c1551dae71d405c5474 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
e0f0d4260ea9d7e0e43887c9 | rshk/python-libxdo | xdo/__init__.py | Xdo.set_window_urgency | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L424-L426 | train | python | Sets the urgency hint for a window | def set_window_urgency(self, window, urgency):
"""Sets the urgency hint for a window"""
_libxdo.xdo_set_window_urgency(self._xdo, window, urgency) | Sets the urgency hint for a window
def set_window_urgency(self, window, urgency):
"""Sets the urgency hint for a window"""
_libxdo.xdo_set_window_urgency(self._xdo, window, urgency) | 51 | 34 | 162 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | fdbfdd4b1acb33387e590b1facdee935873ecf02bfb83c546ffdadc4eae370af | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
94b5fefb5c29844323563869 | rshk/python-libxdo | xdo/__init__.py | Xdo.set_window_override_redirect | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L428-L438 | train | python | Set the override_redirect value for a window. This generally means
whether or not a window manager will manage this window.
If you set it to 1, the window manager will usually not draw
borders on the window, etc. If you set it to 0, the window manager
will see it like a normal applicat... | def set_window_override_redirect(self, window, override_redirect):
"""
Set the override_redirect value for a window. This generally means
whether or not a window manager will manage this window.
If you set it to 1, the window manager will usually not draw
borders on the window, ... | Set the override_redirect value for a window. This generally means
whether or not a window manager will manage this window.
If you set it to 1, the window manager will usually not draw
borders on the window, etc. If you set it to 0, the window manager
will see it like a normal applicat... | 184 | 331 | 530 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | e57b5e1d59a862d47697530f18aba6b296b91f5533c794f428175804c08c5250 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
64705536e53bc472fc36d7e4 | rshk/python-libxdo | xdo/__init__.py | Xdo.get_focused_window | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L458-L468 | train | python | Get the window currently having focus.
:param window_ret:
Pointer to a window where the currently-focused window
will be stored. | def get_focused_window(self):
"""
Get the window currently having focus.
:param window_ret:
Pointer to a window where the currently-focused window
will be stored.
"""
window_ret = window_t(0)
_libxdo.xdo_get_focused_window(self._xdo, ctypes.byref(window_r... | Get the window currently having focus.
:param window_ret:
Pointer to a window where the currently-focused window
will be stored.
def get_focused_window(self):
"""
Get the window currently having focus.
:param window_ret:
Pointer to a window where the currently-... | 106 | 153 | 356 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 711f06a0989ec9d02d310462ba89d14eebb140592833dd3a1651c61067893e31 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
0b8a45032b7713200dac09df | rshk/python-libxdo | xdo/__init__.py | Xdo.wait_for_window_focus | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L470-L477 | train | python | Wait for a window to have or lose focus.
:param window: The window to wait on
:param want_focus: If 1, wait for focus. If 0, wait for loss of focus. | def wait_for_window_focus(self, window, want_focus):
"""
Wait for a window to have or lose focus.
:param window: The window to wait on
:param want_focus: If 1, wait for focus. If 0, wait for loss of focus.
"""
_libxdo.xdo_wait_for_window_focus(self._xdo, window, want_foc... | Wait for a window to have or lose focus.
:param window: The window to wait on
:param want_focus: If 1, wait for focus. If 0, wait for loss of focus.
def wait_for_window_focus(self, window, want_focus):
"""
Wait for a window to have or lose focus.
:param window: The window to w... | 128 | 165 | 323 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 36b0fc467ef33ce4edf492b9cac6af442f707430eb77357db1065e9da30ec43c | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
c70c354b0d48df9565984416 | rshk/python-libxdo | xdo/__init__.py | Xdo.get_focused_window_sane | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L490-L504 | train | python | Like xdo_get_focused_window, but return the first ancestor-or-self
window * having a property of WM_CLASS. This allows you to get
the "real" or top-level-ish window having focus rather than something
you may not expect to be the window having focused.
:param window_ret:
Poin... | def get_focused_window_sane(self):
"""
Like xdo_get_focused_window, but return the first ancestor-or-self
window * having a property of WM_CLASS. This allows you to get
the "real" or top-level-ish window having focus rather than something
you may not expect to be the window havin... | Like xdo_get_focused_window, but return the first ancestor-or-self
window * having a property of WM_CLASS. This allows you to get
the "real" or top-level-ish window having focus rather than something
you may not expect to be the window having focused.
:param window_ret:
Poin... | 218 | 398 | 624 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a1a4a2ce3a07250da34d498ced8761efbde89491a709f2b5cac56b1da2cfd595 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
f415c42e5e0d89d0bd9852b5 | rshk/python-libxdo | xdo/__init__.py | Xdo.wait_for_window_active | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L522-L532 | train | python | Wait for a window to be active or not active.
Requires your window manager to support this.
Uses _NET_ACTIVE_WINDOW from the EWMH spec.
:param window: the window to wait on
:param active: If 1, wait for active. If 0, wait for inactive. | def wait_for_window_active(self, window, active=1):
"""
Wait for a window to be active or not active.
Requires your window manager to support this.
Uses _NET_ACTIVE_WINDOW from the EWMH spec.
:param window: the window to wait on
:param active: If 1, wait for active. If ... | Wait for a window to be active or not active.
Requires your window manager to support this.
Uses _NET_ACTIVE_WINDOW from the EWMH spec.
:param window: the window to wait on
:param active: If 1, wait for active. If 0, wait for inactive.
def wait_for_window_active(self, window, active=1... | 168 | 269 | 423 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | adf86b61f93b6d5ed8c8e05956c01176821c559f57a6951b4af734c937c57b59 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
2fc068876f0c321a3f99f497 | rshk/python-libxdo | xdo/__init__.py | Xdo.reparent_window | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L555-L562 | train | python | Reparents a window
:param wid_source: the window to reparent
:param wid_target: the new parent window | def reparent_window(self, window_source, window_target):
"""
Reparents a window
:param wid_source: the window to reparent
:param wid_target: the new parent window
"""
_libxdo.xdo_reparent_window(self._xdo, window_source, window_target) | Reparents a window
:param wid_source: the window to reparent
:param wid_target: the new parent window
def reparent_window(self, window_source, window_target):
"""
Reparents a window
:param wid_source: the window to reparent
:param wid_target: the new parent window
... | 95 | 118 | 284 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | b270f1be6bec2eb947e4088d404a939cdec3a9228e76620e12d7985602437d48 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
bc04ea9470766d94dcd3537e | rshk/python-libxdo | xdo/__init__.py | Xdo.get_window_location | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L564-L574 | train | python | Get a window's location. | def get_window_location(self, window):
"""
Get a window's location.
"""
screen_ret = Screen()
x_ret = ctypes.c_int(0)
y_ret = ctypes.c_int(0)
_libxdo.xdo_get_window_location(
self._xdo, window, ctypes.byref(x_ret), ctypes.byref(y_ret),
ctyp... | Get a window's location.
def get_window_location(self, window):
"""
Get a window's location.
"""
screen_ret = Screen()
x_ret = ctypes.c_int(0)
y_ret = ctypes.c_int(0)
_libxdo.xdo_get_window_location(
self._xdo, window, ctypes.byref(x_ret), ctypes.byre... | 104 | 24 | 410 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | cbc4e7cdcd1721ce8272bb35e0f6d08cb745c265472ab68f22c1f8e109b96f93 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
4a4b0f8a555284544aca9d3e | rshk/python-libxdo | xdo/__init__.py | Xdo.get_window_size | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L576-L584 | train | python | Get a window's size. | def get_window_size(self, window):
"""
Get a window's size.
"""
w_ret = ctypes.c_uint(0)
h_ret = ctypes.c_uint(0)
_libxdo.xdo_get_window_size(self._xdo, window, ctypes.byref(w_ret),
ctypes.byref(h_ret))
return window_size(w_ret.... | Get a window's size.
def get_window_size(self, window):
"""
Get a window's size.
"""
w_ret = ctypes.c_uint(0)
h_ret = ctypes.c_uint(0)
_libxdo.xdo_get_window_size(self._xdo, window, ctypes.byref(w_ret),
ctypes.byref(h_ret))
ret... | 87 | 20 | 339 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 0584804e0208dd98511155707dfd0211e24daf3197b4ab30ace149b306e9c233 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
424e4fbace587d5e8cc77d84 | rshk/python-libxdo | xdo/__init__.py | Xdo.get_active_window | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L586-L594 | train | python | Get the currently-active window.
Requires your window manager to support this.
Uses ``_NET_ACTIVE_WINDOW`` from the EWMH spec. | def get_active_window(self):
"""
Get the currently-active window.
Requires your window manager to support this.
Uses ``_NET_ACTIVE_WINDOW`` from the EWMH spec.
"""
window_ret = window_t(0)
_libxdo.xdo_get_active_window(self._xdo, ctypes.byref(window_ret))
... | Get the currently-active window.
Requires your window manager to support this.
Uses ``_NET_ACTIVE_WINDOW`` from the EWMH spec.
def get_active_window(self):
"""
Get the currently-active window.
Requires your window manager to support this.
Uses ``_NET_ACTIVE_WINDOW`` from... | 106 | 142 | 343 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f431c5f56a70fd940e85909ad47b2e3fd1fd79cbd54c5a245fc2798419cf0879 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
067abd427c51b7a85a873ea7 | rshk/python-libxdo | xdo/__init__.py | Xdo.select_window_with_click | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L596-L604 | train | python | Get a window ID by clicking on it.
This function blocks until a selection is made. | def select_window_with_click(self):
"""
Get a window ID by clicking on it.
This function blocks until a selection is made.
"""
window_ret = window_t(0)
_libxdo.xdo_select_window_with_click(
self._xdo, ctypes.byref(window_ret))
return window_ret.value | Get a window ID by clicking on it.
This function blocks until a selection is made.
def select_window_with_click(self):
"""
Get a window ID by clicking on it.
This function blocks until a selection is made.
"""
window_ret = window_t(0)
_libxdo.xdo_select_window_wi... | 88 | 90 | 318 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 6e2258f60e532b8fd32527422880c0f519e9b8907a4fb4fce87a6c90fb13a112 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
ac782348eceda68c55f492e1 | rshk/python-libxdo | xdo/__init__.py | Xdo.get_number_of_desktops | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L615-L625 | train | python | Get the current number of desktops.
Uses ``_NET_NUMBER_OF_DESKTOPS`` of the EWMH spec.
:param ndesktops:
pointer to long where the current number of desktops is stored | def get_number_of_desktops(self):
"""
Get the current number of desktops.
Uses ``_NET_NUMBER_OF_DESKTOPS`` of the EWMH spec.
:param ndesktops:
pointer to long where the current number of desktops is stored
"""
ndesktops = ctypes.c_long(0)
_libxdo.xdo_... | Get the current number of desktops.
Uses ``_NET_NUMBER_OF_DESKTOPS`` of the EWMH spec.
:param ndesktops:
pointer to long where the current number of desktops is stored
def get_number_of_desktops(self):
"""
Get the current number of desktops.
Uses ``_NET_NUMBER_OF_DE... | 150 | 196 | 409 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | d7035ff52d30f061964f8389806f9e0d3c4c506c40702f259bbda15964258829 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
c3f60e138060f0b0add6f720 | rshk/python-libxdo | xdo/__init__.py | Xdo.get_current_desktop | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L636-L643 | train | python | Get the current desktop.
Uses ``_NET_CURRENT_DESKTOP`` of the EWMH spec. | def get_current_desktop(self):
"""
Get the current desktop.
Uses ``_NET_CURRENT_DESKTOP`` of the EWMH spec.
"""
desktop = ctypes.c_long(0)
_libxdo.xdo_get_current_desktop(self._xdo, ctypes.byref(desktop))
return desktop.value | Get the current desktop.
Uses ``_NET_CURRENT_DESKTOP`` of the EWMH spec.
def get_current_desktop(self):
"""
Get the current desktop.
Uses ``_NET_CURRENT_DESKTOP`` of the EWMH spec.
"""
desktop = ctypes.c_long(0)
_libxdo.xdo_get_current_desktop(self._xdo, ctypes.b... | 89 | 80 | 281 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | d2b7cb7d24cad2113edc5f857eb99574d07c0a5b988d4ea2b73cede1ea449d46 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
f88b61e22e02d57b4b1ae900 | rshk/python-libxdo | xdo/__init__.py | Xdo.set_desktop_for_window | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L645-L653 | train | python | Move a window to another desktop
Uses _NET_WM_DESKTOP of the EWMH spec.
:param wid: the window to move
:param desktop: the desktop destination for the window | def set_desktop_for_window(self, window, desktop):
"""
Move a window to another desktop
Uses _NET_WM_DESKTOP of the EWMH spec.
:param wid: the window to move
:param desktop: the desktop destination for the window
"""
_libxdo.xdo_set_desktop_for_window(self._xdo, ... | Move a window to another desktop
Uses _NET_WM_DESKTOP of the EWMH spec.
:param wid: the window to move
:param desktop: the desktop destination for the window
def set_desktop_for_window(self, window, desktop):
"""
Move a window to another desktop
Uses _NET_WM_DESKTOP of ... | 124 | 182 | 336 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 698f4806793019bc0b5fa11674dd9f8b2dd76732ecffd190be8c13fec19a4930 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
7ecd519b5387283b296a1301 | rshk/python-libxdo | xdo/__init__.py | Xdo.get_desktop_for_window | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L655-L668 | train | python | Get the desktop a window is on.
Uses _NET_WM_DESKTOP of the EWMH spec.
If your desktop does not support ``_NET_WM_DESKTOP``, then '*desktop'
remains unmodified.
:param wid: the window to query | def get_desktop_for_window(self, window):
"""
Get the desktop a window is on.
Uses _NET_WM_DESKTOP of the EWMH spec.
If your desktop does not support ``_NET_WM_DESKTOP``, then '*desktop'
remains unmodified.
:param wid: the window to query
"""
desktop = c... | Get the desktop a window is on.
Uses _NET_WM_DESKTOP of the EWMH spec.
If your desktop does not support ``_NET_WM_DESKTOP``, then '*desktop'
remains unmodified.
:param wid: the window to query
def get_desktop_for_window(self, window):
"""
Get the desktop a window is on... | 165 | 226 | 462 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 00536335c6e6fec57cc9aa9b94cff4213a0b9e21ae32efb0659c46f1df8681c5 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
8f59d7946d4d406ed7306b9f | rshk/python-libxdo | xdo/__init__.py | Xdo.search_windows | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L670-L743 | train | python | Search for windows.
:param winname:
Regexp to be matched against window name
:param winclass:
Regexp to be matched against window class
:param winclassname:
Regexp to be matched against window class name
:param pid:
Only return windows fro... | def search_windows(
self, winname=None, winclass=None, winclassname=None,
pid=None, only_visible=False, screen=None, require=False,
searchmask=0, desktop=None, limit=0, max_depth=-1):
"""
Search for windows.
:param winname:
Regexp to be matched ag... | Search for windows.
:param winname:
Regexp to be matched against window name
:param winclass:
Regexp to be matched against window class
:param winclassname:
Regexp to be matched against window class name
:param pid:
Only return windows fro... | 722 | 1,017 | 2,522 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | b3c066f1100a7b7f215aa7b27e1e9741e50e6174b581fbe945103ccc6e3df780 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
5c40029ed549b833c4afd10d | rshk/python-libxdo | xdo/__init__.py | Xdo.get_symbol_map | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L782-L805 | train | python | If you need the symbol map, use this method.
The symbol map is an array of string pairs mapping common tokens
to X Keysym strings, such as "alt" to "Alt_L"
:return: array of strings. | def get_symbol_map(self):
"""
If you need the symbol map, use this method.
The symbol map is an array of string pairs mapping common tokens
to X Keysym strings, such as "alt" to "Alt_L"
:return: array of strings.
"""
# todo: make sure we return a list of strings... | If you need the symbol map, use this method.
The symbol map is an array of string pairs mapping common tokens
to X Keysym strings, such as "alt" to "Alt_L"
:return: array of strings.
def get_symbol_map(self):
"""
If you need the symbol map, use this method.
The symbol... | 226 | 208 | 731 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | c4eabff2ade50d328e55aa463da8eafb766baf0851804453caf3b7f71af2e6dd | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
cb9f4626cc77b971029349f5 | rshk/python-libxdo | xdo/__init__.py | Xdo.get_active_modifiers | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L807-L818 | train | python | Get a list of active keys. Uses XQueryKeymap.
:return: list of charcodemap_t instances | def get_active_modifiers(self):
"""
Get a list of active keys. Uses XQueryKeymap.
:return: list of charcodemap_t instances
"""
keys = ctypes.pointer(charcodemap_t())
nkeys = ctypes.c_int(0)
_libxdo.xdo_get_active_modifiers(
self._xdo, ctypes.byref(ke... | Get a list of active keys. Uses XQueryKeymap.
:return: list of charcodemap_t instances
def get_active_modifiers(self):
"""
Get a list of active keys. Uses XQueryKeymap.
:return: list of charcodemap_t instances
"""
keys = ctypes.pointer(charcodemap_t())
nkeys = ... | 125 | 95 | 398 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 8b558e59c4e9b545722e430411809107395ce210fa29a4e203d0c531e5338102 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
ab31044fd4db2ef371e687fe | rshk/python-libxdo | xdo/__init__.py | Xdo.get_window_name | https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/__init__.py#L870-L883 | train | python | Get a window's name, if any. | def get_window_name(self, win_id):
"""
Get a window's name, if any.
"""
window = window_t(win_id)
name_ptr = ctypes.c_char_p()
name_len = ctypes.c_int(0)
name_type = ctypes.c_int(0)
_libxdo.xdo_get_window_name(
self._xdo, window, ctypes.byref(n... | Get a window's name, if any.
def get_window_name(self, win_id):
"""
Get a window's name, if any.
"""
window = window_t(win_id)
name_ptr = ctypes.c_char_p()
name_len = ctypes.c_int(0)
name_type = ctypes.c_int(0)
_libxdo.xdo_get_window_name(
sel... | 137 | 28 | 509 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | ed1ad694444146f20ad4cb066e63546130dc41d7ae1d4989eb1b3998d3de74c7 | BSD-3-Clause | permissive | https://github.com/rshk/python-libxdo/blob/master/LICENSE |
11483658650dbf7e286b702f | elifesciences/elife-tools | elifetools/utils.py | strip_punctuation_space | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L47-L63 | train | python | Strip excess whitespace prior to punctuation. | def strip_punctuation_space(value):
"Strip excess whitespace prior to punctuation."
def strip_punctuation(string):
replacement_list = (
(' .', '.'),
(' :', ':'),
('( ', '('),
(' )', ')'),
)
for match, replacement in replacement_list:
... | Strip excess whitespace prior to punctuation.
def strip_punctuation_space(value):
"Strip excess whitespace prior to punctuation."
def strip_punctuation(string):
replacement_list = (
(' .', '.'),
(' :', ':'),
('( ', '('),
(' )', ')'),
)
... | 125 | 45 | 554 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | ba454e8b8925ab6f40c3e2b456346c900de25936c070171b1e74a264de71b8b2 | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
d27a80f7b2792be650dfddbb | elifesciences/elife-tools | elifetools/utils.py | join_sentences | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L65-L76 | train | python | concatenate two sentences together with punctuation glue | def join_sentences(string1, string2, glue='.'):
"concatenate two sentences together with punctuation glue"
if not string1 or string1 == '':
return string2
if not string2 or string2 == '':
return string1
# both are strings, continue joining them together with the glue and whitespace
n... | concatenate two sentences together with punctuation glue
def join_sentences(string1, string2, glue='.'):
"concatenate two sentences together with punctuation glue"
if not string1 or string1 == '':
return string2
if not string2 or string2 == '':
return string1
# both are strings, continu... | 117 | 56 | 476 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 82cd0958db2db2cc5299f60f8c4cd31b0a8e2a20a3dd975505d6853271065b73 | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
466980bb4860f182e39007f3 | elifesciences/elife-tools | elifetools/utils.py | coerce_to_int | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L78-L85 | train | python | Attempts to cast given value to an integer, return the original value if failed or the default if one provided. | def coerce_to_int(val, default=0xDEADBEEF):
"""Attempts to cast given value to an integer, return the original value if failed or the default if one provided."""
try:
return int(val)
except (TypeError, ValueError):
if default != 0xDEADBEEF:
return default
return val | Attempts to cast given value to an integer, return the original value if failed or the default if one provided.
def coerce_to_int(val, default=0xDEADBEEF):
"""Attempts to cast given value to an integer, return the original value if failed or the default if one provided."""
try:
return int(val)
exce... | 93 | 111 | 314 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 2ebc47ff8ba7df76a99b296f80e3cd986d9fc0baaa51fb6febc1fabadc03d90a | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
33d76296bb61a28f81267c45 | elifesciences/elife-tools | elifetools/utils.py | nullify | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L88-L95 | train | python | Decorator. If empty list, returns None, else list. | def nullify(function):
"Decorator. If empty list, returns None, else list."
def wrapper(*args, **kwargs):
value = function(*args, **kwargs)
if(type(value) == list and len(value) == 0):
return None
return value
return wrapper | Decorator. If empty list, returns None, else list.
def nullify(function):
"Decorator. If empty list, returns None, else list."
def wrapper(*args, **kwargs):
value = function(*args, **kwargs)
if(type(value) == list and len(value) == 0):
return None
return value
return wra... | 76 | 50 | 272 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a72a56ce69bbaf28b29cc671c810dc3fd4f146134c8c53b976b2178fc9b41396 | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
41f5554c1c2c4dd6b7260ca9 | elifesciences/elife-tools | elifetools/utils.py | strippen | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L97-L101 | train | python | Decorator. Strip excess whitespace from return value. | def strippen(function):
"Decorator. Strip excess whitespace from return value."
def wrapper(*args, **kwargs):
return strip_strings(function(*args, **kwargs))
return wrapper | Decorator. Strip excess whitespace from return value.
def strippen(function):
"Decorator. Strip excess whitespace from return value."
def wrapper(*args, **kwargs):
return strip_strings(function(*args, **kwargs))
return wrapper | 49 | 53 | 192 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | cb8424ad9aa1d7b4d57d1ce67b88f3c4f68497fc379ccbd3d8a699edf3fa4e2a | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
861be10354712bc58251fa23 | elifesciences/elife-tools | elifetools/utils.py | inten | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L103-L107 | train | python | Decorator. Attempts to convert return value to int | def inten(function):
"Decorator. Attempts to convert return value to int"
def wrapper(*args, **kwargs):
return coerce_to_int(function(*args, **kwargs))
return wrapper | Decorator. Attempts to convert return value to int
def inten(function):
"Decorator. Attempts to convert return value to int"
def wrapper(*args, **kwargs):
return coerce_to_int(function(*args, **kwargs))
return wrapper | 51 | 50 | 186 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | e4144933c406264787b74c8bbda2d97a1b38ee86b8af0a4556c87080687a5bbf | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
21f6d3ef525773f92c95d6d8 | elifesciences/elife-tools | elifetools/utils.py | date_struct | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L119-L132 | train | python | Given year, month and day numeric values and a timezone
convert to structured date object | def date_struct(year, month, day, tz = "UTC"):
"""
Given year, month and day numeric values and a timezone
convert to structured date object
"""
ymdtz = (year, month, day, tz)
if None in ymdtz:
#logger.debug("a year, month, day or tz value was empty: %s" % str(ymdtz))
return None... | Given year, month and day numeric values and a timezone
convert to structured date object
def date_struct(year, month, day, tz = "UTC"):
"""
Given year, month and day numeric values and a timezone
convert to structured date object
"""
ymdtz = (year, month, day, tz)
if None in ymdtz:
... | 178 | 93 | 548 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | a51c941bd5fb9a5b7c6b8ea76f5d0a0405828554f3fd8abf61f930be041e52ba | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
ece456b07e68084d408518d6 | elifesciences/elife-tools | elifetools/utils.py | date_struct_nn | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L134-L143 | train | python | Assemble a date object but if day or month is none set them to 1
to make it easier to deal with partial dates | def date_struct_nn(year, month, day, tz="UTC"):
"""
Assemble a date object but if day or month is none set them to 1
to make it easier to deal with partial dates
"""
if not day:
day = 1
if not month:
month = 1
return date_struct(year, month, day, tz) | Assemble a date object but if day or month is none set them to 1
to make it easier to deal with partial dates
def date_struct_nn(year, month, day, tz="UTC"):
"""
Assemble a date object but if day or month is none set them to 1
to make it easier to deal with partial dates
"""
if not day:
... | 111 | 113 | 294 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | f200472023598c630c958311fc9077abcf3a917d777b2533af5f4bdd4278a2ef | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
158fb7aa785e8389fe854fb8 | elifesciences/elife-tools | elifetools/utils.py | doi_uri_to_doi | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L195-L203 | train | python | Strip the uri schema from the start of DOI URL strings | def doi_uri_to_doi(value):
"Strip the uri schema from the start of DOI URL strings"
if value is None:
return value
replace_values = ['http://dx.doi.org/', 'https://dx.doi.org/',
'http://doi.org/', 'https://doi.org/']
for replace_value in replace_values:
value = valu... | Strip the uri schema from the start of DOI URL strings
def doi_uri_to_doi(value):
"Strip the uri schema from the start of DOI URL strings"
if value is None:
return value
replace_values = ['http://dx.doi.org/', 'https://dx.doi.org/',
'http://doi.org/', 'https://doi.org/']
f... | 99 | 54 | 365 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 0f2d3f5b341e3e09f86d7a4ad2b76c805f61cff2385e6760bfde59fc0687932f | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
7a98c05a761914065b3a9d63 | elifesciences/elife-tools | elifetools/utils.py | remove_doi_paragraph | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L212-L216 | train | python | Given a list of tags, only return those whose text doesn't start with 'DOI: | def remove_doi_paragraph(tags):
"Given a list of tags, only return those whose text doesn't start with 'DOI:'"
p_tags = list(filter(lambda tag: not starts_with_doi(tag), tags))
p_tags = list(filter(lambda tag: not paragraph_is_only_doi(tag), p_tags))
return p_tags | Given a list of tags, only return those whose text doesn't start with 'DOI:
def remove_doi_paragraph(tags):
"Given a list of tags, only return those whose text doesn't start with 'DOI:'"
p_tags = list(filter(lambda tag: not starts_with_doi(tag), tags))
p_tags = list(filter(lambda tag: not paragraph_is_only... | 88 | 75 | 280 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 768521c6bb0ab9d95c3e393d6ab742382769a6bf3304caefeba4a123b3c4475f | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
495ac459edbff68da1d330c3 | elifesciences/elife-tools | elifetools/utils.py | orcid_uri_to_orcid | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L218-L225 | train | python | Strip the uri schema from the start of ORCID URL strings | def orcid_uri_to_orcid(value):
"Strip the uri schema from the start of ORCID URL strings"
if value is None:
return value
replace_values = ['http://orcid.org/', 'https://orcid.org/']
for replace_value in replace_values:
value = value.replace(replace_value, '')
return value | Strip the uri schema from the start of ORCID URL strings
def orcid_uri_to_orcid(value):
"Strip the uri schema from the start of ORCID URL strings"
if value is None:
return value
replace_values = ['http://orcid.org/', 'https://orcid.org/']
for replace_value in replace_values:
value = val... | 87 | 56 | 308 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 50e183a8010ddb9183164e32d5e608796960095fd54d7ff374f2020899fee65d | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
d4bce3752adc58b97c1aef09 | elifesciences/elife-tools | elifetools/utils.py | component_acting_parent_tag | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L235-L248 | train | python | Only intended for use in getting components, look for tag name of fig-group
and if so, find the first fig tag inside it as the acting parent tag | def component_acting_parent_tag(parent_tag, tag):
"""
Only intended for use in getting components, look for tag name of fig-group
and if so, find the first fig tag inside it as the acting parent tag
"""
if parent_tag.name == "fig-group":
if (len(tag.find_previous_siblings("fig")) > 0):
... | Only intended for use in getting components, look for tag name of fig-group
and if so, find the first fig tag inside it as the acting parent tag
def component_acting_parent_tag(parent_tag, tag):
"""
Only intended for use in getting components, look for tag name of fig-group
and if so, find the first fi... | 161 | 148 | 564 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | e1fb2c36a3c12e7429a5164294ca29e873527c2d54a56dedcc7d454dffa65938 | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
5cb98423dc28fdc8268dc4bb | elifesciences/elife-tools | elifetools/utils.py | extract_nodes | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L254-L262 | train | python | Returns a list of tags (nodes) from the given soup matching the given nodename.
If an optional attribute and value are given, these are used to filter the results
further. | def extract_nodes(soup, nodename, attr = None, value = None):
"""
Returns a list of tags (nodes) from the given soup matching the given nodename.
If an optional attribute and value are given, these are used to filter the results
further."""
tags = soup.find_all(nodename)
if attr != None and valu... | Returns a list of tags (nodes) from the given soup matching the given nodename.
If an optional attribute and value are given, these are used to filter the results
further.
def extract_nodes(soup, nodename, attr = None, value = None):
"""
Returns a list of tags (nodes) from the given soup matching the g... | 139 | 179 | 422 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | d7fb23c59236caf8342ac0c62f808c062c558c9b25d44f1596126ee40028279b | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
89b26419f653ea607eac8ab9 | elifesciences/elife-tools | elifetools/utils.py | node_contents_str | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L268-L282 | train | python | Return the contents of a tag, including it's children, as a string.
Does not include the root/parent of the tag. | def node_contents_str(tag):
"""
Return the contents of a tag, including it's children, as a string.
Does not include the root/parent of the tag.
"""
if not tag:
return None
tag_string = ''
for child_tag in tag.children:
if isinstance(child_tag, Comment):
# Beautif... | Return the contents of a tag, including it's children, as a string.
Does not include the root/parent of the tag.
def node_contents_str(tag):
"""
Return the contents of a tag, including it's children, as a string.
Does not include the root/parent of the tag.
"""
if not tag:
return None
... | 149 | 116 | 554 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 8e151f6b0c6bf2e95a5e0c265ba112127b99f7a236918994cfb4bfe1876f8519 | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
fa919f52bb67e89d81b6e33b | elifesciences/elife-tools | elifetools/utils.py | first_parent | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L284-L291 | train | python | Given a beautiful soup tag, look at its parents and return the first
tag name that matches nodename or the list nodename | def first_parent(tag, nodename):
"""
Given a beautiful soup tag, look at its parents and return the first
tag name that matches nodename or the list nodename
"""
if nodename is not None and type(nodename) == str:
nodename = [nodename]
return first(list(filter(lambda tag: tag.name in node... | Given a beautiful soup tag, look at its parents and return the first
tag name that matches nodename or the list nodename
def first_parent(tag, nodename):
"""
Given a beautiful soup tag, look at its parents and return the first
tag name that matches nodename or the list nodename
"""
if nodename ... | 110 | 124 | 340 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 19bc27e9e701895c7c32789d4da241c30a516d8ab1cdef614662e256fa8a5b2e | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
e8d24429eeafa58dc9ba9fbc | elifesciences/elife-tools | elifetools/utils.py | tag_fig_ordinal | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L302-L311 | train | python | Meant for finding the position of fig tags with respect to whether
they are for a main figure or a child figure | def tag_fig_ordinal(tag):
"""
Meant for finding the position of fig tags with respect to whether
they are for a main figure or a child figure
"""
tag_count = 0
if 'specific-use' not in tag.attrs:
# Look for tags with no "specific-use" attribute
return len(list(filter(lambda tag: ... | Meant for finding the position of fig tags with respect to whether
they are for a main figure or a child figure
def tag_fig_ordinal(tag):
"""
Meant for finding the position of fig tags with respect to whether
they are for a main figure or a child figure
"""
tag_count = 0
if 'specific-use' n... | 123 | 115 | 417 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 56296609e3374da0dd38426c2af309ba1ddba02ef017f1e24a9637c200ca3322 | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
6d0f463f3361d3a3b5fffe69 | elifesciences/elife-tools | elifetools/utils.py | tag_limit_sibling_ordinal | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L323-L335 | train | python | Count previous tags of the same name until it
reaches a tag name of type stop_tag, then stop counting | def tag_limit_sibling_ordinal(tag, stop_tag_name):
"""
Count previous tags of the same name until it
reaches a tag name of type stop_tag, then stop counting
"""
tag_count = 1
for prev_tag in tag.previous_elements:
if prev_tag.name == tag.name:
tag_count += 1
if prev_t... | Count previous tags of the same name until it
reaches a tag name of type stop_tag, then stop counting
def tag_limit_sibling_ordinal(tag, stop_tag_name):
"""
Count previous tags of the same name until it
reaches a tag name of type stop_tag, then stop counting
"""
tag_count = 1
for prev_tag i... | 114 | 105 | 385 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 11a850444192c06b4f14edcfe37d1229d01dd0bd27dc9ed4d2225a60d7fecac3 | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
f35c0bc742fe4f7a294b968d | elifesciences/elife-tools | elifetools/utils.py | tag_media_sibling_ordinal | https://github.com/elifesciences/elife-tools/blob/4b9e38cbe485c61a4ed7cbd8970c6b318334fd86/elifetools/utils.py#L343-L387 | train | python | Count sibling ordinal differently depending on if the
mimetype is video or not | def tag_media_sibling_ordinal(tag):
"""
Count sibling ordinal differently depending on if the
mimetype is video or not
"""
if hasattr(tag, 'name') and tag.name != 'media':
return None
nodenames = ['fig','supplementary-material','sub-article']
first_parent_tag = first_parent(tag, nod... | Count sibling ordinal differently depending on if the
mimetype is video or not
def tag_media_sibling_ordinal(tag):
"""
Count sibling ordinal differently depending on if the
mimetype is video or not
"""
if hasattr(tag, 'name') and tag.name != 'media':
return None
nodenames = ['fig',... | 400 | 82 | 1,774 | CodeSearchNet permissive-repo filter (dataset-level) | code_search_net | 2026-12-05 | 3299dc3e5003b403d8be3dbdad588df5cee751d49a2b006fab4c9df459442c09 | MIT | permissive | https://github.com/elifesciences/elife-tools/blob/develop/LICENSE |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.