repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
KE-works/pykechain | pykechain/models/activity.py | Activity.parts | def parts(self, *args, **kwargs):
"""Retrieve parts belonging to this activity.
Without any arguments it retrieves the Instances related to this task only.
This call only returns the configured properties in an activity. So properties that are not configured
are not in the returned par... | python | def parts(self, *args, **kwargs):
"""Retrieve parts belonging to this activity.
Without any arguments it retrieves the Instances related to this task only.
This call only returns the configured properties in an activity. So properties that are not configured
are not in the returned par... | [
"def",
"parts",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_client",
".",
"parts",
"(",
"*",
"args",
",",
"activity",
"=",
"self",
".",
"id",
",",
"*",
"*",
"kwargs",
")"
] | Retrieve parts belonging to this activity.
Without any arguments it retrieves the Instances related to this task only.
This call only returns the configured properties in an activity. So properties that are not configured
are not in the returned parts.
See :class:`pykechain.Client.par... | [
"Retrieve",
"parts",
"belonging",
"to",
"this",
"activity",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L120-L139 | train |
KE-works/pykechain | pykechain/models/activity.py | Activity.associated_parts | def associated_parts(self, *args, **kwargs):
"""Retrieve models and instances belonging to this activity.
This is a convenience method for the :func:`Activity.parts()` method, which is used to retrieve both the
`Category.MODEL` as well as the `Category.INSTANCE` in a tuple.
This call o... | python | def associated_parts(self, *args, **kwargs):
"""Retrieve models and instances belonging to this activity.
This is a convenience method for the :func:`Activity.parts()` method, which is used to retrieve both the
`Category.MODEL` as well as the `Category.INSTANCE` in a tuple.
This call o... | [
"def",
"associated_parts",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"(",
"self",
".",
"parts",
"(",
"category",
"=",
"Category",
".",
"MODEL",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
",",
"self",
".",
"p... | Retrieve models and instances belonging to this activity.
This is a convenience method for the :func:`Activity.parts()` method, which is used to retrieve both the
`Category.MODEL` as well as the `Category.INSTANCE` in a tuple.
This call only returns the configured properties in an activity. So... | [
"Retrieve",
"models",
"and",
"instances",
"belonging",
"to",
"this",
"activity",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L141-L166 | train |
KE-works/pykechain | pykechain/models/activity.py | Activity.subprocess | def subprocess(self):
"""Retrieve the subprocess in which this activity is defined.
If this is a task on top level, it raises NotFounderror.
:return: a subprocess :class:`Activity`
:raises NotFoundError: when it is a task in the top level of a project
:raises APIError: when oth... | python | def subprocess(self):
"""Retrieve the subprocess in which this activity is defined.
If this is a task on top level, it raises NotFounderror.
:return: a subprocess :class:`Activity`
:raises NotFoundError: when it is a task in the top level of a project
:raises APIError: when oth... | [
"def",
"subprocess",
"(",
"self",
")",
":",
"subprocess_id",
"=",
"self",
".",
"_json_data",
".",
"get",
"(",
"'container'",
")",
"if",
"subprocess_id",
"==",
"self",
".",
"_json_data",
".",
"get",
"(",
"'root_container'",
")",
":",
"raise",
"NotFoundError",... | Retrieve the subprocess in which this activity is defined.
If this is a task on top level, it raises NotFounderror.
:return: a subprocess :class:`Activity`
:raises NotFoundError: when it is a task in the top level of a project
:raises APIError: when other error occurs
Example
... | [
"Retrieve",
"the",
"subprocess",
"in",
"which",
"this",
"activity",
"is",
"defined",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L199-L218 | train |
KE-works/pykechain | pykechain/models/activity.py | Activity.siblings | def siblings(self, **kwargs):
"""Retrieve the other activities that also belong to the subprocess.
It returns a combination of Tasks (a.o. UserTasks) and Subprocesses on the level of the current task, including
itself. This also works if the activity is of type `ActivityType.SUBPROCESS`.
... | python | def siblings(self, **kwargs):
"""Retrieve the other activities that also belong to the subprocess.
It returns a combination of Tasks (a.o. UserTasks) and Subprocesses on the level of the current task, including
itself. This also works if the activity is of type `ActivityType.SUBPROCESS`.
... | [
"def",
"siblings",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"container_id",
"=",
"self",
".",
"_json_data",
".",
"get",
"(",
"'container'",
")",
"return",
"self",
".",
"_client",
".",
"activities",
"(",
"container",
"=",
"container_id",
",",
"scop... | Retrieve the other activities that also belong to the subprocess.
It returns a combination of Tasks (a.o. UserTasks) and Subprocesses on the level of the current task, including
itself. This also works if the activity is of type `ActivityType.SUBPROCESS`.
:param kwargs: Additional search argum... | [
"Retrieve",
"the",
"other",
"activities",
"that",
"also",
"belong",
"to",
"the",
"subprocess",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L248-L269 | train |
KE-works/pykechain | pykechain/models/activity.py | Activity.create | def create(self, *args, **kwargs):
"""Create a new activity belonging to this subprocess.
See :func:`pykechain.Client.create_activity` for available parameters.
:raises IllegalArgumentError: if the `Activity` is not a `SUBPROCESS`.
:raises APIError: if an Error occurs.
"""
... | python | def create(self, *args, **kwargs):
"""Create a new activity belonging to this subprocess.
See :func:`pykechain.Client.create_activity` for available parameters.
:raises IllegalArgumentError: if the `Activity` is not a `SUBPROCESS`.
:raises APIError: if an Error occurs.
"""
... | [
"def",
"create",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"activity_type",
"!=",
"ActivityType",
".",
"SUBPROCESS",
":",
"raise",
"IllegalArgumentError",
"(",
"\"One can only create a task under a subprocess.\"",
")",
... | Create a new activity belonging to this subprocess.
See :func:`pykechain.Client.create_activity` for available parameters.
:raises IllegalArgumentError: if the `Activity` is not a `SUBPROCESS`.
:raises APIError: if an Error occurs. | [
"Create",
"a",
"new",
"activity",
"belonging",
"to",
"this",
"subprocess",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L271-L281 | train |
KE-works/pykechain | pykechain/models/activity.py | Activity.customization | def customization(self):
"""
Get a customization object representing the customization of the activity.
.. versionadded:: 1.11
:return: An instance of :class:`customization.ExtCustomization`
Example
-------
>>> activity = project.activity(name='Customizable act... | python | def customization(self):
"""
Get a customization object representing the customization of the activity.
.. versionadded:: 1.11
:return: An instance of :class:`customization.ExtCustomization`
Example
-------
>>> activity = project.activity(name='Customizable act... | [
"def",
"customization",
"(",
"self",
")",
":",
"from",
".",
"customization",
"import",
"ExtCustomization",
"# For now, we only allow customization in an Ext JS context",
"return",
"ExtCustomization",
"(",
"activity",
"=",
"self",
",",
"client",
"=",
"self",
".",
"_clien... | Get a customization object representing the customization of the activity.
.. versionadded:: 1.11
:return: An instance of :class:`customization.ExtCustomization`
Example
-------
>>> activity = project.activity(name='Customizable activity')
>>> customization = activity.... | [
"Get",
"a",
"customization",
"object",
"representing",
"the",
"customization",
"of",
"the",
"activity",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L398-L417 | train |
hfurubotten/enturclient | enturclient/api.py | EnturPublicTransportData.all_stop_places_quays | def all_stop_places_quays(self) -> list:
"""Get all stop places and quays"""
all_places = self.stops.copy()
for quay in self.quays:
all_places.append(quay)
return all_places | python | def all_stop_places_quays(self) -> list:
"""Get all stop places and quays"""
all_places = self.stops.copy()
for quay in self.quays:
all_places.append(quay)
return all_places | [
"def",
"all_stop_places_quays",
"(",
"self",
")",
"->",
"list",
":",
"all_places",
"=",
"self",
".",
"stops",
".",
"copy",
"(",
")",
"for",
"quay",
"in",
"self",
".",
"quays",
":",
"all_places",
".",
"append",
"(",
"quay",
")",
"return",
"all_places"
] | Get all stop places and quays | [
"Get",
"all",
"stop",
"places",
"and",
"quays"
] | 8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4 | https://github.com/hfurubotten/enturclient/blob/8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4/enturclient/api.py#L68-L73 | train |
hfurubotten/enturclient | enturclient/api.py | EnturPublicTransportData.expand_all_quays | async def expand_all_quays(self) -> None:
"""Find all quays from stop places."""
if not self.stops:
return
headers = {'ET-Client-Name': self._client_name}
request = {
'query': GRAPHQL_STOP_TO_QUAY_TEMPLATE,
'variables': {
'stops': self... | python | async def expand_all_quays(self) -> None:
"""Find all quays from stop places."""
if not self.stops:
return
headers = {'ET-Client-Name': self._client_name}
request = {
'query': GRAPHQL_STOP_TO_QUAY_TEMPLATE,
'variables': {
'stops': self... | [
"async",
"def",
"expand_all_quays",
"(",
"self",
")",
"->",
"None",
":",
"if",
"not",
"self",
".",
"stops",
":",
"return",
"headers",
"=",
"{",
"'ET-Client-Name'",
":",
"self",
".",
"_client_name",
"}",
"request",
"=",
"{",
"'query'",
":",
"GRAPHQL_STOP_TO... | Find all quays from stop places. | [
"Find",
"all",
"quays",
"from",
"stop",
"places",
"."
] | 8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4 | https://github.com/hfurubotten/enturclient/blob/8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4/enturclient/api.py#L75-L108 | train |
hfurubotten/enturclient | enturclient/api.py | EnturPublicTransportData.update | async def update(self) -> None:
"""Get the latest data from api.entur.org."""
headers = {'ET-Client-Name': self._client_name}
request = {
'query': self.get_gql_query(),
'variables': {
'stops': self.stops,
'quays': self.quays,
... | python | async def update(self) -> None:
"""Get the latest data from api.entur.org."""
headers = {'ET-Client-Name': self._client_name}
request = {
'query': self.get_gql_query(),
'variables': {
'stops': self.stops,
'quays': self.quays,
... | [
"async",
"def",
"update",
"(",
"self",
")",
"->",
"None",
":",
"headers",
"=",
"{",
"'ET-Client-Name'",
":",
"self",
".",
"_client_name",
"}",
"request",
"=",
"{",
"'query'",
":",
"self",
".",
"get_gql_query",
"(",
")",
",",
"'variables'",
":",
"{",
"'... | Get the latest data from api.entur.org. | [
"Get",
"the",
"latest",
"data",
"from",
"api",
".",
"entur",
".",
"org",
"."
] | 8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4 | https://github.com/hfurubotten/enturclient/blob/8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4/enturclient/api.py#L110-L152 | train |
hfurubotten/enturclient | enturclient/api.py | EnturPublicTransportData._process_place | def _process_place(self, place: dict, is_platform: bool) -> None:
"""Extract information from place dictionary."""
place_id = place['id']
self.info[place_id] = Place(place, is_platform) | python | def _process_place(self, place: dict, is_platform: bool) -> None:
"""Extract information from place dictionary."""
place_id = place['id']
self.info[place_id] = Place(place, is_platform) | [
"def",
"_process_place",
"(",
"self",
",",
"place",
":",
"dict",
",",
"is_platform",
":",
"bool",
")",
"->",
"None",
":",
"place_id",
"=",
"place",
"[",
"'id'",
"]",
"self",
".",
"info",
"[",
"place_id",
"]",
"=",
"Place",
"(",
"place",
",",
"is_plat... | Extract information from place dictionary. | [
"Extract",
"information",
"from",
"place",
"dictionary",
"."
] | 8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4 | https://github.com/hfurubotten/enturclient/blob/8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4/enturclient/api.py#L158-L161 | train |
SuryaSankar/flask-sqlalchemy-booster | flask_sqlalchemy_booster/responses.py | serializable_list | def serializable_list(
olist, attrs_to_serialize=None, rels_to_expand=None,
group_listrels_by=None, rels_to_serialize=None,
key_modifications=None, groupby=None, keyvals_to_merge=None,
preserve_order=False, dict_struct=None, dict_post_processors=None):
"""
Converts a list of mode... | python | def serializable_list(
olist, attrs_to_serialize=None, rels_to_expand=None,
group_listrels_by=None, rels_to_serialize=None,
key_modifications=None, groupby=None, keyvals_to_merge=None,
preserve_order=False, dict_struct=None, dict_post_processors=None):
"""
Converts a list of mode... | [
"def",
"serializable_list",
"(",
"olist",
",",
"attrs_to_serialize",
"=",
"None",
",",
"rels_to_expand",
"=",
"None",
",",
"group_listrels_by",
"=",
"None",
",",
"rels_to_serialize",
"=",
"None",
",",
"key_modifications",
"=",
"None",
",",
"groupby",
"=",
"None"... | Converts a list of model instances to a list of dictionaries
using their `todict` method.
Args:
olist (list): The list of instances to convert
attrs_to_serialize (list, optional): To be passed as an argument
to the `todict` method
rels_to_expand (list, optional): To be passe... | [
"Converts",
"a",
"list",
"of",
"model",
"instances",
"to",
"a",
"list",
"of",
"dictionaries",
"using",
"their",
"todict",
"method",
"."
] | 444048d167ab7718f758e943665ef32d101423a5 | https://github.com/SuryaSankar/flask-sqlalchemy-booster/blob/444048d167ab7718f758e943665ef32d101423a5/flask_sqlalchemy_booster/responses.py#L96-L168 | train |
SuryaSankar/flask-sqlalchemy-booster | flask_sqlalchemy_booster/responses.py | jsoned | def jsoned(struct, wrap=True, meta=None, struct_key='result', pre_render_callback=None):
""" Provides a json dump of the struct
Args:
struct: The data to dump
wrap (bool, optional): Specify whether to wrap the
struct in an enclosing dict
struct_key (str, optional): The strin... | python | def jsoned(struct, wrap=True, meta=None, struct_key='result', pre_render_callback=None):
""" Provides a json dump of the struct
Args:
struct: The data to dump
wrap (bool, optional): Specify whether to wrap the
struct in an enclosing dict
struct_key (str, optional): The strin... | [
"def",
"jsoned",
"(",
"struct",
",",
"wrap",
"=",
"True",
",",
"meta",
"=",
"None",
",",
"struct_key",
"=",
"'result'",
",",
"pre_render_callback",
"=",
"None",
")",
":",
"return",
"_json",
".",
"dumps",
"(",
"structured",
"(",
"struct",
",",
"wrap",
"... | Provides a json dump of the struct
Args:
struct: The data to dump
wrap (bool, optional): Specify whether to wrap the
struct in an enclosing dict
struct_key (str, optional): The string key which will
contain the struct in the result dict
meta (dict, optional):... | [
"Provides",
"a",
"json",
"dump",
"of",
"the",
"struct"
] | 444048d167ab7718f758e943665ef32d101423a5 | https://github.com/SuryaSankar/flask-sqlalchemy-booster/blob/444048d167ab7718f758e943665ef32d101423a5/flask_sqlalchemy_booster/responses.py#L191-L216 | train |
SuryaSankar/flask-sqlalchemy-booster | flask_sqlalchemy_booster/responses.py | as_list | def as_list(func):
""" A decorator used to return a JSON response of a list of model
objects. It expects the decorated function to return a list
of model instances. It then converts the instances to dicts
and serializes them into a json response
Examples:
>>> @app.route... | python | def as_list(func):
""" A decorator used to return a JSON response of a list of model
objects. It expects the decorated function to return a list
of model instances. It then converts the instances to dicts
and serializes them into a json response
Examples:
>>> @app.route... | [
"def",
"as_list",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"response",
"=",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"if",
"isinstance",
"(",
"r... | A decorator used to return a JSON response of a list of model
objects. It expects the decorated function to return a list
of model instances. It then converts the instances to dicts
and serializes them into a json response
Examples:
>>> @app.route('/api')
... @a... | [
"A",
"decorator",
"used",
"to",
"return",
"a",
"JSON",
"response",
"of",
"a",
"list",
"of",
"model",
"objects",
".",
"It",
"expects",
"the",
"decorated",
"function",
"to",
"return",
"a",
"list",
"of",
"model",
"instances",
".",
"It",
"then",
"converts",
... | 444048d167ab7718f758e943665ef32d101423a5 | https://github.com/SuryaSankar/flask-sqlalchemy-booster/blob/444048d167ab7718f758e943665ef32d101423a5/flask_sqlalchemy_booster/responses.py#L419-L441 | train |
SuryaSankar/flask-sqlalchemy-booster | flask_sqlalchemy_booster/responses.py | as_processed_list | def as_processed_list(func):
""" A decorator used to return a JSON response of a list of model
objects. It differs from `as_list` in that it accepts a variety
of querying parameters and can use them to filter and modify the
results. It expects the decorated function to return either Model Cl... | python | def as_processed_list(func):
""" A decorator used to return a JSON response of a list of model
objects. It differs from `as_list` in that it accepts a variety
of querying parameters and can use them to filter and modify the
results. It expects the decorated function to return either Model Cl... | [
"def",
"as_processed_list",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"func_argspec",
"=",
"inspect",
".",
"getargspec",
"(",
"func",
")",
"func_args",
"=",
"func_argsp... | A decorator used to return a JSON response of a list of model
objects. It differs from `as_list` in that it accepts a variety
of querying parameters and can use them to filter and modify the
results. It expects the decorated function to return either Model Class
to query or a SQLAlchemy ... | [
"A",
"decorator",
"used",
"to",
"return",
"a",
"JSON",
"response",
"of",
"a",
"list",
"of",
"model",
"objects",
".",
"It",
"differs",
"from",
"as_list",
"in",
"that",
"it",
"accepts",
"a",
"variety",
"of",
"querying",
"parameters",
"and",
"can",
"use",
"... | 444048d167ab7718f758e943665ef32d101423a5 | https://github.com/SuryaSankar/flask-sqlalchemy-booster/blob/444048d167ab7718f758e943665ef32d101423a5/flask_sqlalchemy_booster/responses.py#L911-L946 | train |
SuryaSankar/flask-sqlalchemy-booster | flask_sqlalchemy_booster/responses.py | as_obj | def as_obj(func):
""" A decorator used to return a JSON response with a dict
representation of the model instance. It expects the decorated function
to return a Model instance. It then converts the instance to dicts
and serializes it into a json response
Examples:
>>> ... | python | def as_obj(func):
""" A decorator used to return a JSON response with a dict
representation of the model instance. It expects the decorated function
to return a Model instance. It then converts the instance to dicts
and serializes it into a json response
Examples:
>>> ... | [
"def",
"as_obj",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"response",
"=",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"render_json_obj_with_... | A decorator used to return a JSON response with a dict
representation of the model instance. It expects the decorated function
to return a Model instance. It then converts the instance to dicts
and serializes it into a json response
Examples:
>>> @app.route('/api/shipments... | [
"A",
"decorator",
"used",
"to",
"return",
"a",
"JSON",
"response",
"with",
"a",
"dict",
"representation",
"of",
"the",
"model",
"instance",
".",
"It",
"expects",
"the",
"decorated",
"function",
"to",
"return",
"a",
"Model",
"instance",
".",
"It",
"then",
"... | 444048d167ab7718f758e943665ef32d101423a5 | https://github.com/SuryaSankar/flask-sqlalchemy-booster/blob/444048d167ab7718f758e943665ef32d101423a5/flask_sqlalchemy_booster/responses.py#L949-L966 | train |
KE-works/pykechain | pykechain/models/service.py | Service.execute | def execute(self, interactive=False):
"""
Execute the service.
For interactive (notebook) service execution, set interactive to True, defaults to False.
.. versionadded:: 1.13
:param interactive: (optional) True if the notebook service should execute in interactive mode.
... | python | def execute(self, interactive=False):
"""
Execute the service.
For interactive (notebook) service execution, set interactive to True, defaults to False.
.. versionadded:: 1.13
:param interactive: (optional) True if the notebook service should execute in interactive mode.
... | [
"def",
"execute",
"(",
"self",
",",
"interactive",
"=",
"False",
")",
":",
"url",
"=",
"self",
".",
"_client",
".",
"_build_url",
"(",
"'service_execute'",
",",
"service_id",
"=",
"self",
".",
"id",
")",
"response",
"=",
"self",
".",
"_client",
".",
"_... | Execute the service.
For interactive (notebook) service execution, set interactive to True, defaults to False.
.. versionadded:: 1.13
:param interactive: (optional) True if the notebook service should execute in interactive mode.
:type interactive: bool or None
:return: Servic... | [
"Execute",
"the",
"service",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/service.py#L51-L71 | train |
KE-works/pykechain | pykechain/models/service.py | Service.edit | def edit(self, name=None, description=None, version=None, **kwargs):
"""
Edit Service details.
.. versionadded:: 1.13
:param name: (optional) name of the service to change.
:type name: basestring or None
:param description: (optional) description of the service.
... | python | def edit(self, name=None, description=None, version=None, **kwargs):
"""
Edit Service details.
.. versionadded:: 1.13
:param name: (optional) name of the service to change.
:type name: basestring or None
:param description: (optional) description of the service.
... | [
"def",
"edit",
"(",
"self",
",",
"name",
"=",
"None",
",",
"description",
"=",
"None",
",",
"version",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"update_dict",
"=",
"{",
"'id'",
":",
"self",
".",
"id",
"}",
"if",
"name",
":",
"if",
"not",
... | Edit Service details.
.. versionadded:: 1.13
:param name: (optional) name of the service to change.
:type name: basestring or None
:param description: (optional) description of the service.
:type description: basestring or None
:param version: (optional) version number ... | [
"Edit",
"Service",
"details",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/service.py#L73-L115 | train |
KE-works/pykechain | pykechain/models/service.py | Service.delete | def delete(self):
# type: () -> None
"""Delete this service.
:raises APIError: if delete was not succesfull.
"""
response = self._client._request('DELETE', self._client._build_url('service', service_id=self.id))
if response.status_code != requests.codes.no_content: # p... | python | def delete(self):
# type: () -> None
"""Delete this service.
:raises APIError: if delete was not succesfull.
"""
response = self._client._request('DELETE', self._client._build_url('service', service_id=self.id))
if response.status_code != requests.codes.no_content: # p... | [
"def",
"delete",
"(",
"self",
")",
":",
"# type: () -> None",
"response",
"=",
"self",
".",
"_client",
".",
"_request",
"(",
"'DELETE'",
",",
"self",
".",
"_client",
".",
"_build_url",
"(",
"'service'",
",",
"service_id",
"=",
"self",
".",
"id",
")",
")"... | Delete this service.
:raises APIError: if delete was not succesfull. | [
"Delete",
"this",
"service",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/service.py#L117-L126 | train |
KE-works/pykechain | pykechain/models/service.py | Service.get_executions | def get_executions(self, **kwargs):
"""
Retrieve the executions related to the current service.
.. versionadded:: 1.13
:param kwargs: (optional) additional search keyword arguments to limit the search even further.
:type kwargs: dict
:return: list of ServiceExecutions a... | python | def get_executions(self, **kwargs):
"""
Retrieve the executions related to the current service.
.. versionadded:: 1.13
:param kwargs: (optional) additional search keyword arguments to limit the search even further.
:type kwargs: dict
:return: list of ServiceExecutions a... | [
"def",
"get_executions",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_client",
".",
"service_executions",
"(",
"service",
"=",
"self",
".",
"id",
",",
"scope",
"=",
"self",
".",
"scope_id",
",",
"*",
"*",
"kwargs",
")"
] | Retrieve the executions related to the current service.
.. versionadded:: 1.13
:param kwargs: (optional) additional search keyword arguments to limit the search even further.
:type kwargs: dict
:return: list of ServiceExecutions associated to the current service. | [
"Retrieve",
"the",
"executions",
"related",
"to",
"the",
"current",
"service",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/service.py#L177-L187 | train |
KE-works/pykechain | pykechain/models/service.py | ServiceExecution.service | def service(self):
"""Retrieve the `Service` object to which this execution is associated."""
if not self._service:
self._service = self._client.service(id=self.service_id)
return self._service | python | def service(self):
"""Retrieve the `Service` object to which this execution is associated."""
if not self._service:
self._service = self._client.service(id=self.service_id)
return self._service | [
"def",
"service",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_service",
":",
"self",
".",
"_service",
"=",
"self",
".",
"_client",
".",
"service",
"(",
"id",
"=",
"self",
".",
"service_id",
")",
"return",
"self",
".",
"_service"
] | Retrieve the `Service` object to which this execution is associated. | [
"Retrieve",
"the",
"Service",
"object",
"to",
"which",
"this",
"execution",
"is",
"associated",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/service.py#L232-L236 | train |
KE-works/pykechain | pykechain/models/service.py | ServiceExecution.terminate | def terminate(self):
"""
Terminate the Service execution.
.. versionadded:: 1.13
:return: None if the termination request was successful
:raises APIError: When the service execution could not be terminated.
"""
url = self._client._build_url('service_execution_te... | python | def terminate(self):
"""
Terminate the Service execution.
.. versionadded:: 1.13
:return: None if the termination request was successful
:raises APIError: When the service execution could not be terminated.
"""
url = self._client._build_url('service_execution_te... | [
"def",
"terminate",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_client",
".",
"_build_url",
"(",
"'service_execution_terminate'",
",",
"service_execution_id",
"=",
"self",
".",
"id",
")",
"response",
"=",
"self",
".",
"_client",
".",
"_request",
"(",
... | Terminate the Service execution.
.. versionadded:: 1.13
:return: None if the termination request was successful
:raises APIError: When the service execution could not be terminated. | [
"Terminate",
"the",
"Service",
"execution",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/service.py#L241-L254 | train |
KE-works/pykechain | pykechain/models/service.py | ServiceExecution.get_log | def get_log(self, target_dir=None, log_filename='log.txt'):
"""
Retrieve the log of the service execution.
.. versionadded:: 1.13
:param target_dir: (optional) directory path name where the store the log.txt to.
:type target_dir: basestring or None
:param log_filename: ... | python | def get_log(self, target_dir=None, log_filename='log.txt'):
"""
Retrieve the log of the service execution.
.. versionadded:: 1.13
:param target_dir: (optional) directory path name where the store the log.txt to.
:type target_dir: basestring or None
:param log_filename: ... | [
"def",
"get_log",
"(",
"self",
",",
"target_dir",
"=",
"None",
",",
"log_filename",
"=",
"'log.txt'",
")",
":",
"full_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"target_dir",
"or",
"os",
".",
"getcwd",
"(",
")",
",",
"log_filename",
")",
"url",
... | Retrieve the log of the service execution.
.. versionadded:: 1.13
:param target_dir: (optional) directory path name where the store the log.txt to.
:type target_dir: basestring or None
:param log_filename: (optional) log filename to write the log to, defaults to `log.txt`.
:typ... | [
"Retrieve",
"the",
"log",
"of",
"the",
"service",
"execution",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/service.py#L256-L278 | train |
KE-works/pykechain | pykechain/models/service.py | ServiceExecution.get_notebook_url | def get_notebook_url(self):
"""
Get the url of the notebook, if the notebook is executed in interactive mode.
.. versionadded:: 1.13
:return: full url to the interactive running notebook as `basestring`
:raises APIError: when the url cannot be retrieved.
"""
url... | python | def get_notebook_url(self):
"""
Get the url of the notebook, if the notebook is executed in interactive mode.
.. versionadded:: 1.13
:return: full url to the interactive running notebook as `basestring`
:raises APIError: when the url cannot be retrieved.
"""
url... | [
"def",
"get_notebook_url",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_client",
".",
"_build_url",
"(",
"'service_execution_notebook_url'",
",",
"service_execution_id",
"=",
"self",
".",
"id",
")",
"response",
"=",
"self",
".",
"_client",
".",
"_request"... | Get the url of the notebook, if the notebook is executed in interactive mode.
.. versionadded:: 1.13
:return: full url to the interactive running notebook as `basestring`
:raises APIError: when the url cannot be retrieved. | [
"Get",
"the",
"url",
"of",
"the",
"notebook",
"if",
"the",
"notebook",
"is",
"executed",
"in",
"interactive",
"mode",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/service.py#L280-L297 | train |
pdxjohnny/SimpleHTTPSServer | SimpleHTTPSServer/SimpleWebSocketServer.py | WebSocket.sendMessage | def sendMessage(self, data):
"""
Send websocket data frame to the client.
If data is a unicode object then the frame is sent as Text.
If the data is a bytearray object then the frame is sent as Binary.
"""
opcode = BINARY
if isinstance(data, unicode):
... | python | def sendMessage(self, data):
"""
Send websocket data frame to the client.
If data is a unicode object then the frame is sent as Text.
If the data is a bytearray object then the frame is sent as Binary.
"""
opcode = BINARY
if isinstance(data, unicode):
... | [
"def",
"sendMessage",
"(",
"self",
",",
"data",
")",
":",
"opcode",
"=",
"BINARY",
"if",
"isinstance",
"(",
"data",
",",
"unicode",
")",
":",
"opcode",
"=",
"TEXT",
"self",
".",
"_sendMessage",
"(",
"False",
",",
"opcode",
",",
"data",
")"
] | Send websocket data frame to the client.
If data is a unicode object then the frame is sent as Text.
If the data is a bytearray object then the frame is sent as Binary. | [
"Send",
"websocket",
"data",
"frame",
"to",
"the",
"client",
".",
"If",
"data",
"is",
"a",
"unicode",
"object",
"then",
"the",
"frame",
"is",
"sent",
"as",
"Text",
".",
"If",
"the",
"data",
"is",
"a",
"bytearray",
"object",
"then",
"the",
"frame",
"is"... | 5ba0490e1c15541287f89abedfdcd2ff70ad1e88 | https://github.com/pdxjohnny/SimpleHTTPSServer/blob/5ba0490e1c15541287f89abedfdcd2ff70ad1e88/SimpleHTTPSServer/SimpleWebSocketServer.py#L343-L353 | train |
biosignalsnotebooks/biosignalsnotebooks | biosignalsnotebooks/biosignalsnotebooks/synchronisation.py | _shape_array | def _shape_array(array1, array2):
"""
Function that equalises the input arrays by zero-padding the shortest one.
----------
Parameters
----------
array1: list or numpy.array
Array
array2: list or numpy.array
Array
Return
------
arrays: numpy.array
Array ... | python | def _shape_array(array1, array2):
"""
Function that equalises the input arrays by zero-padding the shortest one.
----------
Parameters
----------
array1: list or numpy.array
Array
array2: list or numpy.array
Array
Return
------
arrays: numpy.array
Array ... | [
"def",
"_shape_array",
"(",
"array1",
",",
"array2",
")",
":",
"if",
"len",
"(",
"array1",
")",
">",
"len",
"(",
"array2",
")",
":",
"new_array",
"=",
"array2",
"old_array",
"=",
"array1",
"else",
":",
"new_array",
"=",
"array1",
"old_array",
"=",
"arr... | Function that equalises the input arrays by zero-padding the shortest one.
----------
Parameters
----------
array1: list or numpy.array
Array
array2: list or numpy.array
Array
Return
------
arrays: numpy.array
Array containing the equal-length arrays. | [
"Function",
"that",
"equalises",
"the",
"input",
"arrays",
"by",
"zero",
"-",
"padding",
"the",
"shortest",
"one",
"."
] | aaa01d4125180b3a34f1e26e0d3ff08c23f666d3 | https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/biosignalsnotebooks/synchronisation.py#L315-L348 | train |
biosignalsnotebooks/biosignalsnotebooks | biosignalsnotebooks/biosignalsnotebooks/synchronisation.py | _create_txt_from_str | def _create_txt_from_str(in_path, channels, new_path):
"""
This function allows to generate a text file with synchronised signals from the input file.
----------
Parameters
----------
in_path : str
Path to the file containing the two signals that will be synchronised.
channels : lis... | python | def _create_txt_from_str(in_path, channels, new_path):
"""
This function allows to generate a text file with synchronised signals from the input file.
----------
Parameters
----------
in_path : str
Path to the file containing the two signals that will be synchronised.
channels : lis... | [
"def",
"_create_txt_from_str",
"(",
"in_path",
",",
"channels",
",",
"new_path",
")",
":",
"header",
"=",
"[",
"\"# OpenSignals Text File Format\"",
"]",
"files",
"=",
"[",
"bsnb",
".",
"load",
"(",
"in_path",
")",
"]",
"with",
"open",
"(",
"in_path",
",",
... | This function allows to generate a text file with synchronised signals from the input file.
----------
Parameters
----------
in_path : str
Path to the file containing the two signals that will be synchronised.
channels : list
List with the strings identifying the channels of each si... | [
"This",
"function",
"allows",
"to",
"generate",
"a",
"text",
"file",
"with",
"synchronised",
"signals",
"from",
"the",
"input",
"file",
"."
] | aaa01d4125180b3a34f1e26e0d3ff08c23f666d3 | https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/biosignalsnotebooks/synchronisation.py#L444-L493 | train |
googleapis/protoc-java-resource-names-plugin | plugin/utils/path_template.py | PathTemplate.render | def render(self, bindings):
"""Renders a string from a path template using the provided bindings.
Args:
bindings (dict): A dictionary of var names to binding strings.
Returns:
str: The rendered instantiation of this path template.
Raises:
Validation... | python | def render(self, bindings):
"""Renders a string from a path template using the provided bindings.
Args:
bindings (dict): A dictionary of var names to binding strings.
Returns:
str: The rendered instantiation of this path template.
Raises:
Validation... | [
"def",
"render",
"(",
"self",
",",
"bindings",
")",
":",
"out",
"=",
"[",
"]",
"binding",
"=",
"False",
"for",
"segment",
"in",
"self",
".",
"segments",
":",
"if",
"segment",
".",
"kind",
"==",
"_BINDING",
":",
"if",
"segment",
".",
"literal",
"not",... | Renders a string from a path template using the provided bindings.
Args:
bindings (dict): A dictionary of var names to binding strings.
Returns:
str: The rendered instantiation of this path template.
Raises:
ValidationError: If a key isn't provided or if a ... | [
"Renders",
"a",
"string",
"from",
"a",
"path",
"template",
"using",
"the",
"provided",
"bindings",
"."
] | 3fb2ec9b778f62646c05a7b960c893464c7791c0 | https://github.com/googleapis/protoc-java-resource-names-plugin/blob/3fb2ec9b778f62646c05a7b960c893464c7791c0/plugin/utils/path_template.py#L82-L113 | train |
googleapis/protoc-java-resource-names-plugin | plugin/utils/path_template.py | PathTemplate.match | def match(self, path):
"""Matches a fully qualified path template string.
Args:
path (str): A fully qualified path template string.
Returns:
dict: Var names to matched binding values.
Raises:
ValidationException: If path can't be matched to the temp... | python | def match(self, path):
"""Matches a fully qualified path template string.
Args:
path (str): A fully qualified path template string.
Returns:
dict: Var names to matched binding values.
Raises:
ValidationException: If path can't be matched to the temp... | [
"def",
"match",
"(",
"self",
",",
"path",
")",
":",
"this",
"=",
"self",
".",
"segments",
"that",
"=",
"path",
".",
"split",
"(",
"'/'",
")",
"current_var",
"=",
"None",
"bindings",
"=",
"{",
"}",
"segment_count",
"=",
"self",
".",
"segment_count",
"... | Matches a fully qualified path template string.
Args:
path (str): A fully qualified path template string.
Returns:
dict: Var names to matched binding values.
Raises:
ValidationException: If path can't be matched to the template. | [
"Matches",
"a",
"fully",
"qualified",
"path",
"template",
"string",
"."
] | 3fb2ec9b778f62646c05a7b960c893464c7791c0 | https://github.com/googleapis/protoc-java-resource-names-plugin/blob/3fb2ec9b778f62646c05a7b960c893464c7791c0/plugin/utils/path_template.py#L115-L157 | train |
googleapis/protoc-java-resource-names-plugin | plugin/utils/path_template.py | _Parser.parse | def parse(self, data):
"""Returns a list of path template segments parsed from data.
Args:
data: A path template string.
Returns:
A list of _Segment.
"""
self.binding_var_count = 0
self.segment_count = 0
segments = self.parser.parse(data)... | python | def parse(self, data):
"""Returns a list of path template segments parsed from data.
Args:
data: A path template string.
Returns:
A list of _Segment.
"""
self.binding_var_count = 0
self.segment_count = 0
segments = self.parser.parse(data)... | [
"def",
"parse",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"binding_var_count",
"=",
"0",
"self",
".",
"segment_count",
"=",
"0",
"segments",
"=",
"self",
".",
"parser",
".",
"parse",
"(",
"data",
")",
"# Validation step: checks that there are no nested ... | Returns a list of path template segments parsed from data.
Args:
data: A path template string.
Returns:
A list of _Segment. | [
"Returns",
"a",
"list",
"of",
"path",
"template",
"segments",
"parsed",
"from",
"data",
"."
] | 3fb2ec9b778f62646c05a7b960c893464c7791c0 | https://github.com/googleapis/protoc-java-resource-names-plugin/blob/3fb2ec9b778f62646c05a7b960c893464c7791c0/plugin/utils/path_template.py#L190-L211 | train |
mozilla/FoxPuppet | foxpuppet/windows/browser/notifications/base.py | BaseNotification.create | def create(window, root):
"""Create a notification object.
Args:
window (:py:class:`BrowserWindow`): Window object this region
appears in.
root
(:py:class:`~selenium.webdriver.remote.webelement.WebElement`):
WebDriver element objec... | python | def create(window, root):
"""Create a notification object.
Args:
window (:py:class:`BrowserWindow`): Window object this region
appears in.
root
(:py:class:`~selenium.webdriver.remote.webelement.WebElement`):
WebDriver element objec... | [
"def",
"create",
"(",
"window",
",",
"root",
")",
":",
"notifications",
"=",
"{",
"}",
"_id",
"=",
"root",
".",
"get_property",
"(",
"\"id\"",
")",
"from",
"foxpuppet",
".",
"windows",
".",
"browser",
".",
"notifications",
"import",
"addons",
"notification... | Create a notification object.
Args:
window (:py:class:`BrowserWindow`): Window object this region
appears in.
root
(:py:class:`~selenium.webdriver.remote.webelement.WebElement`):
WebDriver element object that serves as the root for the
... | [
"Create",
"a",
"notification",
"object",
"."
] | 6575eb4c72fd024c986b254e198c8b4e6f68cddd | https://github.com/mozilla/FoxPuppet/blob/6575eb4c72fd024c986b254e198c8b4e6f68cddd/foxpuppet/windows/browser/notifications/base.py#L19-L39 | train |
mozilla/FoxPuppet | foxpuppet/windows/browser/notifications/base.py | BaseNotification.label | def label(self):
"""Provide access to the notification label.
Returns:
str: The notification label
"""
with self.selenium.context(self.selenium.CONTEXT_CHROME):
return self.root.get_attribute("label") | python | def label(self):
"""Provide access to the notification label.
Returns:
str: The notification label
"""
with self.selenium.context(self.selenium.CONTEXT_CHROME):
return self.root.get_attribute("label") | [
"def",
"label",
"(",
"self",
")",
":",
"with",
"self",
".",
"selenium",
".",
"context",
"(",
"self",
".",
"selenium",
".",
"CONTEXT_CHROME",
")",
":",
"return",
"self",
".",
"root",
".",
"get_attribute",
"(",
"\"label\"",
")"
] | Provide access to the notification label.
Returns:
str: The notification label | [
"Provide",
"access",
"to",
"the",
"notification",
"label",
"."
] | 6575eb4c72fd024c986b254e198c8b4e6f68cddd | https://github.com/mozilla/FoxPuppet/blob/6575eb4c72fd024c986b254e198c8b4e6f68cddd/foxpuppet/windows/browser/notifications/base.py#L42-L50 | train |
mozilla/FoxPuppet | foxpuppet/windows/browser/notifications/base.py | BaseNotification.origin | def origin(self):
"""Provide access to the notification origin.
Returns:
str: The notification origin.
"""
with self.selenium.context(self.selenium.CONTEXT_CHROME):
return self.root.get_attribute("origin") | python | def origin(self):
"""Provide access to the notification origin.
Returns:
str: The notification origin.
"""
with self.selenium.context(self.selenium.CONTEXT_CHROME):
return self.root.get_attribute("origin") | [
"def",
"origin",
"(",
"self",
")",
":",
"with",
"self",
".",
"selenium",
".",
"context",
"(",
"self",
".",
"selenium",
".",
"CONTEXT_CHROME",
")",
":",
"return",
"self",
".",
"root",
".",
"get_attribute",
"(",
"\"origin\"",
")"
] | Provide access to the notification origin.
Returns:
str: The notification origin. | [
"Provide",
"access",
"to",
"the",
"notification",
"origin",
"."
] | 6575eb4c72fd024c986b254e198c8b4e6f68cddd | https://github.com/mozilla/FoxPuppet/blob/6575eb4c72fd024c986b254e198c8b4e6f68cddd/foxpuppet/windows/browser/notifications/base.py#L53-L61 | train |
mozilla/FoxPuppet | foxpuppet/windows/browser/notifications/base.py | BaseNotification.find_primary_button | def find_primary_button(self):
"""Retrieve the primary button."""
if self.window.firefox_version >= 67:
return self.root.find_element(
By.CLASS_NAME, "popup-notification-primary-button")
return self.root.find_anonymous_element_by_attribute(
"anonid", "butt... | python | def find_primary_button(self):
"""Retrieve the primary button."""
if self.window.firefox_version >= 67:
return self.root.find_element(
By.CLASS_NAME, "popup-notification-primary-button")
return self.root.find_anonymous_element_by_attribute(
"anonid", "butt... | [
"def",
"find_primary_button",
"(",
"self",
")",
":",
"if",
"self",
".",
"window",
".",
"firefox_version",
">=",
"67",
":",
"return",
"self",
".",
"root",
".",
"find_element",
"(",
"By",
".",
"CLASS_NAME",
",",
"\"popup-notification-primary-button\"",
")",
"ret... | Retrieve the primary button. | [
"Retrieve",
"the",
"primary",
"button",
"."
] | 6575eb4c72fd024c986b254e198c8b4e6f68cddd | https://github.com/mozilla/FoxPuppet/blob/6575eb4c72fd024c986b254e198c8b4e6f68cddd/foxpuppet/windows/browser/notifications/base.py#L63-L69 | train |
mozilla/FoxPuppet | foxpuppet/windows/manager.py | WindowManager.windows | def windows(self):
"""Return a list of all open windows.
Returns:
list: List of FoxPuppet BrowserWindow objects.
"""
from foxpuppet.windows import BrowserWindow
return [
BrowserWindow(self.selenium, handle)
for handle in self.selenium.window... | python | def windows(self):
"""Return a list of all open windows.
Returns:
list: List of FoxPuppet BrowserWindow objects.
"""
from foxpuppet.windows import BrowserWindow
return [
BrowserWindow(self.selenium, handle)
for handle in self.selenium.window... | [
"def",
"windows",
"(",
"self",
")",
":",
"from",
"foxpuppet",
".",
"windows",
"import",
"BrowserWindow",
"return",
"[",
"BrowserWindow",
"(",
"self",
".",
"selenium",
",",
"handle",
")",
"for",
"handle",
"in",
"self",
".",
"selenium",
".",
"window_handles",
... | Return a list of all open windows.
Returns:
list: List of FoxPuppet BrowserWindow objects. | [
"Return",
"a",
"list",
"of",
"all",
"open",
"windows",
"."
] | 6575eb4c72fd024c986b254e198c8b4e6f68cddd | https://github.com/mozilla/FoxPuppet/blob/6575eb4c72fd024c986b254e198c8b4e6f68cddd/foxpuppet/windows/manager.py#L26-L38 | train |
thomasdelaet/python-velbus | velbus/connections/socket.py | SocketConnection.read_daemon | def read_daemon(self):
"""Read thread."""
while True:
data = self._socket.recv(9999)
self.feed_parser(data) | python | def read_daemon(self):
"""Read thread."""
while True:
data = self._socket.recv(9999)
self.feed_parser(data) | [
"def",
"read_daemon",
"(",
"self",
")",
":",
"while",
"True",
":",
"data",
"=",
"self",
".",
"_socket",
".",
"recv",
"(",
"9999",
")",
"self",
".",
"feed_parser",
"(",
"data",
")"
] | Read thread. | [
"Read",
"thread",
"."
] | af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd | https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/connections/socket.py#L66-L70 | train |
KE-works/pykechain | pykechain/models/validators/validators_base.py | PropertyValidator._logic | def _logic(self, value=None):
# type: (Any) -> Tuple[Union[bool, None], str]
"""Process the inner logic of the validator.
The validation results are returned as tuple (boolean (true/false), reasontext)
"""
self._validation_result, self._validation_reason = None, 'No reason'
... | python | def _logic(self, value=None):
# type: (Any) -> Tuple[Union[bool, None], str]
"""Process the inner logic of the validator.
The validation results are returned as tuple (boolean (true/false), reasontext)
"""
self._validation_result, self._validation_reason = None, 'No reason'
... | [
"def",
"_logic",
"(",
"self",
",",
"value",
"=",
"None",
")",
":",
"# type: (Any) -> Tuple[Union[bool, None], str]",
"self",
".",
"_validation_result",
",",
"self",
".",
"_validation_reason",
"=",
"None",
",",
"'No reason'",
"return",
"self",
".",
"_validation_resul... | Process the inner logic of the validator.
The validation results are returned as tuple (boolean (true/false), reasontext) | [
"Process",
"the",
"inner",
"logic",
"of",
"the",
"validator",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/validators/validators_base.py#L194-L201 | train |
robert-b-clarke/nre-darwin-py | nredarwin/webservice.py | DarwinLdbSession.get_station_board | def get_station_board(
self,
crs,
rows=17,
include_departures=True,
include_arrivals=False,
destination_crs=None,
origin_crs=None
):
"""
Query the darwin webservice to obtain a board for a particular station
and return a StationBoard in... | python | def get_station_board(
self,
crs,
rows=17,
include_departures=True,
include_arrivals=False,
destination_crs=None,
origin_crs=None
):
"""
Query the darwin webservice to obtain a board for a particular station
and return a StationBoard in... | [
"def",
"get_station_board",
"(",
"self",
",",
"crs",
",",
"rows",
"=",
"17",
",",
"include_departures",
"=",
"True",
",",
"include_arrivals",
"=",
"False",
",",
"destination_crs",
"=",
"None",
",",
"origin_crs",
"=",
"None",
")",
":",
"# Determine the darwn qu... | Query the darwin webservice to obtain a board for a particular station
and return a StationBoard instance
Positional arguments:
crs -- the three letter CRS code of a UK station
Keyword arguments:
rows -- the number of rows to retrieve (default 10)
include_departures -- ... | [
"Query",
"the",
"darwin",
"webservice",
"to",
"obtain",
"a",
"board",
"for",
"a",
"particular",
"station",
"and",
"return",
"a",
"StationBoard",
"instance"
] | 6b0b181770e085dc7f71fbd2eb3fe779f653da62 | https://github.com/robert-b-clarke/nre-darwin-py/blob/6b0b181770e085dc7f71fbd2eb3fe779f653da62/nredarwin/webservice.py#L67-L121 | train |
robert-b-clarke/nre-darwin-py | nredarwin/webservice.py | DarwinLdbSession.get_service_details | def get_service_details(self, service_id):
"""
Get the details of an individual service and return a ServiceDetails
instance.
Positional arguments:
service_id: A Darwin LDB service id
"""
service_query = \
self._soap_client.service['LDBServiceSoap']['... | python | def get_service_details(self, service_id):
"""
Get the details of an individual service and return a ServiceDetails
instance.
Positional arguments:
service_id: A Darwin LDB service id
"""
service_query = \
self._soap_client.service['LDBServiceSoap']['... | [
"def",
"get_service_details",
"(",
"self",
",",
"service_id",
")",
":",
"service_query",
"=",
"self",
".",
"_soap_client",
".",
"service",
"[",
"'LDBServiceSoap'",
"]",
"[",
"'GetServiceDetails'",
"]",
"try",
":",
"soap_response",
"=",
"service_query",
"(",
"ser... | Get the details of an individual service and return a ServiceDetails
instance.
Positional arguments:
service_id: A Darwin LDB service id | [
"Get",
"the",
"details",
"of",
"an",
"individual",
"service",
"and",
"return",
"a",
"ServiceDetails",
"instance",
"."
] | 6b0b181770e085dc7f71fbd2eb3fe779f653da62 | https://github.com/robert-b-clarke/nre-darwin-py/blob/6b0b181770e085dc7f71fbd2eb3fe779f653da62/nredarwin/webservice.py#L123-L137 | train |
kytos/kytos-utils | kytos/utils/openapi.py | OpenAPI.render_template | def render_template(self):
"""Render and save API doc in openapi.yml."""
self._parse_paths()
context = dict(napp=self._napp.__dict__, paths=self._paths)
self._save(context) | python | def render_template(self):
"""Render and save API doc in openapi.yml."""
self._parse_paths()
context = dict(napp=self._napp.__dict__, paths=self._paths)
self._save(context) | [
"def",
"render_template",
"(",
"self",
")",
":",
"self",
".",
"_parse_paths",
"(",
")",
"context",
"=",
"dict",
"(",
"napp",
"=",
"self",
".",
"_napp",
".",
"__dict__",
",",
"paths",
"=",
"self",
".",
"_paths",
")",
"self",
".",
"_save",
"(",
"contex... | Render and save API doc in openapi.yml. | [
"Render",
"and",
"save",
"API",
"doc",
"in",
"openapi",
".",
"yml",
"."
] | b4750c618d15cff75970ea6124bda4d2b9a33578 | https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/openapi.py#L35-L39 | train |
kytos/kytos-utils | kytos/utils/openapi.py | OpenAPI._parse_decorated_functions | def _parse_decorated_functions(self, code):
"""Return URL rule, HTTP methods and docstring."""
matches = re.finditer(r"""
# @rest decorators
(?P<decorators>
(?:@rest\(.+?\)\n)+ # one or more @rest decorators inside
)
# ... | python | def _parse_decorated_functions(self, code):
"""Return URL rule, HTTP methods and docstring."""
matches = re.finditer(r"""
# @rest decorators
(?P<decorators>
(?:@rest\(.+?\)\n)+ # one or more @rest decorators inside
)
# ... | [
"def",
"_parse_decorated_functions",
"(",
"self",
",",
"code",
")",
":",
"matches",
"=",
"re",
".",
"finditer",
"(",
"r\"\"\"\n # @rest decorators\n (?P<decorators>\n (?:@rest\\(.+?\\)\\n)+ # one or more @rest decorators inside\n ... | Return URL rule, HTTP methods and docstring. | [
"Return",
"URL",
"rule",
"HTTP",
"methods",
"and",
"docstring",
"."
] | b4750c618d15cff75970ea6124bda4d2b9a33578 | https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/openapi.py#L46-L60 | train |
kytos/kytos-utils | kytos/utils/openapi.py | OpenAPI._parse_docstring | def _parse_docstring(self, docstring):
"""Parse the method docstring."""
match = re.match(r"""
# Following PEP 257
\s* (?P<summary>[^\n]+?) \s* # First line
( # Description and YAML are optional
(\n \s*){2} ... | python | def _parse_docstring(self, docstring):
"""Parse the method docstring."""
match = re.match(r"""
# Following PEP 257
\s* (?P<summary>[^\n]+?) \s* # First line
( # Description and YAML are optional
(\n \s*){2} ... | [
"def",
"_parse_docstring",
"(",
"self",
",",
"docstring",
")",
":",
"match",
"=",
"re",
".",
"match",
"(",
"r\"\"\"\n # Following PEP 257\n \\s* (?P<summary>[^\\n]+?) \\s* # First line\n\n ( # Description and YAML are option... | Parse the method docstring. | [
"Parse",
"the",
"method",
"docstring",
"."
] | b4750c618d15cff75970ea6124bda4d2b9a33578 | https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/openapi.py#L69-L102 | train |
kytos/kytos-utils | kytos/utils/openapi.py | OpenAPI._parse_methods | def _parse_methods(cls, list_string):
"""Return HTTP method list. Use json for security reasons."""
if list_string is None:
return APIServer.DEFAULT_METHODS
# json requires double quotes
json_list = list_string.replace("'", '"')
return json.loads(json_list) | python | def _parse_methods(cls, list_string):
"""Return HTTP method list. Use json for security reasons."""
if list_string is None:
return APIServer.DEFAULT_METHODS
# json requires double quotes
json_list = list_string.replace("'", '"')
return json.loads(json_list) | [
"def",
"_parse_methods",
"(",
"cls",
",",
"list_string",
")",
":",
"if",
"list_string",
"is",
"None",
":",
"return",
"APIServer",
".",
"DEFAULT_METHODS",
"# json requires double quotes",
"json_list",
"=",
"list_string",
".",
"replace",
"(",
"\"'\"",
",",
"'\"'",
... | Return HTTP method list. Use json for security reasons. | [
"Return",
"HTTP",
"method",
"list",
".",
"Use",
"json",
"for",
"security",
"reasons",
"."
] | b4750c618d15cff75970ea6124bda4d2b9a33578 | https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/openapi.py#L127-L133 | train |
kytos/kytos-utils | kytos/utils/openapi.py | OpenAPI._rule2path | def _rule2path(cls, rule):
"""Convert relative Flask rule to absolute OpenAPI path."""
typeless = re.sub(r'<\w+?:', '<', rule) # remove Flask types
return typeless.replace('<', '{').replace('>', '}') | python | def _rule2path(cls, rule):
"""Convert relative Flask rule to absolute OpenAPI path."""
typeless = re.sub(r'<\w+?:', '<', rule) # remove Flask types
return typeless.replace('<', '{').replace('>', '}') | [
"def",
"_rule2path",
"(",
"cls",
",",
"rule",
")",
":",
"typeless",
"=",
"re",
".",
"sub",
"(",
"r'<\\w+?:'",
",",
"'<'",
",",
"rule",
")",
"# remove Flask types",
"return",
"typeless",
".",
"replace",
"(",
"'<'",
",",
"'{'",
")",
".",
"replace",
"(",
... | Convert relative Flask rule to absolute OpenAPI path. | [
"Convert",
"relative",
"Flask",
"rule",
"to",
"absolute",
"OpenAPI",
"path",
"."
] | b4750c618d15cff75970ea6124bda4d2b9a33578 | https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/openapi.py#L142-L145 | train |
KE-works/pykechain | pykechain/models/part.py | Part.property | def property(self, name):
"""Retrieve the property belonging to this part based on its name or uuid.
:param name: property name or property UUID to search for
:type name: basestring
:return: a single :class:`Property`
:raises NotFoundError: if the `Property` is not part of the `... | python | def property(self, name):
"""Retrieve the property belonging to this part based on its name or uuid.
:param name: property name or property UUID to search for
:type name: basestring
:return: a single :class:`Property`
:raises NotFoundError: if the `Property` is not part of the `... | [
"def",
"property",
"(",
"self",
",",
"name",
")",
":",
"found",
"=",
"None",
"if",
"is_uuid",
"(",
"name",
")",
":",
"found",
"=",
"find",
"(",
"self",
".",
"properties",
",",
"lambda",
"p",
":",
"name",
"==",
"p",
".",
"id",
")",
"else",
":",
... | Retrieve the property belonging to this part based on its name or uuid.
:param name: property name or property UUID to search for
:type name: basestring
:return: a single :class:`Property`
:raises NotFoundError: if the `Property` is not part of the `Part`
Example
------... | [
"Retrieve",
"the",
"property",
"belonging",
"to",
"this",
"part",
"based",
"on",
"its",
"name",
"or",
"uuid",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L69-L103 | train |
KE-works/pykechain | pykechain/models/part.py | Part.parent | def parent(self):
# type: () -> Any
"""Retrieve the parent of this `Part`.
:return: the parent :class:`Part` of this part
:raises APIError: if an Error occurs
Example
-------
>>> part = project.part('Frame')
>>> bike = part.parent()
"""
... | python | def parent(self):
# type: () -> Any
"""Retrieve the parent of this `Part`.
:return: the parent :class:`Part` of this part
:raises APIError: if an Error occurs
Example
-------
>>> part = project.part('Frame')
>>> bike = part.parent()
"""
... | [
"def",
"parent",
"(",
"self",
")",
":",
"# type: () -> Any",
"if",
"self",
".",
"parent_id",
":",
"return",
"self",
".",
"_client",
".",
"part",
"(",
"pk",
"=",
"self",
".",
"parent_id",
",",
"category",
"=",
"self",
".",
"category",
")",
"else",
":",
... | Retrieve the parent of this `Part`.
:return: the parent :class:`Part` of this part
:raises APIError: if an Error occurs
Example
-------
>>> part = project.part('Frame')
>>> bike = part.parent() | [
"Retrieve",
"the",
"parent",
"of",
"this",
"Part",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L105-L122 | train |
KE-works/pykechain | pykechain/models/part.py | Part.children | def children(self, **kwargs):
"""Retrieve the children of this `Part` as `Partset`.
When you call the :func:`Part.children()` method without any additional filtering options for the children,
the children are cached to help speed up subsequent calls to retrieve the children. The cached children... | python | def children(self, **kwargs):
"""Retrieve the children of this `Part` as `Partset`.
When you call the :func:`Part.children()` method without any additional filtering options for the children,
the children are cached to help speed up subsequent calls to retrieve the children. The cached children... | [
"def",
"children",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"kwargs",
":",
"# no kwargs provided is the default, we aim to cache it.",
"if",
"not",
"self",
".",
"_cached_children",
":",
"self",
".",
"_cached_children",
"=",
"list",
"(",
"self... | Retrieve the children of this `Part` as `Partset`.
When you call the :func:`Part.children()` method without any additional filtering options for the children,
the children are cached to help speed up subsequent calls to retrieve the children. The cached children are
returned as a list and not a... | [
"Retrieve",
"the",
"children",
"of",
"this",
"Part",
"as",
"Partset",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L124-L163 | train |
KE-works/pykechain | pykechain/models/part.py | Part.siblings | def siblings(self, **kwargs):
# type: (Any) -> Any
"""Retrieve the siblings of this `Part` as `Partset`.
Siblings are other Parts sharing the same parent of this `Part`, including the part itself.
:param kwargs: Additional search arguments to search for, check :class:`pykechain.Client.... | python | def siblings(self, **kwargs):
# type: (Any) -> Any
"""Retrieve the siblings of this `Part` as `Partset`.
Siblings are other Parts sharing the same parent of this `Part`, including the part itself.
:param kwargs: Additional search arguments to search for, check :class:`pykechain.Client.... | [
"def",
"siblings",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# type: (Any) -> Any",
"if",
"self",
".",
"parent_id",
":",
"return",
"self",
".",
"_client",
".",
"parts",
"(",
"parent",
"=",
"self",
".",
"parent_id",
",",
"category",
"=",
"self",
... | Retrieve the siblings of this `Part` as `Partset`.
Siblings are other Parts sharing the same parent of this `Part`, including the part itself.
:param kwargs: Additional search arguments to search for, check :class:`pykechain.Client.parts`
for additional info
:type kwargs... | [
"Retrieve",
"the",
"siblings",
"of",
"this",
"Part",
"as",
"Partset",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L165-L181 | train |
KE-works/pykechain | pykechain/models/part.py | Part.model | def model(self):
"""
Retrieve the model of this `Part` as `Part`.
For instance, you can get the part model of a part instance. But trying to get the model of a part that
has no model, like a part model, will raise a :exc:`NotFoundError`.
.. versionadded:: 1.8
:return: ... | python | def model(self):
"""
Retrieve the model of this `Part` as `Part`.
For instance, you can get the part model of a part instance. But trying to get the model of a part that
has no model, like a part model, will raise a :exc:`NotFoundError`.
.. versionadded:: 1.8
:return: ... | [
"def",
"model",
"(",
"self",
")",
":",
"if",
"self",
".",
"category",
"==",
"Category",
".",
"INSTANCE",
":",
"model_id",
"=",
"self",
".",
"_json_data",
"[",
"'model'",
"]",
".",
"get",
"(",
"'id'",
")",
"return",
"self",
".",
"_client",
".",
"model... | Retrieve the model of this `Part` as `Part`.
For instance, you can get the part model of a part instance. But trying to get the model of a part that
has no model, like a part model, will raise a :exc:`NotFoundError`.
.. versionadded:: 1.8
:return: the model of this part instance as :c... | [
"Retrieve",
"the",
"model",
"of",
"this",
"Part",
"as",
"Part",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L183-L205 | train |
KE-works/pykechain | pykechain/models/part.py | Part.instances | def instances(self, **kwargs):
"""
Retrieve the instances of this `Part` as a `PartSet`.
For instance, if you have a model part, you can get the list of instances that are created based on this
moodel. If there are no instances (only possible if the multiplicity is :attr:`enums.Multipli... | python | def instances(self, **kwargs):
"""
Retrieve the instances of this `Part` as a `PartSet`.
For instance, if you have a model part, you can get the list of instances that are created based on this
moodel. If there are no instances (only possible if the multiplicity is :attr:`enums.Multipli... | [
"def",
"instances",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"category",
"==",
"Category",
".",
"MODEL",
":",
"return",
"self",
".",
"_client",
".",
"parts",
"(",
"model",
"=",
"self",
",",
"category",
"=",
"Category",
".",
... | Retrieve the instances of this `Part` as a `PartSet`.
For instance, if you have a model part, you can get the list of instances that are created based on this
moodel. If there are no instances (only possible if the multiplicity is :attr:`enums.Multiplicity.ZERO_MANY`)
than a :exc:`NotFoundError... | [
"Retrieve",
"the",
"instances",
"of",
"this",
"Part",
"as",
"a",
"PartSet",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L207-L234 | train |
KE-works/pykechain | pykechain/models/part.py | Part.proxy_model | def proxy_model(self):
"""
Retrieve the proxy model of this proxied `Part` as a `Part`.
Allows you to retrieve the model of a proxy. But trying to get the catalog model of a part that
has no proxy, will raise an :exc:`NotFoundError`. Only models can have a proxy.
:return: :clas... | python | def proxy_model(self):
"""
Retrieve the proxy model of this proxied `Part` as a `Part`.
Allows you to retrieve the model of a proxy. But trying to get the catalog model of a part that
has no proxy, will raise an :exc:`NotFoundError`. Only models can have a proxy.
:return: :clas... | [
"def",
"proxy_model",
"(",
"self",
")",
":",
"if",
"self",
".",
"category",
"!=",
"Category",
".",
"MODEL",
":",
"raise",
"IllegalArgumentError",
"(",
"\"Part {} is not a model, therefore it cannot have a proxy model\"",
".",
"format",
"(",
"self",
")",
")",
"if",
... | Retrieve the proxy model of this proxied `Part` as a `Part`.
Allows you to retrieve the model of a proxy. But trying to get the catalog model of a part that
has no proxy, will raise an :exc:`NotFoundError`. Only models can have a proxy.
:return: :class:`Part` with category `MODEL` and from whi... | [
"Retrieve",
"the",
"proxy",
"model",
"of",
"this",
"proxied",
"Part",
"as",
"a",
"Part",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L255-L281 | train |
KE-works/pykechain | pykechain/models/part.py | Part.add | def add(self, model, **kwargs):
# type: (Part, **Any) -> Part
"""Add a new child instance, based on a model, to this part.
This can only act on instances. It needs a model from which to create the child instance.
In order to prevent the backend from updating the frontend you may add `s... | python | def add(self, model, **kwargs):
# type: (Part, **Any) -> Part
"""Add a new child instance, based on a model, to this part.
This can only act on instances. It needs a model from which to create the child instance.
In order to prevent the backend from updating the frontend you may add `s... | [
"def",
"add",
"(",
"self",
",",
"model",
",",
"*",
"*",
"kwargs",
")",
":",
"# type: (Part, **Any) -> Part",
"if",
"self",
".",
"category",
"!=",
"Category",
".",
"INSTANCE",
":",
"raise",
"APIError",
"(",
"\"Part should be of category INSTANCE\"",
")",
"return"... | Add a new child instance, based on a model, to this part.
This can only act on instances. It needs a model from which to create the child instance.
In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as
additional keyword=value argument to this method... | [
"Add",
"a",
"new",
"child",
"instance",
"based",
"on",
"a",
"model",
"to",
"this",
"part",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L283-L311 | train |
KE-works/pykechain | pykechain/models/part.py | Part.add_to | def add_to(self, parent, **kwargs):
# type: (Part, **Any) -> Part
"""Add a new instance of this model to a part.
This works if the current part is a model and an instance of this model is to be added
to a part instances in the tree.
In order to prevent the backend from updating... | python | def add_to(self, parent, **kwargs):
# type: (Part, **Any) -> Part
"""Add a new instance of this model to a part.
This works if the current part is a model and an instance of this model is to be added
to a part instances in the tree.
In order to prevent the backend from updating... | [
"def",
"add_to",
"(",
"self",
",",
"parent",
",",
"*",
"*",
"kwargs",
")",
":",
"# type: (Part, **Any) -> Part",
"if",
"self",
".",
"category",
"!=",
"Category",
".",
"MODEL",
":",
"raise",
"APIError",
"(",
"\"Part should be of category MODEL\"",
")",
"return",
... | Add a new instance of this model to a part.
This works if the current part is a model and an instance of this model is to be added
to a part instances in the tree.
In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as
additional keyword=value... | [
"Add",
"a",
"new",
"instance",
"of",
"this",
"model",
"to",
"a",
"part",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L313-L344 | train |
KE-works/pykechain | pykechain/models/part.py | Part.add_model | def add_model(self, *args, **kwargs):
# type: (*Any, **Any) -> Part
"""Add a new child model to this model.
In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as
additional keyword=value argument to this method. This will improve performance o... | python | def add_model(self, *args, **kwargs):
# type: (*Any, **Any) -> Part
"""Add a new child model to this model.
In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as
additional keyword=value argument to this method. This will improve performance o... | [
"def",
"add_model",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# type: (*Any, **Any) -> Part",
"if",
"self",
".",
"category",
"!=",
"Category",
".",
"MODEL",
":",
"raise",
"APIError",
"(",
"\"Part should be of category MODEL\"",
")",
"r... | Add a new child model to this model.
In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as
additional keyword=value argument to this method. This will improve performance of the backend
against a trade-off that someone looking at the frontend won't no... | [
"Add",
"a",
"new",
"child",
"model",
"to",
"this",
"model",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L346-L360 | train |
KE-works/pykechain | pykechain/models/part.py | Part.add_property | def add_property(self, *args, **kwargs):
# type: (*Any, **Any) -> Property
"""Add a new property to this model.
See :class:`pykechain.Client.create_property` for available parameters.
:return: :class:`Property`
:raises APIError: in case an Error occurs
"""
if se... | python | def add_property(self, *args, **kwargs):
# type: (*Any, **Any) -> Property
"""Add a new property to this model.
See :class:`pykechain.Client.create_property` for available parameters.
:return: :class:`Property`
:raises APIError: in case an Error occurs
"""
if se... | [
"def",
"add_property",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# type: (*Any, **Any) -> Property",
"if",
"self",
".",
"category",
"!=",
"Category",
".",
"MODEL",
":",
"raise",
"APIError",
"(",
"\"Part should be of category MODEL\"",
")... | Add a new property to this model.
See :class:`pykechain.Client.create_property` for available parameters.
:return: :class:`Property`
:raises APIError: in case an Error occurs | [
"Add",
"a",
"new",
"property",
"to",
"this",
"model",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L398-L410 | train |
KE-works/pykechain | pykechain/models/part.py | Part.update | def update(self, name=None, update_dict=None, bulk=True, **kwargs):
"""
Edit part name and property values in one go.
In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as
additional keyword=value argument to this method. This will improve per... | python | def update(self, name=None, update_dict=None, bulk=True, **kwargs):
"""
Edit part name and property values in one go.
In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as
additional keyword=value argument to this method. This will improve per... | [
"def",
"update",
"(",
"self",
",",
"name",
"=",
"None",
",",
"update_dict",
"=",
"None",
",",
"bulk",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# dict(name=name, properties=json.dumps(update_dict))) with property ids:value",
"action",
"=",
"'bulk_update_prope... | Edit part name and property values in one go.
In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as
additional keyword=value argument to this method. This will improve performance of the backend
against a trade-off that someone looking at the frontend... | [
"Edit",
"part",
"name",
"and",
"property",
"values",
"in",
"one",
"go",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L505-L556 | train |
KE-works/pykechain | pykechain/models/part.py | Part.add_with_properties | def add_with_properties(self, model, name=None, update_dict=None, bulk=True, **kwargs):
"""
Add a part and update its properties in one go.
In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as
additional keyword=value argument to this method.... | python | def add_with_properties(self, model, name=None, update_dict=None, bulk=True, **kwargs):
"""
Add a part and update its properties in one go.
In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as
additional keyword=value argument to this method.... | [
"def",
"add_with_properties",
"(",
"self",
",",
"model",
",",
"name",
"=",
"None",
",",
"update_dict",
"=",
"None",
",",
"bulk",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"category",
"!=",
"Category",
".",
"INSTANCE",
":",
"r... | Add a part and update its properties in one go.
In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as
additional keyword=value argument to this method. This will improve performance of the backend
against a trade-off that someone looking at the fronte... | [
"Add",
"a",
"part",
"and",
"update",
"its",
"properties",
"in",
"one",
"go",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L558-L618 | train |
KE-works/pykechain | pykechain/models/part.py | Part.order_properties | def order_properties(self, property_list=None):
"""
Order the properties of a part model using a list of property objects or property names or property id's.
:param property_list: ordered list of property names (basestring) or property id's (uuid)
:type property_list: list(basestring)
... | python | def order_properties(self, property_list=None):
"""
Order the properties of a part model using a list of property objects or property names or property id's.
:param property_list: ordered list of property names (basestring) or property id's (uuid)
:type property_list: list(basestring)
... | [
"def",
"order_properties",
"(",
"self",
",",
"property_list",
"=",
"None",
")",
":",
"if",
"self",
".",
"category",
"!=",
"Category",
".",
"MODEL",
":",
"raise",
"APIError",
"(",
"\"Part should be of category MODEL\"",
")",
"if",
"not",
"isinstance",
"(",
"pro... | Order the properties of a part model using a list of property objects or property names or property id's.
:param property_list: ordered list of property names (basestring) or property id's (uuid)
:type property_list: list(basestring)
:returns: the :class:`Part` with the reordered list of proper... | [
"Order",
"the",
"properties",
"of",
"a",
"part",
"model",
"using",
"a",
"list",
"of",
"property",
"objects",
"or",
"property",
"names",
"or",
"property",
"id",
"s",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L644-L685 | train |
KE-works/pykechain | pykechain/models/part.py | Part.clone | def clone(self, **kwargs):
"""
Clone a part.
.. versionadded:: 2.3
:param kwargs: (optional) additional keyword=value arguments
:type kwargs: dict
:return: cloned :class:`models.Part`
:raises APIError: if the `Part` could not be cloned
Example
-... | python | def clone(self, **kwargs):
"""
Clone a part.
.. versionadded:: 2.3
:param kwargs: (optional) additional keyword=value arguments
:type kwargs: dict
:return: cloned :class:`models.Part`
:raises APIError: if the `Part` could not be cloned
Example
-... | [
"def",
"clone",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"parent",
"=",
"self",
".",
"parent",
"(",
")",
"return",
"self",
".",
"_client",
".",
"_create_clone",
"(",
"parent",
",",
"self",
",",
"*",
"*",
"kwargs",
")"
] | Clone a part.
.. versionadded:: 2.3
:param kwargs: (optional) additional keyword=value arguments
:type kwargs: dict
:return: cloned :class:`models.Part`
:raises APIError: if the `Part` could not be cloned
Example
-------
>>> bike = client.model('Bike')
... | [
"Clone",
"a",
"part",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L719-L737 | train |
KE-works/pykechain | pykechain/models/part.py | Part.copy | def copy(self, target_parent, name=None, include_children=True, include_instances=True):
"""
Copy the `Part` to target parent, both of them having the same category.
.. versionadded:: 2.3
:param target_parent: `Part` object under which the desired `Part` is copied
:type target_... | python | def copy(self, target_parent, name=None, include_children=True, include_instances=True):
"""
Copy the `Part` to target parent, both of them having the same category.
.. versionadded:: 2.3
:param target_parent: `Part` object under which the desired `Part` is copied
:type target_... | [
"def",
"copy",
"(",
"self",
",",
"target_parent",
",",
"name",
"=",
"None",
",",
"include_children",
"=",
"True",
",",
"include_instances",
"=",
"True",
")",
":",
"if",
"self",
".",
"category",
"==",
"Category",
".",
"MODEL",
"and",
"target_parent",
".",
... | Copy the `Part` to target parent, both of them having the same category.
.. versionadded:: 2.3
:param target_parent: `Part` object under which the desired `Part` is copied
:type target_parent: :class:`Part`
:param name: how the copied top-level `Part` should be called
:type nam... | [
"Copy",
"the",
"Part",
"to",
"target",
"parent",
"both",
"of",
"them",
"having",
"the",
"same",
"category",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L739-L785 | train |
KE-works/pykechain | pykechain/models/part.py | Part.move | def move(self, target_parent, name=None, include_children=True, include_instances=True):
"""
Move the `Part` to target parent, both of them the same category.
.. versionadded:: 2.3
:param target_parent: `Part` object under which the desired `Part` is moved
:type target_parent: ... | python | def move(self, target_parent, name=None, include_children=True, include_instances=True):
"""
Move the `Part` to target parent, both of them the same category.
.. versionadded:: 2.3
:param target_parent: `Part` object under which the desired `Part` is moved
:type target_parent: ... | [
"def",
"move",
"(",
"self",
",",
"target_parent",
",",
"name",
"=",
"None",
",",
"include_children",
"=",
"True",
",",
"include_instances",
"=",
"True",
")",
":",
"if",
"not",
"name",
":",
"name",
"=",
"self",
".",
"name",
"if",
"self",
".",
"category"... | Move the `Part` to target parent, both of them the same category.
.. versionadded:: 2.3
:param target_parent: `Part` object under which the desired `Part` is moved
:type target_parent: :class:`Part`
:param name: how the moved top-level `Part` should be called
:type name: basest... | [
"Move",
"the",
"Part",
"to",
"target",
"parent",
"both",
"of",
"them",
"the",
"same",
"category",
"."
] | b0296cf34328fd41660bf6f0b9114fd0167c40c4 | https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/part.py#L787-L839 | train |
biosignalsnotebooks/biosignalsnotebooks | biosignalsnotebooks/biosignalsnotebooks/old/_factory.py | _generate_notebook_by_difficulty_body | def _generate_notebook_by_difficulty_body(notebook_object, dict_by_difficulty):
"""
Internal function that is used for generation of the page where notebooks are organized by
difficulty level.
----------
Parameters
----------
notebook_object : notebook object
Object of "notebook" cl... | python | def _generate_notebook_by_difficulty_body(notebook_object, dict_by_difficulty):
"""
Internal function that is used for generation of the page where notebooks are organized by
difficulty level.
----------
Parameters
----------
notebook_object : notebook object
Object of "notebook" cl... | [
"def",
"_generate_notebook_by_difficulty_body",
"(",
"notebook_object",
",",
"dict_by_difficulty",
")",
":",
"difficulty_keys",
"=",
"list",
"(",
"dict_by_difficulty",
".",
"keys",
"(",
")",
")",
"difficulty_keys",
".",
"sort",
"(",
")",
"for",
"difficulty",
"in",
... | Internal function that is used for generation of the page where notebooks are organized by
difficulty level.
----------
Parameters
----------
notebook_object : notebook object
Object of "notebook" class where the body will be created.
dict_by_difficulty : dict
Global Dictionary... | [
"Internal",
"function",
"that",
"is",
"used",
"for",
"generation",
"of",
"the",
"page",
"where",
"notebooks",
"are",
"organized",
"by",
"difficulty",
"level",
"."
] | aaa01d4125180b3a34f1e26e0d3ff08c23f666d3 | https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/biosignalsnotebooks/old/_factory.py#L442-L481 | train |
biosignalsnotebooks/biosignalsnotebooks | biosignalsnotebooks/biosignalsnotebooks/old/_factory.py | _generate_dir_structure | def _generate_dir_structure(path):
"""
Internal function intended to generate the biosignalsnotebooks directories in order to the user
can visualise and execute the Notebook created with "notebook" class in Jupyter.
----------
Parameters
----------
path : str
Path where the biosigna... | python | def _generate_dir_structure(path):
"""
Internal function intended to generate the biosignalsnotebooks directories in order to the user
can visualise and execute the Notebook created with "notebook" class in Jupyter.
----------
Parameters
----------
path : str
Path where the biosigna... | [
"def",
"_generate_dir_structure",
"(",
"path",
")",
":",
"# ============================ Creation of the main directory ==================================",
"current_dir",
"=",
"(",
"path",
"+",
"\"\\\\opensignalsfactory_environment\"",
")",
".",
"replace",
"(",
"\"\\\\\"",
",",
... | Internal function intended to generate the biosignalsnotebooks directories in order to the user
can visualise and execute the Notebook created with "notebook" class in Jupyter.
----------
Parameters
----------
path : str
Path where the biosignalsnotebooks environment (files and folders) wil... | [
"Internal",
"function",
"intended",
"to",
"generate",
"the",
"biosignalsnotebooks",
"directories",
"in",
"order",
"to",
"the",
"user",
"can",
"visualise",
"and",
"execute",
"the",
"Notebook",
"created",
"with",
"notebook",
"class",
"in",
"Jupyter",
"."
] | aaa01d4125180b3a34f1e26e0d3ff08c23f666d3 | https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/biosignalsnotebooks/old/_factory.py#L669-L713 | train |
sontek/bulby | bulby/color.py | in_lamp_reach | def in_lamp_reach(p):
''' Check if the provided XYPoint can be recreated by a Hue lamp. '''
v1 = XYPoint(Lime.x - Red.x, Lime.y - Red.y)
v2 = XYPoint(Blue.x - Red.x, Blue.y - Red.y)
q = XYPoint(p.x - Red.x, p.y - Red.y)
s = cross_product(q, v2) / cross_product(v1, v2)
t = cross_product(v1, q) /... | python | def in_lamp_reach(p):
''' Check if the provided XYPoint can be recreated by a Hue lamp. '''
v1 = XYPoint(Lime.x - Red.x, Lime.y - Red.y)
v2 = XYPoint(Blue.x - Red.x, Blue.y - Red.y)
q = XYPoint(p.x - Red.x, p.y - Red.y)
s = cross_product(q, v2) / cross_product(v1, v2)
t = cross_product(v1, q) /... | [
"def",
"in_lamp_reach",
"(",
"p",
")",
":",
"v1",
"=",
"XYPoint",
"(",
"Lime",
".",
"x",
"-",
"Red",
".",
"x",
",",
"Lime",
".",
"y",
"-",
"Red",
".",
"y",
")",
"v2",
"=",
"XYPoint",
"(",
"Blue",
".",
"x",
"-",
"Red",
".",
"x",
",",
"Blue",... | Check if the provided XYPoint can be recreated by a Hue lamp. | [
"Check",
"if",
"the",
"provided",
"XYPoint",
"can",
"be",
"recreated",
"by",
"a",
"Hue",
"lamp",
"."
] | a2e741f843ee8e361b50a6079601108bfbe52526 | https://github.com/sontek/bulby/blob/a2e741f843ee8e361b50a6079601108bfbe52526/bulby/color.py#L18-L27 | train |
sontek/bulby | bulby/color.py | get_closest_point_to_line | def get_closest_point_to_line(A, B, P):
'''
Find the closest point on a line. This point will be reproducible by a Hue
lamp.
'''
AP = XYPoint(P.x - A.x, P.y - A.y)
AB = XYPoint(B.x - A.x, B.y - A.y)
ab2 = AB.x * AB.x + AB.y * AB.y
ap_ab = AP.x * AB.x + AP.y * AB.y
t = ap_ab / ab2
... | python | def get_closest_point_to_line(A, B, P):
'''
Find the closest point on a line. This point will be reproducible by a Hue
lamp.
'''
AP = XYPoint(P.x - A.x, P.y - A.y)
AB = XYPoint(B.x - A.x, B.y - A.y)
ab2 = AB.x * AB.x + AB.y * AB.y
ap_ab = AP.x * AB.x + AP.y * AB.y
t = ap_ab / ab2
... | [
"def",
"get_closest_point_to_line",
"(",
"A",
",",
"B",
",",
"P",
")",
":",
"AP",
"=",
"XYPoint",
"(",
"P",
".",
"x",
"-",
"A",
".",
"x",
",",
"P",
".",
"y",
"-",
"A",
".",
"y",
")",
"AB",
"=",
"XYPoint",
"(",
"B",
".",
"x",
"-",
"A",
"."... | Find the closest point on a line. This point will be reproducible by a Hue
lamp. | [
"Find",
"the",
"closest",
"point",
"on",
"a",
"line",
".",
"This",
"point",
"will",
"be",
"reproducible",
"by",
"a",
"Hue",
"lamp",
"."
] | a2e741f843ee8e361b50a6079601108bfbe52526 | https://github.com/sontek/bulby/blob/a2e741f843ee8e361b50a6079601108bfbe52526/bulby/color.py#L30-L46 | train |
sontek/bulby | bulby/color.py | get_closest_point_to_point | def get_closest_point_to_point(xy_point):
'''
Used to find the closest point to an unreproducible Color is unreproducible
on each line in the CIE 1931 'triangle'.
'''
pAB = get_closest_point_to_line(Red, Lime, xy_point)
pAC = get_closest_point_to_line(Blue, Red, xy_point)
pBC = get_closest_p... | python | def get_closest_point_to_point(xy_point):
'''
Used to find the closest point to an unreproducible Color is unreproducible
on each line in the CIE 1931 'triangle'.
'''
pAB = get_closest_point_to_line(Red, Lime, xy_point)
pAC = get_closest_point_to_line(Blue, Red, xy_point)
pBC = get_closest_p... | [
"def",
"get_closest_point_to_point",
"(",
"xy_point",
")",
":",
"pAB",
"=",
"get_closest_point_to_line",
"(",
"Red",
",",
"Lime",
",",
"xy_point",
")",
"pAC",
"=",
"get_closest_point_to_line",
"(",
"Blue",
",",
"Red",
",",
"xy_point",
")",
"pBC",
"=",
"get_clo... | Used to find the closest point to an unreproducible Color is unreproducible
on each line in the CIE 1931 'triangle'. | [
"Used",
"to",
"find",
"the",
"closest",
"point",
"to",
"an",
"unreproducible",
"Color",
"is",
"unreproducible",
"on",
"each",
"line",
"in",
"the",
"CIE",
"1931",
"triangle",
"."
] | a2e741f843ee8e361b50a6079601108bfbe52526 | https://github.com/sontek/bulby/blob/a2e741f843ee8e361b50a6079601108bfbe52526/bulby/color.py#L58-L87 | train |
sontek/bulby | bulby/color.py | get_xy_from_hex | def get_xy_from_hex(hex_value):
'''
Returns X, Y coordinates containing the closest avilable CIE 1931
based on the hex_value provided.
'''
red, green, blue = struct.unpack('BBB', codecs.decode(hex_value, 'hex'))
r = ((red + 0.055) / (1.0 + 0.055)) ** 2.4 if (red > 0.04045) else (red / 12.92) # ... | python | def get_xy_from_hex(hex_value):
'''
Returns X, Y coordinates containing the closest avilable CIE 1931
based on the hex_value provided.
'''
red, green, blue = struct.unpack('BBB', codecs.decode(hex_value, 'hex'))
r = ((red + 0.055) / (1.0 + 0.055)) ** 2.4 if (red > 0.04045) else (red / 12.92) # ... | [
"def",
"get_xy_from_hex",
"(",
"hex_value",
")",
":",
"red",
",",
"green",
",",
"blue",
"=",
"struct",
".",
"unpack",
"(",
"'BBB'",
",",
"codecs",
".",
"decode",
"(",
"hex_value",
",",
"'hex'",
")",
")",
"r",
"=",
"(",
"(",
"red",
"+",
"0.055",
")"... | Returns X, Y coordinates containing the closest avilable CIE 1931
based on the hex_value provided. | [
"Returns",
"X",
"Y",
"coordinates",
"containing",
"the",
"closest",
"avilable",
"CIE",
"1931",
"based",
"on",
"the",
"hex_value",
"provided",
"."
] | a2e741f843ee8e361b50a6079601108bfbe52526 | https://github.com/sontek/bulby/blob/a2e741f843ee8e361b50a6079601108bfbe52526/bulby/color.py#L90-L117 | train |
formiaczek/multi_key_dict | multi_key_dict.py | multi_key_dict.get_other_keys | def get_other_keys(self, key, including_current=False):
""" Returns list of other keys that are mapped to the same value as specified key.
@param key - key for which other keys should be returned.
@param including_current if set to True - key will also appear on this list."""
... | python | def get_other_keys(self, key, including_current=False):
""" Returns list of other keys that are mapped to the same value as specified key.
@param key - key for which other keys should be returned.
@param including_current if set to True - key will also appear on this list."""
... | [
"def",
"get_other_keys",
"(",
"self",
",",
"key",
",",
"including_current",
"=",
"False",
")",
":",
"other_keys",
"=",
"[",
"]",
"if",
"key",
"in",
"self",
":",
"other_keys",
".",
"extend",
"(",
"self",
".",
"__dict__",
"[",
"str",
"(",
"type",
"(",
... | Returns list of other keys that are mapped to the same value as specified key.
@param key - key for which other keys should be returned.
@param including_current if set to True - key will also appear on this list. | [
"Returns",
"list",
"of",
"other",
"keys",
"that",
"are",
"mapped",
"to",
"the",
"same",
"value",
"as",
"specified",
"key",
"."
] | 320826cadad8ae8664042c627fa90f82ecd7b6b7 | https://github.com/formiaczek/multi_key_dict/blob/320826cadad8ae8664042c627fa90f82ecd7b6b7/multi_key_dict.py#L167-L176 | train |
formiaczek/multi_key_dict | multi_key_dict.py | multi_key_dict.iterkeys | def iterkeys(self, key_type=None, return_all_keys=False):
""" Returns an iterator over the dictionary's keys.
@param key_type if specified, iterator for a dictionary of this type will be used.
Otherwise (if not specified) tuples containing all (multiple) keys
... | python | def iterkeys(self, key_type=None, return_all_keys=False):
""" Returns an iterator over the dictionary's keys.
@param key_type if specified, iterator for a dictionary of this type will be used.
Otherwise (if not specified) tuples containing all (multiple) keys
... | [
"def",
"iterkeys",
"(",
"self",
",",
"key_type",
"=",
"None",
",",
"return_all_keys",
"=",
"False",
")",
":",
"if",
"(",
"key_type",
"is",
"not",
"None",
")",
":",
"the_key",
"=",
"str",
"(",
"key_type",
")",
"if",
"the_key",
"in",
"self",
".",
"__di... | Returns an iterator over the dictionary's keys.
@param key_type if specified, iterator for a dictionary of this type will be used.
Otherwise (if not specified) tuples containing all (multiple) keys
for this dictionary will be generated.
@param return_al... | [
"Returns",
"an",
"iterator",
"over",
"the",
"dictionary",
"s",
"keys",
"."
] | 320826cadad8ae8664042c627fa90f82ecd7b6b7 | https://github.com/formiaczek/multi_key_dict/blob/320826cadad8ae8664042c627fa90f82ecd7b6b7/multi_key_dict.py#L201-L217 | train |
formiaczek/multi_key_dict | multi_key_dict.py | multi_key_dict.itervalues | def itervalues(self, key_type=None):
""" Returns an iterator over the dictionary's values.
@param key_type if specified, iterator will be returning only values pointed by keys of this type.
Otherwise (if not specified) all values in this dictinary will be generated."""
... | python | def itervalues(self, key_type=None):
""" Returns an iterator over the dictionary's values.
@param key_type if specified, iterator will be returning only values pointed by keys of this type.
Otherwise (if not specified) all values in this dictinary will be generated."""
... | [
"def",
"itervalues",
"(",
"self",
",",
"key_type",
"=",
"None",
")",
":",
"if",
"(",
"key_type",
"is",
"not",
"None",
")",
":",
"intermediate_key",
"=",
"str",
"(",
"key_type",
")",
"if",
"intermediate_key",
"in",
"self",
".",
"__dict__",
":",
"for",
"... | Returns an iterator over the dictionary's values.
@param key_type if specified, iterator will be returning only values pointed by keys of this type.
Otherwise (if not specified) all values in this dictinary will be generated. | [
"Returns",
"an",
"iterator",
"over",
"the",
"dictionary",
"s",
"values",
"."
] | 320826cadad8ae8664042c627fa90f82ecd7b6b7 | https://github.com/formiaczek/multi_key_dict/blob/320826cadad8ae8664042c627fa90f82ecd7b6b7/multi_key_dict.py#L219-L230 | train |
formiaczek/multi_key_dict | multi_key_dict.py | multi_key_dict.keys | def keys(self, key_type=None):
""" Returns a copy of the dictionary's keys.
@param key_type if specified, only keys for this type will be returned.
Otherwise list of tuples containing all (multiple) keys will be returned."""
if key_type is not None:
intermed... | python | def keys(self, key_type=None):
""" Returns a copy of the dictionary's keys.
@param key_type if specified, only keys for this type will be returned.
Otherwise list of tuples containing all (multiple) keys will be returned."""
if key_type is not None:
intermed... | [
"def",
"keys",
"(",
"self",
",",
"key_type",
"=",
"None",
")",
":",
"if",
"key_type",
"is",
"not",
"None",
":",
"intermediate_key",
"=",
"str",
"(",
"key_type",
")",
"if",
"intermediate_key",
"in",
"self",
".",
"__dict__",
":",
"return",
"self",
".",
"... | Returns a copy of the dictionary's keys.
@param key_type if specified, only keys for this type will be returned.
Otherwise list of tuples containing all (multiple) keys will be returned. | [
"Returns",
"a",
"copy",
"of",
"the",
"dictionary",
"s",
"keys",
"."
] | 320826cadad8ae8664042c627fa90f82ecd7b6b7 | https://github.com/formiaczek/multi_key_dict/blob/320826cadad8ae8664042c627fa90f82ecd7b6b7/multi_key_dict.py#L239-L251 | train |
formiaczek/multi_key_dict | multi_key_dict.py | multi_key_dict.values | def values(self, key_type=None):
""" Returns a copy of the dictionary's values.
@param key_type if specified, only values pointed by keys of this type will be returned.
Otherwise list of all values contained in this dictionary will be returned."""
if(key_type is not None... | python | def values(self, key_type=None):
""" Returns a copy of the dictionary's values.
@param key_type if specified, only values pointed by keys of this type will be returned.
Otherwise list of all values contained in this dictionary will be returned."""
if(key_type is not None... | [
"def",
"values",
"(",
"self",
",",
"key_type",
"=",
"None",
")",
":",
"if",
"(",
"key_type",
"is",
"not",
"None",
")",
":",
"all_items",
"=",
"{",
"}",
"# in order to preserve keys() type (dict_values for python3) \r",
"keys_used",
"=",
"set",
"(",
")",
"direc... | Returns a copy of the dictionary's values.
@param key_type if specified, only values pointed by keys of this type will be returned.
Otherwise list of all values contained in this dictionary will be returned. | [
"Returns",
"a",
"copy",
"of",
"the",
"dictionary",
"s",
"values",
"."
] | 320826cadad8ae8664042c627fa90f82ecd7b6b7 | https://github.com/formiaczek/multi_key_dict/blob/320826cadad8ae8664042c627fa90f82ecd7b6b7/multi_key_dict.py#L253-L268 | train |
formiaczek/multi_key_dict | multi_key_dict.py | multi_key_dict.__add_item | def __add_item(self, item, keys=None):
""" Internal method to add an item to the multi-key dictionary"""
if(not keys or not len(keys)):
raise Exception('Error in %s.__add_item(%s, keys=tuple/list of items): need to specify a tuple/list containing at least one key!'
... | python | def __add_item(self, item, keys=None):
""" Internal method to add an item to the multi-key dictionary"""
if(not keys or not len(keys)):
raise Exception('Error in %s.__add_item(%s, keys=tuple/list of items): need to specify a tuple/list containing at least one key!'
... | [
"def",
"__add_item",
"(",
"self",
",",
"item",
",",
"keys",
"=",
"None",
")",
":",
"if",
"(",
"not",
"keys",
"or",
"not",
"len",
"(",
"keys",
")",
")",
":",
"raise",
"Exception",
"(",
"'Error in %s.__add_item(%s, keys=tuple/list of items): need to specify a tupl... | Internal method to add an item to the multi-key dictionary | [
"Internal",
"method",
"to",
"add",
"an",
"item",
"to",
"the",
"multi",
"-",
"key",
"dictionary"
] | 320826cadad8ae8664042c627fa90f82ecd7b6b7 | https://github.com/formiaczek/multi_key_dict/blob/320826cadad8ae8664042c627fa90f82ecd7b6b7/multi_key_dict.py#L277-L294 | train |
formiaczek/multi_key_dict | multi_key_dict.py | multi_key_dict.get | def get(self, key, default=None):
""" Return the value at index specified as key."""
if key in self:
return self.items_dict[self.__dict__[str(type(key))][key]]
else:
return default | python | def get(self, key, default=None):
""" Return the value at index specified as key."""
if key in self:
return self.items_dict[self.__dict__[str(type(key))][key]]
else:
return default | [
"def",
"get",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"if",
"key",
"in",
"self",
":",
"return",
"self",
".",
"items_dict",
"[",
"self",
".",
"__dict__",
"[",
"str",
"(",
"type",
"(",
"key",
")",
")",
"]",
"[",
"key",
"]"... | Return the value at index specified as key. | [
"Return",
"the",
"value",
"at",
"index",
"specified",
"as",
"key",
"."
] | 320826cadad8ae8664042c627fa90f82ecd7b6b7 | https://github.com/formiaczek/multi_key_dict/blob/320826cadad8ae8664042c627fa90f82ecd7b6b7/multi_key_dict.py#L296-L301 | train |
adamziel/django_translate | django_translate/extractors/django_template.py | DjangoTemplateExtractor.extract_translations | def extract_translations(self, string):
"""Extract messages from Django template string."""
trans = []
for t in Lexer(string.decode("utf-8"), None).tokenize():
if t.token_type == TOKEN_BLOCK:
if not t.contents.startswith(
(self.tranz_tag, self... | python | def extract_translations(self, string):
"""Extract messages from Django template string."""
trans = []
for t in Lexer(string.decode("utf-8"), None).tokenize():
if t.token_type == TOKEN_BLOCK:
if not t.contents.startswith(
(self.tranz_tag, self... | [
"def",
"extract_translations",
"(",
"self",
",",
"string",
")",
":",
"trans",
"=",
"[",
"]",
"for",
"t",
"in",
"Lexer",
"(",
"string",
".",
"decode",
"(",
"\"utf-8\"",
")",
",",
"None",
")",
".",
"tokenize",
"(",
")",
":",
"if",
"t",
".",
"token_ty... | Extract messages from Django template string. | [
"Extract",
"messages",
"from",
"Django",
"template",
"string",
"."
] | 43d8ef94a5c230abbdc89f3dbc623313fde998f2 | https://github.com/adamziel/django_translate/blob/43d8ef94a5c230abbdc89f3dbc623313fde998f2/django_translate/extractors/django_template.py#L32-L58 | train |
lemieuxl/pyplink | pyplink/pyplink.py | PyPlink.next | def next(self):
"""Returns the next marker.
Returns:
tuple: The marker name as a string and its genotypes as a
:py:class:`numpy.ndarray`.
"""
if self._mode != "r":
raise UnsupportedOperation("not available in 'w' mode")
self._n += 1
... | python | def next(self):
"""Returns the next marker.
Returns:
tuple: The marker name as a string and its genotypes as a
:py:class:`numpy.ndarray`.
"""
if self._mode != "r":
raise UnsupportedOperation("not available in 'w' mode")
self._n += 1
... | [
"def",
"next",
"(",
"self",
")",
":",
"if",
"self",
".",
"_mode",
"!=",
"\"r\"",
":",
"raise",
"UnsupportedOperation",
"(",
"\"not available in 'w' mode\"",
")",
"self",
".",
"_n",
"+=",
"1",
"if",
"self",
".",
"_n",
">",
"self",
".",
"_nb_markers",
":",... | Returns the next marker.
Returns:
tuple: The marker name as a string and its genotypes as a
:py:class:`numpy.ndarray`. | [
"Returns",
"the",
"next",
"marker",
"."
] | 31d47c86f589064bda98206314a2d0b20e7fd2f0 | https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L181-L196 | train |
lemieuxl/pyplink | pyplink/pyplink.py | PyPlink._read_current_marker | def _read_current_marker(self):
"""Reads the current marker and returns its genotypes."""
return self._geno_values[
np.frombuffer(self._bed.read(self._nb_bytes), dtype=np.uint8)
].flatten(order="C")[:self._nb_samples] | python | def _read_current_marker(self):
"""Reads the current marker and returns its genotypes."""
return self._geno_values[
np.frombuffer(self._bed.read(self._nb_bytes), dtype=np.uint8)
].flatten(order="C")[:self._nb_samples] | [
"def",
"_read_current_marker",
"(",
"self",
")",
":",
"return",
"self",
".",
"_geno_values",
"[",
"np",
".",
"frombuffer",
"(",
"self",
".",
"_bed",
".",
"read",
"(",
"self",
".",
"_nb_bytes",
")",
",",
"dtype",
"=",
"np",
".",
"uint8",
")",
"]",
"."... | Reads the current marker and returns its genotypes. | [
"Reads",
"the",
"current",
"marker",
"and",
"returns",
"its",
"genotypes",
"."
] | 31d47c86f589064bda98206314a2d0b20e7fd2f0 | https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L198-L202 | train |
lemieuxl/pyplink | pyplink/pyplink.py | PyPlink.seek | def seek(self, n):
"""Gets to a certain marker position in the BED file.
Args:
n (int): The index of the marker to seek to.
"""
if self._mode != "r":
raise UnsupportedOperation("not available in 'w' mode")
if 0 <= n < self._nb_markers:
self.... | python | def seek(self, n):
"""Gets to a certain marker position in the BED file.
Args:
n (int): The index of the marker to seek to.
"""
if self._mode != "r":
raise UnsupportedOperation("not available in 'w' mode")
if 0 <= n < self._nb_markers:
self.... | [
"def",
"seek",
"(",
"self",
",",
"n",
")",
":",
"if",
"self",
".",
"_mode",
"!=",
"\"r\"",
":",
"raise",
"UnsupportedOperation",
"(",
"\"not available in 'w' mode\"",
")",
"if",
"0",
"<=",
"n",
"<",
"self",
".",
"_nb_markers",
":",
"self",
".",
"_n",
"... | Gets to a certain marker position in the BED file.
Args:
n (int): The index of the marker to seek to. | [
"Gets",
"to",
"a",
"certain",
"marker",
"position",
"in",
"the",
"BED",
"file",
"."
] | 31d47c86f589064bda98206314a2d0b20e7fd2f0 | https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L204-L220 | train |
lemieuxl/pyplink | pyplink/pyplink.py | PyPlink._read_bim | def _read_bim(self):
"""Reads the BIM file."""
# Reading the BIM file and setting the values
bim = pd.read_csv(self.bim_filename, delim_whitespace=True,
names=["chrom", "snp", "cm", "pos", "a1", "a2"],
dtype=dict(snp=str, a1=str, a2=str))
... | python | def _read_bim(self):
"""Reads the BIM file."""
# Reading the BIM file and setting the values
bim = pd.read_csv(self.bim_filename, delim_whitespace=True,
names=["chrom", "snp", "cm", "pos", "a1", "a2"],
dtype=dict(snp=str, a1=str, a2=str))
... | [
"def",
"_read_bim",
"(",
"self",
")",
":",
"# Reading the BIM file and setting the values",
"bim",
"=",
"pd",
".",
"read_csv",
"(",
"self",
".",
"bim_filename",
",",
"delim_whitespace",
"=",
"True",
",",
"names",
"=",
"[",
"\"chrom\"",
",",
"\"snp\"",
",",
"\"... | Reads the BIM file. | [
"Reads",
"the",
"BIM",
"file",
"."
] | 31d47c86f589064bda98206314a2d0b20e7fd2f0 | https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L231-L295 | train |
lemieuxl/pyplink | pyplink/pyplink.py | PyPlink._read_fam | def _read_fam(self):
"""Reads the FAM file."""
# Reading the FAM file and setting the values
fam = pd.read_csv(self.fam_filename, delim_whitespace=True,
names=["fid", "iid", "father", "mother", "gender",
"status"],
... | python | def _read_fam(self):
"""Reads the FAM file."""
# Reading the FAM file and setting the values
fam = pd.read_csv(self.fam_filename, delim_whitespace=True,
names=["fid", "iid", "father", "mother", "gender",
"status"],
... | [
"def",
"_read_fam",
"(",
"self",
")",
":",
"# Reading the FAM file and setting the values",
"fam",
"=",
"pd",
".",
"read_csv",
"(",
"self",
".",
"fam_filename",
",",
"delim_whitespace",
"=",
"True",
",",
"names",
"=",
"[",
"\"fid\"",
",",
"\"iid\"",
",",
"\"fa... | Reads the FAM file. | [
"Reads",
"the",
"FAM",
"file",
"."
] | 31d47c86f589064bda98206314a2d0b20e7fd2f0 | https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L333-L349 | train |
lemieuxl/pyplink | pyplink/pyplink.py | PyPlink._read_bed | def _read_bed(self):
"""Reads the BED file."""
# Checking if BIM and BAM files were both read
if (self._bim is None) or (self._fam is None):
raise RuntimeError("no BIM or FAM file were read")
# The number of bytes per marker
self._nb_bytes = int(np.ceil(self._nb_samp... | python | def _read_bed(self):
"""Reads the BED file."""
# Checking if BIM and BAM files were both read
if (self._bim is None) or (self._fam is None):
raise RuntimeError("no BIM or FAM file were read")
# The number of bytes per marker
self._nb_bytes = int(np.ceil(self._nb_samp... | [
"def",
"_read_bed",
"(",
"self",
")",
":",
"# Checking if BIM and BAM files were both read",
"if",
"(",
"self",
".",
"_bim",
"is",
"None",
")",
"or",
"(",
"self",
".",
"_fam",
"is",
"None",
")",
":",
"raise",
"RuntimeError",
"(",
"\"no BIM or FAM file were read\... | Reads the BED file. | [
"Reads",
"the",
"BED",
"file",
"."
] | 31d47c86f589064bda98206314a2d0b20e7fd2f0 | https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L375-L408 | train |
lemieuxl/pyplink | pyplink/pyplink.py | PyPlink._write_bed_header | def _write_bed_header(self):
"""Writes the BED first 3 bytes."""
# Writing the first three bytes
final_byte = 1 if self._bed_format == "SNP-major" else 0
self._bed.write(bytearray((108, 27, final_byte))) | python | def _write_bed_header(self):
"""Writes the BED first 3 bytes."""
# Writing the first three bytes
final_byte = 1 if self._bed_format == "SNP-major" else 0
self._bed.write(bytearray((108, 27, final_byte))) | [
"def",
"_write_bed_header",
"(",
"self",
")",
":",
"# Writing the first three bytes",
"final_byte",
"=",
"1",
"if",
"self",
".",
"_bed_format",
"==",
"\"SNP-major\"",
"else",
"0",
"self",
".",
"_bed",
".",
"write",
"(",
"bytearray",
"(",
"(",
"108",
",",
"27... | Writes the BED first 3 bytes. | [
"Writes",
"the",
"BED",
"first",
"3",
"bytes",
"."
] | 31d47c86f589064bda98206314a2d0b20e7fd2f0 | https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L410-L414 | train |
lemieuxl/pyplink | pyplink/pyplink.py | PyPlink.iter_geno_marker | def iter_geno_marker(self, markers, return_index=False):
"""Iterates over genotypes for a list of markers.
Args:
markers (list): The list of markers to iterate onto.
return_index (bool): Wether to return the marker's index or not.
Returns:
tuple: The name of... | python | def iter_geno_marker(self, markers, return_index=False):
"""Iterates over genotypes for a list of markers.
Args:
markers (list): The list of markers to iterate onto.
return_index (bool): Wether to return the marker's index or not.
Returns:
tuple: The name of... | [
"def",
"iter_geno_marker",
"(",
"self",
",",
"markers",
",",
"return_index",
"=",
"False",
")",
":",
"if",
"self",
".",
"_mode",
"!=",
"\"r\"",
":",
"raise",
"UnsupportedOperation",
"(",
"\"not available in 'w' mode\"",
")",
"# If string, we change to list",
"if",
... | Iterates over genotypes for a list of markers.
Args:
markers (list): The list of markers to iterate onto.
return_index (bool): Wether to return the marker's index or not.
Returns:
tuple: The name of the marker as a string, and its genotypes as a
:py:clas... | [
"Iterates",
"over",
"genotypes",
"for",
"a",
"list",
"of",
"markers",
"."
] | 31d47c86f589064bda98206314a2d0b20e7fd2f0 | https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L445-L471 | train |
lemieuxl/pyplink | pyplink/pyplink.py | PyPlink.get_geno_marker | def get_geno_marker(self, marker, return_index=False):
"""Gets the genotypes for a given marker.
Args:
marker (str): The name of the marker.
return_index (bool): Wether to return the marker's index or not.
Returns:
numpy.ndarray: The genotypes of the marker ... | python | def get_geno_marker(self, marker, return_index=False):
"""Gets the genotypes for a given marker.
Args:
marker (str): The name of the marker.
return_index (bool): Wether to return the marker's index or not.
Returns:
numpy.ndarray: The genotypes of the marker ... | [
"def",
"get_geno_marker",
"(",
"self",
",",
"marker",
",",
"return_index",
"=",
"False",
")",
":",
"if",
"self",
".",
"_mode",
"!=",
"\"r\"",
":",
"raise",
"UnsupportedOperation",
"(",
"\"not available in 'w' mode\"",
")",
"# Check if the marker exists",
"if",
"ma... | Gets the genotypes for a given marker.
Args:
marker (str): The name of the marker.
return_index (bool): Wether to return the marker's index or not.
Returns:
numpy.ndarray: The genotypes of the marker (additive format). | [
"Gets",
"the",
"genotypes",
"for",
"a",
"given",
"marker",
"."
] | 31d47c86f589064bda98206314a2d0b20e7fd2f0 | https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L489-L513 | train |
lemieuxl/pyplink | pyplink/pyplink.py | PyPlink.write_genotypes | def write_genotypes(self, genotypes):
"""Write genotypes to binary file.
Args:
genotypes (numpy.ndarray): The genotypes to write in the BED file.
"""
if self._mode != "w":
raise UnsupportedOperation("not available in 'r' mode")
# Initializing the number... | python | def write_genotypes(self, genotypes):
"""Write genotypes to binary file.
Args:
genotypes (numpy.ndarray): The genotypes to write in the BED file.
"""
if self._mode != "w":
raise UnsupportedOperation("not available in 'r' mode")
# Initializing the number... | [
"def",
"write_genotypes",
"(",
"self",
",",
"genotypes",
")",
":",
"if",
"self",
".",
"_mode",
"!=",
"\"w\"",
":",
"raise",
"UnsupportedOperation",
"(",
"\"not available in 'r' mode\"",
")",
"# Initializing the number of samples if required",
"if",
"self",
".",
"_nb_v... | Write genotypes to binary file.
Args:
genotypes (numpy.ndarray): The genotypes to write in the BED file. | [
"Write",
"genotypes",
"to",
"binary",
"file",
"."
] | 31d47c86f589064bda98206314a2d0b20e7fd2f0 | https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L531-L557 | train |
CI-WATER/gsshapy | gsshapy/orm/tim.py | TimeSeriesFile._read | def _read(self, directory, filename, session, path, name, extension, spatial=None, spatialReferenceID=None, replaceParamFile=None):
"""
Generic Time Series Read from File Method
"""
# Assign file extension attribute to file object
self.fileExtension = extension
timeSerie... | python | def _read(self, directory, filename, session, path, name, extension, spatial=None, spatialReferenceID=None, replaceParamFile=None):
"""
Generic Time Series Read from File Method
"""
# Assign file extension attribute to file object
self.fileExtension = extension
timeSerie... | [
"def",
"_read",
"(",
"self",
",",
"directory",
",",
"filename",
",",
"session",
",",
"path",
",",
"name",
",",
"extension",
",",
"spatial",
"=",
"None",
",",
"spatialReferenceID",
"=",
"None",
",",
"replaceParamFile",
"=",
"None",
")",
":",
"# Assign file ... | Generic Time Series Read from File Method | [
"Generic",
"Time",
"Series",
"Read",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/tim.py#L60-L82 | train |
CI-WATER/gsshapy | gsshapy/orm/tim.py | TimeSeriesFile._write | def _write(self, session, openFile, replaceParamFile):
"""
Generic Time Series Write to File Method
"""
# Retrieve all time series
timeSeries = self.timeSeries
# Num TimeSeries
numTS = len(timeSeries)
# Transform into list of dictionaries for pivot tool
... | python | def _write(self, session, openFile, replaceParamFile):
"""
Generic Time Series Write to File Method
"""
# Retrieve all time series
timeSeries = self.timeSeries
# Num TimeSeries
numTS = len(timeSeries)
# Transform into list of dictionaries for pivot tool
... | [
"def",
"_write",
"(",
"self",
",",
"session",
",",
"openFile",
",",
"replaceParamFile",
")",
":",
"# Retrieve all time series",
"timeSeries",
"=",
"self",
".",
"timeSeries",
"# Num TimeSeries",
"numTS",
"=",
"len",
"(",
"timeSeries",
")",
"# Transform into list of d... | Generic Time Series Write to File Method | [
"Generic",
"Time",
"Series",
"Write",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/tim.py#L84-L121 | train |
CI-WATER/gsshapy | gsshapy/orm/tim.py | TimeSeriesFile.as_dataframe | def as_dataframe(self):
"""
Return time series as pandas dataframe
"""
time_series = {}
for ts_index, ts in enumerate(self.timeSeries):
index = []
data = []
for value in ts.values:
index.append(value.simTime)
dat... | python | def as_dataframe(self):
"""
Return time series as pandas dataframe
"""
time_series = {}
for ts_index, ts in enumerate(self.timeSeries):
index = []
data = []
for value in ts.values:
index.append(value.simTime)
dat... | [
"def",
"as_dataframe",
"(",
"self",
")",
":",
"time_series",
"=",
"{",
"}",
"for",
"ts_index",
",",
"ts",
"in",
"enumerate",
"(",
"self",
".",
"timeSeries",
")",
":",
"index",
"=",
"[",
"]",
"data",
"=",
"[",
"]",
"for",
"value",
"in",
"ts",
".",
... | Return time series as pandas dataframe | [
"Return",
"time",
"series",
"as",
"pandas",
"dataframe"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/tim.py#L123-L135 | train |
CI-WATER/gsshapy | gsshapy/orm/tim.py | TimeSeriesFile._createTimeSeriesObjects | def _createTimeSeriesObjects(self, timeSeries, filename):
"""
Create GSSHAPY TimeSeries and TimeSeriesValue Objects Method
"""
try:
# Determine number of value columns
valColumns = len(timeSeries[0]['values'])
# Create List of GSSHAPY TimeSeries objec... | python | def _createTimeSeriesObjects(self, timeSeries, filename):
"""
Create GSSHAPY TimeSeries and TimeSeriesValue Objects Method
"""
try:
# Determine number of value columns
valColumns = len(timeSeries[0]['values'])
# Create List of GSSHAPY TimeSeries objec... | [
"def",
"_createTimeSeriesObjects",
"(",
"self",
",",
"timeSeries",
",",
"filename",
")",
":",
"try",
":",
"# Determine number of value columns",
"valColumns",
"=",
"len",
"(",
"timeSeries",
"[",
"0",
"]",
"[",
"'values'",
"]",
")",
"# Create List of GSSHAPY TimeSeri... | Create GSSHAPY TimeSeries and TimeSeriesValue Objects Method | [
"Create",
"GSSHAPY",
"TimeSeries",
"and",
"TimeSeriesValue",
"Objects",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/tim.py#L137-L164 | train |
vinci1it2000/schedula | schedula/utils/blue.py | Blueprint.extend | def extend(self, *blues, memo=None):
"""
Extends deferred operations calling each operation of given Blueprints.
:param blues:
Blueprints or Dispatchers to extend deferred operations.
:type blues: Blueprint | schedula.dispatcher.Dispatcher
:param memo:
A... | python | def extend(self, *blues, memo=None):
"""
Extends deferred operations calling each operation of given Blueprints.
:param blues:
Blueprints or Dispatchers to extend deferred operations.
:type blues: Blueprint | schedula.dispatcher.Dispatcher
:param memo:
A... | [
"def",
"extend",
"(",
"self",
",",
"*",
"blues",
",",
"memo",
"=",
"None",
")",
":",
"memo",
"=",
"{",
"}",
"if",
"memo",
"is",
"None",
"else",
"memo",
"for",
"blue",
"in",
"blues",
":",
"if",
"isinstance",
"(",
"blue",
",",
"Dispatcher",
")",
":... | Extends deferred operations calling each operation of given Blueprints.
:param blues:
Blueprints or Dispatchers to extend deferred operations.
:type blues: Blueprint | schedula.dispatcher.Dispatcher
:param memo:
A dictionary to cache Blueprints.
:type memo: dict... | [
"Extends",
"deferred",
"operations",
"calling",
"each",
"operation",
"of",
"given",
"Blueprints",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/blue.py#L89-L123 | train |
CI-WATER/gsshapy | gsshapy/orm/loc.py | OutputLocationFile._read | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Generic Output Location Read from File Method
"""
# Assign file extension attribute to file object
self.fileExtension = extension
# Open file and pars... | python | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Generic Output Location Read from File Method
"""
# Assign file extension attribute to file object
self.fileExtension = extension
# Open file and pars... | [
"def",
"_read",
"(",
"self",
",",
"directory",
",",
"filename",
",",
"session",
",",
"path",
",",
"name",
",",
"extension",
",",
"spatial",
",",
"spatialReferenceID",
",",
"replaceParamFile",
")",
":",
"# Assign file extension attribute to file object",
"self",
".... | Generic Output Location Read from File Method | [
"Generic",
"Output",
"Location",
"Read",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/loc.py#L61-L81 | train |
CI-WATER/gsshapy | gsshapy/orm/loc.py | OutputLocationFile._write | def _write(self, session, openFile, replaceParamFile):
"""
Generic Output Location Write to File Method
"""
# Retrieve output locations
locations = self.outputLocations
# Write lines
openFile.write('%s\n' % self.numLocations)
for location in locations:
... | python | def _write(self, session, openFile, replaceParamFile):
"""
Generic Output Location Write to File Method
"""
# Retrieve output locations
locations = self.outputLocations
# Write lines
openFile.write('%s\n' % self.numLocations)
for location in locations:
... | [
"def",
"_write",
"(",
"self",
",",
"session",
",",
"openFile",
",",
"replaceParamFile",
")",
":",
"# Retrieve output locations",
"locations",
"=",
"self",
".",
"outputLocations",
"# Write lines",
"openFile",
".",
"write",
"(",
"'%s\\n'",
"%",
"self",
".",
"numLo... | Generic Output Location Write to File Method | [
"Generic",
"Output",
"Location",
"Write",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/loc.py#L83-L95 | train |
vinci1it2000/schedula | schedula/utils/base.py | Base.web | def web(self, depth=-1, node_data=NONE, node_function=NONE, directory=None,
sites=None, run=True):
"""
Creates a dispatcher Flask app.
:param depth:
Depth of sub-dispatch plots. If negative all levels are plotted.
:type depth: int, optional
:param node_d... | python | def web(self, depth=-1, node_data=NONE, node_function=NONE, directory=None,
sites=None, run=True):
"""
Creates a dispatcher Flask app.
:param depth:
Depth of sub-dispatch plots. If negative all levels are plotted.
:type depth: int, optional
:param node_d... | [
"def",
"web",
"(",
"self",
",",
"depth",
"=",
"-",
"1",
",",
"node_data",
"=",
"NONE",
",",
"node_function",
"=",
"NONE",
",",
"directory",
"=",
"None",
",",
"sites",
"=",
"None",
",",
"run",
"=",
"True",
")",
":",
"options",
"=",
"{",
"'node_data'... | Creates a dispatcher Flask app.
:param depth:
Depth of sub-dispatch plots. If negative all levels are plotted.
:type depth: int, optional
:param node_data:
Data node attributes to view.
:type node_data: tuple[str], optional
:param node_function:
... | [
"Creates",
"a",
"dispatcher",
"Flask",
"app",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/base.py#L27-L109 | train |
vinci1it2000/schedula | schedula/utils/base.py | Base.plot | def plot(self, workflow=None, view=True, depth=-1, name=NONE, comment=NONE,
format=NONE, engine=NONE, encoding=NONE, graph_attr=NONE,
node_attr=NONE, edge_attr=NONE, body=NONE, node_styles=NONE,
node_data=NONE, node_function=NONE, edge_data=NONE, max_lines=NONE,
max_w... | python | def plot(self, workflow=None, view=True, depth=-1, name=NONE, comment=NONE,
format=NONE, engine=NONE, encoding=NONE, graph_attr=NONE,
node_attr=NONE, edge_attr=NONE, body=NONE, node_styles=NONE,
node_data=NONE, node_function=NONE, edge_data=NONE, max_lines=NONE,
max_w... | [
"def",
"plot",
"(",
"self",
",",
"workflow",
"=",
"None",
",",
"view",
"=",
"True",
",",
"depth",
"=",
"-",
"1",
",",
"name",
"=",
"NONE",
",",
"comment",
"=",
"NONE",
",",
"format",
"=",
"NONE",
",",
"engine",
"=",
"NONE",
",",
"encoding",
"=",
... | Plots the Dispatcher with a graph in the DOT language with Graphviz.
:param workflow:
If True the latest solution will be plotted, otherwise the dmap.
:type workflow: bool, optional
:param view:
Open the rendered directed graph in the DOT language with the sys
... | [
"Plots",
"the",
"Dispatcher",
"with",
"a",
"graph",
"in",
"the",
"DOT",
"language",
"with",
"Graphviz",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/base.py#L111-L265 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/base.py | Resource._api_get | def _api_get(self, url, **kwargs):
"""
A convenience wrapper for _get. Adds headers, auth and base url by
default
"""
kwargs['url'] = self.url + url
kwargs['auth'] = self.auth
headers = deepcopy(self.headers)
headers.update(kwargs.get('headers', {}))
... | python | def _api_get(self, url, **kwargs):
"""
A convenience wrapper for _get. Adds headers, auth and base url by
default
"""
kwargs['url'] = self.url + url
kwargs['auth'] = self.auth
headers = deepcopy(self.headers)
headers.update(kwargs.get('headers', {}))
... | [
"def",
"_api_get",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'url'",
"]",
"=",
"self",
".",
"url",
"+",
"url",
"kwargs",
"[",
"'auth'",
"]",
"=",
"self",
".",
"auth",
"headers",
"=",
"deepcopy",
"(",
"self",
".",... | A convenience wrapper for _get. Adds headers, auth and base url by
default | [
"A",
"convenience",
"wrapper",
"for",
"_get",
".",
"Adds",
"headers",
"auth",
"and",
"base",
"url",
"by",
"default"
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/base.py#L36-L47 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/base.py | Resource._api_put | def _api_put(self, url, **kwargs):
"""
A convenience wrapper for _put. Adds headers, auth and base url by
default
"""
kwargs['url'] = self.url + url
kwargs['auth'] = self.auth
headers = deepcopy(self.headers)
headers.update(kwargs.get('headers', {}))
... | python | def _api_put(self, url, **kwargs):
"""
A convenience wrapper for _put. Adds headers, auth and base url by
default
"""
kwargs['url'] = self.url + url
kwargs['auth'] = self.auth
headers = deepcopy(self.headers)
headers.update(kwargs.get('headers', {}))
... | [
"def",
"_api_put",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'url'",
"]",
"=",
"self",
".",
"url",
"+",
"url",
"kwargs",
"[",
"'auth'",
"]",
"=",
"self",
".",
"auth",
"headers",
"=",
"deepcopy",
"(",
"self",
".",... | A convenience wrapper for _put. Adds headers, auth and base url by
default | [
"A",
"convenience",
"wrapper",
"for",
"_put",
".",
"Adds",
"headers",
"auth",
"and",
"base",
"url",
"by",
"default"
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/base.py#L62-L73 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/base.py | Resource._api_post | def _api_post(self, url, **kwargs):
"""
A convenience wrapper for _post. Adds headers, auth and base url by
default
"""
kwargs['url'] = self.url + url
kwargs['auth'] = self.auth
headers = deepcopy(self.headers)
headers.update(kwargs.get('headers', {}))
... | python | def _api_post(self, url, **kwargs):
"""
A convenience wrapper for _post. Adds headers, auth and base url by
default
"""
kwargs['url'] = self.url + url
kwargs['auth'] = self.auth
headers = deepcopy(self.headers)
headers.update(kwargs.get('headers', {}))
... | [
"def",
"_api_post",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'url'",
"]",
"=",
"self",
".",
"url",
"+",
"url",
"kwargs",
"[",
"'auth'",
"]",
"=",
"self",
".",
"auth",
"headers",
"=",
"deepcopy",
"(",
"self",
"."... | A convenience wrapper for _post. Adds headers, auth and base url by
default | [
"A",
"convenience",
"wrapper",
"for",
"_post",
".",
"Adds",
"headers",
"auth",
"and",
"base",
"url",
"by",
"default"
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/base.py#L87-L98 | train |
ambitioninc/rabbitmq-admin | rabbitmq_admin/base.py | Resource._api_delete | def _api_delete(self, url, **kwargs):
"""
A convenience wrapper for _delete. Adds headers, auth and base url by
default
"""
kwargs['url'] = self.url + url
kwargs['auth'] = self.auth
headers = deepcopy(self.headers)
headers.update(kwargs.get('headers', {})... | python | def _api_delete(self, url, **kwargs):
"""
A convenience wrapper for _delete. Adds headers, auth and base url by
default
"""
kwargs['url'] = self.url + url
kwargs['auth'] = self.auth
headers = deepcopy(self.headers)
headers.update(kwargs.get('headers', {})... | [
"def",
"_api_delete",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'url'",
"]",
"=",
"self",
".",
"url",
"+",
"url",
"kwargs",
"[",
"'auth'",
"]",
"=",
"self",
".",
"auth",
"headers",
"=",
"deepcopy",
"(",
"self",
"... | A convenience wrapper for _delete. Adds headers, auth and base url by
default | [
"A",
"convenience",
"wrapper",
"for",
"_delete",
".",
"Adds",
"headers",
"auth",
"and",
"base",
"url",
"by",
"default"
] | ff65054115f19991da153f0e4f4e45e526545fea | https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/base.py#L112-L123 | train |
CI-WATER/gsshapy | gsshapy/base/rast.py | RasterObjectBase.getAsKmlGrid | def getAsKmlGrid(self, session, path=None, documentName=None, colorRamp=ColorRampEnum.COLOR_RAMP_HUE, alpha=1.0,
noDataValue=None):
"""
Retrieve the raster as a KML document with each cell of the raster represented as a vector polygon. The result
is a vector grid of raster c... | python | def getAsKmlGrid(self, session, path=None, documentName=None, colorRamp=ColorRampEnum.COLOR_RAMP_HUE, alpha=1.0,
noDataValue=None):
"""
Retrieve the raster as a KML document with each cell of the raster represented as a vector polygon. The result
is a vector grid of raster c... | [
"def",
"getAsKmlGrid",
"(",
"self",
",",
"session",
",",
"path",
"=",
"None",
",",
"documentName",
"=",
"None",
",",
"colorRamp",
"=",
"ColorRampEnum",
".",
"COLOR_RAMP_HUE",
",",
"alpha",
"=",
"1.0",
",",
"noDataValue",
"=",
"None",
")",
":",
"if",
"typ... | Retrieve the raster as a KML document with each cell of the raster represented as a vector polygon. The result
is a vector grid of raster cells. Cells with the no data value are excluded.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabl... | [
"Retrieve",
"the",
"raster",
"as",
"a",
"KML",
"document",
"with",
"each",
"cell",
"of",
"the",
"raster",
"represented",
"as",
"a",
"vector",
"polygon",
".",
"The",
"result",
"is",
"a",
"vector",
"grid",
"of",
"raster",
"cells",
".",
"Cells",
"with",
"th... | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/base/rast.py#L33-L91 | train |
CI-WATER/gsshapy | gsshapy/base/rast.py | RasterObjectBase.getAsGrassAsciiGrid | def getAsGrassAsciiGrid(self, session):
"""
Retrieve the raster in the GRASS ASCII Grid format.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database.
Returns:
str: GRASS ASCII string.
"""
... | python | def getAsGrassAsciiGrid(self, session):
"""
Retrieve the raster in the GRASS ASCII Grid format.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database.
Returns:
str: GRASS ASCII string.
"""
... | [
"def",
"getAsGrassAsciiGrid",
"(",
"self",
",",
"session",
")",
":",
"if",
"type",
"(",
"self",
".",
"raster",
")",
"!=",
"type",
"(",
"None",
")",
":",
"# Make sure the raster field is valid",
"converter",
"=",
"RasterConverter",
"(",
"sqlAlchemyEngineOrSession",... | Retrieve the raster in the GRASS ASCII Grid format.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database.
Returns:
str: GRASS ASCII string. | [
"Retrieve",
"the",
"raster",
"in",
"the",
"GRASS",
"ASCII",
"Grid",
"format",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/base/rast.py#L229-L246 | train |
pedrotgn/pyactor | pyactor/context.py | shutdown | def shutdown(url=None):
'''
Stops the Host passed by parameter or all of them if none is
specified, stopping at the same time all its actors.
Should be called at the end of its usage, to finish correctly
all the connections and threads.
'''
if url is None:
for host in util.hosts.valu... | python | def shutdown(url=None):
'''
Stops the Host passed by parameter or all of them if none is
specified, stopping at the same time all its actors.
Should be called at the end of its usage, to finish correctly
all the connections and threads.
'''
if url is None:
for host in util.hosts.valu... | [
"def",
"shutdown",
"(",
"url",
"=",
"None",
")",
":",
"if",
"url",
"is",
"None",
":",
"for",
"host",
"in",
"util",
".",
"hosts",
".",
"values",
"(",
")",
":",
"host",
".",
"shutdown",
"(",
")",
"global",
"core_type",
"core_type",
"=",
"None",
"else... | Stops the Host passed by parameter or all of them if none is
specified, stopping at the same time all its actors.
Should be called at the end of its usage, to finish correctly
all the connections and threads. | [
"Stops",
"the",
"Host",
"passed",
"by",
"parameter",
"or",
"all",
"of",
"them",
"if",
"none",
"is",
"specified",
"stopping",
"at",
"the",
"same",
"time",
"all",
"its",
"actors",
".",
"Should",
"be",
"called",
"at",
"the",
"end",
"of",
"its",
"usage",
"... | 24d98d134dd4228f2ba38e83611e9c3f50ec2fd4 | https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/context.py#L483-L497 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.