repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
spotify/pyfg
pyFG/forticonfig.py
https://github.com/spotify/pyfg/blob/518668539146e7f998a37d75994a4278adf79897/pyFG/forticonfig.py#L343-L383
def parse_config_output(self, output): """ This method will parse a string containing FortiOS config and will load it into the current :class:`~pyFG.forticonfig.FortiConfig` object. Args: - **output** (string) - A string containing a supported version of FortiOS config ...
[ "def", "parse_config_output", "(", "self", ",", "output", ")", ":", "regexp", "=", "re", ".", "compile", "(", "'^(config |edit |set |end$|next$)(.*)'", ")", "current_block", "=", "self", "if", "isinstance", "(", "output", ",", "py23_compat", ".", "string_types", ...
This method will parse a string containing FortiOS config and will load it into the current :class:`~pyFG.forticonfig.FortiConfig` object. Args: - **output** (string) - A string containing a supported version of FortiOS config
[ "This", "method", "will", "parse", "a", "string", "containing", "FortiOS", "config", "and", "will", "load", "it", "into", "the", "current", ":", "class", ":", "~pyFG", ".", "forticonfig", ".", "FortiConfig", "object", "." ]
python
train
fracpete/python-weka-wrapper3
python/weka/attribute_selection.py
https://github.com/fracpete/python-weka-wrapper3/blob/d850ab1bdb25fbd5a8d86e99f34a397975425838/python/weka/attribute_selection.py#L114-L127
def post_process(self, indices): """ Post-processes the evaluator with the selected attribute indices. :param indices: the attribute indices list to use :type indices: ndarray :return: the processed indices :rtype: ndarray """ array = javabridge.call(self...
[ "def", "post_process", "(", "self", ",", "indices", ")", ":", "array", "=", "javabridge", ".", "call", "(", "self", ".", "jobject", ",", "\"postProcess\"", ",", "\"([I)[I\"", ",", "indices", ")", "if", "array", "is", "None", ":", "return", "None", "else"...
Post-processes the evaluator with the selected attribute indices. :param indices: the attribute indices list to use :type indices: ndarray :return: the processed indices :rtype: ndarray
[ "Post", "-", "processes", "the", "evaluator", "with", "the", "selected", "attribute", "indices", "." ]
python
train
KrishnaswamyLab/graphtools
graphtools/graphs.py
https://github.com/KrishnaswamyLab/graphtools/blob/44685352be7df2005d44722903092207967457f2/graphtools/graphs.py#L803-L813
def get_params(self): """Get parameters from this object """ params = super().get_params() params.update({'knn': self.knn, 'decay': self.decay, 'bandwidth': self.bandwidth, 'bandwidth_scale': self.bandwidth_scale, ...
[ "def", "get_params", "(", "self", ")", ":", "params", "=", "super", "(", ")", ".", "get_params", "(", ")", "params", ".", "update", "(", "{", "'knn'", ":", "self", ".", "knn", ",", "'decay'", ":", "self", ".", "decay", ",", "'bandwidth'", ":", "sel...
Get parameters from this object
[ "Get", "parameters", "from", "this", "object" ]
python
train
grst/geos
geos/print.py
https://github.com/grst/geos/blob/ea15abcc5d8f86c9051df55e489b7d941b51a638/geos/print.py#L43-L70
def print_map(map_source, x, y, zoom=14, width=297, height=210, dpi=300, format="pdf"): """ Download map tiles and stitch them together in a single image, ready for printing. Args: map_source (MapSource): Map to download x (float): map center x-coordinate in Mercator projection (EPSG:4326) ...
[ "def", "print_map", "(", "map_source", ",", "x", ",", "y", ",", "zoom", "=", "14", ",", "width", "=", "297", ",", "height", "=", "210", ",", "dpi", "=", "300", ",", "format", "=", "\"pdf\"", ")", ":", "bbox", "=", "get_print_bbox", "(", "x", ",",...
Download map tiles and stitch them together in a single image, ready for printing. Args: map_source (MapSource): Map to download x (float): map center x-coordinate in Mercator projection (EPSG:4326) y (float): map center y-coordinate in Mercator projection (EPSG:4326) zoom (int): ti...
[ "Download", "map", "tiles", "and", "stitch", "them", "together", "in", "a", "single", "image", "ready", "for", "printing", "." ]
python
train
tensorflow/cleverhans
cleverhans/attacks_tf.py
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/attacks_tf.py#L55-L79
def apply_perturbations(i, j, X, increase, theta, clip_min, clip_max): """ TensorFlow implementation for apply perturbations to input features based on salency maps :param i: index of first selected feature :param j: index of second selected feature :param X: a matrix containing our input features for our s...
[ "def", "apply_perturbations", "(", "i", ",", "j", ",", "X", ",", "increase", ",", "theta", ",", "clip_min", ",", "clip_max", ")", ":", "warnings", ".", "warn", "(", "\"This function is dead code and will be removed on or after 2019-07-18\"", ")", "# perturb our input ...
TensorFlow implementation for apply perturbations to input features based on salency maps :param i: index of first selected feature :param j: index of second selected feature :param X: a matrix containing our input features for our sample :param increase: boolean; true if we are increasing pixels, false other...
[ "TensorFlow", "implementation", "for", "apply", "perturbations", "to", "input", "features", "based", "on", "salency", "maps", ":", "param", "i", ":", "index", "of", "first", "selected", "feature", ":", "param", "j", ":", "index", "of", "second", "selected", ...
python
train
ResilienceTesting/gremlinsdk-python
python/pygremlin/assertionchecker.py
https://github.com/ResilienceTesting/gremlinsdk-python/blob/c5cc439ea1c0d6a98ff88f5604bf739f3c48d1e6/python/pygremlin/assertionchecker.py#L54-L70
def _check_value_recursively(key, val, haystack): """ Check if there is key _key_ with value _val_ in the given dictionary. ..warning: This is geared at JSON dictionaries, so some corner cases are ignored, we assume all iterables are either arrays or dicts """ if isinstance(haystack,...
[ "def", "_check_value_recursively", "(", "key", ",", "val", ",", "haystack", ")", ":", "if", "isinstance", "(", "haystack", ",", "list", ")", ":", "return", "any", "(", "[", "_check_value_recursively", "(", "key", ",", "val", ",", "l", ")", "for", "l", ...
Check if there is key _key_ with value _val_ in the given dictionary. ..warning: This is geared at JSON dictionaries, so some corner cases are ignored, we assume all iterables are either arrays or dicts
[ "Check", "if", "there", "is", "key", "_key_", "with", "value", "_val_", "in", "the", "given", "dictionary", ".", "..", "warning", ":", "This", "is", "geared", "at", "JSON", "dictionaries", "so", "some", "corner", "cases", "are", "ignored", "we", "assume", ...
python
train
pip-services3-python/pip-services3-commons-python
pip_services3_commons/convert/RecursiveMapConverter.py
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/convert/RecursiveMapConverter.py#L72-L83
def to_map_with_default(value, default_value): """ Converts value into map object or returns default when conversion is not possible :param value: the value to convert. :param default_value: the default value. :return: map object or emptu map when conversion is not supported. ...
[ "def", "to_map_with_default", "(", "value", ",", "default_value", ")", ":", "result", "=", "RecursiveMapConverter", ".", "to_nullable_map", "(", "value", ")", "return", "result", "if", "result", "!=", "None", "else", "default_value" ]
Converts value into map object or returns default when conversion is not possible :param value: the value to convert. :param default_value: the default value. :return: map object or emptu map when conversion is not supported.
[ "Converts", "value", "into", "map", "object", "or", "returns", "default", "when", "conversion", "is", "not", "possible" ]
python
train
dpgaspar/Flask-AppBuilder
flask_appbuilder/models/mongoengine/interface.py
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/models/mongoengine/interface.py#L274-L289
def get_order_columns_list(self, list_columns=None): """ Returns the columns that can be ordered :param list_columns: optional list of columns name, if provided will use this list only. """ ret_lst = list() list_columns = list_columns or self.get_...
[ "def", "get_order_columns_list", "(", "self", ",", "list_columns", "=", "None", ")", ":", "ret_lst", "=", "list", "(", ")", "list_columns", "=", "list_columns", "or", "self", ".", "get_columns_list", "(", ")", "for", "col_name", "in", "list_columns", ":", "i...
Returns the columns that can be ordered :param list_columns: optional list of columns name, if provided will use this list only.
[ "Returns", "the", "columns", "that", "can", "be", "ordered" ]
python
train
graphql-python/graphql-core
graphql/language/parser.py
https://github.com/graphql-python/graphql-core/blob/d8e9d3abe7c209eb2f51cf001402783bfd480596/graphql/language/parser.py#L583-L599
def parse_type(parser): # type: (Parser) -> Union[NamedType, NonNullType, ListType] """Handles the 'Type': TypeName, ListType, and NonNullType parsing rules.""" start = parser.token.start if skip(parser, TokenKind.BRACKET_L): ast_type = parse_type(parser) expect(parser, TokenKind.BRA...
[ "def", "parse_type", "(", "parser", ")", ":", "# type: (Parser) -> Union[NamedType, NonNullType, ListType]", "start", "=", "parser", ".", "token", ".", "start", "if", "skip", "(", "parser", ",", "TokenKind", ".", "BRACKET_L", ")", ":", "ast_type", "=", "parse_type...
Handles the 'Type': TypeName, ListType, and NonNullType parsing rules.
[ "Handles", "the", "Type", ":", "TypeName", "ListType", "and", "NonNullType", "parsing", "rules", "." ]
python
train
gitpython-developers/GitPython
git/remote.py
https://github.com/gitpython-developers/GitPython/blob/1f66e25c25cde2423917ee18c4704fff83b837d1/git/remote.py#L861-L875
def config_writer(self): """ :return: GitConfigParser compatible object able to write options for this remote. :note: You can only own one writer at a time - delete it to release the configuration file and make it usable by others. To assure consistent result...
[ "def", "config_writer", "(", "self", ")", ":", "writer", "=", "self", ".", "repo", ".", "config_writer", "(", ")", "# clear our cache to assure we re-read the possibly changed configuration", "self", ".", "_clear_cache", "(", ")", "return", "SectionConstraint", "(", "...
:return: GitConfigParser compatible object able to write options for this remote. :note: You can only own one writer at a time - delete it to release the configuration file and make it usable by others. To assure consistent results, you should only query options through the ...
[ ":", "return", ":", "GitConfigParser", "compatible", "object", "able", "to", "write", "options", "for", "this", "remote", ".", ":", "note", ":", "You", "can", "only", "own", "one", "writer", "at", "a", "time", "-", "delete", "it", "to", "release", "the",...
python
train
tensorflow/probability
tensorflow_probability/python/internal/nest_util.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/nest_util.py#L98-L113
def _nested_convert_to_tensor(struct, dtype=None, name=None): """Eagerly converts struct to Tensor, recursing upon failure.""" if dtype is not None or not tf.nest.is_nested(struct): return tf.convert_to_tensor(struct, dtype=dtype) if _maybe_convertible_to_tensor(struct): try: # Try converting the s...
[ "def", "_nested_convert_to_tensor", "(", "struct", ",", "dtype", "=", "None", ",", "name", "=", "None", ")", ":", "if", "dtype", "is", "not", "None", "or", "not", "tf", ".", "nest", ".", "is_nested", "(", "struct", ")", ":", "return", "tf", ".", "con...
Eagerly converts struct to Tensor, recursing upon failure.
[ "Eagerly", "converts", "struct", "to", "Tensor", "recursing", "upon", "failure", "." ]
python
test
bcbio/bcbio-nextgen
bcbio/chipseq/peaks.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/chipseq/peaks.py#L106-L133
def greylisting(data): """ Run ChIP-seq greylisting """ input_bam = data.get("work_bam_input", None) if not input_bam: logger.info("No input BAM file detected, skipping greylisting.") return None try: greylister = config_utils.get_program("chipseq-greylist", data) exc...
[ "def", "greylisting", "(", "data", ")", ":", "input_bam", "=", "data", ".", "get", "(", "\"work_bam_input\"", ",", "None", ")", "if", "not", "input_bam", ":", "logger", ".", "info", "(", "\"No input BAM file detected, skipping greylisting.\"", ")", "return", "No...
Run ChIP-seq greylisting
[ "Run", "ChIP", "-", "seq", "greylisting" ]
python
train
Erotemic/utool
utool/util_dbg.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_dbg.py#L1209-L1233
def get_varval_from_locals(key, locals_, strict=False): """ Returns a variable value from locals. Different from locals()['varname'] because get_varval_from_locals('varname.attribute', locals()) is allowed """ assert isinstance(key, six.string_types), 'must have parsed key into a string alre...
[ "def", "get_varval_from_locals", "(", "key", ",", "locals_", ",", "strict", "=", "False", ")", ":", "assert", "isinstance", "(", "key", ",", "six", ".", "string_types", ")", ",", "'must have parsed key into a string already'", "if", "key", "not", "in", "locals_"...
Returns a variable value from locals. Different from locals()['varname'] because get_varval_from_locals('varname.attribute', locals()) is allowed
[ "Returns", "a", "variable", "value", "from", "locals", ".", "Different", "from", "locals", "()", "[", "varname", "]", "because", "get_varval_from_locals", "(", "varname", ".", "attribute", "locals", "()", ")", "is", "allowed" ]
python
train
humilis/humilis-lambdautils
lambdautils/utils.py
https://github.com/humilis/humilis-lambdautils/blob/58f75eb5ace23523c283708d56a9193181ea7e8e/lambdautils/utils.py#L82-L97
def annotate_filter(**decargs): """Add input and output watermarks to filtered events.""" def decorator(func): """Annotate events with entry and/or exit timestamps.""" def wrapper(event, *args, **kwargs): """Add enter and exit annotations to the processed event.""" funcna...
[ "def", "annotate_filter", "(", "*", "*", "decargs", ")", ":", "def", "decorator", "(", "func", ")", ":", "\"\"\"Annotate events with entry and/or exit timestamps.\"\"\"", "def", "wrapper", "(", "event", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\...
Add input and output watermarks to filtered events.
[ "Add", "input", "and", "output", "watermarks", "to", "filtered", "events", "." ]
python
train
drslump/pyshould
pyshould/expectation.py
https://github.com/drslump/pyshould/blob/7210859d4c84cfbaa64f91b30c2a541aea788ddf/pyshould/expectation.py#L81-L100
def resolve(self, value=None): """ Resolve the current expression against the supplied value """ # If we still have an uninitialized matcher init it now if self.matcher: self._init_matcher() # Evaluate the current set of matchers forming the expression matcher = sel...
[ "def", "resolve", "(", "self", ",", "value", "=", "None", ")", ":", "# If we still have an uninitialized matcher init it now", "if", "self", ".", "matcher", ":", "self", ".", "_init_matcher", "(", ")", "# Evaluate the current set of matchers forming the expression", "matc...
Resolve the current expression against the supplied value
[ "Resolve", "the", "current", "expression", "against", "the", "supplied", "value" ]
python
train
mrstephenneal/mysql-toolkit
mysql/toolkit/components/structure/keys.py
https://github.com/mrstephenneal/mysql-toolkit/blob/6964f718f4b72eb30f2259adfcfaf3090526c53d/mysql/toolkit/components/structure/keys.py#L9-L13
def get_primary_key(self, table): """Retrieve the column which is the primary key for a table.""" for column in self.get_schema(table): if len(column) > 3 and 'pri' in column[3].lower(): return column[0]
[ "def", "get_primary_key", "(", "self", ",", "table", ")", ":", "for", "column", "in", "self", ".", "get_schema", "(", "table", ")", ":", "if", "len", "(", "column", ")", ">", "3", "and", "'pri'", "in", "column", "[", "3", "]", ".", "lower", "(", ...
Retrieve the column which is the primary key for a table.
[ "Retrieve", "the", "column", "which", "is", "the", "primary", "key", "for", "a", "table", "." ]
python
train
ARMmbed/mbed-cloud-sdk-python
src/mbed_cloud/device_directory/device_directory.py
https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/device_directory/device_directory.py#L664-L674
def filter(self): """Get the query of this Query. The device query :return: The query of this Query. :rtype: dict """ if isinstance(self._filter, str): return self._decode_query(self._filter) return self._filter
[ "def", "filter", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "_filter", ",", "str", ")", ":", "return", "self", ".", "_decode_query", "(", "self", ".", "_filter", ")", "return", "self", ".", "_filter" ]
Get the query of this Query. The device query :return: The query of this Query. :rtype: dict
[ "Get", "the", "query", "of", "this", "Query", "." ]
python
train
autokey/autokey
lib/autokey/configmanager.py
https://github.com/autokey/autokey/blob/35decb72f286ce68cd2a1f09ace8891a520b58d1/lib/autokey/configmanager.py#L328-L344
def convert_rename_autostart_entries_for_v0_95_3(): """ In versions <= 0.95.2, the autostart option in autokey-gtk copied the default autokey-gtk.desktop file into $XDG_CONFIG_DIR/autostart (with minor, unrelated modifications). For versions >= 0.95.3, the autostart file is renamed to autokey.desktop. I...
[ "def", "convert_rename_autostart_entries_for_v0_95_3", "(", ")", ":", "old_autostart_file", "=", "Path", "(", "common", ".", "AUTOSTART_DIR", ")", "/", "\"autokey-gtk.desktop\"", "if", "old_autostart_file", ".", "exists", "(", ")", ":", "new_file_name", "=", "Path", ...
In versions <= 0.95.2, the autostart option in autokey-gtk copied the default autokey-gtk.desktop file into $XDG_CONFIG_DIR/autostart (with minor, unrelated modifications). For versions >= 0.95.3, the autostart file is renamed to autokey.desktop. In 0.95.3, the autostart functionality is implemented for aut...
[ "In", "versions", "<", "=", "0", ".", "95", ".", "2", "the", "autostart", "option", "in", "autokey", "-", "gtk", "copied", "the", "default", "autokey", "-", "gtk", ".", "desktop", "file", "into", "$XDG_CONFIG_DIR", "/", "autostart", "(", "with", "minor",...
python
train
cga-harvard/Hypermap-Registry
hypermap/search_api/utils.py
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/search_api/utils.py#L73-L88
def parse_datetime_range(time_filter): """ Parse the url param to python objects. From what time range to divide by a.time.gap into intervals. Defaults to q.time and otherwise 90 days. Validate in API: re.search("\\[(.*) TO (.*)\\]", value) :param time_filter: [2013-03-01 TO 2013-05-01T00:00:00]...
[ "def", "parse_datetime_range", "(", "time_filter", ")", ":", "if", "not", "time_filter", ":", "time_filter", "=", "\"[* TO *]\"", "start", ",", "end", "=", "parse_solr_time_range_as_pair", "(", "time_filter", ")", "start", ",", "end", "=", "parse_datetime", "(", ...
Parse the url param to python objects. From what time range to divide by a.time.gap into intervals. Defaults to q.time and otherwise 90 days. Validate in API: re.search("\\[(.*) TO (.*)\\]", value) :param time_filter: [2013-03-01 TO 2013-05-01T00:00:00] :return: datetime.datetime(2013, 3, 1, 0, 0), ...
[ "Parse", "the", "url", "param", "to", "python", "objects", ".", "From", "what", "time", "range", "to", "divide", "by", "a", ".", "time", ".", "gap", "into", "intervals", ".", "Defaults", "to", "q", ".", "time", "and", "otherwise", "90", "days", ".", ...
python
train
Azure/azure-cli-extensions
src/aks-preview/azext_aks_preview/_format.py
https://github.com/Azure/azure-cli-extensions/blob/3d4854205b0f0d882f688cfa12383d14506c2e35/src/aks-preview/azext_aks_preview/_format.py#L73-L84
def aks_versions_table_format(result): """Format get-versions results as a summary for display with "-o table".""" # pylint: disable=import-error from jmespath import compile as compile_jmes, Options parsed = compile_jmes("""orchestrators[].{ kubernetesVersion: orchestratorVersion, upgr...
[ "def", "aks_versions_table_format", "(", "result", ")", ":", "# pylint: disable=import-error", "from", "jmespath", "import", "compile", "as", "compile_jmes", ",", "Options", "parsed", "=", "compile_jmes", "(", "\"\"\"orchestrators[].{\n kubernetesVersion: orchestratorVer...
Format get-versions results as a summary for display with "-o table".
[ "Format", "get", "-", "versions", "results", "as", "a", "summary", "for", "display", "with", "-", "o", "table", "." ]
python
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/client.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/client.py#L337-L345
async def service_status(self, name): """Pull the current status of a service by name. Returns: dict: A dictionary of service status """ return await self.send_command(OPERATIONS.CMD_QUERY_STATUS, {'name': name}, MESSAGES.QueryStatusRe...
[ "async", "def", "service_status", "(", "self", ",", "name", ")", ":", "return", "await", "self", ".", "send_command", "(", "OPERATIONS", ".", "CMD_QUERY_STATUS", ",", "{", "'name'", ":", "name", "}", ",", "MESSAGES", ".", "QueryStatusResponse", ",", "timeout...
Pull the current status of a service by name. Returns: dict: A dictionary of service status
[ "Pull", "the", "current", "status", "of", "a", "service", "by", "name", "." ]
python
train
Kortemme-Lab/klab
klab/cloning/cloning.py
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/cloning/cloning.py#L422-L443
def write_sequences_to_xlsx(path, seqs): """ Create a XLSX file listing the given sequences. Arguments ========= path: str or pathlib.Path The name of the file to create. seqs: dict A mapping of names to sequences, which can be either protein or DNA. """ from openpyxl i...
[ "def", "write_sequences_to_xlsx", "(", "path", ",", "seqs", ")", ":", "from", "openpyxl", "import", "Workbook", "wb", "=", "Workbook", "(", ")", "ws", "=", "wb", ".", "active", "for", "row", ",", "id", "in", "enumerate", "(", "seqs", ",", "1", ")", "...
Create a XLSX file listing the given sequences. Arguments ========= path: str or pathlib.Path The name of the file to create. seqs: dict A mapping of names to sequences, which can be either protein or DNA.
[ "Create", "a", "XLSX", "file", "listing", "the", "given", "sequences", "." ]
python
train
mottosso/be
be/vendor/click/core.py
https://github.com/mottosso/be/blob/0f3d4f3597c71223f616d78c6d9b2c8dffcd8a71/be/vendor/click/core.py#L758-L765
def make_parser(self, ctx): """Creates the underlying option parser for this command.""" parser = OptionParser(ctx) parser.allow_interspersed_args = ctx.allow_interspersed_args parser.ignore_unknown_options = ctx.ignore_unknown_options for param in self.get_params(ctx): ...
[ "def", "make_parser", "(", "self", ",", "ctx", ")", ":", "parser", "=", "OptionParser", "(", "ctx", ")", "parser", ".", "allow_interspersed_args", "=", "ctx", ".", "allow_interspersed_args", "parser", ".", "ignore_unknown_options", "=", "ctx", ".", "ignore_unkno...
Creates the underlying option parser for this command.
[ "Creates", "the", "underlying", "option", "parser", "for", "this", "command", "." ]
python
train
lago-project/lago
lago/subnet_lease.py
https://github.com/lago-project/lago/blob/5b8970f7687e063e4619066d5b8093ca997678c9/lago/subnet_lease.py#L364-L391
def create_lease_object_from_subnet(self, subnet): """ Create a lease from ip in a dotted decimal format, (for example `192.168.200.0/24`). the _cidr will be added if not exist in `subnet`. Args: subnet (str): The value of the third octet Returns: ...
[ "def", "create_lease_object_from_subnet", "(", "self", ",", "subnet", ")", ":", "if", "'/'", "not", "in", "subnet", ":", "subnet", "=", "'{}/{}'", ".", "format", "(", "subnet", ",", "self", ".", "_cidr", ")", "try", ":", "if", "not", "self", ".", "is_l...
Create a lease from ip in a dotted decimal format, (for example `192.168.200.0/24`). the _cidr will be added if not exist in `subnet`. Args: subnet (str): The value of the third octet Returns: Lease: Lease object which represents the requested subnet. R...
[ "Create", "a", "lease", "from", "ip", "in", "a", "dotted", "decimal", "format", "(", "for", "example", "192", ".", "168", ".", "200", ".", "0", "/", "24", ")", ".", "the", "_cidr", "will", "be", "added", "if", "not", "exist", "in", "subnet", "." ]
python
train
mlavin/django-hilbert
hilbert/decorators.py
https://github.com/mlavin/django-hilbert/blob/e77b685f4afc6e1224dc7e616e9ee9f7c2bc55b6/hilbert/decorators.py#L20-L35
def ajax_login_required(view_func): """Handle non-authenticated users differently if it is an AJAX request.""" @wraps(view_func, assigned=available_attrs(view_func)) def _wrapped_view(request, *args, **kwargs): if request.is_ajax(): if request.user.is_authenticated(): re...
[ "def", "ajax_login_required", "(", "view_func", ")", ":", "@", "wraps", "(", "view_func", ",", "assigned", "=", "available_attrs", "(", "view_func", ")", ")", "def", "_wrapped_view", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "i...
Handle non-authenticated users differently if it is an AJAX request.
[ "Handle", "non", "-", "authenticated", "users", "differently", "if", "it", "is", "an", "AJAX", "request", "." ]
python
train
Telefonica/toolium
toolium/utils.py
https://github.com/Telefonica/toolium/blob/56847c243b3a98876df74c184b75e43f8810e475/toolium/utils.py#L99-L120
def save_webdriver_logs_by_type(self, log_type, test_name): """Get webdriver logs of the specified type and write them to a log file :param log_type: browser, client, driver, performance, server, syslog, crashlog or logcat :param test_name: test that has generated these logs """ ...
[ "def", "save_webdriver_logs_by_type", "(", "self", ",", "log_type", ",", "test_name", ")", ":", "try", ":", "logs", "=", "self", ".", "driver_wrapper", ".", "driver", ".", "get_log", "(", "log_type", ")", "except", "Exception", ":", "return", "if", "len", ...
Get webdriver logs of the specified type and write them to a log file :param log_type: browser, client, driver, performance, server, syslog, crashlog or logcat :param test_name: test that has generated these logs
[ "Get", "webdriver", "logs", "of", "the", "specified", "type", "and", "write", "them", "to", "a", "log", "file" ]
python
train
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/api/map_job/map_job_control.py
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/map_job_control.py#L170-L174
def __update_state(self): """Fetches most up to date state from db.""" # Only if the job was not in a terminal state. if self._state.active: self._state = self.__get_state_by_id(self.job_config.job_id)
[ "def", "__update_state", "(", "self", ")", ":", "# Only if the job was not in a terminal state.", "if", "self", ".", "_state", ".", "active", ":", "self", ".", "_state", "=", "self", ".", "__get_state_by_id", "(", "self", ".", "job_config", ".", "job_id", ")" ]
Fetches most up to date state from db.
[ "Fetches", "most", "up", "to", "date", "state", "from", "db", "." ]
python
train
EndurantDevs/webargs-sanic
webargs_sanic/sanicparser.py
https://github.com/EndurantDevs/webargs-sanic/blob/8861a3b7d16d43a0b7e6669115eb93b0553f1b63/webargs_sanic/sanicparser.py#L33-L44
def abort(http_status_code, exc=None, **kwargs): """Raise a HTTPException for the given http_status_code. Attach any keyword arguments to the exception for later processing. From Flask-Restful. See NOTICE file for license information. """ try: sanic.exceptions.abort(http_status_code, exc) ...
[ "def", "abort", "(", "http_status_code", ",", "exc", "=", "None", ",", "*", "*", "kwargs", ")", ":", "try", ":", "sanic", ".", "exceptions", ".", "abort", "(", "http_status_code", ",", "exc", ")", "except", "sanic", ".", "exceptions", ".", "SanicExceptio...
Raise a HTTPException for the given http_status_code. Attach any keyword arguments to the exception for later processing. From Flask-Restful. See NOTICE file for license information.
[ "Raise", "a", "HTTPException", "for", "the", "given", "http_status_code", ".", "Attach", "any", "keyword", "arguments", "to", "the", "exception", "for", "later", "processing", "." ]
python
train
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L10871-L10889
def hil_controls_encode(self, time_usec, roll_ailerons, pitch_elevator, yaw_rudder, throttle, aux1, aux2, aux3, aux4, mode, nav_mode): ''' Sent from autopilot to simulation. Hardware in the loop control outputs time_usec : Timestamp (micro...
[ "def", "hil_controls_encode", "(", "self", ",", "time_usec", ",", "roll_ailerons", ",", "pitch_elevator", ",", "yaw_rudder", ",", "throttle", ",", "aux1", ",", "aux2", ",", "aux3", ",", "aux4", ",", "mode", ",", "nav_mode", ")", ":", "return", "MAVLink_hil_c...
Sent from autopilot to simulation. Hardware in the loop control outputs time_usec : Timestamp (microseconds since UNIX epoch or microseconds since system boot) (uint64_t) roll_ailerons : Control output -1 .. 1 (float) pitch_ele...
[ "Sent", "from", "autopilot", "to", "simulation", ".", "Hardware", "in", "the", "loop", "control", "outputs" ]
python
train
saltstack/salt
salt/states/pkg.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L901-L917
def _preflight_check(desired, fromrepo, **kwargs): ''' Perform platform-specific checks on desired packages ''' if 'pkg.check_db' not in __salt__: return {} ret = {'suggest': {}, 'no_suggest': []} pkginfo = __salt__['pkg.check_db']( *list(desired.keys()), fromrepo=fromrepo, **kwa...
[ "def", "_preflight_check", "(", "desired", ",", "fromrepo", ",", "*", "*", "kwargs", ")", ":", "if", "'pkg.check_db'", "not", "in", "__salt__", ":", "return", "{", "}", "ret", "=", "{", "'suggest'", ":", "{", "}", ",", "'no_suggest'", ":", "[", "]", ...
Perform platform-specific checks on desired packages
[ "Perform", "platform", "-", "specific", "checks", "on", "desired", "packages" ]
python
train
obriencj/python-javatools
javatools/pack.py
https://github.com/obriencj/python-javatools/blob/9e2332b452ddc508bed0615937dddcb2cf051557/javatools/pack.py#L183-L203
def unpack(self, fmt): """ unpacks the given fmt from the underlying buffer and returns the results. Will raise an UnpackException if there is not enough data to satisfy the fmt """ sfmt = compile_struct(fmt) size = sfmt.size offset = self.offset ...
[ "def", "unpack", "(", "self", ",", "fmt", ")", ":", "sfmt", "=", "compile_struct", "(", "fmt", ")", "size", "=", "sfmt", ".", "size", "offset", "=", "self", ".", "offset", "if", "self", ".", "data", ":", "avail", "=", "len", "(", "self", ".", "da...
unpacks the given fmt from the underlying buffer and returns the results. Will raise an UnpackException if there is not enough data to satisfy the fmt
[ "unpacks", "the", "given", "fmt", "from", "the", "underlying", "buffer", "and", "returns", "the", "results", ".", "Will", "raise", "an", "UnpackException", "if", "there", "is", "not", "enough", "data", "to", "satisfy", "the", "fmt" ]
python
train
log2timeline/plaso
plaso/parsers/mediator.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/parsers/mediator.py#L395-L462
def ProcessEvent( self, event, parser_chain=None, file_entry=None, query=None): """Processes an event before it written to the storage. Args: event (EventObject|EventData): event or event data. parser_chain (Optional[str]): parsing chain up to this point. file_entry (Optional[dfvfs.File...
[ "def", "ProcessEvent", "(", "self", ",", "event", ",", "parser_chain", "=", "None", ",", "file_entry", "=", "None", ",", "query", "=", "None", ")", ":", "# TODO: rename this to event.parser_chain or equivalent.", "if", "not", "getattr", "(", "event", ",", "'pars...
Processes an event before it written to the storage. Args: event (EventObject|EventData): event or event data. parser_chain (Optional[str]): parsing chain up to this point. file_entry (Optional[dfvfs.FileEntry]): file entry, where None will use the current file entry set in the mediator...
[ "Processes", "an", "event", "before", "it", "written", "to", "the", "storage", "." ]
python
train
fastai/fastai
fastai/vision/learner.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/learner.py#L65-L77
def create_head(nf:int, nc:int, lin_ftrs:Optional[Collection[int]]=None, ps:Floats=0.5, concat_pool:bool=True, bn_final:bool=False): "Model head that takes `nf` features, runs through `lin_ftrs`, and about `nc` classes." lin_ftrs = [nf, 512, nc] if lin_ftrs is None else [nf] + lin_ftrs + [nc] ...
[ "def", "create_head", "(", "nf", ":", "int", ",", "nc", ":", "int", ",", "lin_ftrs", ":", "Optional", "[", "Collection", "[", "int", "]", "]", "=", "None", ",", "ps", ":", "Floats", "=", "0.5", ",", "concat_pool", ":", "bool", "=", "True", ",", "...
Model head that takes `nf` features, runs through `lin_ftrs`, and about `nc` classes.
[ "Model", "head", "that", "takes", "nf", "features", "runs", "through", "lin_ftrs", "and", "about", "nc", "classes", "." ]
python
train
boto/s3transfer
s3transfer/utils.py
https://github.com/boto/s3transfer/blob/2aead638c8385d8ae0b1756b2de17e8fad45fffa/s3transfer/utils.py#L693-L708
def adjust_chunksize(self, current_chunksize, file_size=None): """Get a chunksize close to current that fits within all S3 limits. :type current_chunksize: int :param current_chunksize: The currently configured chunksize. :type file_size: int or None :param file_size: The size ...
[ "def", "adjust_chunksize", "(", "self", ",", "current_chunksize", ",", "file_size", "=", "None", ")", ":", "chunksize", "=", "current_chunksize", "if", "file_size", "is", "not", "None", ":", "chunksize", "=", "self", ".", "_adjust_for_max_parts", "(", "chunksize...
Get a chunksize close to current that fits within all S3 limits. :type current_chunksize: int :param current_chunksize: The currently configured chunksize. :type file_size: int or None :param file_size: The size of the file to upload. This might be None if the object being ...
[ "Get", "a", "chunksize", "close", "to", "current", "that", "fits", "within", "all", "S3", "limits", "." ]
python
test
unitedstack/steth
stetho/agent/drivers/iperf.py
https://github.com/unitedstack/steth/blob/955884ceebf3bdc474c93cc5cf555e67d16458f1/stetho/agent/drivers/iperf.py#L27-L40
def start_server(self, protocol='TCP', port=5001, mss=None, window=None): """iperf -s -D --mss mss """ cmd = ['iperf', '-s', '-p', str(port)] if not cmp(protocol, 'UDP'): cmd.append('-u') if mss: cmd.extend(['-M', str(mss)]) if window: ...
[ "def", "start_server", "(", "self", ",", "protocol", "=", "'TCP'", ",", "port", "=", "5001", ",", "mss", "=", "None", ",", "window", "=", "None", ")", ":", "cmd", "=", "[", "'iperf'", ",", "'-s'", ",", "'-p'", ",", "str", "(", "port", ")", "]", ...
iperf -s -D --mss mss
[ "iperf", "-", "s", "-", "D", "--", "mss", "mss" ]
python
train
phfaist/pylatexenc
pylatexenc/latex2text.py
https://github.com/phfaist/pylatexenc/blob/0c1788d1349e749501e67a6fba54d79e6e0d54f6/pylatexenc/latex2text.py#L656-L686
def set_tex_input_directory(self, tex_input_directory, latex_walker_init_args=None, strict_input=True): """ Set where to look for input files when encountering the ``\\input`` or ``\\include`` macro. Alternatively, you may also override :py:meth:`read_input_file()` to implement ...
[ "def", "set_tex_input_directory", "(", "self", ",", "tex_input_directory", ",", "latex_walker_init_args", "=", "None", ",", "strict_input", "=", "True", ")", ":", "self", ".", "tex_input_directory", "=", "tex_input_directory", "self", ".", "latex_walker_init_args", "=...
Set where to look for input files when encountering the ``\\input`` or ``\\include`` macro. Alternatively, you may also override :py:meth:`read_input_file()` to implement a custom file lookup mechanism. The argument `tex_input_directory` is the directory relative to which to se...
[ "Set", "where", "to", "look", "for", "input", "files", "when", "encountering", "the", "\\\\", "input", "or", "\\\\", "include", "macro", "." ]
python
test
rapidpro/expressions
python/temba_expressions/functions/custom.py
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/python/temba_expressions/functions/custom.py#L51-L86
def read_digits(ctx, text): """ Formats digits in text for reading in TTS """ def chunk(value, chunk_size): return [value[i: i + chunk_size] for i in range(0, len(value), chunk_size)] text = conversions.to_string(text, ctx).strip() if not text: return '' # trim off the plus...
[ "def", "read_digits", "(", "ctx", ",", "text", ")", ":", "def", "chunk", "(", "value", ",", "chunk_size", ")", ":", "return", "[", "value", "[", "i", ":", "i", "+", "chunk_size", "]", "for", "i", "in", "range", "(", "0", ",", "len", "(", "value",...
Formats digits in text for reading in TTS
[ "Formats", "digits", "in", "text", "for", "reading", "in", "TTS" ]
python
train
MillionIntegrals/vel
vel/rl/commands/rl_train_command.py
https://github.com/MillionIntegrals/vel/blob/e0726e1f63742b728966ccae0c8b825ea0ba491a/vel/rl/commands/rl_train_command.py#L106-L116
def gather_callbacks(self, optimizer) -> list: """ Gather all the callbacks to be used in this training run """ callbacks = [FrameTracker(self.total_frames), TimeTracker()] if self.scheduler_factory is not None: callbacks.append(self.scheduler_factory.instantiate(optimizer)) ...
[ "def", "gather_callbacks", "(", "self", ",", "optimizer", ")", "->", "list", ":", "callbacks", "=", "[", "FrameTracker", "(", "self", ".", "total_frames", ")", ",", "TimeTracker", "(", ")", "]", "if", "self", ".", "scheduler_factory", "is", "not", "None", ...
Gather all the callbacks to be used in this training run
[ "Gather", "all", "the", "callbacks", "to", "be", "used", "in", "this", "training", "run" ]
python
train
DiscordBotList/DBL-Python-Library
dbl/client.py
https://github.com/DiscordBotList/DBL-Python-Library/blob/c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa/dbl/client.py#L117-L139
async def get_guild_count(self, bot_id: int=None): """This function is a coroutine. Gets a guild count from discordbots.org Parameters ========== bot_id: int[Optional] The bot_id of the bot you want to lookup. Defaults to the Bot provided in Client init...
[ "async", "def", "get_guild_count", "(", "self", ",", "bot_id", ":", "int", "=", "None", ")", ":", "if", "bot_id", "is", "None", ":", "bot_id", "=", "self", ".", "bot_id", "return", "await", "self", ".", "http", ".", "get_guild_count", "(", "bot_id", ")...
This function is a coroutine. Gets a guild count from discordbots.org Parameters ========== bot_id: int[Optional] The bot_id of the bot you want to lookup. Defaults to the Bot provided in Client init Returns ======= stats: dict ...
[ "This", "function", "is", "a", "coroutine", "." ]
python
test
Unidata/MetPy
metpy/io/_tools.py
https://github.com/Unidata/MetPy/blob/16f68a94919b9a82dcf9cada2169cf039129e67b/metpy/io/_tools.py#L127-L129
def unpack_from(self, buff, offset=0): """Read bytes from a buffer and return as a namedtuple.""" return self._create(super(NamedStruct, self).unpack_from(buff, offset))
[ "def", "unpack_from", "(", "self", ",", "buff", ",", "offset", "=", "0", ")", ":", "return", "self", ".", "_create", "(", "super", "(", "NamedStruct", ",", "self", ")", ".", "unpack_from", "(", "buff", ",", "offset", ")", ")" ]
Read bytes from a buffer and return as a namedtuple.
[ "Read", "bytes", "from", "a", "buffer", "and", "return", "as", "a", "namedtuple", "." ]
python
train
iotile/coretools
iotileemulate/iotile/emulate/virtual/emulation_mixin.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/virtual/emulation_mixin.py#L151-L174
def register_scenario(self, scenario_name, handler): """Register a scenario handler for this object. Scenario handlers are callable functions with no positional arguments that can be called by name with the load_scenario function and should prepare the emulated object into a known state...
[ "def", "register_scenario", "(", "self", ",", "scenario_name", ",", "handler", ")", ":", "if", "scenario_name", "in", "self", ".", "_known_scenarios", ":", "raise", "ArgumentError", "(", "\"Attempted to add the same scenario name twice\"", ",", "scenario_name", "=", "...
Register a scenario handler for this object. Scenario handlers are callable functions with no positional arguments that can be called by name with the load_scenario function and should prepare the emulated object into a known state. The purpose of a scenario is to make it easy to get a...
[ "Register", "a", "scenario", "handler", "for", "this", "object", "." ]
python
train
andreikop/qutepart
qutepart/__init__.py
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/__init__.py#L460-L463
def _updateTabStopWidth(self): """Update tabstop width after font or indentation changed """ self.setTabStopWidth(self.fontMetrics().width(' ' * self._indenter.width))
[ "def", "_updateTabStopWidth", "(", "self", ")", ":", "self", ".", "setTabStopWidth", "(", "self", ".", "fontMetrics", "(", ")", ".", "width", "(", "' '", "*", "self", ".", "_indenter", ".", "width", ")", ")" ]
Update tabstop width after font or indentation changed
[ "Update", "tabstop", "width", "after", "font", "or", "indentation", "changed" ]
python
train
nickoala/telepot
telepot/__init__.py
https://github.com/nickoala/telepot/blob/3792fde251d0f1d5a6ca16c8ad1a71f89360c41d/telepot/__init__.py#L1046-L1068
def download_file(self, file_id, dest): """ Download a file to local disk. :param dest: a path or a ``file`` object """ f = self.getFile(file_id) try: d = dest if _isfile(dest) else open(dest, 'wb') r = api.download((self._token, f['file_path']),...
[ "def", "download_file", "(", "self", ",", "file_id", ",", "dest", ")", ":", "f", "=", "self", ".", "getFile", "(", "file_id", ")", "try", ":", "d", "=", "dest", "if", "_isfile", "(", "dest", ")", "else", "open", "(", "dest", ",", "'wb'", ")", "r"...
Download a file to local disk. :param dest: a path or a ``file`` object
[ "Download", "a", "file", "to", "local", "disk", "." ]
python
train
SoftwareDefinedBuildings/XBOS
python/xbos/services/pundat.py
https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/python/xbos/services/pundat.py#L141-L154
def tags_uuids(self, uuids, archiver="", timeout=DEFAULT_TIMEOUT): """ Retrieves tags for all streams with the provided UUIDs Arguments: [uuids]: list of UUIDs [archiver]: if specified, this is the archiver to use. Else, it will run on the first archiver passed ...
[ "def", "tags_uuids", "(", "self", ",", "uuids", ",", "archiver", "=", "\"\"", ",", "timeout", "=", "DEFAULT_TIMEOUT", ")", ":", "if", "not", "isinstance", "(", "uuids", ",", "list", ")", ":", "uuids", "=", "[", "uuids", "]", "where", "=", "\" or \"", ...
Retrieves tags for all streams with the provided UUIDs Arguments: [uuids]: list of UUIDs [archiver]: if specified, this is the archiver to use. Else, it will run on the first archiver passed into the constructor for the client [timeout]: time in seconds to wait for a...
[ "Retrieves", "tags", "for", "all", "streams", "with", "the", "provided", "UUIDs" ]
python
train
PyCQA/pyflakes
pyflakes/checker.py
https://github.com/PyCQA/pyflakes/blob/232cb1d27ee134bf96adc8f37e53589dc259b159/pyflakes/checker.py#L694-L703
def deferFunction(self, callable): """ Schedule a function handler to be called just before completion. This is used for handling function bodies, which must be deferred because code later in the file might modify the global scope. When `callable` is called, the scope at the tim...
[ "def", "deferFunction", "(", "self", ",", "callable", ")", ":", "self", ".", "_deferredFunctions", ".", "append", "(", "(", "callable", ",", "self", ".", "scopeStack", "[", ":", "]", ",", "self", ".", "offset", ")", ")" ]
Schedule a function handler to be called just before completion. This is used for handling function bodies, which must be deferred because code later in the file might modify the global scope. When `callable` is called, the scope at the time this is called will be restored, however it w...
[ "Schedule", "a", "function", "handler", "to", "be", "called", "just", "before", "completion", "." ]
python
train
saltstack/salt
salt/modules/napalm_mod.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/napalm_mod.py#L492-L522
def netmiko_fun(fun, *args, **kwargs): ''' .. versionadded:: 2019.2.0 Call an arbitrary function from the :mod:`Netmiko<salt.modules.netmiko_mod>` module, passing the authentication details from the existing NAPALM connection. fun The name of the function from the :mod:`Netmiko<salt.mo...
[ "def", "netmiko_fun", "(", "fun", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'netmiko.'", "not", "in", "fun", ":", "fun", "=", "'netmiko.{fun}'", ".", "format", "(", "fun", "=", "fun", ")", "netmiko_kwargs", "=", "netmiko_args", "(", ...
.. versionadded:: 2019.2.0 Call an arbitrary function from the :mod:`Netmiko<salt.modules.netmiko_mod>` module, passing the authentication details from the existing NAPALM connection. fun The name of the function from the :mod:`Netmiko<salt.modules.netmiko_mod>` to invoke. args ...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
python
train
zhanglab/psamm
psamm/datasource/sbml.py
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/datasource/sbml.py#L427-L433
def properties(self): """All compartment properties as a dict.""" properties = {'id': self._id} if self._name is not None: properties['name'] = self._name return properties
[ "def", "properties", "(", "self", ")", ":", "properties", "=", "{", "'id'", ":", "self", ".", "_id", "}", "if", "self", ".", "_name", "is", "not", "None", ":", "properties", "[", "'name'", "]", "=", "self", ".", "_name", "return", "properties" ]
All compartment properties as a dict.
[ "All", "compartment", "properties", "as", "a", "dict", "." ]
python
train
raiden-network/raiden
raiden/network/transport/matrix/client.py
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/transport/matrix/client.py#L267-L278
def stop_listener_thread(self): """ Kills sync_thread greenlet before joining it """ # when stopping, `kill` will cause the `self.api.sync` call in _sync # to raise a connection error. This flag will ensure it exits gracefully then self.should_listen = False if self.sync_thread: ...
[ "def", "stop_listener_thread", "(", "self", ")", ":", "# when stopping, `kill` will cause the `self.api.sync` call in _sync", "# to raise a connection error. This flag will ensure it exits gracefully then", "self", ".", "should_listen", "=", "False", "if", "self", ".", "sync_thread",...
Kills sync_thread greenlet before joining it
[ "Kills", "sync_thread", "greenlet", "before", "joining", "it" ]
python
train
DLR-RM/RAFCON
source/rafcon/gui/helpers/state.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/state.py#L233-L286
def extract_child_models_of_state(state_m, new_state_class): """Retrieve child models of state model The function extracts the child state and state element models of the given state model into a dict. It only extracts those properties that are required for a state of type `new_state_class`. Transitions ar...
[ "def", "extract_child_models_of_state", "(", "state_m", ",", "new_state_class", ")", ":", "# check if root state and which type of state", "assert", "isinstance", "(", "state_m", ",", "StateModel", ")", "assert", "issubclass", "(", "new_state_class", ",", "State", ")", ...
Retrieve child models of state model The function extracts the child state and state element models of the given state model into a dict. It only extracts those properties that are required for a state of type `new_state_class`. Transitions are always left out. :param state_m: state model of which childre...
[ "Retrieve", "child", "models", "of", "state", "model" ]
python
train
vertexproject/synapse
synapse/lib/slabseqn.py
https://github.com/vertexproject/synapse/blob/22e67c5a8f6d7caddbcf34b39ab1bd2d6c4a6e0b/synapse/lib/slabseqn.py#L45-L79
def save(self, items): ''' Save a series of items to a sequence. Args: items (tuple): The series of items to save into the sequence. Returns: The index of the first item ''' rows = [] indx = self.indx size = 0 tick = s_co...
[ "def", "save", "(", "self", ",", "items", ")", ":", "rows", "=", "[", "]", "indx", "=", "self", ".", "indx", "size", "=", "0", "tick", "=", "s_common", ".", "now", "(", ")", "for", "item", "in", "items", ":", "byts", "=", "s_msgpack", ".", "en"...
Save a series of items to a sequence. Args: items (tuple): The series of items to save into the sequence. Returns: The index of the first item
[ "Save", "a", "series", "of", "items", "to", "a", "sequence", "." ]
python
train
DiamondLightSource/python-workflows
workflows/recipe/wrapper.py
https://github.com/DiamondLightSource/python-workflows/blob/7ef47b457655b96f4d2ef7ee9863cf1b6d20e023/workflows/recipe/wrapper.py#L163-L177
def _generate_full_recipe_message(self, destination, message, add_path_step): """Factory function to generate independent message objects for downstream recipients with different destinations.""" if add_path_step and self.recipe_pointer: recipe_path = self.recipe_path + [self.recipe_...
[ "def", "_generate_full_recipe_message", "(", "self", ",", "destination", ",", "message", ",", "add_path_step", ")", ":", "if", "add_path_step", "and", "self", ".", "recipe_pointer", ":", "recipe_path", "=", "self", ".", "recipe_path", "+", "[", "self", ".", "r...
Factory function to generate independent message objects for downstream recipients with different destinations.
[ "Factory", "function", "to", "generate", "independent", "message", "objects", "for", "downstream", "recipients", "with", "different", "destinations", "." ]
python
train
aio-libs/aioredis
aioredis/pool.py
https://github.com/aio-libs/aioredis/blob/e8c33e39558d4cc91cf70dde490d8b330c97dc2e/aioredis/pool.py#L220-L245
def get_connection(self, command, args=()): """Get free connection from pool. Returns connection. """ # TODO: find a better way to determine if connection is free # and not havily used. command = command.upper().strip() is_pubsub = command in _PUBSUB_COMMAN...
[ "def", "get_connection", "(", "self", ",", "command", ",", "args", "=", "(", ")", ")", ":", "# TODO: find a better way to determine if connection is free", "# and not havily used.", "command", "=", "command", ".", "upper", "(", ")", ".", "strip", "(", ")", "...
Get free connection from pool. Returns connection.
[ "Get", "free", "connection", "from", "pool", "." ]
python
train
jwass/mplleaflet
mplleaflet/_display.py
https://github.com/jwass/mplleaflet/blob/a83d7b69c56d5507dd7c17f5be377d23a31e84ab/mplleaflet/_display.py#L167-L185
def show(fig=None, path='_map.html', **kwargs): """ Convert a Matplotlib Figure to a Leaflet map. Open in a browser Parameters ---------- fig : figure, default gcf() Figure used to convert to map path : string, default '_map.html' Filename where output html will be saved Se...
[ "def", "show", "(", "fig", "=", "None", ",", "path", "=", "'_map.html'", ",", "*", "*", "kwargs", ")", ":", "import", "webbrowser", "fullpath", "=", "os", ".", "path", ".", "abspath", "(", "path", ")", "with", "open", "(", "fullpath", ",", "'w'", "...
Convert a Matplotlib Figure to a Leaflet map. Open in a browser Parameters ---------- fig : figure, default gcf() Figure used to convert to map path : string, default '_map.html' Filename where output html will be saved See fig_to_html() for description of keyword args.
[ "Convert", "a", "Matplotlib", "Figure", "to", "a", "Leaflet", "map", ".", "Open", "in", "a", "browser" ]
python
train
kragniz/python-etcd3
etcd3/client.py
https://github.com/kragniz/python-etcd3/blob/0adb14840d4a6011a2023a13f07e247e4c336a80/etcd3/client.py#L266-L290
def get(self, key, **kwargs): """ Get the value of a key from etcd. example usage: .. code-block:: python >>> import etcd3 >>> etcd = etcd3.client() >>> etcd.get('/thing/key') 'hello world' :param key: key in etcd to get ...
[ "def", "get", "(", "self", ",", "key", ",", "*", "*", "kwargs", ")", ":", "range_response", "=", "self", ".", "get_response", "(", "key", ",", "*", "*", "kwargs", ")", "if", "range_response", ".", "count", "<", "1", ":", "return", "None", ",", "Non...
Get the value of a key from etcd. example usage: .. code-block:: python >>> import etcd3 >>> etcd = etcd3.client() >>> etcd.get('/thing/key') 'hello world' :param key: key in etcd to get :param serializable: whether to allow serializabl...
[ "Get", "the", "value", "of", "a", "key", "from", "etcd", "." ]
python
train
PyCQA/pylint
pylint/checkers/variables.py
https://github.com/PyCQA/pylint/blob/2bf5c61a3ff6ae90613b81679de42c0f19aea600/pylint/checkers/variables.py#L1574-L1590
def _has_homonym_in_upper_function_scope(self, node, index): """ Return True if there is a node with the same name in the to_consume dict of an upper scope and if that scope is a function :param node: node to check for :type node: astroid.Node :param index: index of the ...
[ "def", "_has_homonym_in_upper_function_scope", "(", "self", ",", "node", ",", "index", ")", ":", "for", "_consumer", "in", "self", ".", "_to_consume", "[", "index", "-", "1", ":", ":", "-", "1", "]", ":", "if", "_consumer", ".", "scope_type", "==", "\"fu...
Return True if there is a node with the same name in the to_consume dict of an upper scope and if that scope is a function :param node: node to check for :type node: astroid.Node :param index: index of the current consumer inside self._to_consume :type index: int :return...
[ "Return", "True", "if", "there", "is", "a", "node", "with", "the", "same", "name", "in", "the", "to_consume", "dict", "of", "an", "upper", "scope", "and", "if", "that", "scope", "is", "a", "function" ]
python
test
gregreen/dustmaps
dustmaps/json_serializers.py
https://github.com/gregreen/dustmaps/blob/c8f571a71da0d951bf8ea865621bee14492bdfd9/dustmaps/json_serializers.py#L287-L305
def deserialize_skycoord(d): """ Deserializes a JSONified :obj:`astropy.coordinates.SkyCoord`. Args: d (:obj:`dict`): A dictionary representation of a :obj:`SkyCoord` object. Returns: A :obj:`SkyCoord` object. """ if 'distance' in d: args = (d['lon'], d['lat'], d['dista...
[ "def", "deserialize_skycoord", "(", "d", ")", ":", "if", "'distance'", "in", "d", ":", "args", "=", "(", "d", "[", "'lon'", "]", ",", "d", "[", "'lat'", "]", ",", "d", "[", "'distance'", "]", ")", "else", ":", "args", "=", "(", "d", "[", "'lon'...
Deserializes a JSONified :obj:`astropy.coordinates.SkyCoord`. Args: d (:obj:`dict`): A dictionary representation of a :obj:`SkyCoord` object. Returns: A :obj:`SkyCoord` object.
[ "Deserializes", "a", "JSONified", ":", "obj", ":", "astropy", ".", "coordinates", ".", "SkyCoord", "." ]
python
train
gwastro/pycbc-glue
pycbc_glue/ligolw/dbtables.py
https://github.com/gwastro/pycbc-glue/blob/a3e906bae59fbfd707c3ff82e5d008d939ec5e24/pycbc_glue/ligolw/dbtables.py#L555-L587
def get_xml(connection, table_names = None): """ Construct an XML document tree wrapping around the contents of the database. On success the return value is a ligolw.LIGO_LW element containing the tables as children. Arguments are a connection to to a database, and an optional list of table names to dump. If t...
[ "def", "get_xml", "(", "connection", ",", "table_names", "=", "None", ")", ":", "ligo_lw", "=", "ligolw", ".", "LIGO_LW", "(", ")", "if", "table_names", "is", "None", ":", "table_names", "=", "get_table_names", "(", "connection", ")", "for", "table_name", ...
Construct an XML document tree wrapping around the contents of the database. On success the return value is a ligolw.LIGO_LW element containing the tables as children. Arguments are a connection to to a database, and an optional list of table names to dump. If table_names is not provided the set is obtained from...
[ "Construct", "an", "XML", "document", "tree", "wrapping", "around", "the", "contents", "of", "the", "database", ".", "On", "success", "the", "return", "value", "is", "a", "ligolw", ".", "LIGO_LW", "element", "containing", "the", "tables", "as", "children", "...
python
train
ultrabug/py3status
py3status/i3status.py
https://github.com/ultrabug/py3status/blob/4c105f1b44f7384ca4f7da5f821a47e468c7dee2/py3status/i3status.py#L142-L183
def update_from_item(self, item): """ Update from i3status output. returns if item has changed. """ if not self.is_time_module: # correct the output # Restore the name/instance. item["name"] = self.name item["instance"] = self.instance ...
[ "def", "update_from_item", "(", "self", ",", "item", ")", ":", "if", "not", "self", ".", "is_time_module", ":", "# correct the output", "# Restore the name/instance.", "item", "[", "\"name\"", "]", "=", "self", ".", "name", "item", "[", "\"instance\"", "]", "=...
Update from i3status output. returns if item has changed.
[ "Update", "from", "i3status", "output", ".", "returns", "if", "item", "has", "changed", "." ]
python
train
scivision/histutils
histutils/simulFrame.py
https://github.com/scivision/histutils/blob/859a91d3894cb57faed34881c6ea16130b90571e/histutils/simulFrame.py#L26-L103
def HSTsync(sim, cam, verbose): """ this function now uses UT1 time -- seconds since 1970 Jan 1 """ try: if isinstance(sim.startutc, datetime): reqStart = sim.startutc.timestamp() reqStop = sim.stoputc.timestamp() elif isinstance(sim.startutc, (float, int)): # ut1_un...
[ "def", "HSTsync", "(", "sim", ",", "cam", ",", "verbose", ")", ":", "try", ":", "if", "isinstance", "(", "sim", ".", "startutc", ",", "datetime", ")", ":", "reqStart", "=", "sim", ".", "startutc", ".", "timestamp", "(", ")", "reqStop", "=", "sim", ...
this function now uses UT1 time -- seconds since 1970 Jan 1
[ "this", "function", "now", "uses", "UT1", "time", "--", "seconds", "since", "1970", "Jan", "1" ]
python
train
dereneaton/ipyrad
ipyrad/assemble/cluster_across.py
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/cluster_across.py#L1150-L1176
def write_to_fullarr(data, sample, sidx): """ writes arrays to h5 disk """ ## enter ref data? #isref = 'reference' in data.paramsdict["assembly_method"] LOGGER.info("writing fullarr %s %s", sample.name, sidx) ## save big arrays to disk temporarily with h5py.File(data.clust_database, 'r+') as i...
[ "def", "write_to_fullarr", "(", "data", ",", "sample", ",", "sidx", ")", ":", "## enter ref data?", "#isref = 'reference' in data.paramsdict[\"assembly_method\"]", "LOGGER", ".", "info", "(", "\"writing fullarr %s %s\"", ",", "sample", ".", "name", ",", "sidx", ")", "...
writes arrays to h5 disk
[ "writes", "arrays", "to", "h5", "disk" ]
python
valid
mojaie/chorus
chorus/draw/svg.py
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/draw/svg.py#L89-L95
def _coords_conv(self, pos): """For Svg coordinate system, reflect over X axis and translate from center to top-left """ px = (self.original_size[0] / 2 + pos[0]) * self.scale_factor py = (self.original_size[1] / 2 - pos[1]) * self.scale_factor return round(px, 2), round(...
[ "def", "_coords_conv", "(", "self", ",", "pos", ")", ":", "px", "=", "(", "self", ".", "original_size", "[", "0", "]", "/", "2", "+", "pos", "[", "0", "]", ")", "*", "self", ".", "scale_factor", "py", "=", "(", "self", ".", "original_size", "[", ...
For Svg coordinate system, reflect over X axis and translate from center to top-left
[ "For", "Svg", "coordinate", "system", "reflect", "over", "X", "axis", "and", "translate", "from", "center", "to", "top", "-", "left" ]
python
train
snobear/ezmomi
ezmomi/ezmomi.py
https://github.com/snobear/ezmomi/blob/c98e26dc2d32cd5c92134fdcbcb8353540ac0208/ezmomi/ezmomi.py#L856-L861
def get_vm(self, name, path=""): """Get a VirtualMachine object""" if path: return self.get_obj([vim.VirtualMachine], name, path=path) else: return self.get_obj([vim.VirtualMachine], name)
[ "def", "get_vm", "(", "self", ",", "name", ",", "path", "=", "\"\"", ")", ":", "if", "path", ":", "return", "self", ".", "get_obj", "(", "[", "vim", ".", "VirtualMachine", "]", ",", "name", ",", "path", "=", "path", ")", "else", ":", "return", "s...
Get a VirtualMachine object
[ "Get", "a", "VirtualMachine", "object" ]
python
train
vedarthk/exreporter
exreporter/stores/github.py
https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L161-L172
def comment(self, body): """Adds a comment to the issue. :params body: body, content of the comment :returns: issue object :rtype: :class:`exreporter.stores.github.GithubIssue` """ self.github_request.comment(issue=self, body=body) if self.state == 'closed': ...
[ "def", "comment", "(", "self", ",", "body", ")", ":", "self", ".", "github_request", ".", "comment", "(", "issue", "=", "self", ",", "body", "=", "body", ")", "if", "self", ".", "state", "==", "'closed'", ":", "self", ".", "open_issue", "(", ")", "...
Adds a comment to the issue. :params body: body, content of the comment :returns: issue object :rtype: :class:`exreporter.stores.github.GithubIssue`
[ "Adds", "a", "comment", "to", "the", "issue", "." ]
python
train
artefactual-labs/mets-reader-writer
metsrw/metadata.py
https://github.com/artefactual-labs/mets-reader-writer/blob/d95939cabdfdc25cb1bf67df0c84bd0d6e6a73ff/metsrw/metadata.py#L211-L240
def parse(cls, element): """ Create a new Agent by parsing root. :param element: Element to be parsed into an Agent. :raises exceptions.ParseError: If element is not a valid agent. """ if element.tag != cls.AGENT_TAG: raise exceptions.ParseError( ...
[ "def", "parse", "(", "cls", ",", "element", ")", ":", "if", "element", ".", "tag", "!=", "cls", ".", "AGENT_TAG", ":", "raise", "exceptions", ".", "ParseError", "(", "u\"Agent got unexpected tag {}; expected {}\"", ".", "format", "(", "element", ".", "tag", ...
Create a new Agent by parsing root. :param element: Element to be parsed into an Agent. :raises exceptions.ParseError: If element is not a valid agent.
[ "Create", "a", "new", "Agent", "by", "parsing", "root", "." ]
python
train
ArchiveTeam/wpull
wpull/path.py
https://github.com/ArchiveTeam/wpull/blob/ddf051aa3322479325ba20aa778cb2cb97606bf5/wpull/path.py#L309-L328
def parse_content_disposition(text): '''Parse a Content-Disposition header value.''' match = re.search(r'filename\s*=\s*(.+)', text, re.IGNORECASE) if not match: return filename = match.group(1) if filename[0] in '"\'': match = re.match(r'(.)(.+)(?!\\)\1', filename) if ma...
[ "def", "parse_content_disposition", "(", "text", ")", ":", "match", "=", "re", ".", "search", "(", "r'filename\\s*=\\s*(.+)'", ",", "text", ",", "re", ".", "IGNORECASE", ")", "if", "not", "match", ":", "return", "filename", "=", "match", ".", "group", "(",...
Parse a Content-Disposition header value.
[ "Parse", "a", "Content", "-", "Disposition", "header", "value", "." ]
python
train
DarkEnergySurvey/ugali
ugali/utils/stats.py
https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/stats.py#L82-L101
def peak_interval(data, alpha=_alpha, npoints=_npoints): """ Identify interval using Gaussian kernel density estimator. """ peak = kde_peak(data,npoints) x = np.sort(data.flat); n = len(x) # The number of entries in the interval window = int(np.rint((1.0-alpha)*n)) # The start, stop, and...
[ "def", "peak_interval", "(", "data", ",", "alpha", "=", "_alpha", ",", "npoints", "=", "_npoints", ")", ":", "peak", "=", "kde_peak", "(", "data", ",", "npoints", ")", "x", "=", "np", ".", "sort", "(", "data", ".", "flat", ")", "n", "=", "len", "...
Identify interval using Gaussian kernel density estimator.
[ "Identify", "interval", "using", "Gaussian", "kernel", "density", "estimator", "." ]
python
train
sorgerlab/indra
indra/sources/sparser/api.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/sparser/api.py#L31-L59
def process_text(text, output_fmt='json', outbuf=None, cleanup=True, key='', **kwargs): """Return processor with Statements extracted by reading text with Sparser. Parameters ---------- text : str The text to be processed output_fmt: Optional[str] The output format ...
[ "def", "process_text", "(", "text", ",", "output_fmt", "=", "'json'", ",", "outbuf", "=", "None", ",", "cleanup", "=", "True", ",", "key", "=", "''", ",", "*", "*", "kwargs", ")", ":", "nxml_str", "=", "make_nxml_from_text", "(", "text", ")", "return",...
Return processor with Statements extracted by reading text with Sparser. Parameters ---------- text : str The text to be processed output_fmt: Optional[str] The output format to obtain from Sparser, with the two options being 'json' and 'xml'. Default: 'json' outbuf : Option...
[ "Return", "processor", "with", "Statements", "extracted", "by", "reading", "text", "with", "Sparser", "." ]
python
train
NoneGG/aredis
aredis/commands/streams.py
https://github.com/NoneGG/aredis/blob/204caad740ac13e5760d46444a2ba7632982a046/aredis/commands/streams.py#L422-L430
async def xgroup_del_consumer(self, name: str, group: str, consumer: str) -> int: """ [NOTICE] Not officially released yet XGROUP is used in order to create, destroy and manage consumer groups. :param name: name of the stream :param group: name of the consumer group :para...
[ "async", "def", "xgroup_del_consumer", "(", "self", ",", "name", ":", "str", ",", "group", ":", "str", ",", "consumer", ":", "str", ")", "->", "int", ":", "return", "await", "self", ".", "execute_command", "(", "'XGROUP DELCONSUMER'", ",", "name", ",", "...
[NOTICE] Not officially released yet XGROUP is used in order to create, destroy and manage consumer groups. :param name: name of the stream :param group: name of the consumer group :param consumer: name of the consumer
[ "[", "NOTICE", "]", "Not", "officially", "released", "yet", "XGROUP", "is", "used", "in", "order", "to", "create", "destroy", "and", "manage", "consumer", "groups", ".", ":", "param", "name", ":", "name", "of", "the", "stream", ":", "param", "group", ":"...
python
train
alexa/alexa-skills-kit-sdk-for-python
ask-sdk-runtime/ask_sdk_runtime/dispatch_components/request_components.py
https://github.com/alexa/alexa-skills-kit-sdk-for-python/blob/097b6406aa12d5ca0b825b00c936861b530cbf39/ask-sdk-runtime/ask_sdk_runtime/dispatch_components/request_components.py#L348-L363
def get_request_handler_chain(self, handler_input): # type: (Input) -> Union[GenericRequestHandlerChain, None] """Get the request handler chain that can handle the dispatch input. :param handler_input: Generic input passed to the dispatcher. :type handler_input: Inpu...
[ "def", "get_request_handler_chain", "(", "self", ",", "handler_input", ")", ":", "# type: (Input) -> Union[GenericRequestHandlerChain, None]", "for", "chain", "in", "self", ".", "request_handler_chains", ":", "handler", "=", "chain", ".", "request_handler", "# type: Abstrac...
Get the request handler chain that can handle the dispatch input. :param handler_input: Generic input passed to the dispatcher. :type handler_input: Input :return: Handler Chain that can handle the input. :rtype: Union[None, GenericRequestHandlerChain]
[ "Get", "the", "request", "handler", "chain", "that", "can", "handle", "the", "dispatch", "input", "." ]
python
train
RedHatInsights/insights-core
insights/specs/default.py
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/specs/default.py#L346-L361
def httpd_cmd(broker): """Command: httpd_command""" ps = broker[DefaultSpecs.ps_auxww].content ps_httpds = set() for p in ps: p_splits = p.split(None, 10) if len(p_splits) >= 11: cmd = p_splits[10].split()[0] # Should compatible wit...
[ "def", "httpd_cmd", "(", "broker", ")", ":", "ps", "=", "broker", "[", "DefaultSpecs", ".", "ps_auxww", "]", ".", "content", "ps_httpds", "=", "set", "(", ")", "for", "p", "in", "ps", ":", "p_splits", "=", "p", ".", "split", "(", "None", ",", "10",...
Command: httpd_command
[ "Command", ":", "httpd_command" ]
python
train
chaoss/grimoirelab-elk
grimoire_elk/elastic.py
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/elastic.py#L153-L187
def safe_put_bulk(self, url, bulk_json): """ Bulk PUT controlling unicode issues """ headers = {"Content-Type": "application/x-ndjson"} try: res = self.requests.put(url + '?refresh=true', data=bulk_json, headers=headers) res.raise_for_status() except UnicodeEnco...
[ "def", "safe_put_bulk", "(", "self", ",", "url", ",", "bulk_json", ")", ":", "headers", "=", "{", "\"Content-Type\"", ":", "\"application/x-ndjson\"", "}", "try", ":", "res", "=", "self", ".", "requests", ".", "put", "(", "url", "+", "'?refresh=true'", ","...
Bulk PUT controlling unicode issues
[ "Bulk", "PUT", "controlling", "unicode", "issues" ]
python
train
boatd/python-boatd
boatdclient/point.py
https://github.com/boatd/python-boatd/blob/404ff0d0c389f6ed84ddbfea1c41db6569ad2ed4/boatdclient/point.py#L63-L78
def distance_to(self, point): ''' Return the distance between this point and another point in meters. :param point: Point to measure distance to :type point: Point :returns: The distance to the other point :rtype: float ''' angle = math.acos( ...
[ "def", "distance_to", "(", "self", ",", "point", ")", ":", "angle", "=", "math", ".", "acos", "(", "sin", "(", "self", ".", "lat_radians", ")", "*", "sin", "(", "point", ".", "lat_radians", ")", "+", "cos", "(", "self", ".", "lat_radians", ")", "*"...
Return the distance between this point and another point in meters. :param point: Point to measure distance to :type point: Point :returns: The distance to the other point :rtype: float
[ "Return", "the", "distance", "between", "this", "point", "and", "another", "point", "in", "meters", "." ]
python
train
python-rope/rope
rope/base/utils/__init__.py
https://github.com/python-rope/rope/blob/1c9f9cd5964b099a99a9111e998f0dc728860688/rope/base/utils/__init__.py#L36-L45
def ignore_exception(exception_class): """A decorator that ignores `exception_class` exceptions""" def _decorator(func): def newfunc(*args, **kwds): try: return func(*args, **kwds) except exception_class: pass return newfunc return _dec...
[ "def", "ignore_exception", "(", "exception_class", ")", ":", "def", "_decorator", "(", "func", ")", ":", "def", "newfunc", "(", "*", "args", ",", "*", "*", "kwds", ")", ":", "try", ":", "return", "func", "(", "*", "args", ",", "*", "*", "kwds", ")"...
A decorator that ignores `exception_class` exceptions
[ "A", "decorator", "that", "ignores", "exception_class", "exceptions" ]
python
train
ownport/scrapy-dblite
dblite/query.py
https://github.com/ownport/scrapy-dblite/blob/6de5021caa31d439478d9808738b046d1db699c9/dblite/query.py#L61-L68
def delete(self): ''' return DELETE SQL ''' SQL = 'DELETE FROM %s' % self._table if self._selectors: SQL = ' '.join([SQL, 'WHERE', self._selectors]).strip() return SQL
[ "def", "delete", "(", "self", ")", ":", "SQL", "=", "'DELETE FROM %s'", "%", "self", ".", "_table", "if", "self", ".", "_selectors", ":", "SQL", "=", "' '", ".", "join", "(", "[", "SQL", ",", "'WHERE'", ",", "self", ".", "_selectors", "]", ")", "."...
return DELETE SQL
[ "return", "DELETE", "SQL" ]
python
train
hyperledger/indy-sdk
vcx/wrappers/python3/vcx/api/disclosed_proof.py
https://github.com/hyperledger/indy-sdk/blob/55240dc170308d7883c48f03f308130a6d077be6/vcx/wrappers/python3/vcx/api/disclosed_proof.py#L30-L76
async def create(source_id: str, proof_request: str): """ Create a proof for fulfilling a corresponding proof request :param source_id: Tag associated by user of sdk :param proof_request: Proof Request data sent by requestor. Example: source_id = 'sourceId' reques...
[ "async", "def", "create", "(", "source_id", ":", "str", ",", "proof_request", ":", "str", ")", ":", "constructor_params", "=", "(", "source_id", ",", ")", "c_source_id", "=", "c_char_p", "(", "source_id", ".", "encode", "(", "'utf-8'", ")", ")", "c_proof_r...
Create a proof for fulfilling a corresponding proof request :param source_id: Tag associated by user of sdk :param proof_request: Proof Request data sent by requestor. Example: source_id = 'sourceId' request = { "@topic": { "mid": 9, "tid": 1 ...
[ "Create", "a", "proof", "for", "fulfilling", "a", "corresponding", "proof", "request", ":", "param", "source_id", ":", "Tag", "associated", "by", "user", "of", "sdk", ":", "param", "proof_request", ":", "Proof", "Request", "data", "sent", "by", "requestor", ...
python
train
jingw/pyhdfs
pyhdfs.py
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L528-L530
def get_file_status(self, path, **kwargs): """Return a :py:class:`FileStatus` object that represents the path.""" return FileStatus(**_json(self._get(path, 'GETFILESTATUS', **kwargs))['FileStatus'])
[ "def", "get_file_status", "(", "self", ",", "path", ",", "*", "*", "kwargs", ")", ":", "return", "FileStatus", "(", "*", "*", "_json", "(", "self", ".", "_get", "(", "path", ",", "'GETFILESTATUS'", ",", "*", "*", "kwargs", ")", ")", "[", "'FileStatus...
Return a :py:class:`FileStatus` object that represents the path.
[ "Return", "a", ":", "py", ":", "class", ":", "FileStatus", "object", "that", "represents", "the", "path", "." ]
python
train
mnooner256/pyqrcode
pyqrcode/builder.py
https://github.com/mnooner256/pyqrcode/blob/674a77b5eaf850d063f518bd90c243ee34ad6b5d/pyqrcode/builder.py#L1244-L1391
def _png(code, version, file, scale=1, module_color=(0, 0, 0, 255), background=(255, 255, 255, 255), quiet_zone=4, debug=False): """See: pyqrcode.QRCode.png() This function was abstracted away from QRCode to allow for the output of QR codes during the build process, i.e. for debugging. It works ...
[ "def", "_png", "(", "code", ",", "version", ",", "file", ",", "scale", "=", "1", ",", "module_color", "=", "(", "0", ",", "0", ",", "0", ",", "255", ")", ",", "background", "=", "(", "255", ",", "255", ",", "255", ",", "255", ")", ",", "quiet...
See: pyqrcode.QRCode.png() This function was abstracted away from QRCode to allow for the output of QR codes during the build process, i.e. for debugging. It works just the same except you must specify the code's version. This is needed to calculate the PNG's size. This method will write the given...
[ "See", ":", "pyqrcode", ".", "QRCode", ".", "png", "()" ]
python
train
mandiant/ioc_writer
ioc_writer/ioc_common.py
https://github.com/mandiant/ioc_writer/blob/712247f3a10bdc2584fa18ac909fc763f71df21a/ioc_writer/ioc_common.py#L369-L381
def make_fileitem_peinfo_petimestamp(compile_time, condition='is', negate=False): """ Create a node for FileItem/PEInfo/PETimeStamp :return: A IndicatorItem represented as an Element node """ document = 'FileItem' search = 'FileItem/PEInfo/PETimeStamp' content_type = 'date' content ...
[ "def", "make_fileitem_peinfo_petimestamp", "(", "compile_time", ",", "condition", "=", "'is'", ",", "negate", "=", "False", ")", ":", "document", "=", "'FileItem'", "search", "=", "'FileItem/PEInfo/PETimeStamp'", "content_type", "=", "'date'", "content", "=", "compi...
Create a node for FileItem/PEInfo/PETimeStamp :return: A IndicatorItem represented as an Element node
[ "Create", "a", "node", "for", "FileItem", "/", "PEInfo", "/", "PETimeStamp", ":", "return", ":", "A", "IndicatorItem", "represented", "as", "an", "Element", "node" ]
python
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/shell.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/shell.py#L296-L323
def create_shortcuts(self): """Create shortcuts for ipyconsole.""" inspect = config_shortcut(self._control.inspect_current_object, context='Console', name='Inspect current object', parent=self) clear_console = config_shortcut(se...
[ "def", "create_shortcuts", "(", "self", ")", ":", "inspect", "=", "config_shortcut", "(", "self", ".", "_control", ".", "inspect_current_object", ",", "context", "=", "'Console'", ",", "name", "=", "'Inspect current object'", ",", "parent", "=", "self", ")", "...
Create shortcuts for ipyconsole.
[ "Create", "shortcuts", "for", "ipyconsole", "." ]
python
train
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/job.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/job.py#L2645-L2655
def ddl_target_table(self): """Optional[TableReference]: Return the DDL target table, present for CREATE/DROP TABLE/VIEW queries. See: https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#statistics.query.ddlTargetTable """ prop = self._job_statistics().get(...
[ "def", "ddl_target_table", "(", "self", ")", ":", "prop", "=", "self", ".", "_job_statistics", "(", ")", ".", "get", "(", "\"ddlTargetTable\"", ")", "if", "prop", "is", "not", "None", ":", "prop", "=", "TableReference", ".", "from_api_repr", "(", "prop", ...
Optional[TableReference]: Return the DDL target table, present for CREATE/DROP TABLE/VIEW queries. See: https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#statistics.query.ddlTargetTable
[ "Optional", "[", "TableReference", "]", ":", "Return", "the", "DDL", "target", "table", "present", "for", "CREATE", "/", "DROP", "TABLE", "/", "VIEW", "queries", "." ]
python
train
pycontribs/pyrax
pyrax/cloudmonitoring.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudmonitoring.py#L264-L281
def list(self, limit=None, marker=None, return_next=False): """ This is necessary to handle pagination correctly, as the Monitoring service defines 'marker' differently than most other services. For monitoring, 'marker' represents the first item in the next page, whereas other se...
[ "def", "list", "(", "self", ",", "limit", "=", "None", ",", "marker", "=", "None", ",", "return_next", "=", "False", ")", ":", "kwargs", "=", "{", "}", "if", "return_next", ":", "kwargs", "[", "\"other_keys\"", "]", "=", "\"metadata\"", "ret", "=", "...
This is necessary to handle pagination correctly, as the Monitoring service defines 'marker' differently than most other services. For monitoring, 'marker' represents the first item in the next page, whereas other services define it as the ID of the last item in the current page.
[ "This", "is", "necessary", "to", "handle", "pagination", "correctly", "as", "the", "Monitoring", "service", "defines", "marker", "differently", "than", "most", "other", "services", ".", "For", "monitoring", "marker", "represents", "the", "first", "item", "in", "...
python
train
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/datacenter.py
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/datacenter.py#L81-L91
def RootGroup(self): """Returns group object for datacenter root group. >>> clc.v2.Datacenter().RootGroup() <clc.APIv2.group.Group object at 0x105feacd0> >>> print _ WA1 Hardware """ return(clc.v2.Group(id=self.root_group_id,alias=self.alias,session=self.session))
[ "def", "RootGroup", "(", "self", ")", ":", "return", "(", "clc", ".", "v2", ".", "Group", "(", "id", "=", "self", ".", "root_group_id", ",", "alias", "=", "self", ".", "alias", ",", "session", "=", "self", ".", "session", ")", ")" ]
Returns group object for datacenter root group. >>> clc.v2.Datacenter().RootGroup() <clc.APIv2.group.Group object at 0x105feacd0> >>> print _ WA1 Hardware
[ "Returns", "group", "object", "for", "datacenter", "root", "group", "." ]
python
train
gautammishra/lyft-rides-python-sdk
lyft_rides/auth.py
https://github.com/gautammishra/lyft-rides-python-sdk/blob/b6d96a0fceaf7dc3425153c418a8e25c57803431/lyft_rides/auth.py#L61-L90
def _build_authorization_request_url( self, response_type, state=None ): """Form URL to request an auth code or access token. Parameters response_type (str) Only 'code' (Authorization Code Grant) supported at this time state (str) ...
[ "def", "_build_authorization_request_url", "(", "self", ",", "response_type", ",", "state", "=", "None", ")", ":", "if", "response_type", "not", "in", "auth", ".", "VALID_RESPONSE_TYPES", ":", "message", "=", "'{} is not a valid response type.'", "raise", "LyftIllegal...
Form URL to request an auth code or access token. Parameters response_type (str) Only 'code' (Authorization Code Grant) supported at this time state (str) Optional CSRF State token to send to server. Returns (str) The fu...
[ "Form", "URL", "to", "request", "an", "auth", "code", "or", "access", "token", ".", "Parameters", "response_type", "(", "str", ")", "Only", "code", "(", "Authorization", "Code", "Grant", ")", "supported", "at", "this", "time", "state", "(", "str", ")", "...
python
train
jaywink/federation
federation/entities/diaspora/utils.py
https://github.com/jaywink/federation/blob/59d31bb37e662891dbea72c1dee05dc53146c78b/federation/entities/diaspora/utils.py#L5-L13
def ensure_timezone(dt, tz=None): """ Make sure the datetime <dt> has a timezone set, using timezone <tz> if it doesn't. <tz> defaults to the local timezone. """ if dt.tzinfo is None: return dt.replace(tzinfo=tz or tzlocal()) else: return dt
[ "def", "ensure_timezone", "(", "dt", ",", "tz", "=", "None", ")", ":", "if", "dt", ".", "tzinfo", "is", "None", ":", "return", "dt", ".", "replace", "(", "tzinfo", "=", "tz", "or", "tzlocal", "(", ")", ")", "else", ":", "return", "dt" ]
Make sure the datetime <dt> has a timezone set, using timezone <tz> if it doesn't. <tz> defaults to the local timezone.
[ "Make", "sure", "the", "datetime", "<dt", ">", "has", "a", "timezone", "set", "using", "timezone", "<tz", ">", "if", "it", "doesn", "t", ".", "<tz", ">", "defaults", "to", "the", "local", "timezone", "." ]
python
train
kata198/NamedAtomicLock
NamedAtomicLock/__init__.py
https://github.com/kata198/NamedAtomicLock/blob/82d480b81daf4deea926964f18bb2e47d4f30f6c/NamedAtomicLock/__init__.py#L74-L126
def acquire(self, timeout=None): ''' acquire - Acquire given lock. Can be blocking or nonblocking by providing a timeout. Returns "True" if you got the lock, otherwise "False" @param timeout <None/float> - Max number of seconds to wait, or None to block until we can acquir...
[ "def", "acquire", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "self", ".", "held", "is", "True", ":", "# NOTE: Without some type of in-directory marker (like a uuid) we cannot", "# refresh an expired lock accurately", "if", "os", ".", "path", ".", ...
acquire - Acquire given lock. Can be blocking or nonblocking by providing a timeout. Returns "True" if you got the lock, otherwise "False" @param timeout <None/float> - Max number of seconds to wait, or None to block until we can acquire it. @return <bool> - True if you got the ...
[ "acquire", "-", "Acquire", "given", "lock", ".", "Can", "be", "blocking", "or", "nonblocking", "by", "providing", "a", "timeout", ".", "Returns", "True", "if", "you", "got", "the", "lock", "otherwise", "False" ]
python
train
iqbal-lab-org/cluster_vcf_records
cluster_vcf_records/vcf_record.py
https://github.com/iqbal-lab-org/cluster_vcf_records/blob/0db26af36b6da97a7361364457d2152dc756055c/cluster_vcf_records/vcf_record.py#L329-L333
def near_to_position(self, position, max_distance): '''Returns true iff the record is within max_distance of the given position. Note: chromosome name not checked, so that's up to you to do first.''' end = self.ref_end_pos() return self.POS <= position <= end or abs(position - self.POS) ...
[ "def", "near_to_position", "(", "self", ",", "position", ",", "max_distance", ")", ":", "end", "=", "self", ".", "ref_end_pos", "(", ")", "return", "self", ".", "POS", "<=", "position", "<=", "end", "or", "abs", "(", "position", "-", "self", ".", "POS"...
Returns true iff the record is within max_distance of the given position. Note: chromosome name not checked, so that's up to you to do first.
[ "Returns", "true", "iff", "the", "record", "is", "within", "max_distance", "of", "the", "given", "position", ".", "Note", ":", "chromosome", "name", "not", "checked", "so", "that", "s", "up", "to", "you", "to", "do", "first", "." ]
python
train
python/core-workflow
cherry_picker/cherry_picker/cherry_picker.py
https://github.com/python/core-workflow/blob/b93c76195f6db382cfcefee334380fb4c68d4e21/cherry_picker/cherry_picker/cherry_picker.py#L183-L201
def checkout_branch(self, branch_name): """ git checkout -b <branch_name> """ cmd = [ "git", "checkout", "-b", self.get_cherry_pick_branch(branch_name), f"{self.upstream}/{branch_name}", ] try: self.run_cmd(cmd) ...
[ "def", "checkout_branch", "(", "self", ",", "branch_name", ")", ":", "cmd", "=", "[", "\"git\"", ",", "\"checkout\"", ",", "\"-b\"", ",", "self", ".", "get_cherry_pick_branch", "(", "branch_name", ")", ",", "f\"{self.upstream}/{branch_name}\"", ",", "]", "try", ...
git checkout -b <branch_name>
[ "git", "checkout", "-", "b", "<branch_name", ">" ]
python
train
fastai/fastai
fastai/vision/image.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L195-L199
def affine_mat(self)->AffineMatrix: "Get the affine matrix that will be applied by `refresh`." if self._affine_mat is None: self._affine_mat = torch.eye(3).to(self.device) return self._affine_mat
[ "def", "affine_mat", "(", "self", ")", "->", "AffineMatrix", ":", "if", "self", ".", "_affine_mat", "is", "None", ":", "self", ".", "_affine_mat", "=", "torch", ".", "eye", "(", "3", ")", ".", "to", "(", "self", ".", "device", ")", "return", "self", ...
Get the affine matrix that will be applied by `refresh`.
[ "Get", "the", "affine", "matrix", "that", "will", "be", "applied", "by", "refresh", "." ]
python
train
geophysics-ubonn/crtomo_tools
src/cr_get_modelling_errors.py
https://github.com/geophysics-ubonn/crtomo_tools/blob/27c3e21a557f8df1c12455b96c4c2e00e08a5b4a/src/cr_get_modelling_errors.py#L110-L125
def get_R_mod(options, rho0): """Compute synthetic measurements over a homogeneous half-space """ tomodir = tdManager.tdMan( elem_file=options.elem_file, elec_file=options.elec_file, config_file=options.config_file, ) # set model tomodir.add_homogeneous_model(magnitude=r...
[ "def", "get_R_mod", "(", "options", ",", "rho0", ")", ":", "tomodir", "=", "tdManager", ".", "tdMan", "(", "elem_file", "=", "options", ".", "elem_file", ",", "elec_file", "=", "options", ".", "elec_file", ",", "config_file", "=", "options", ".", "config_f...
Compute synthetic measurements over a homogeneous half-space
[ "Compute", "synthetic", "measurements", "over", "a", "homogeneous", "half", "-", "space" ]
python
train
ansible/molecule
molecule/driver/base.py
https://github.com/ansible/molecule/blob/766dc35b0b0ce498cd5e3a62b40f828742d0d08c/molecule/driver/base.py#L173-L204
def status(self): """ Collects the instances state and returns a list. .. important:: Molecule assumes all instances were created successfully by Ansible, otherwise Ansible would return an error on create. This may prove to be a bad assumption. However, co...
[ "def", "status", "(", "self", ")", ":", "status_list", "=", "[", "]", "for", "platform", "in", "self", ".", "_config", ".", "platforms", ".", "instances", ":", "instance_name", "=", "platform", "[", "'name'", "]", "driver_name", "=", "self", ".", "name",...
Collects the instances state and returns a list. .. important:: Molecule assumes all instances were created successfully by Ansible, otherwise Ansible would return an error on create. This may prove to be a bad assumption. However, configuring Molecule's drive...
[ "Collects", "the", "instances", "state", "and", "returns", "a", "list", "." ]
python
train
Britefury/batchup
batchup/data_source.py
https://github.com/Britefury/batchup/blob/3fc2304e629f813c05f9e7a85a18acef3581a536/batchup/data_source.py#L1426-L1446
def samples_by_indices(self, indices): """ Gather a batch of samples by indices, applying any index mapping defined by the underlying data sources. Parameters ---------- indices: 1D-array of ints or slice An index array or a slice that selects the samples to ...
[ "def", "samples_by_indices", "(", "self", ",", "indices", ")", ":", "if", "not", "self", ".", "_random_access", ":", "raise", "TypeError", "(", "'samples_by_indices method not supported as one '", "'or more of the underlying data sources does '", "'not support random access'", ...
Gather a batch of samples by indices, applying any index mapping defined by the underlying data sources. Parameters ---------- indices: 1D-array of ints or slice An index array or a slice that selects the samples to retrieve Returns ------- nested li...
[ "Gather", "a", "batch", "of", "samples", "by", "indices", "applying", "any", "index", "mapping", "defined", "by", "the", "underlying", "data", "sources", "." ]
python
train
ga4gh/ga4gh-server
ga4gh/server/datamodel/__init__.py
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datamodel/__init__.py#L68-L90
def getFileHandle(self, dataFile, openMethod): """ Returns handle associated to the filename. If the file is already opened, update its priority in the cache and return its handle. Otherwise, open the file using openMethod, store it in the cache and return the corresponding handl...
[ "def", "getFileHandle", "(", "self", ",", "dataFile", ",", "openMethod", ")", ":", "if", "dataFile", "in", "self", ".", "_memoTable", ":", "handle", "=", "self", ".", "_memoTable", "[", "dataFile", "]", "self", ".", "_update", "(", "dataFile", ",", "hand...
Returns handle associated to the filename. If the file is already opened, update its priority in the cache and return its handle. Otherwise, open the file using openMethod, store it in the cache and return the corresponding handle.
[ "Returns", "handle", "associated", "to", "the", "filename", ".", "If", "the", "file", "is", "already", "opened", "update", "its", "priority", "in", "the", "cache", "and", "return", "its", "handle", ".", "Otherwise", "open", "the", "file", "using", "openMetho...
python
train
pytroll/satpy
satpy/readers/sar_c_safe.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/readers/sar_c_safe.py#L60-L79
def dictify(r, root=True): """Convert an ElementTree into a dict.""" if root: return {r.tag: dictify(r, False)} d = {} if r.text and r.text.strip(): try: return int(r.text) except ValueError: try: return float(r.text) except Val...
[ "def", "dictify", "(", "r", ",", "root", "=", "True", ")", ":", "if", "root", ":", "return", "{", "r", ".", "tag", ":", "dictify", "(", "r", ",", "False", ")", "}", "d", "=", "{", "}", "if", "r", ".", "text", "and", "r", ".", "text", ".", ...
Convert an ElementTree into a dict.
[ "Convert", "an", "ElementTree", "into", "a", "dict", "." ]
python
train
trailofbits/manticore
manticore/native/cpu/x86.py
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/native/cpu/x86.py#L2916-L2941
def XCHG(cpu, dest, src): """ Exchanges register/memory with register. Exchanges the contents of the destination (first) and source (second) operands. The operands can be two general-purpose registers or a register and a memory location. If a memory operand is referenced, the pr...
[ "def", "XCHG", "(", "cpu", ",", "dest", ",", "src", ")", ":", "temp", "=", "dest", ".", "read", "(", ")", "dest", ".", "write", "(", "src", ".", "read", "(", ")", ")", "src", ".", "write", "(", "temp", ")" ]
Exchanges register/memory with register. Exchanges the contents of the destination (first) and source (second) operands. The operands can be two general-purpose registers or a register and a memory location. If a memory operand is referenced, the processor's locking protocol is automati...
[ "Exchanges", "register", "/", "memory", "with", "register", "." ]
python
valid
saltstack/salt
salt/states/service.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/service.py#L338-L514
def running(name, enable=None, sig=None, init_delay=None, no_block=False, unmask=False, unmask_runtime=False, **kwargs): ''' Ensure that the service is running name The name of the init or rc script used to manage t...
[ "def", "running", "(", "name", ",", "enable", "=", "None", ",", "sig", "=", "None", ",", "init_delay", "=", "None", ",", "no_block", "=", "False", ",", "unmask", "=", "False", ",", "unmask_runtime", "=", "False", ",", "*", "*", "kwargs", ")", ":", ...
Ensure that the service is running name The name of the init or rc script used to manage the service enable Set the service to be enabled at boot time, ``True`` sets the service to be enabled, ``False`` sets the named service to be disabled. The default is ``None``, which does ...
[ "Ensure", "that", "the", "service", "is", "running" ]
python
train
sorgerlab/indra
indra/databases/mesh_client.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/mesh_client.py#L28-L51
def get_mesh_name_from_web(mesh_id): """Get the MESH label for the given MESH ID using the NLM REST API. Parameters ---------- mesh_id : str MESH Identifier, e.g. 'D003094'. Returns ------- str Label for the MESH ID, or None if the query failed or no label was found...
[ "def", "get_mesh_name_from_web", "(", "mesh_id", ")", ":", "url", "=", "MESH_URL", "+", "mesh_id", "+", "'.json'", "resp", "=", "requests", ".", "get", "(", "url", ")", "if", "resp", ".", "status_code", "!=", "200", ":", "return", "None", "mesh_json", "=...
Get the MESH label for the given MESH ID using the NLM REST API. Parameters ---------- mesh_id : str MESH Identifier, e.g. 'D003094'. Returns ------- str Label for the MESH ID, or None if the query failed or no label was found.
[ "Get", "the", "MESH", "label", "for", "the", "given", "MESH", "ID", "using", "the", "NLM", "REST", "API", "." ]
python
train
ultrabug/py3status
py3status/core.py
https://github.com/ultrabug/py3status/blob/4c105f1b44f7384ca4f7da5f821a47e468c7dee2/py3status/core.py#L292-L303
def timeout_queue_add(self, item, cache_time=0): """ Add a item to be run at a future time. This must be a Module, I3statusModule or a Task """ # add the info to the add queue. We do this so that actually adding # the module is done in the core thread. self.timeo...
[ "def", "timeout_queue_add", "(", "self", ",", "item", ",", "cache_time", "=", "0", ")", ":", "# add the info to the add queue. We do this so that actually adding", "# the module is done in the core thread.", "self", ".", "timeout_add_queue", ".", "append", "(", "(", "item"...
Add a item to be run at a future time. This must be a Module, I3statusModule or a Task
[ "Add", "a", "item", "to", "be", "run", "at", "a", "future", "time", ".", "This", "must", "be", "a", "Module", "I3statusModule", "or", "a", "Task" ]
python
train
Becksteinlab/GromacsWrapper
gromacs/cbook.py
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L212-L343
def trj_fitandcenter(xy=False, **kwargs): """Center everything and make a compact representation (pass 1) and fit the system to a reference (pass 2). :Keywords: *s* input structure file (tpr file required to make molecule whole); if a list or tuple is provided then s[0] is used for...
[ "def", "trj_fitandcenter", "(", "xy", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "xy", ":", "fitmode", "=", "'rotxy+transxy'", "kwargs", ".", "pop", "(", "'fit'", ",", "None", ")", "else", ":", "fitmode", "=", "kwargs", ".", "pop", "(", ...
Center everything and make a compact representation (pass 1) and fit the system to a reference (pass 2). :Keywords: *s* input structure file (tpr file required to make molecule whole); if a list or tuple is provided then s[0] is used for pass 1 (should be a tpr) and s[1] is ...
[ "Center", "everything", "and", "make", "a", "compact", "representation", "(", "pass", "1", ")", "and", "fit", "the", "system", "to", "a", "reference", "(", "pass", "2", ")", "." ]
python
valid
adafruit/Adafruit_CircuitPython_ADS1x15
adafruit_ads1x15/analog_in.py
https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15/blob/5ba760c6de40824386f1df343603eab77d3e336c/adafruit_ads1x15/analog_in.py#L71-L73
def value(self): """Returns the value of an ADC pin as an integer.""" return self._ads.read(self._pin_setting, is_differential=self.is_differential)
[ "def", "value", "(", "self", ")", ":", "return", "self", ".", "_ads", ".", "read", "(", "self", ".", "_pin_setting", ",", "is_differential", "=", "self", ".", "is_differential", ")" ]
Returns the value of an ADC pin as an integer.
[ "Returns", "the", "value", "of", "an", "ADC", "pin", "as", "an", "integer", "." ]
python
train
CityOfZion/neo-python
neo/Network/NodeLeader.py
https://github.com/CityOfZion/neo-python/blob/fe90f62e123d720d4281c79af0598d9df9e776fb/neo/Network/NodeLeader.py#L553-L588
def Relay(self, inventory): """ Relay the inventory to the remote client. Args: inventory (neo.Network.Inventory): Returns: bool: True if relayed successfully. False otherwise. """ if type(inventory) is MinerTransaction: return False ...
[ "def", "Relay", "(", "self", ",", "inventory", ")", ":", "if", "type", "(", "inventory", ")", "is", "MinerTransaction", ":", "return", "False", "if", "inventory", ".", "Hash", ".", "ToBytes", "(", ")", "in", "self", ".", "KnownHashes", ":", "return", "...
Relay the inventory to the remote client. Args: inventory (neo.Network.Inventory): Returns: bool: True if relayed successfully. False otherwise.
[ "Relay", "the", "inventory", "to", "the", "remote", "client", "." ]
python
train