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
reingart/gui2py
gui/doc/ext/autosummary/__init__.py
https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/doc/ext/autosummary/__init__.py#L132-L165
def get_documenter(obj, parent): """Get an autodoc.Documenter class suitable for documenting the given object. *obj* is the Python object to be documented, and *parent* is an another Python object (e.g. a module or a class) to which *obj* belongs to. """ from sphinx.ext.autodoc import AutoD...
[ "def", "get_documenter", "(", "obj", ",", "parent", ")", ":", "from", "sphinx", ".", "ext", ".", "autodoc", "import", "AutoDirective", ",", "DataDocumenter", ",", "ModuleDocumenter", "if", "inspect", ".", "ismodule", "(", "obj", ")", ":", "# ModuleDocumenter.c...
Get an autodoc.Documenter class suitable for documenting the given object. *obj* is the Python object to be documented, and *parent* is an another Python object (e.g. a module or a class) to which *obj* belongs to.
[ "Get", "an", "autodoc", ".", "Documenter", "class", "suitable", "for", "documenting", "the", "given", "object", "." ]
python
test
bhmm/bhmm
bhmm/hidden/api.py
https://github.com/bhmm/bhmm/blob/9804d18c2ddb684fb4d90b544cc209617a89ca9a/bhmm/hidden/api.py#L277-L302
def sample_path(alpha, A, pobs, T=None): """ Sample the hidden pathway S from the conditional distribution P ( S | Parameters, Observations ) Parameters ---------- alpha : ndarray((T,N), dtype = float), optional, default = None alpha[t,i] is the ith forward coefficient of time t. A : ndarra...
[ "def", "sample_path", "(", "alpha", ",", "A", ",", "pobs", ",", "T", "=", "None", ")", ":", "if", "__impl__", "==", "__IMPL_PYTHON__", ":", "return", "ip", ".", "sample_path", "(", "alpha", ",", "A", ",", "pobs", ",", "T", "=", "T", ",", "dtype", ...
Sample the hidden pathway S from the conditional distribution P ( S | Parameters, Observations ) Parameters ---------- alpha : ndarray((T,N), dtype = float), optional, default = None alpha[t,i] is the ith forward coefficient of time t. A : ndarray((N,N), dtype = float) transition matrix...
[ "Sample", "the", "hidden", "pathway", "S", "from", "the", "conditional", "distribution", "P", "(", "S", "|", "Parameters", "Observations", ")" ]
python
train
threeML/astromodels
astromodels/core/sky_direction.py
https://github.com/threeML/astromodels/blob/9aac365a372f77603039533df9a6b694c1e360d5/astromodels/core/sky_direction.py#L216-L229
def parameters(self): """ Get the dictionary of parameters (either ra,dec or l,b) :return: dictionary of parameters """ if self._coord_type == 'galactic': return collections.OrderedDict((('l', self.l), ('b', self.b))) else: return collections....
[ "def", "parameters", "(", "self", ")", ":", "if", "self", ".", "_coord_type", "==", "'galactic'", ":", "return", "collections", ".", "OrderedDict", "(", "(", "(", "'l'", ",", "self", ".", "l", ")", ",", "(", "'b'", ",", "self", ".", "b", ")", ")", ...
Get the dictionary of parameters (either ra,dec or l,b) :return: dictionary of parameters
[ "Get", "the", "dictionary", "of", "parameters", "(", "either", "ra", "dec", "or", "l", "b", ")" ]
python
train
resync/resync
resync/resource_set.py
https://github.com/resync/resync/blob/98292c17b2c00f2d6f5191c6ab51fef8c292a018/resync/resource_set.py#L30-L36
def add(self, resource, replace=False): """Add just a single resource.""" uri = resource.uri if (uri in self and not replace): raise ResourceSetDupeError( "Attempt to add resource already in this set") self[uri] = resource
[ "def", "add", "(", "self", ",", "resource", ",", "replace", "=", "False", ")", ":", "uri", "=", "resource", ".", "uri", "if", "(", "uri", "in", "self", "and", "not", "replace", ")", ":", "raise", "ResourceSetDupeError", "(", "\"Attempt to add resource alre...
Add just a single resource.
[ "Add", "just", "a", "single", "resource", "." ]
python
train
MLAB-project/pymlab
src/pymlab/sensors/gpio.py
https://github.com/MLAB-project/pymlab/blob/d18d858ae83b203defcf2aead0dbd11b3c444658/src/pymlab/sensors/gpio.py#L236-L240
def set_pullups(self, port0 = 0x00, port1 = 0x00): 'Sets INPUT (1) or OUTPUT (0) direction on pins. Inversion setting is applicable for input pins 1-inverted 0-noninverted input polarity.' self.bus.write_byte_data(self.address, self.PULLUP_PORT0, port0) self.bus.write_byte_data(self.address, se...
[ "def", "set_pullups", "(", "self", ",", "port0", "=", "0x00", ",", "port1", "=", "0x00", ")", ":", "self", ".", "bus", ".", "write_byte_data", "(", "self", ".", "address", ",", "self", ".", "PULLUP_PORT0", ",", "port0", ")", "self", ".", "bus", ".", ...
Sets INPUT (1) or OUTPUT (0) direction on pins. Inversion setting is applicable for input pins 1-inverted 0-noninverted input polarity.
[ "Sets", "INPUT", "(", "1", ")", "or", "OUTPUT", "(", "0", ")", "direction", "on", "pins", ".", "Inversion", "setting", "is", "applicable", "for", "input", "pins", "1", "-", "inverted", "0", "-", "noninverted", "input", "polarity", "." ]
python
train
albu/albumentations
albumentations/augmentations/functional.py
https://github.com/albu/albumentations/blob/b31393cd6126516d37a84e44c879bd92c68ffc93/albumentations/augmentations/functional.py#L949-L957
def crop_bbox_by_coords(bbox, crop_coords, crop_height, crop_width, rows, cols): """Crop a bounding box using the provided coordinates of bottom-left and top-right corners in pixels and the required height and width of the crop. """ bbox = denormalize_bbox(bbox, rows, cols) x_min, y_min, x_max, y_ma...
[ "def", "crop_bbox_by_coords", "(", "bbox", ",", "crop_coords", ",", "crop_height", ",", "crop_width", ",", "rows", ",", "cols", ")", ":", "bbox", "=", "denormalize_bbox", "(", "bbox", ",", "rows", ",", "cols", ")", "x_min", ",", "y_min", ",", "x_max", ",...
Crop a bounding box using the provided coordinates of bottom-left and top-right corners in pixels and the required height and width of the crop.
[ "Crop", "a", "bounding", "box", "using", "the", "provided", "coordinates", "of", "bottom", "-", "left", "and", "top", "-", "right", "corners", "in", "pixels", "and", "the", "required", "height", "and", "width", "of", "the", "crop", "." ]
python
train
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/mavplayback.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/tools/mavplayback.py#L139-L148
def find_message(self): '''find the next valid message''' while True: self.msg = self.mlog.recv_match(condition=args.condition) if self.msg is not None and self.msg.get_type() != 'BAD_DATA': break if self.mlog.f.tell() > self.filesize - 10: ...
[ "def", "find_message", "(", "self", ")", ":", "while", "True", ":", "self", ".", "msg", "=", "self", ".", "mlog", ".", "recv_match", "(", "condition", "=", "args", ".", "condition", ")", "if", "self", ".", "msg", "is", "not", "None", "and", "self", ...
find the next valid message
[ "find", "the", "next", "valid", "message" ]
python
train
rosenbrockc/fortpy
fortpy/interop/ftypes.py
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L683-L690
def _py_outvar(parameter, lparams, tab): """Returns the code to produce a ctypes output variable for interacting with fortran. """ if ("out" in parameter.direction and parameter.D > 0 and ":" in parameter.dimension and ("allocatable" in parameter.modifiers or "pointer" in parameter.modifiers)): ...
[ "def", "_py_outvar", "(", "parameter", ",", "lparams", ",", "tab", ")", ":", "if", "(", "\"out\"", "in", "parameter", ".", "direction", "and", "parameter", ".", "D", ">", "0", "and", "\":\"", "in", "parameter", ".", "dimension", "and", "(", "\"allocatabl...
Returns the code to produce a ctypes output variable for interacting with fortran.
[ "Returns", "the", "code", "to", "produce", "a", "ctypes", "output", "variable", "for", "interacting", "with", "fortran", "." ]
python
train
tanghaibao/goatools
goatools/rpt/rpt_lev_depth.py
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/rpt/rpt_lev_depth.py#L87-L90
def write_summary_cnts_all(self): """Write summary of level and depth counts for all active GO Terms.""" cnts = self.get_cnts_levels_depths_recs(set(self.obo.values())) self._write_summary_cnts(cnts)
[ "def", "write_summary_cnts_all", "(", "self", ")", ":", "cnts", "=", "self", ".", "get_cnts_levels_depths_recs", "(", "set", "(", "self", ".", "obo", ".", "values", "(", ")", ")", ")", "self", ".", "_write_summary_cnts", "(", "cnts", ")" ]
Write summary of level and depth counts for all active GO Terms.
[ "Write", "summary", "of", "level", "and", "depth", "counts", "for", "all", "active", "GO", "Terms", "." ]
python
train
openpermissions/koi
koi/commands.py
https://github.com/openpermissions/koi/blob/d721f8e1dfa8f07ad265d9dec32e8aaf80a9f281/koi/commands.py#L202-L214
def _get_existing_conf(config): """ Read existing local.conf and strip out service id and client secret :param config: Location of config files :param lines of existing config (excluding service id and client secret) """ try: with open(os.path.join(config, 'local.conf'), 'r') as f: ...
[ "def", "_get_existing_conf", "(", "config", ")", ":", "try", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "config", ",", "'local.conf'", ")", ",", "'r'", ")", "as", "f", ":", "lines", "=", "[", "line", "for", "line", "in", "f", ...
Read existing local.conf and strip out service id and client secret :param config: Location of config files :param lines of existing config (excluding service id and client secret)
[ "Read", "existing", "local", ".", "conf", "and", "strip", "out", "service", "id", "and", "client", "secret", ":", "param", "config", ":", "Location", "of", "config", "files", ":", "param", "lines", "of", "existing", "config", "(", "excluding", "service", "...
python
train
senaite/senaite.core
bika/lims/exportimport/instruments/sysmex/xs/i500.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/exportimport/instruments/sysmex/xs/i500.py#L31-L46
def getForm(instrument_name, request): """ Since 500i and 1000i print the same results structure (https://jira.bikalabs.com/browse/LIMS-1571), this function will be overwrote on i1000 importer to save code. :param instrument_name: a string containing the instrument's name with the format: 'sysmex_xs_500...
[ "def", "getForm", "(", "instrument_name", ",", "request", ")", ":", "d", "=", "{", "'infile'", ":", "request", ".", "form", "[", "instrument_name", "+", "'_file'", "]", ",", "'fileformat'", ":", "request", ".", "form", "[", "instrument_name", "+", "'_forma...
Since 500i and 1000i print the same results structure (https://jira.bikalabs.com/browse/LIMS-1571), this function will be overwrote on i1000 importer to save code. :param instrument_name: a string containing the instrument's name with the format: 'sysmex_xs_500i' :param request: the request object :retu...
[ "Since", "500i", "and", "1000i", "print", "the", "same", "results", "structure", "(", "https", ":", "//", "jira", ".", "bikalabs", ".", "com", "/", "browse", "/", "LIMS", "-", "1571", ")", "this", "function", "will", "be", "overwrote", "on", "i1000", "...
python
train
cloudera/cm_api
python/src/cm_api/endpoints/clusters.py
https://github.com/cloudera/cm_api/blob/5d2512375bd94684b4da36df9e0d9177865ffcbb/python/src/cm_api/endpoints/clusters.py#L387-L393
def delete_host_template(self, name): """ Deletes a host template. @param name: Name of the host template to delete. @return: An ApiHostTemplate object. """ return host_templates.delete_host_template(self._get_resource_root(), name, self.name)
[ "def", "delete_host_template", "(", "self", ",", "name", ")", ":", "return", "host_templates", ".", "delete_host_template", "(", "self", ".", "_get_resource_root", "(", ")", ",", "name", ",", "self", ".", "name", ")" ]
Deletes a host template. @param name: Name of the host template to delete. @return: An ApiHostTemplate object.
[ "Deletes", "a", "host", "template", "." ]
python
train
pgmpy/pgmpy
pgmpy/factors/discrete/CPD.py
https://github.com/pgmpy/pgmpy/blob/9381a66aba3c3871d3ccd00672b148d17d63239e/pgmpy/factors/discrete/CPD.py#L354-L464
def reorder_parents(self, new_order, inplace=True): """ Returns a new cpd table according to provided order. Parameters ---------- new_order: list list of new ordering of variables inplace: boolean If inplace == True it will modify the CPD itself...
[ "def", "reorder_parents", "(", "self", ",", "new_order", ",", "inplace", "=", "True", ")", ":", "if", "(", "len", "(", "self", ".", "variables", ")", "<=", "1", "or", "(", "set", "(", "new_order", ")", "-", "set", "(", "self", ".", "variables", ")"...
Returns a new cpd table according to provided order. Parameters ---------- new_order: list list of new ordering of variables inplace: boolean If inplace == True it will modify the CPD itself otherwise new value will be returned without affecting old ...
[ "Returns", "a", "new", "cpd", "table", "according", "to", "provided", "order", "." ]
python
train
googledatalab/pydatalab
solutionbox/structured_data/mltoolbox/_structured_data/_package.py
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/solutionbox/structured_data/mltoolbox/_structured_data/_package.py#L550-L592
def predict(data, training_dir=None, model_name=None, model_version=None, cloud=False): """Runs prediction locally or on the cloud. Args: data: List of csv strings or a Pandas DataFrame that match the model schema. training_dir: local path to the trained output folder. model_name: deployed model name ...
[ "def", "predict", "(", "data", ",", "training_dir", "=", "None", ",", "model_name", "=", "None", ",", "model_version", "=", "None", ",", "cloud", "=", "False", ")", ":", "if", "cloud", ":", "if", "not", "model_version", "or", "not", "model_name", ":", ...
Runs prediction locally or on the cloud. Args: data: List of csv strings or a Pandas DataFrame that match the model schema. training_dir: local path to the trained output folder. model_name: deployed model name model_version: depoyed model version cloud: bool. If False, does local prediction and ...
[ "Runs", "prediction", "locally", "or", "on", "the", "cloud", "." ]
python
train
sethmlarson/virtualbox-python
virtualbox/library.py
https://github.com/sethmlarson/virtualbox-python/blob/706c8e3f6e3aee17eb06458e73cbb4bc2d37878b/virtualbox/library.py#L28586-L28607
def on_shared_folder_change(self, global_p): """Triggered when a permanent (global or machine) shared folder has been created or removed. We don't pass shared folder parameters in this notification because the order in which parallel notifications are delivered is not defined, ...
[ "def", "on_shared_folder_change", "(", "self", ",", "global_p", ")", ":", "if", "not", "isinstance", "(", "global_p", ",", "bool", ")", ":", "raise", "TypeError", "(", "\"global_p can only be an instance of type bool\"", ")", "self", ".", "_call", "(", "\"onShared...
Triggered when a permanent (global or machine) shared folder has been created or removed. We don't pass shared folder parameters in this notification because the order in which parallel notifications are delivered is not defined, therefore it could happen that these parameters w...
[ "Triggered", "when", "a", "permanent", "(", "global", "or", "machine", ")", "shared", "folder", "has", "been", "created", "or", "removed", ".", "We", "don", "t", "pass", "shared", "folder", "parameters", "in", "this", "notification", "because", "the", "order...
python
train
inasafe/inasafe
safe/gui/tools/wizard/step_kw44_fields_mapping.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_kw44_fields_mapping.py#L117-L133
def get_field_mapping(self): """Obtain metadata from current state of the widget. Null or empty list will be removed. :returns: Dictionary of values by type in this format: {'fields': {}, 'values': {}}. :rtype: dict """ field_mapping = self.field_mapping_wid...
[ "def", "get_field_mapping", "(", "self", ")", ":", "field_mapping", "=", "self", ".", "field_mapping_widget", ".", "get_field_mapping", "(", ")", "for", "k", ",", "v", "in", "list", "(", "field_mapping", "[", "'values'", "]", ".", "items", "(", ")", ")", ...
Obtain metadata from current state of the widget. Null or empty list will be removed. :returns: Dictionary of values by type in this format: {'fields': {}, 'values': {}}. :rtype: dict
[ "Obtain", "metadata", "from", "current", "state", "of", "the", "widget", "." ]
python
train
sorgerlab/indra
indra/databases/cbio_client.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L223-L258
def get_genetic_profiles(study_id, profile_filter=None): """Return all the genetic profiles (data sets) for a given study. Genetic profiles are different types of data for a given study. For instance the study 'cellline_ccle_broad' has profiles such as 'cellline_ccle_broad_mutations' for mutations, 'ce...
[ "def", "get_genetic_profiles", "(", "study_id", ",", "profile_filter", "=", "None", ")", ":", "data", "=", "{", "'cmd'", ":", "'getGeneticProfiles'", ",", "'cancer_study_id'", ":", "study_id", "}", "df", "=", "send_request", "(", "*", "*", "data", ")", "res"...
Return all the genetic profiles (data sets) for a given study. Genetic profiles are different types of data for a given study. For instance the study 'cellline_ccle_broad' has profiles such as 'cellline_ccle_broad_mutations' for mutations, 'cellline_ccle_broad_CNA' for copy number alterations, etc. ...
[ "Return", "all", "the", "genetic", "profiles", "(", "data", "sets", ")", "for", "a", "given", "study", "." ]
python
train
pandas-dev/pandas
pandas/core/reshape/concat.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/reshape/concat.py#L24-L229
def concat(objs, axis=0, join='outer', join_axes=None, ignore_index=False, keys=None, levels=None, names=None, verify_integrity=False, sort=None, copy=True): """ Concatenate pandas objects along a particular axis with optional set logic along the other axes. Can also add a layer o...
[ "def", "concat", "(", "objs", ",", "axis", "=", "0", ",", "join", "=", "'outer'", ",", "join_axes", "=", "None", ",", "ignore_index", "=", "False", ",", "keys", "=", "None", ",", "levels", "=", "None", ",", "names", "=", "None", ",", "verify_integrit...
Concatenate pandas objects along a particular axis with optional set logic along the other axes. Can also add a layer of hierarchical indexing on the concatenation axis, which may be useful if the labels are the same (or overlapping) on the passed axis number. Parameters ---------- objs : ...
[ "Concatenate", "pandas", "objects", "along", "a", "particular", "axis", "with", "optional", "set", "logic", "along", "the", "other", "axes", "." ]
python
train
Duke-GCB/DukeDSClient
ddsc/core/parallel.py
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/parallel.py#L233-L245
def process_single_message_from_queue(self): """ Tries to read a single message from the queue and let the associated task process it. :return: bool: True if we processed a message, otherwise False """ try: message = self.message_queue.get_nowait() task_id...
[ "def", "process_single_message_from_queue", "(", "self", ")", ":", "try", ":", "message", "=", "self", ".", "message_queue", ".", "get_nowait", "(", ")", "task_id", ",", "data", "=", "message", "task", "=", "self", ".", "task_id_to_task", "[", "task_id", "]"...
Tries to read a single message from the queue and let the associated task process it. :return: bool: True if we processed a message, otherwise False
[ "Tries", "to", "read", "a", "single", "message", "from", "the", "queue", "and", "let", "the", "associated", "task", "process", "it", ".", ":", "return", ":", "bool", ":", "True", "if", "we", "processed", "a", "message", "otherwise", "False" ]
python
train
aquatix/python-utilkit
utilkit/stringutil.py
https://github.com/aquatix/python-utilkit/blob/1b4a4175381d2175592208619315f399610f915c/utilkit/stringutil.py#L6-L20
def safe_unicode(obj, *args): """ return the unicode representation of obj """ try: return unicode(obj, *args) # noqa for undefined-variable except UnicodeDecodeError: # obj is byte string ascii_text = str(obj).encode('string_escape') try: return unicode(ascii_te...
[ "def", "safe_unicode", "(", "obj", ",", "*", "args", ")", ":", "try", ":", "return", "unicode", "(", "obj", ",", "*", "args", ")", "# noqa for undefined-variable", "except", "UnicodeDecodeError", ":", "# obj is byte string", "ascii_text", "=", "str", "(", "obj...
return the unicode representation of obj
[ "return", "the", "unicode", "representation", "of", "obj" ]
python
train
QuantEcon/QuantEcon.py
quantecon/quad.py
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/quad.py#L685-L730
def _qnwcheb1(n, a, b): """ Compute univariate Guass-Checbychev quadrature nodes and weights Parameters ---------- n : int The number of nodes a : int The lower endpoint b : int The upper endpoint Returns ------- nodes : np.ndarray(dtype=float) ...
[ "def", "_qnwcheb1", "(", "n", ",", "a", ",", "b", ")", ":", "nodes", "=", "(", "b", "+", "a", ")", "/", "2", "-", "(", "b", "-", "a", ")", "/", "2", "*", "np", ".", "cos", "(", "np", ".", "pi", "/", "n", "*", "np", ".", "linspace", "(...
Compute univariate Guass-Checbychev quadrature nodes and weights Parameters ---------- n : int The number of nodes a : int The lower endpoint b : int The upper endpoint Returns ------- nodes : np.ndarray(dtype=float) An n element array of nodes no...
[ "Compute", "univariate", "Guass", "-", "Checbychev", "quadrature", "nodes", "and", "weights" ]
python
train
wimglenn/wimpy
wimpy/util.py
https://github.com/wimglenn/wimpy/blob/4e8ebe4e7052d88c9f88ac7dcaa1b587cc2cf86e/wimpy/util.py#L61-L68
def strip_suffix(s, suffix, strict=False): """Removes the suffix, if it's there, otherwise returns input string unchanged. If strict is True, also ensures the suffix was present""" if s.endswith(suffix): return s[: len(s) - len(suffix)] elif strict: raise WimpyError("string doesn't end w...
[ "def", "strip_suffix", "(", "s", ",", "suffix", ",", "strict", "=", "False", ")", ":", "if", "s", ".", "endswith", "(", "suffix", ")", ":", "return", "s", "[", ":", "len", "(", "s", ")", "-", "len", "(", "suffix", ")", "]", "elif", "strict", ":...
Removes the suffix, if it's there, otherwise returns input string unchanged. If strict is True, also ensures the suffix was present
[ "Removes", "the", "suffix", "if", "it", "s", "there", "otherwise", "returns", "input", "string", "unchanged", ".", "If", "strict", "is", "True", "also", "ensures", "the", "suffix", "was", "present" ]
python
test
materialsproject/pymatgen-db
matgendb/builders/core.py
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/builders/core.py#L45-L80
def parse_fn_docstring(fn): """Get parameter and return types from function's docstring. Docstrings must use this format:: :param foo: What is foo :type foo: int :return: What is returned :rtype: double :return: A map of names, each with keys 'type' and 'desc'. :rtype: tup...
[ "def", "parse_fn_docstring", "(", "fn", ")", ":", "doc", "=", "fn", ".", "__doc__", "params", ",", "return_", "=", "{", "}", ",", "{", "}", "param_order", "=", "[", "]", "for", "line", "in", "doc", ".", "split", "(", "\"\\n\"", ")", ":", "line", ...
Get parameter and return types from function's docstring. Docstrings must use this format:: :param foo: What is foo :type foo: int :return: What is returned :rtype: double :return: A map of names, each with keys 'type' and 'desc'. :rtype: tuple(dict)
[ "Get", "parameter", "and", "return", "types", "from", "function", "s", "docstring", "." ]
python
train
census-instrumentation/opencensus-python
opencensus/stats/measurement_map.py
https://github.com/census-instrumentation/opencensus-python/blob/992b223f7e34c5dcb65922b7d5c827e7a1351e7d/opencensus/stats/measurement_map.py#L93-L119
def record(self, tags=None): """records all the measures at the same time with a tag_map. tag_map could either be explicitly passed to the method, or implicitly read from current runtime context. """ if tags is None: tags = TagContext.get() if self._invalid: ...
[ "def", "record", "(", "self", ",", "tags", "=", "None", ")", ":", "if", "tags", "is", "None", ":", "tags", "=", "TagContext", ".", "get", "(", ")", "if", "self", ".", "_invalid", ":", "logger", ".", "warning", "(", "\"Measurement map has included negativ...
records all the measures at the same time with a tag_map. tag_map could either be explicitly passed to the method, or implicitly read from current runtime context.
[ "records", "all", "the", "measures", "at", "the", "same", "time", "with", "a", "tag_map", ".", "tag_map", "could", "either", "be", "explicitly", "passed", "to", "the", "method", "or", "implicitly", "read", "from", "current", "runtime", "context", "." ]
python
train
apache/incubator-mxnet
example/ssd/symbol/common.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/example/ssd/symbol/common.py#L153-L304
def multibox_layer(from_layers, num_classes, sizes=[.2, .95], ratios=[1], normalization=-1, num_channels=[], clip=False, interm_layer=0, steps=[]): """ the basic aggregation module for SSD detection. Takes in multiple layers, generate multiple object detection targets...
[ "def", "multibox_layer", "(", "from_layers", ",", "num_classes", ",", "sizes", "=", "[", ".2", ",", ".95", "]", ",", "ratios", "=", "[", "1", "]", ",", "normalization", "=", "-", "1", ",", "num_channels", "=", "[", "]", ",", "clip", "=", "False", "...
the basic aggregation module for SSD detection. Takes in multiple layers, generate multiple object detection targets by customized layers Parameters: ---------- from_layers : list of mx.symbol generate multibox detection from layers num_classes : int number of classes excluding back...
[ "the", "basic", "aggregation", "module", "for", "SSD", "detection", ".", "Takes", "in", "multiple", "layers", "generate", "multiple", "object", "detection", "targets", "by", "customized", "layers" ]
python
train
berkeley-cocosci/Wallace
wallace/custom.py
https://github.com/berkeley-cocosci/Wallace/blob/3650c0bc3b0804d0adb1d178c5eba9992babb1b0/wallace/custom.py#L419-L431
def get_participant(participant_id): """Get the participant with the given id.""" try: ppt = models.Participant.query.filter_by(id=participant_id).one() except NoResultFound: return error_response( error_type="/participant GET: no participant found", status=403) ...
[ "def", "get_participant", "(", "participant_id", ")", ":", "try", ":", "ppt", "=", "models", ".", "Participant", ".", "query", ".", "filter_by", "(", "id", "=", "participant_id", ")", ".", "one", "(", ")", "except", "NoResultFound", ":", "return", "error_r...
Get the participant with the given id.
[ "Get", "the", "participant", "with", "the", "given", "id", "." ]
python
train
mitsei/dlkit
dlkit/json_/learning/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/sessions.py#L3343-L3368
def delete_activity(self, activity_id): """Deletes the ``Activity`` identified by the given ``Id``. arg: activity_id (osid.id.Id): the ``Id`` of the ``Activity`` to delete raise: NotFound - an ``Activity`` was not found identified by the given ``Id`` ...
[ "def", "delete_activity", "(", "self", ",", "activity_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceAdminSession.delete_resource_template", "collection", "=", "JSONClientValidated", "(", "'learning'", ",", "collection", "=", "'Activity'", ",", "ru...
Deletes the ``Activity`` identified by the given ``Id``. arg: activity_id (osid.id.Id): the ``Id`` of the ``Activity`` to delete raise: NotFound - an ``Activity`` was not found identified by the given ``Id`` raise: NullArgument - ``activity_id`` is ``null`` ...
[ "Deletes", "the", "Activity", "identified", "by", "the", "given", "Id", "." ]
python
train
briancappello/flask-unchained
flask_unchained/bundles/controller/decorators.py
https://github.com/briancappello/flask-unchained/blob/4d536cb90e2cc4829c1c05f2c74d3e22901a1399/flask_unchained/bundles/controller/decorators.py#L5-L57
def route(rule=None, blueprint=None, defaults=None, endpoint=None, is_member=False, methods=None, only_if=None, **rule_options): """ Decorator to set default route rules for a view function. The arguments this function accepts are very similar to Flask's :meth:`~flask.Flask.route`, however, th...
[ "def", "route", "(", "rule", "=", "None", ",", "blueprint", "=", "None", ",", "defaults", "=", "None", ",", "endpoint", "=", "None", ",", "is_member", "=", "False", ",", "methods", "=", "None", ",", "only_if", "=", "None", ",", "*", "*", "rule_option...
Decorator to set default route rules for a view function. The arguments this function accepts are very similar to Flask's :meth:`~flask.Flask.route`, however, the ``is_member`` perhaps deserves an example:: class UserResource(ModelResource): class Meta: model = User ...
[ "Decorator", "to", "set", "default", "route", "rules", "for", "a", "view", "function", ".", "The", "arguments", "this", "function", "accepts", "are", "very", "similar", "to", "Flask", "s", ":", "meth", ":", "~flask", ".", "Flask", ".", "route", "however", ...
python
train
empirical-org/Quill-NLP-Tools-and-Datasets
quillnlp/srl.py
https://github.com/empirical-org/Quill-NLP-Tools-and-Datasets/blob/f2ff579ddf3a556d9cdc47c5f702422fa06863d9/quillnlp/srl.py#L4-L16
def perform_srl(responses, prompt): """ Perform semantic role labeling on a list of responses, given a prompt.""" predictor = Predictor.from_path("https://s3-us-west-2.amazonaws.com/allennlp/models/srl-model-2018.05.25.tar.gz") sentences = [{"sentence": prompt + " " + response} for response in responses] ...
[ "def", "perform_srl", "(", "responses", ",", "prompt", ")", ":", "predictor", "=", "Predictor", ".", "from_path", "(", "\"https://s3-us-west-2.amazonaws.com/allennlp/models/srl-model-2018.05.25.tar.gz\"", ")", "sentences", "=", "[", "{", "\"sentence\"", ":", "prompt", "...
Perform semantic role labeling on a list of responses, given a prompt.
[ "Perform", "semantic", "role", "labeling", "on", "a", "list", "of", "responses", "given", "a", "prompt", "." ]
python
train
basho/riak-python-client
riak/datatypes/map.py
https://github.com/basho/riak-python-client/blob/91de13a16607cdf553d1a194e762734e3bec4231/riak/datatypes/map.py#L227-L234
def _check_key(self, key): """ Ensures well-formedness of a key. """ if not len(key) == 2: raise TypeError('invalid key: %r' % key) elif key[1] not in TYPES: raise TypeError('invalid datatype: %s' % key[1])
[ "def", "_check_key", "(", "self", ",", "key", ")", ":", "if", "not", "len", "(", "key", ")", "==", "2", ":", "raise", "TypeError", "(", "'invalid key: %r'", "%", "key", ")", "elif", "key", "[", "1", "]", "not", "in", "TYPES", ":", "raise", "TypeErr...
Ensures well-formedness of a key.
[ "Ensures", "well", "-", "formedness", "of", "a", "key", "." ]
python
train
lpomfrey/django-debreach
debreach/context_processors.py
https://github.com/lpomfrey/django-debreach/blob/b425bb719ea5de583fae7db5b7419e5fed569cb0/debreach/context_processors.py#L14-L36
def csrf(request): """ Context processor that provides a CSRF token, or the string 'NOTPROVIDED' if it has not been provided by either a view decorator or the middleware """ def _get_val(): token = get_token(request) if token is None: # In order to be able to provide debu...
[ "def", "csrf", "(", "request", ")", ":", "def", "_get_val", "(", ")", ":", "token", "=", "get_token", "(", "request", ")", "if", "token", "is", "None", ":", "# In order to be able to provide debugging info in the", "# case of misconfiguration, we use a sentinel value", ...
Context processor that provides a CSRF token, or the string 'NOTPROVIDED' if it has not been provided by either a view decorator or the middleware
[ "Context", "processor", "that", "provides", "a", "CSRF", "token", "or", "the", "string", "NOTPROVIDED", "if", "it", "has", "not", "been", "provided", "by", "either", "a", "view", "decorator", "or", "the", "middleware" ]
python
train
apache/airflow
airflow/contrib/hooks/salesforce_hook.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/salesforce_hook.py#L186-L293
def write_object_to_file(self, query_results, filename, fmt="csv", coerce_to_timestamp=False, record_time_added=False): """ Write query results to file. ...
[ "def", "write_object_to_file", "(", "self", ",", "query_results", ",", "filename", ",", "fmt", "=", "\"csv\"", ",", "coerce_to_timestamp", "=", "False", ",", "record_time_added", "=", "False", ")", ":", "fmt", "=", "fmt", ".", "lower", "(", ")", "if", "fmt...
Write query results to file. Acceptable formats are: - csv: comma-separated-values file. This is the default format. - json: JSON array. Each element in the array is a different row. - ndjson: JSON array but each element is new...
[ "Write", "query", "results", "to", "file", "." ]
python
test
sdispater/cachy
cachy/stores/memcached_store.py
https://github.com/sdispater/cachy/blob/ee4b044d6aafa80125730a00b1f679a7bd852b8a/cachy/stores/memcached_store.py#L80-L92
def decrement(self, key, value=1): """ Decrement the value of an item in the cache. :param key: The cache key :type key: str :param value: The decrement value :type value: int :rtype: int or bool """ return self._memcache.decr(self._prefix + key...
[ "def", "decrement", "(", "self", ",", "key", ",", "value", "=", "1", ")", ":", "return", "self", ".", "_memcache", ".", "decr", "(", "self", ".", "_prefix", "+", "key", ",", "value", ")" ]
Decrement the value of an item in the cache. :param key: The cache key :type key: str :param value: The decrement value :type value: int :rtype: int or bool
[ "Decrement", "the", "value", "of", "an", "item", "in", "the", "cache", "." ]
python
train
musicmetric/mmpy
src/entity.py
https://github.com/musicmetric/mmpy/blob/2b5d975c61f9ea8c7f19f76a90b59771833ef881/src/entity.py#L70-L104
def response_from(self, ext_endpoint=None, params = {}): """ fetches and parses data from the semetric API, returning whatever is in the 'response' field in the top level dict on success (200) if the endpoint returns a 204, returns None (no data available for id) else throws a va...
[ "def", "response_from", "(", "self", ",", "ext_endpoint", "=", "None", ",", "params", "=", "{", "}", ")", ":", "params", "[", "'token'", "]", "=", "API_KEY", "base_endpoint", "=", "\"{base_url}/{entity}/{entityID}\"", "uri", "=", "base_endpoint", ".", "format"...
fetches and parses data from the semetric API, returning whatever is in the 'response' field in the top level dict on success (200) if the endpoint returns a 204, returns None (no data available for id) else throws a value error self should have these attributes as needed: @entit...
[ "fetches", "and", "parses", "data", "from", "the", "semetric", "API", "returning", "whatever", "is", "in", "the", "response", "field", "in", "the", "top", "level", "dict", "on", "success", "(", "200", ")", "if", "the", "endpoint", "returns", "a", "204", ...
python
train
inasafe/inasafe
safe/gui/tools/wizard/step_kw20_unit.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_kw20_unit.py#L43-L60
def get_next_step(self): """Find the proper step when user clicks the Next button. :returns: The step to be switched to. :rtype: WizardStep instance or None """ subcategory = self.parent.step_kw_subcategory.selected_subcategory() is_raster = is_raster_layer(self.parent.l...
[ "def", "get_next_step", "(", "self", ")", ":", "subcategory", "=", "self", ".", "parent", ".", "step_kw_subcategory", ".", "selected_subcategory", "(", ")", "is_raster", "=", "is_raster_layer", "(", "self", ".", "parent", ".", "layer", ")", "has_classifications"...
Find the proper step when user clicks the Next button. :returns: The step to be switched to. :rtype: WizardStep instance or None
[ "Find", "the", "proper", "step", "when", "user", "clicks", "the", "Next", "button", "." ]
python
train
trezor/python-trezor
trezorlib/stellar.py
https://github.com/trezor/python-trezor/blob/2813522b05cef4e0e545a101f8b3559a3183b45b/trezorlib/stellar.py#L294-L306
def _xdr_read_asset(unpacker): """Reads a stellar Asset from unpacker""" asset = messages.StellarAssetType(type=unpacker.unpack_uint()) if asset.type == ASSET_TYPE_ALPHA4: asset.code = unpacker.unpack_fstring(4) asset.issuer = _xdr_read_address(unpacker) if asset.type == ASSET_TYPE_ALP...
[ "def", "_xdr_read_asset", "(", "unpacker", ")", ":", "asset", "=", "messages", ".", "StellarAssetType", "(", "type", "=", "unpacker", ".", "unpack_uint", "(", ")", ")", "if", "asset", ".", "type", "==", "ASSET_TYPE_ALPHA4", ":", "asset", ".", "code", "=", ...
Reads a stellar Asset from unpacker
[ "Reads", "a", "stellar", "Asset", "from", "unpacker" ]
python
train
GNS3/gns3-server
gns3server/controller/project.py
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/project.py#L844-L875
def duplicate(self, name=None, location=None): """ Duplicate a project It's the save as feature of the 1.X. It's implemented on top of the export / import features. It will generate a gns3p and reimport it. It's a little slower but we have only one implementation to maintain. ...
[ "def", "duplicate", "(", "self", ",", "name", "=", "None", ",", "location", "=", "None", ")", ":", "# If the project was not open we open it temporary", "previous_status", "=", "self", ".", "_status", "if", "self", ".", "_status", "==", "\"closed\"", ":", "yield...
Duplicate a project It's the save as feature of the 1.X. It's implemented on top of the export / import features. It will generate a gns3p and reimport it. It's a little slower but we have only one implementation to maintain. :param name: Name of the new project. A new one will be gene...
[ "Duplicate", "a", "project" ]
python
train
jakevdp/supersmoother
supersmoother/utils.py
https://github.com/jakevdp/supersmoother/blob/0c96cf13dcd6f9006d3c0421f9cd6e18abe27a2f/supersmoother/utils.py#L195-L235
def multinterp(x, y, xquery, slow=False): """Multiple linear interpolations Parameters ---------- x : array_like, shape=(N,) sorted array of x values y : array_like, shape=(N, M) array of y values corresponding to each x value xquery : array_like, shape=(M,) array of que...
[ "def", "multinterp", "(", "x", ",", "y", ",", "xquery", ",", "slow", "=", "False", ")", ":", "x", ",", "y", ",", "xquery", "=", "map", "(", "np", ".", "asarray", ",", "(", "x", ",", "y", ",", "xquery", ")", ")", "assert", "x", ".", "ndim", ...
Multiple linear interpolations Parameters ---------- x : array_like, shape=(N,) sorted array of x values y : array_like, shape=(N, M) array of y values corresponding to each x value xquery : array_like, shape=(M,) array of query values slow : boolean, default=False ...
[ "Multiple", "linear", "interpolations" ]
python
train
crytic/slither
utils/possible_paths/possible_paths.py
https://github.com/crytic/slither/blob/04c147f7e50223c6af458ca430befae747ccd259/utils/possible_paths/possible_paths.py#L4-L26
def resolve_function(slither, contract_name, function_name): """ Resolves a function instance, given a contract name and function. :param contract_name: The name of the contract the function is declared in. :param function_name: The name of the function to resolve. :return: Returns the resolved func...
[ "def", "resolve_function", "(", "slither", ",", "contract_name", ",", "function_name", ")", ":", "# Obtain the target contract", "contract", "=", "slither", ".", "get_contract_from_name", "(", "contract_name", ")", "# Verify the contract was resolved successfully", "if", "c...
Resolves a function instance, given a contract name and function. :param contract_name: The name of the contract the function is declared in. :param function_name: The name of the function to resolve. :return: Returns the resolved function, raises an exception otherwise.
[ "Resolves", "a", "function", "instance", "given", "a", "contract", "name", "and", "function", ".", ":", "param", "contract_name", ":", "The", "name", "of", "the", "contract", "the", "function", "is", "declared", "in", ".", ":", "param", "function_name", ":",...
python
train
RIPE-NCC/ripe-atlas-cousteau
ripe/atlas/cousteau/api_listing.py
https://github.com/RIPE-NCC/ripe-atlas-cousteau/blob/ffee2556aaa4df86525b88c269bb098de11678ec/ripe/atlas/cousteau/api_listing.py#L162-L166
def set_total_count(self, value): """Setter for count attribute. Set should append only one count per splitted url.""" if not self.total_count_flag and value: self._count.append(int(value)) self.total_count_flag = True
[ "def", "set_total_count", "(", "self", ",", "value", ")", ":", "if", "not", "self", ".", "total_count_flag", "and", "value", ":", "self", ".", "_count", ".", "append", "(", "int", "(", "value", ")", ")", "self", ".", "total_count_flag", "=", "True" ]
Setter for count attribute. Set should append only one count per splitted url.
[ "Setter", "for", "count", "attribute", ".", "Set", "should", "append", "only", "one", "count", "per", "splitted", "url", "." ]
python
train
rootpy/rootpy
rootpy/tree/tree.py
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/tree/tree.py#L129-L139
def create_branches(self, branches): """ Create branches from a TreeBuffer or dict mapping names to type names Parameters ---------- branches : TreeBuffer or dict """ if not isinstance(branches, TreeBuffer): branches = TreeBuffer(branches) sel...
[ "def", "create_branches", "(", "self", ",", "branches", ")", ":", "if", "not", "isinstance", "(", "branches", ",", "TreeBuffer", ")", ":", "branches", "=", "TreeBuffer", "(", "branches", ")", "self", ".", "set_buffer", "(", "branches", ",", "create_branches"...
Create branches from a TreeBuffer or dict mapping names to type names Parameters ---------- branches : TreeBuffer or dict
[ "Create", "branches", "from", "a", "TreeBuffer", "or", "dict", "mapping", "names", "to", "type", "names" ]
python
train
mushkevych/scheduler
synergy/scheduler/abstract_state_machine.py
https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/abstract_state_machine.py#L45-L67
def _insert_uow(self, process_name, timeperiod, start_timeperiod, end_timeperiod, start_id, end_id): """creates unit_of_work and inserts it into the DB :raise DuplicateKeyError: if unit_of_work with given parameters already exists """ uow = UnitOfWork() uow.process_name = process_nam...
[ "def", "_insert_uow", "(", "self", ",", "process_name", ",", "timeperiod", ",", "start_timeperiod", ",", "end_timeperiod", ",", "start_id", ",", "end_id", ")", ":", "uow", "=", "UnitOfWork", "(", ")", "uow", ".", "process_name", "=", "process_name", "uow", "...
creates unit_of_work and inserts it into the DB :raise DuplicateKeyError: if unit_of_work with given parameters already exists
[ "creates", "unit_of_work", "and", "inserts", "it", "into", "the", "DB", ":", "raise", "DuplicateKeyError", ":", "if", "unit_of_work", "with", "given", "parameters", "already", "exists" ]
python
train
buildbot/buildbot
master/buildbot/schedulers/forcesched.py
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/schedulers/forcesched.py#L425-L437
def collectChildProperties(self, kwargs, properties, collector, **kw): """Collapse the child values into a dictionary. This is intended to be called by child classes to fix up the fullName->name conversions.""" childProperties = {} for field in self.fields: # pylint: disable=not-an-...
[ "def", "collectChildProperties", "(", "self", ",", "kwargs", ",", "properties", ",", "collector", ",", "*", "*", "kw", ")", ":", "childProperties", "=", "{", "}", "for", "field", "in", "self", ".", "fields", ":", "# pylint: disable=not-an-iterable", "yield", ...
Collapse the child values into a dictionary. This is intended to be called by child classes to fix up the fullName->name conversions.
[ "Collapse", "the", "child", "values", "into", "a", "dictionary", ".", "This", "is", "intended", "to", "be", "called", "by", "child", "classes", "to", "fix", "up", "the", "fullName", "-", ">", "name", "conversions", "." ]
python
train
log2timeline/plaso
plaso/multi_processing/psort.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/multi_processing/psort.py#L635-L648
def _StatusUpdateThreadMain(self): """Main function of the status update thread.""" while self._status_update_active: # Make a local copy of the PIDs in case the dict is changed by # the main thread. for pid in list(self._process_information_per_pid.keys()): self._CheckStatusAnalysisPr...
[ "def", "_StatusUpdateThreadMain", "(", "self", ")", ":", "while", "self", ".", "_status_update_active", ":", "# Make a local copy of the PIDs in case the dict is changed by", "# the main thread.", "for", "pid", "in", "list", "(", "self", ".", "_process_information_per_pid", ...
Main function of the status update thread.
[ "Main", "function", "of", "the", "status", "update", "thread", "." ]
python
train
lehins/python-wepay
wepay/calls/checkout.py
https://github.com/lehins/python-wepay/blob/414d25a1a8d0ecb22a3ddd1f16c60b805bb52a1f/wepay/calls/checkout.py#L135-L158
def __refund(self, checkout_id, refund_reason, **kwargs): """Call documentation: `/checkout/refund <https://www.wepay.com/developer/reference/checkout#refund>`_, plus extra keyword parameters: :keyword str access_token: will be used instead of instance's ``access_toke...
[ "def", "__refund", "(", "self", ",", "checkout_id", ",", "refund_reason", ",", "*", "*", "kwargs", ")", ":", "params", "=", "{", "'checkout_id'", ":", "checkout_id", ",", "'refund_reason'", ":", "refund_reason", "}", "return", "self", ".", "make_call", "(", ...
Call documentation: `/checkout/refund <https://www.wepay.com/developer/reference/checkout#refund>`_, plus extra keyword parameters: :keyword str access_token: will be used instead of instance's ``access_token``, with ``batch_mode=True`` will set `authorization` par...
[ "Call", "documentation", ":", "/", "checkout", "/", "refund", "<https", ":", "//", "www", ".", "wepay", ".", "com", "/", "developer", "/", "reference", "/", "checkout#refund", ">", "_", "plus", "extra", "keyword", "parameters", ":", ":", "keyword", "str", ...
python
train
DLR-RM/RAFCON
source/rafcon/gui/controllers/global_variable_manager.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/global_variable_manager.py#L96-L106
def global_variable_is_editable(self, gv_name, intro_message='edit'): """Check whether global variable is locked :param str gv_name: Name of global variable to be checked :param str intro_message: Message which is used form a useful logger error message if needed :return: """ ...
[ "def", "global_variable_is_editable", "(", "self", ",", "gv_name", ",", "intro_message", "=", "'edit'", ")", ":", "if", "self", ".", "model", ".", "global_variable_manager", ".", "is_locked", "(", "gv_name", ")", ":", "logger", ".", "error", "(", "\"{1} of glo...
Check whether global variable is locked :param str gv_name: Name of global variable to be checked :param str intro_message: Message which is used form a useful logger error message if needed :return:
[ "Check", "whether", "global", "variable", "is", "locked" ]
python
train
jtwhite79/pyemu
pyemu/pst/pst_handler.py
https://github.com/jtwhite79/pyemu/blob/c504d8e7a4097cec07655a6318d275739bd8148a/pyemu/pst/pst_handler.py#L175-L186
def set_res(self,res): """ reset the private Pst.res attribute Parameters ---------- res : (varies) something to use as Pst.res attribute """ if isinstance(res,str): res = pst_utils.read_resfile(res) self.__res = res
[ "def", "set_res", "(", "self", ",", "res", ")", ":", "if", "isinstance", "(", "res", ",", "str", ")", ":", "res", "=", "pst_utils", ".", "read_resfile", "(", "res", ")", "self", ".", "__res", "=", "res" ]
reset the private Pst.res attribute Parameters ---------- res : (varies) something to use as Pst.res attribute
[ "reset", "the", "private", "Pst", ".", "res", "attribute" ]
python
train
Datary/scrapbag
scrapbag/collections.py
https://github.com/Datary/scrapbag/blob/3a4f9824ab6fe21121214ba9963690618da2c9de/scrapbag/collections.py#L132-L218
def _add_element_by_names(src, names, value, override=False, digit=True): """ Internal method recursive to Add element into a list or dict easily using a path. ============= ============= ======================================= Parameter Type Description ============= ====...
[ "def", "_add_element_by_names", "(", "src", ",", "names", ",", "value", ",", "override", "=", "False", ",", "digit", "=", "True", ")", ":", "if", "src", "is", "None", ":", "return", "False", "else", ":", "if", "names", "and", "names", "[", "0", "]", ...
Internal method recursive to Add element into a list or dict easily using a path. ============= ============= ======================================= Parameter Type Description ============= ============= ======================================= src list or dict ...
[ "Internal", "method", "recursive", "to", "Add", "element", "into", "a", "list", "or", "dict", "easily", "using", "a", "path", ".", "=============", "=============", "=======================================", "Parameter", "Type", "Description", "=============", "========...
python
train
IDSIA/sacred
sacred/experiment.py
https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/experiment.py#L96-L107
def main(self, function): """ Decorator to define the main function of the experiment. The main function of an experiment is the default command that is being run when no command is specified, or when calling the run() method. Usually it is more convenient to use ``automain`` i...
[ "def", "main", "(", "self", ",", "function", ")", ":", "captured", "=", "self", ".", "command", "(", "function", ")", "self", ".", "default_command", "=", "captured", ".", "__name__", "return", "captured" ]
Decorator to define the main function of the experiment. The main function of an experiment is the default command that is being run when no command is specified, or when calling the run() method. Usually it is more convenient to use ``automain`` instead.
[ "Decorator", "to", "define", "the", "main", "function", "of", "the", "experiment", "." ]
python
train
rstoneback/pysat
pysat/_constellation.py
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_constellation.py#L64-L69
def set_bounds(self, start, stop): """ Sets boundaries for all instruments in constellation """ for instrument in self.instruments: instrument.bounds = (start, stop)
[ "def", "set_bounds", "(", "self", ",", "start", ",", "stop", ")", ":", "for", "instrument", "in", "self", ".", "instruments", ":", "instrument", ".", "bounds", "=", "(", "start", ",", "stop", ")" ]
Sets boundaries for all instruments in constellation
[ "Sets", "boundaries", "for", "all", "instruments", "in", "constellation" ]
python
train
pypa/pipenv
pipenv/vendor/pexpect/spawnbase.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/spawnbase.py#L420-L428
def expect_loop(self, searcher, timeout=-1, searchwindowsize=-1): '''This is the common loop used inside expect. The 'searcher' should be an instance of searcher_re or searcher_string, which describes how and what to search for in the input. See expect() for other arguments, return valu...
[ "def", "expect_loop", "(", "self", ",", "searcher", ",", "timeout", "=", "-", "1", ",", "searchwindowsize", "=", "-", "1", ")", ":", "exp", "=", "Expecter", "(", "self", ",", "searcher", ",", "searchwindowsize", ")", "return", "exp", ".", "expect_loop", ...
This is the common loop used inside expect. The 'searcher' should be an instance of searcher_re or searcher_string, which describes how and what to search for in the input. See expect() for other arguments, return value and exceptions.
[ "This", "is", "the", "common", "loop", "used", "inside", "expect", ".", "The", "searcher", "should", "be", "an", "instance", "of", "searcher_re", "or", "searcher_string", "which", "describes", "how", "and", "what", "to", "search", "for", "in", "the", "input"...
python
train
hannorein/rebound
rebound/simulation.py
https://github.com/hannorein/rebound/blob/bb0f814c98e629401acaab657cae2304b0e003f7/rebound/simulation.py#L872-L889
def gravity(self): """ Get or set the gravity module. Available gravity modules are: - ``'none'`` - ``'basic'`` (default) - ``'compensated'`` - ``'tree'`` Check the online documentation for a full description of each of the modules. ""...
[ "def", "gravity", "(", "self", ")", ":", "i", "=", "self", ".", "_gravity", "for", "name", ",", "_i", "in", "GRAVITIES", ".", "items", "(", ")", ":", "if", "i", "==", "_i", ":", "return", "name", "return", "i" ]
Get or set the gravity module. Available gravity modules are: - ``'none'`` - ``'basic'`` (default) - ``'compensated'`` - ``'tree'`` Check the online documentation for a full description of each of the modules.
[ "Get", "or", "set", "the", "gravity", "module", "." ]
python
train
elliterate/capybara.py
capybara/node/actions.py
https://github.com/elliterate/capybara.py/blob/0c6ae449cc37e4445ec3cd6af95674533beedc6c/capybara/node/actions.py#L44-L59
def check(self, locator=None, allow_label_click=None, **kwargs): """ Find a check box and mark it as checked. The check box can be found via name, id, or label text. :: page.check("German") Args: locator (str, optional): Which check box to check. all...
[ "def", "check", "(", "self", ",", "locator", "=", "None", ",", "allow_label_click", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_check_with_label", "(", "\"checkbox\"", ",", "True", ",", "locator", "=", "locator", ",", "allow_label_click"...
Find a check box and mark it as checked. The check box can be found via name, id, or label text. :: page.check("German") Args: locator (str, optional): Which check box to check. allow_label_click (bool, optional): Attempt to click the label to toggle state if ...
[ "Find", "a", "check", "box", "and", "mark", "it", "as", "checked", ".", "The", "check", "box", "can", "be", "found", "via", "name", "id", "or", "label", "text", ".", "::" ]
python
test
pyecore/pyecore
pyecore/resources/resource.py
https://github.com/pyecore/pyecore/blob/22b67ad8799594f8f44fd8bee497583d4f12ed63/pyecore/resources/resource.py#L47-L68
def create_resource(self, uri): """Creates a new Resource. The created ressource type depends on the used URI. :param uri: the resource URI :type uri: URI :return: a new Resource :rtype: Resource .. seealso:: URI, Resource, XMIResource """ if is...
[ "def", "create_resource", "(", "self", ",", "uri", ")", ":", "if", "isinstance", "(", "uri", ",", "str", ")", ":", "uri", "=", "URI", "(", "uri", ")", "try", ":", "resource", "=", "self", ".", "resource_factory", "[", "uri", ".", "extension", "]", ...
Creates a new Resource. The created ressource type depends on the used URI. :param uri: the resource URI :type uri: URI :return: a new Resource :rtype: Resource .. seealso:: URI, Resource, XMIResource
[ "Creates", "a", "new", "Resource", "." ]
python
train
blockstack/blockstack-core
blockstack/lib/client.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/client.py#L2912-L2976
def get_block_from_consensus(consensus_hash, hostport=None, proxy=None): """ Get a block height from a consensus hash Returns the block height on success Returns {'error': ...} on failure """ assert hostport or proxy, 'Need hostport or proxy' if proxy is None: proxy = connect_hostpor...
[ "def", "get_block_from_consensus", "(", "consensus_hash", ",", "hostport", "=", "None", ",", "proxy", "=", "None", ")", ":", "assert", "hostport", "or", "proxy", ",", "'Need hostport or proxy'", "if", "proxy", "is", "None", ":", "proxy", "=", "connect_hostport",...
Get a block height from a consensus hash Returns the block height on success Returns {'error': ...} on failure
[ "Get", "a", "block", "height", "from", "a", "consensus", "hash", "Returns", "the", "block", "height", "on", "success", "Returns", "{", "error", ":", "...", "}", "on", "failure" ]
python
train
Bystroushaak/pyDHTMLParser
src/dhtmlparser/htmlelement/html_parser.py
https://github.com/Bystroushaak/pyDHTMLParser/blob/4756f93dd048500b038ece2323fe26e46b6bfdea/src/dhtmlparser/htmlelement/html_parser.py#L162-L169
def _parseIsTag(self): """ Detect whether the element is HTML tag or not. Result is saved to the :attr:`_istag` property. """ el = self._element self._istag = el and el[0] == "<" and el[-1] == ">"
[ "def", "_parseIsTag", "(", "self", ")", ":", "el", "=", "self", ".", "_element", "self", ".", "_istag", "=", "el", "and", "el", "[", "0", "]", "==", "\"<\"", "and", "el", "[", "-", "1", "]", "==", "\">\"" ]
Detect whether the element is HTML tag or not. Result is saved to the :attr:`_istag` property.
[ "Detect", "whether", "the", "element", "is", "HTML", "tag", "or", "not", "." ]
python
train
closeio/tasktiger
tasktiger/task.py
https://github.com/closeio/tasktiger/blob/59f893152d6eb4b7f1f62fc4b35aeeca7f26c07a/tasktiger/task.py#L421-L433
def n_executions(self): """ Queries and returns the number of past task executions. """ pipeline = self.tiger.connection.pipeline() pipeline.exists(self.tiger._key('task', self.id)) pipeline.llen(self.tiger._key('task', self.id, 'executions')) exists, n_executions...
[ "def", "n_executions", "(", "self", ")", ":", "pipeline", "=", "self", ".", "tiger", ".", "connection", ".", "pipeline", "(", ")", "pipeline", ".", "exists", "(", "self", ".", "tiger", ".", "_key", "(", "'task'", ",", "self", ".", "id", ")", ")", "...
Queries and returns the number of past task executions.
[ "Queries", "and", "returns", "the", "number", "of", "past", "task", "executions", "." ]
python
train
mesowx/MesoPy
MesoPy.py
https://github.com/mesowx/MesoPy/blob/cd1e837e108ed7a110d81cf789f19afcdd52145b/MesoPy.py#L422-L495
def timeseries(self, start, end, **kwargs): r""" Returns a time series of observations at a user specified location for a specified time. Users must specify at least one geographic search parameter ('stid', 'state', 'country', 'county', 'radius', 'bbox', 'cwa', 'nwsfirezone', 'gacc', or 'subgacc...
[ "def", "timeseries", "(", "self", ",", "start", ",", "end", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_check_geo_param", "(", "kwargs", ")", "kwargs", "[", "'start'", "]", "=", "start", "kwargs", "[", "'end'", "]", "=", "end", "kwargs", "[", ...
r""" Returns a time series of observations at a user specified location for a specified time. Users must specify at least one geographic search parameter ('stid', 'state', 'country', 'county', 'radius', 'bbox', 'cwa', 'nwsfirezone', 'gacc', or 'subgacc') to obtain observation data. Other parameters may ...
[ "r", "Returns", "a", "time", "series", "of", "observations", "at", "a", "user", "specified", "location", "for", "a", "specified", "time", ".", "Users", "must", "specify", "at", "least", "one", "geographic", "search", "parameter", "(", "stid", "state", "count...
python
train
cole/aiosmtplib
src/aiosmtplib/auth.py
https://github.com/cole/aiosmtplib/blob/0cd00e5059005371cbdfca995feff9183a16a51f/src/aiosmtplib/auth.py#L84-L122
async def auth_crammd5( self, username: str, password: str, timeout: DefaultNumType = _default ) -> SMTPResponse: """ CRAM-MD5 auth uses the password as a shared secret to MD5 the server's response. Example:: 250 AUTH CRAM-MD5 auth cram-md5 ...
[ "async", "def", "auth_crammd5", "(", "self", ",", "username", ":", "str", ",", "password", ":", "str", ",", "timeout", ":", "DefaultNumType", "=", "_default", ")", "->", "SMTPResponse", ":", "async", "with", "self", ".", "_command_lock", ":", "initial_respon...
CRAM-MD5 auth uses the password as a shared secret to MD5 the server's response. Example:: 250 AUTH CRAM-MD5 auth cram-md5 334 PDI0NjA5LjEwNDc5MTQwNDZAcG9wbWFpbC5TcGFjZS5OZXQ+ dGltIGI5MTNhNjAyYzdlZGE3YTQ5NWI0ZTZlNzMzNGQzODkw
[ "CRAM", "-", "MD5", "auth", "uses", "the", "password", "as", "a", "shared", "secret", "to", "MD5", "the", "server", "s", "response", "." ]
python
train
ARMmbed/mbed-cloud-sdk-python
src/mbed_cloud/_backends/iam/apis/developer_api.py
https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/_backends/iam/apis/developer_api.py#L1569-L1589
def remove_my_api_key_from_groups(self, body, **kwargs): # noqa: E501 """Remove API key from groups. # noqa: E501 An endpoint for removing API key from groups. **Example usage:** `curl -X DELETE https://api.us-east-1.mbedcloud.com/v3/api-keys/me/groups -d '[0162056a9a1586f30242590700000000,0117056a...
[ "def", "remove_my_api_key_from_groups", "(", "self", ",", "body", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'asynchronous'", ")", ":", "return", "self", "...
Remove API key from groups. # noqa: E501 An endpoint for removing API key from groups. **Example usage:** `curl -X DELETE https://api.us-east-1.mbedcloud.com/v3/api-keys/me/groups -d '[0162056a9a1586f30242590700000000,0117056a9a1586f30242590700000000]' -H 'content-type: application/json' -H 'Authorization: ...
[ "Remove", "API", "key", "from", "groups", ".", "#", "noqa", ":", "E501" ]
python
train
gabstopper/smc-python
smc-monitoring/smc_monitoring/models/formats.py
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc-monitoring/smc_monitoring/models/formats.py#L101-L116
def set_resolving(self, **kw): """ Certain log fields can be individually resolved. Use this method to set these fields. Valid keyword arguments: :param str timezone: string value to set timezone for audits :param bool time_show_zone: show the time zone in the audit. ...
[ "def", "set_resolving", "(", "self", ",", "*", "*", "kw", ")", ":", "if", "'timezone'", "in", "kw", "and", "'time_show_zone'", "not", "in", "kw", ":", "kw", ".", "update", "(", "time_show_zone", "=", "True", ")", "self", ".", "data", "[", "'resolving'"...
Certain log fields can be individually resolved. Use this method to set these fields. Valid keyword arguments: :param str timezone: string value to set timezone for audits :param bool time_show_zone: show the time zone in the audit. :param bool time_show_millis: show timezone in...
[ "Certain", "log", "fields", "can", "be", "individually", "resolved", ".", "Use", "this", "method", "to", "set", "these", "fields", ".", "Valid", "keyword", "arguments", ":", ":", "param", "str", "timezone", ":", "string", "value", "to", "set", "timezone", ...
python
train
djgagne/hagelslag
hagelslag/util/output_tree_ensembles.py
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/output_tree_ensembles.py#L72-L116
def print_tree_recursive(tree_obj, node_index, attribute_names=None): """ Recursively writes a string representation of a decision tree object. Parameters ---------- tree_obj : sklearn.tree._tree.Tree object A base decision tree object node_index : int Index of the node being pr...
[ "def", "print_tree_recursive", "(", "tree_obj", ",", "node_index", ",", "attribute_names", "=", "None", ")", ":", "tree_str", "=", "\"\"", "if", "node_index", "==", "0", ":", "tree_str", "+=", "\"{0:d}\\n\"", ".", "format", "(", "tree_obj", ".", "node_count", ...
Recursively writes a string representation of a decision tree object. Parameters ---------- tree_obj : sklearn.tree._tree.Tree object A base decision tree object node_index : int Index of the node being printed attribute_names : list List of attribute names Returns ...
[ "Recursively", "writes", "a", "string", "representation", "of", "a", "decision", "tree", "object", "." ]
python
train
adafruit/Adafruit_CircuitPython_MatrixKeypad
adafruit_matrixkeypad.py
https://github.com/adafruit/Adafruit_CircuitPython_MatrixKeypad/blob/f530b1a920a40ef09ec1394b7760f243a243045a/adafruit_matrixkeypad.py#L69-L91
def pressed_keys(self): """An array containing all detected keys that are pressed from the initalized list-of-lists passed in during creation""" # make a list of all the keys that are detected pressed = [] # set all pins pins to be inputs w/pullups for pin in self.row_pi...
[ "def", "pressed_keys", "(", "self", ")", ":", "# make a list of all the keys that are detected", "pressed", "=", "[", "]", "# set all pins pins to be inputs w/pullups", "for", "pin", "in", "self", ".", "row_pins", "+", "self", ".", "col_pins", ":", "pin", ".", "dire...
An array containing all detected keys that are pressed from the initalized list-of-lists passed in during creation
[ "An", "array", "containing", "all", "detected", "keys", "that", "are", "pressed", "from", "the", "initalized", "list", "-", "of", "-", "lists", "passed", "in", "during", "creation" ]
python
train
qiniu/python-sdk
qiniu/services/compute/app.py
https://github.com/qiniu/python-sdk/blob/a69fbef4e3e6ea1ebe09f4610a5b18bb2c17de59/qiniu/services/compute/app.py#L180-L192
def list_apps(self): """获得当前账号的应用列表 列出所属应用为当前请求方的应用列表。 Returns: 返回一个tuple对象,其格式为(<result>, <ResponseInfo>) - result 成功返回应用列表,失败返回None - ResponseInfo 请求的Response信息 """ url = '{0}/v3/apps'.format(self.host) return http._get...
[ "def", "list_apps", "(", "self", ")", ":", "url", "=", "'{0}/v3/apps'", ".", "format", "(", "self", ".", "host", ")", "return", "http", ".", "_get_with_qiniu_mac", "(", "url", ",", "None", ",", "self", ".", "auth", ")" ]
获得当前账号的应用列表 列出所属应用为当前请求方的应用列表。 Returns: 返回一个tuple对象,其格式为(<result>, <ResponseInfo>) - result 成功返回应用列表,失败返回None - ResponseInfo 请求的Response信息
[ "获得当前账号的应用列表" ]
python
train
thespacedoctor/tastic
tastic/tastic.py
https://github.com/thespacedoctor/tastic/blob/a0a16cf329a50057906ac3f696bb60b6fcee25e0/tastic/tastic.py#L625-L724
def sort_tasks( self, workflowTags, indentLevel=1): """*order tasks within this taskpaper object via a list of tags* The order of the tags in the list dictates the order of the sort - first comes first* **Key Arguments:** - ``workflowTags`` -- a ...
[ "def", "sort_tasks", "(", "self", ",", "workflowTags", ",", "indentLevel", "=", "1", ")", ":", "self", ".", "refresh", "if", "not", "isinstance", "(", "workflowTags", ",", "list", ")", ":", "workflowTagsLists", "=", "workflowTags", ".", "strip", "(", ")", ...
*order tasks within this taskpaper object via a list of tags* The order of the tags in the list dictates the order of the sort - first comes first* **Key Arguments:** - ``workflowTags`` -- a string of space seperated tags. **Return:** - ``None`` **Usage:** ...
[ "*", "order", "tasks", "within", "this", "taskpaper", "object", "via", "a", "list", "of", "tags", "*" ]
python
train
openstack/proliantutils
proliantutils/redfish/resources/account_service/account.py
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/account_service/account.py#L25-L33
def update_credentials(self, password): """Update credentials of a redfish system :param password: password to be updated """ data = { 'Password': password, } self._conn.patch(self.path, data=data)
[ "def", "update_credentials", "(", "self", ",", "password", ")", ":", "data", "=", "{", "'Password'", ":", "password", ",", "}", "self", ".", "_conn", ".", "patch", "(", "self", ".", "path", ",", "data", "=", "data", ")" ]
Update credentials of a redfish system :param password: password to be updated
[ "Update", "credentials", "of", "a", "redfish", "system" ]
python
train
jsvine/spectra
spectra/grapefruit.py
https://github.com/jsvine/spectra/blob/2269a0ae9b5923154b15bd661fb81179608f7ec2/spectra/grapefruit.py#L1824-L1858
def MonochromeScheme(self): '''Return 4 colors in the same hue with varying saturation/lightness. Returns: A tuple of 4 grapefruit.Color in the same hue as this one, with varying saturation/lightness. >>> c = Color.NewFromHsl(30, 0.5, 0.5) >>> ['(%g, %g, %g)' % clr.hsl for clr in c.Monochr...
[ "def", "MonochromeScheme", "(", "self", ")", ":", "def", "_wrap", "(", "x", ",", "min", ",", "thres", ",", "plus", ")", ":", "if", "(", "x", "-", "min", ")", "<", "thres", ":", "return", "x", "+", "plus", "else", ":", "return", "x", "-", "min",...
Return 4 colors in the same hue with varying saturation/lightness. Returns: A tuple of 4 grapefruit.Color in the same hue as this one, with varying saturation/lightness. >>> c = Color.NewFromHsl(30, 0.5, 0.5) >>> ['(%g, %g, %g)' % clr.hsl for clr in c.MonochromeScheme()] ['(30, 0.2, 0.8)',...
[ "Return", "4", "colors", "in", "the", "same", "hue", "with", "varying", "saturation", "/", "lightness", "." ]
python
train
bear/parsedatetime
parsedatetime/__init__.py
https://github.com/bear/parsedatetime/blob/830775dc5e36395622b41f12317f5e10c303d3a2/parsedatetime/__init__.py#L1644-L1687
def _partialParseMeridian(self, s, sourceTime): """ test if giving C{s} matched CRE_TIMEHMS2, used by L{parse()} @type s: string @param s: date/time text to evaluate @type sourceTime: struct_time @param sourceTime: C{struct_time} value to use as the b...
[ "def", "_partialParseMeridian", "(", "self", ",", "s", ",", "sourceTime", ")", ":", "parseStr", "=", "None", "chunk1", "=", "chunk2", "=", "''", "# HH:MM(:SS) am/pm time strings", "m", "=", "self", ".", "ptc", ".", "CRE_TIMEHMS2", ".", "search", "(", "s", ...
test if giving C{s} matched CRE_TIMEHMS2, used by L{parse()} @type s: string @param s: date/time text to evaluate @type sourceTime: struct_time @param sourceTime: C{struct_time} value to use as the base @rtype: tuple @return: tuple of remained date/...
[ "test", "if", "giving", "C", "{", "s", "}", "matched", "CRE_TIMEHMS2", "used", "by", "L", "{", "parse", "()", "}" ]
python
train
tradenity/python-sdk
tradenity/resources/table_rate_shipping.py
https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/table_rate_shipping.py#L462-L482
def create_table_rate_shipping(cls, table_rate_shipping, **kwargs): """Create TableRateShipping Create a new TableRateShipping This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.create_table_rate...
[ "def", "create_table_rate_shipping", "(", "cls", ",", "table_rate_shipping", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async'", ")", ":", "return", "cls", ".", "_create_...
Create TableRateShipping Create a new TableRateShipping This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.create_table_rate_shipping(table_rate_shipping, async=True) >>> result = thread.get() ...
[ "Create", "TableRateShipping" ]
python
train
hammerlab/stancache
stancache/utils.py
https://github.com/hammerlab/stancache/blob/22f2548731d0960c14c0d41f4f64e418d3f22e4c/stancache/utils.py#L45-L56
def _list_files_in_path(path, pattern="*.stan"): """ indexes a directory of stan files returns as dictionary containing contents of files """ results = [] for dirname, subdirs, files in os.walk(path): for name in files: if fnmatch(name, pattern): results.appe...
[ "def", "_list_files_in_path", "(", "path", ",", "pattern", "=", "\"*.stan\"", ")", ":", "results", "=", "[", "]", "for", "dirname", ",", "subdirs", ",", "files", "in", "os", ".", "walk", "(", "path", ")", ":", "for", "name", "in", "files", ":", "if",...
indexes a directory of stan files returns as dictionary containing contents of files
[ "indexes", "a", "directory", "of", "stan", "files", "returns", "as", "dictionary", "containing", "contents", "of", "files" ]
python
train
pypa/pipenv
pipenv/vendor/distlib/database.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/distlib/database.py#L407-L439
def matches_requirement(self, req): """ Say if this instance matches (fulfills) a requirement. :param req: The requirement to match. :rtype req: str :return: True if it matches, else False. """ # Requirement may contain extras - parse to lose those # from ...
[ "def", "matches_requirement", "(", "self", ",", "req", ")", ":", "# Requirement may contain extras - parse to lose those", "# from what's passed to the matcher", "r", "=", "parse_requirement", "(", "req", ")", "scheme", "=", "get_scheme", "(", "self", ".", "metadata", "...
Say if this instance matches (fulfills) a requirement. :param req: The requirement to match. :rtype req: str :return: True if it matches, else False.
[ "Say", "if", "this", "instance", "matches", "(", "fulfills", ")", "a", "requirement", ".", ":", "param", "req", ":", "The", "requirement", "to", "match", ".", ":", "rtype", "req", ":", "str", ":", "return", ":", "True", "if", "it", "matches", "else", ...
python
train
quantopian/zipline
zipline/utils/pandas_utils.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/utils/pandas_utils.py#L48-L63
def _time_to_micros(time): """Convert a time into microseconds since midnight. Parameters ---------- time : datetime.time The time to convert. Returns ------- us : int The number of microseconds since midnight. Notes ----- This does not account for leap seconds or...
[ "def", "_time_to_micros", "(", "time", ")", ":", "seconds", "=", "time", ".", "hour", "*", "60", "*", "60", "+", "time", ".", "minute", "*", "60", "+", "time", ".", "second", "return", "1000000", "*", "seconds", "+", "time", ".", "microsecond" ]
Convert a time into microseconds since midnight. Parameters ---------- time : datetime.time The time to convert. Returns ------- us : int The number of microseconds since midnight. Notes ----- This does not account for leap seconds or daylight savings.
[ "Convert", "a", "time", "into", "microseconds", "since", "midnight", ".", "Parameters", "----------", "time", ":", "datetime", ".", "time", "The", "time", "to", "convert", ".", "Returns", "-------", "us", ":", "int", "The", "number", "of", "microseconds", "s...
python
train
onecodex/onecodex
onecodex/lib/upload.py
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/lib/upload.py#L782-L861
def _s3_intermediate_upload(file_obj, file_name, fields, session, callback_url): """Uploads a single file-like object to an intermediate S3 bucket which One Codex can pull from after receiving a callback. Parameters ---------- file_obj : `FASTXInterleave`, `FilePassthru`, or a file-like object ...
[ "def", "_s3_intermediate_upload", "(", "file_obj", ",", "file_name", ",", "fields", ",", "session", ",", "callback_url", ")", ":", "import", "boto3", "from", "boto3", ".", "s3", ".", "transfer", "import", "TransferConfig", "from", "boto3", ".", "exceptions", "...
Uploads a single file-like object to an intermediate S3 bucket which One Codex can pull from after receiving a callback. Parameters ---------- file_obj : `FASTXInterleave`, `FilePassthru`, or a file-like object A wrapper around a pair of fastx files (`FASTXInterleave`) or a single fastx file. I...
[ "Uploads", "a", "single", "file", "-", "like", "object", "to", "an", "intermediate", "S3", "bucket", "which", "One", "Codex", "can", "pull", "from", "after", "receiving", "a", "callback", "." ]
python
train
blockstack/blockstack-core
blockstack/blockstackd.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/blockstackd.py#L1845-L1875
def rpc_get_zonefiles_by_block( self, from_block, to_block, offset, count, **con_info ): """ Get information about zonefiles announced in blocks [@from_block, @to_block] @offset - offset into result set @count - max records to return, must be <= 100 Returns {'status': True, 'last...
[ "def", "rpc_get_zonefiles_by_block", "(", "self", ",", "from_block", ",", "to_block", ",", "offset", ",", "count", ",", "*", "*", "con_info", ")", ":", "conf", "=", "get_blockstack_opts", "(", ")", "if", "not", "is_atlas_enabled", "(", "conf", ")", ":", "r...
Get information about zonefiles announced in blocks [@from_block, @to_block] @offset - offset into result set @count - max records to return, must be <= 100 Returns {'status': True, 'lastblock' : blockNumber, 'zonefile_info' : [ { 'block_height' : 470000, ...
[ "Get", "information", "about", "zonefiles", "announced", "in", "blocks", "[" ]
python
train
collectiveacuity/labPack
labpack/platforms/aws/ssh.py
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ssh.py#L228-L301
def script(self, commands, synopsis=True): ''' a method to run a list of shell command scripts on AWS instance :param commands: list of strings with shell commands to pass through connection :param synopsis: [optional] boolean to simplify progress messages to one line :retu...
[ "def", "script", "(", "self", ",", "commands", ",", "synopsis", "=", "True", ")", ":", "title", "=", "'%s.script'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "if", "isinstance", "(", "commands", ",", "str", ")", ":", "commands", ...
a method to run a list of shell command scripts on AWS instance :param commands: list of strings with shell commands to pass through connection :param synopsis: [optional] boolean to simplify progress messages to one line :return: string with response to last command
[ "a", "method", "to", "run", "a", "list", "of", "shell", "command", "scripts", "on", "AWS", "instance" ]
python
train
PythonCharmers/python-future
src/future/backports/email/_header_value_parser.py
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/backports/email/_header_value_parser.py#L2380-L2446
def parse_mime_version(value): """ mime-version = [CFWS] 1*digit [CFWS] "." [CFWS] 1*digit [CFWS] """ # The [CFWS] is implicit in the RFC 2045 BNF. # XXX: This routine is a bit verbose, should factor out a get_int method. mime_version = MIMEVersion() if not value: mime_version.defects.a...
[ "def", "parse_mime_version", "(", "value", ")", ":", "# The [CFWS] is implicit in the RFC 2045 BNF.", "# XXX: This routine is a bit verbose, should factor out a get_int method.", "mime_version", "=", "MIMEVersion", "(", ")", "if", "not", "value", ":", "mime_version", ".", "defe...
mime-version = [CFWS] 1*digit [CFWS] "." [CFWS] 1*digit [CFWS]
[ "mime", "-", "version", "=", "[", "CFWS", "]", "1", "*", "digit", "[", "CFWS", "]", ".", "[", "CFWS", "]", "1", "*", "digit", "[", "CFWS", "]" ]
python
train
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/pool.py#L551-L571
def check_auth(self, all_credentials): """Update this socket's authentication. Log in or out to bring this socket's credentials up to date with those provided. Can raise ConnectionFailure or OperationFailure. :Parameters: - `all_credentials`: dict, maps auth source to MongoCr...
[ "def", "check_auth", "(", "self", ",", "all_credentials", ")", ":", "if", "all_credentials", "or", "self", ".", "authset", ":", "cached", "=", "set", "(", "itervalues", "(", "all_credentials", ")", ")", "authset", "=", "self", ".", "authset", ".", "copy", ...
Update this socket's authentication. Log in or out to bring this socket's credentials up to date with those provided. Can raise ConnectionFailure or OperationFailure. :Parameters: - `all_credentials`: dict, maps auth source to MongoCredential.
[ "Update", "this", "socket", "s", "authentication", "." ]
python
train
Hackerfleet/hfos
hfos/schemata/base.py
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/schemata/base.py#L42-L62
def uuid_object(title="Reference", description="Select an object", default=None, display=True): """Generates a regular expression controlled UUID field""" uuid = { 'pattern': '^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{' '4}-[' 'a-fA-F0-9]{4}-[a-fA-F0-9]{12}$', ...
[ "def", "uuid_object", "(", "title", "=", "\"Reference\"", ",", "description", "=", "\"Select an object\"", ",", "default", "=", "None", ",", "display", "=", "True", ")", ":", "uuid", "=", "{", "'pattern'", ":", "'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{'", "'4}...
Generates a regular expression controlled UUID field
[ "Generates", "a", "regular", "expression", "controlled", "UUID", "field" ]
python
train
theno/fabsetup
fabsetup/fabfile/setup/__init__.py
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/__init__.py#L428-L445
def telegram(): '''Install Telegram desktop client for linux (x64). More infos: https://telegram.org https://desktop.telegram.org/ ''' if not exists('~/bin/Telegram', msg='Download and install Telegram:'): run('mkdir -p /tmp/telegram') run('cd /tmp/telegram && wget https:/...
[ "def", "telegram", "(", ")", ":", "if", "not", "exists", "(", "'~/bin/Telegram'", ",", "msg", "=", "'Download and install Telegram:'", ")", ":", "run", "(", "'mkdir -p /tmp/telegram'", ")", "run", "(", "'cd /tmp/telegram && wget https://telegram.org/dl/desktop/linux'", ...
Install Telegram desktop client for linux (x64). More infos: https://telegram.org https://desktop.telegram.org/
[ "Install", "Telegram", "desktop", "client", "for", "linux", "(", "x64", ")", "." ]
python
train
Felspar/django-fost-authn
fost_authn/signature.py
https://github.com/Felspar/django-fost-authn/blob/31623fa9f77570fe9b99962595da12f67f24c409/fost_authn/signature.py#L23-L33
def fost_hmac_url_signature( key, secret, host, path, query_string, expires): """ Return a signature that corresponds to the signed URL. """ if query_string: document = '%s%s?%s\n%s' % (host, path, query_string, expires) else: document = '%s%s\n%s' % (host, path, expires) ...
[ "def", "fost_hmac_url_signature", "(", "key", ",", "secret", ",", "host", ",", "path", ",", "query_string", ",", "expires", ")", ":", "if", "query_string", ":", "document", "=", "'%s%s?%s\\n%s'", "%", "(", "host", ",", "path", ",", "query_string", ",", "ex...
Return a signature that corresponds to the signed URL.
[ "Return", "a", "signature", "that", "corresponds", "to", "the", "signed", "URL", "." ]
python
train
justquick/python-varnish
varnish.py
https://github.com/justquick/python-varnish/blob/8f114c74898e6c5ade2ce49c8b595040bd150465/varnish.py#L289-L302
def run(addr, *commands, **kwargs): """ Non-threaded batch command runner returning output results """ results = [] handler = VarnishHandler(addr, **kwargs) for cmd in commands: if isinstance(cmd, tuple) and len(cmd)>1: results.extend([getattr(handler, c[0].replace('.','_'))(...
[ "def", "run", "(", "addr", ",", "*", "commands", ",", "*", "*", "kwargs", ")", ":", "results", "=", "[", "]", "handler", "=", "VarnishHandler", "(", "addr", ",", "*", "*", "kwargs", ")", "for", "cmd", "in", "commands", ":", "if", "isinstance", "(",...
Non-threaded batch command runner returning output results
[ "Non", "-", "threaded", "batch", "command", "runner", "returning", "output", "results" ]
python
train
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/keyset.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/keyset.py#L68-L88
def _to_pb(self): """Construct a KeyRange protobuf. :rtype: :class:`~google.cloud.spanner_v1.proto.keys_pb2.KeyRange` :returns: protobuf corresponding to this instance. """ kwargs = {} if self.start_open is not None: kwargs["start_open"] = _make_list_value_p...
[ "def", "_to_pb", "(", "self", ")", ":", "kwargs", "=", "{", "}", "if", "self", ".", "start_open", "is", "not", "None", ":", "kwargs", "[", "\"start_open\"", "]", "=", "_make_list_value_pb", "(", "self", ".", "start_open", ")", "if", "self", ".", "start...
Construct a KeyRange protobuf. :rtype: :class:`~google.cloud.spanner_v1.proto.keys_pb2.KeyRange` :returns: protobuf corresponding to this instance.
[ "Construct", "a", "KeyRange", "protobuf", "." ]
python
train
gem/oq-engine
openquake/commonlib/readinput.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/commonlib/readinput.py#L536-L558
def check_nonparametric_sources(fname, smodel, investigation_time): """ :param fname: full path to a source model file :param smodel: source model object :param investigation_time: investigation_time to compare with in the case of nonparametric sources :returns: ...
[ "def", "check_nonparametric_sources", "(", "fname", ",", "smodel", ",", "investigation_time", ")", ":", "# NonParametricSeismicSources", "np", "=", "[", "src", "for", "sg", "in", "smodel", ".", "src_groups", "for", "src", "in", "sg", "if", "hasattr", "(", "src...
:param fname: full path to a source model file :param smodel: source model object :param investigation_time: investigation_time to compare with in the case of nonparametric sources :returns: the nonparametric sources in the model :raises: a ValueError if t...
[ ":", "param", "fname", ":", "full", "path", "to", "a", "source", "model", "file", ":", "param", "smodel", ":", "source", "model", "object", ":", "param", "investigation_time", ":", "investigation_time", "to", "compare", "with", "in", "the", "case", "of", "...
python
train
Opentrons/opentrons
api/src/opentrons/protocol_api/contexts.py
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/api/src/opentrons/protocol_api/contexts.py#L1085-L1103
def consolidate(self, volume: float, source: List[Well], dest: Well, *args, **kwargs) -> 'InstrumentContext': """ Move liquid from multiple wells (sources) to a single well(destination) :param volume: The amount of ...
[ "def", "consolidate", "(", "self", ",", "volume", ":", "float", ",", "source", ":", "List", "[", "Well", "]", ",", "dest", ":", "Well", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "'InstrumentContext'", ":", "self", ".", "_log", ".", "deb...
Move liquid from multiple wells (sources) to a single well(destination) :param volume: The amount of volume to consolidate from each source well. :param source: List of wells from where liquid will be aspirated. :param dest: The single well into which liquid will be dispe...
[ "Move", "liquid", "from", "multiple", "wells", "(", "sources", ")", "to", "a", "single", "well", "(", "destination", ")" ]
python
train
prompt-toolkit/ptpython
ptpython/ipython.py
https://github.com/prompt-toolkit/ptpython/blob/b1bba26a491324cd65e0ef46c7b818c4b88fd993/ptpython/ipython.py#L227-L243
def initialize_extensions(shell, extensions): """ Partial copy of `InteractiveShellApp.init_extensions` from IPython. """ try: iter(extensions) except TypeError: pass # no extensions found else: for ext in extensions: try: shell.extension_mana...
[ "def", "initialize_extensions", "(", "shell", ",", "extensions", ")", ":", "try", ":", "iter", "(", "extensions", ")", "except", "TypeError", ":", "pass", "# no extensions found", "else", ":", "for", "ext", "in", "extensions", ":", "try", ":", "shell", ".", ...
Partial copy of `InteractiveShellApp.init_extensions` from IPython.
[ "Partial", "copy", "of", "InteractiveShellApp", ".", "init_extensions", "from", "IPython", "." ]
python
train
wakatime/wakatime
wakatime/packages/pygments/lexers/data.py
https://github.com/wakatime/wakatime/blob/74519ace04e8472f3a3993269963732b9946a01d/wakatime/packages/pygments/lexers/data.py#L120-L135
def parse_block_scalar_empty_line(indent_token_class, content_token_class): """Process an empty line in a block scalar.""" def callback(lexer, match, context): text = match.group() if (context.block_scalar_indent is None or len(text) <= context.block_scalar_in...
[ "def", "parse_block_scalar_empty_line", "(", "indent_token_class", ",", "content_token_class", ")", ":", "def", "callback", "(", "lexer", ",", "match", ",", "context", ")", ":", "text", "=", "match", ".", "group", "(", ")", "if", "(", "context", ".", "block_...
Process an empty line in a block scalar.
[ "Process", "an", "empty", "line", "in", "a", "block", "scalar", "." ]
python
train
domainaware/parsedmarc
parsedmarc/__init__.py
https://github.com/domainaware/parsedmarc/blob/ecc9fd434c23d896ccd1f35795ccc047f946ed05/parsedmarc/__init__.py#L636-L676
def parsed_forensic_reports_to_csv(reports): """ Converts one or more parsed forensic reports to flat CSV format, including headers Args: reports: A parsed forensic report or list of parsed forensic reports Returns: str: Parsed forensic report data in flat CSV format, including hea...
[ "def", "parsed_forensic_reports_to_csv", "(", "reports", ")", ":", "fields", "=", "[", "\"feedback_type\"", ",", "\"user_agent\"", ",", "\"version\"", ",", "\"original_envelope_id\"", ",", "\"original_mail_from\"", ",", "\"original_rcpt_to\"", ",", "\"arrival_date\"", ","...
Converts one or more parsed forensic reports to flat CSV format, including headers Args: reports: A parsed forensic report or list of parsed forensic reports Returns: str: Parsed forensic report data in flat CSV format, including headers
[ "Converts", "one", "or", "more", "parsed", "forensic", "reports", "to", "flat", "CSV", "format", "including", "headers" ]
python
test
dswah/pyGAM
pygam/terms.py
https://github.com/dswah/pyGAM/blob/b3e5c3cd580f0a3ad69f9372861624f67760c325/pygam/terms.py#L767-L795
def build_columns(self, X, verbose=False): """construct the model matrix columns for the term Parameters ---------- X : array-like Input dataset with n rows verbose : bool whether to show warnings Returns ------- scipy sparse arr...
[ "def", "build_columns", "(", "self", ",", "X", ",", "verbose", "=", "False", ")", ":", "X", "[", ":", ",", "self", ".", "feature", "]", "[", ":", ",", "np", ".", "newaxis", "]", "splines", "=", "b_spline_basis", "(", "X", "[", ":", ",", "self", ...
construct the model matrix columns for the term Parameters ---------- X : array-like Input dataset with n rows verbose : bool whether to show warnings Returns ------- scipy sparse array with n rows
[ "construct", "the", "model", "matrix", "columns", "for", "the", "term" ]
python
train
blackecho/Deep-Learning-TensorFlow
yadlt/models/autoencoders/deep_autoencoder.py
https://github.com/blackecho/Deep-Learning-TensorFlow/blob/ddeb1f2848da7b7bee166ad2152b4afc46bb2086/yadlt/models/autoencoders/deep_autoencoder.py#L180-L206
def build_model(self, n_features, encoding_w=None, encoding_b=None): """Create the computational graph for the reconstruction task. :param n_features: Number of features :param encoding_w: list of weights for the encoding layers. :param encoding_b: list of biases for the encoding layers...
[ "def", "build_model", "(", "self", ",", "n_features", ",", "encoding_w", "=", "None", ",", "encoding_b", "=", "None", ")", ":", "self", ".", "_create_placeholders", "(", "n_features", ",", "n_features", ")", "if", "encoding_w", "and", "encoding_b", ":", "sel...
Create the computational graph for the reconstruction task. :param n_features: Number of features :param encoding_w: list of weights for the encoding layers. :param encoding_b: list of biases for the encoding layers. :return: self
[ "Create", "the", "computational", "graph", "for", "the", "reconstruction", "task", "." ]
python
train
gbowerman/azurerm
azurerm/networkrp.py
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/networkrp.py#L608-L621
def list_nsgs_all(access_token, subscription_id): '''List all network security groups in a subscription. Args: access_token (str): a valid Azure Authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body of all network security groups in...
[ "def", "list_nsgs_all", "(", "access_token", ",", "subscription_id", ")", ":", "endpoint", "=", "''", ".", "join", "(", "[", "get_rm_endpoint", "(", ")", ",", "'/subscriptions/'", ",", "subscription_id", ",", "'/providers/Microsoft.Network/'", ",", "'networkSEcurity...
List all network security groups in a subscription. Args: access_token (str): a valid Azure Authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body of all network security groups in a subscription.
[ "List", "all", "network", "security", "groups", "in", "a", "subscription", ".", "Args", ":", "access_token", "(", "str", ")", ":", "a", "valid", "Azure", "Authentication", "token", ".", "subscription_id", "(", "str", ")", ":", "Azure", "subscription", "id", ...
python
train
ambitioninc/django-entity
entity/sync.py
https://github.com/ambitioninc/django-entity/blob/ebc61f34313c52f4ef5819eb1da25b2ad837e80c/entity/sync.py#L120-L135
def _get_model_objs_to_sync(model_ids_to_sync, model_objs_map, sync_all): """ Given the model IDs to sync, fetch all model objects to sync """ model_objs_to_sync = {} for ctype, model_ids_to_sync_for_ctype in model_ids_to_sync.items(): model_qset = entity_registry.entity_registry.get(ctype.m...
[ "def", "_get_model_objs_to_sync", "(", "model_ids_to_sync", ",", "model_objs_map", ",", "sync_all", ")", ":", "model_objs_to_sync", "=", "{", "}", "for", "ctype", ",", "model_ids_to_sync_for_ctype", "in", "model_ids_to_sync", ".", "items", "(", ")", ":", "model_qset...
Given the model IDs to sync, fetch all model objects to sync
[ "Given", "the", "model", "IDs", "to", "sync", "fetch", "all", "model", "objects", "to", "sync" ]
python
train
Phlya/adjustText
adjustText/__init__.py
https://github.com/Phlya/adjustText/blob/bebc4925dffb24508af6e371d4961850fe815fe8/adjustText/__init__.py#L206-L253
def repel_text(texts, renderer=None, ax=None, expand=(1.2, 1.2), only_use_max_min=False, move=False): """ Repel texts from each other while expanding their bounding boxes by expand (x, y), e.g. (1.2, 1.2) would multiply width and height by 1.2. Requires a renderer to get the actual sizes ...
[ "def", "repel_text", "(", "texts", ",", "renderer", "=", "None", ",", "ax", "=", "None", ",", "expand", "=", "(", "1.2", ",", "1.2", ")", ",", "only_use_max_min", "=", "False", ",", "move", "=", "False", ")", ":", "if", "ax", "is", "None", ":", "...
Repel texts from each other while expanding their bounding boxes by expand (x, y), e.g. (1.2, 1.2) would multiply width and height by 1.2. Requires a renderer to get the actual sizes of the text, and to that end either one needs to be directly provided, or the axes have to be specified, and the renderer...
[ "Repel", "texts", "from", "each", "other", "while", "expanding", "their", "bounding", "boxes", "by", "expand", "(", "x", "y", ")", "e", ".", "g", ".", "(", "1", ".", "2", "1", ".", "2", ")", "would", "multiply", "width", "and", "height", "by", "1",...
python
train
aws/sagemaker-python-sdk
src/sagemaker/session.py
https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L937-L985
def endpoint_from_job(self, job_name, initial_instance_count, instance_type, deployment_image=None, name=None, role=None, wait=True, model_environment_vars=None, vpc_config_override=vpc_utils.VPC_CONFIG_DEFAULT, accelerator_type=None): ...
[ "def", "endpoint_from_job", "(", "self", ",", "job_name", ",", "initial_instance_count", ",", "instance_type", ",", "deployment_image", "=", "None", ",", "name", "=", "None", ",", "role", "=", "None", ",", "wait", "=", "True", ",", "model_environment_vars", "=...
Create an ``Endpoint`` using the results of a successful training job. Specify the job name, Docker image containing the inference code, and hardware configuration to deploy the model. Internally the API, creates an Amazon SageMaker model (that describes the model artifacts and the Docker image...
[ "Create", "an", "Endpoint", "using", "the", "results", "of", "a", "successful", "training", "job", "." ]
python
train
yoavaviram/python-amazon-simple-product-api
amazon/api.py
https://github.com/yoavaviram/python-amazon-simple-product-api/blob/f1cb0e209145fcfac9444e4c733dd19deb59d31a/amazon/api.py#L390-L424
def cart_modify(self, items, CartId=None, HMAC=None, **kwargs): """CartAdd. :param items: A dictionary containing the items to be added to the cart. Or a list containing these dictionaries. example: [{'cart_item_id': 'rt2ofih3f389nwiuhf8934z87o3f4h', 'quan...
[ "def", "cart_modify", "(", "self", ",", "items", ",", "CartId", "=", "None", ",", "HMAC", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "CartId", "or", "not", "HMAC", ":", "raise", "CartException", "(", "'CartId required for CartModify call'...
CartAdd. :param items: A dictionary containing the items to be added to the cart. Or a list containing these dictionaries. example: [{'cart_item_id': 'rt2ofih3f389nwiuhf8934z87o3f4h', 'quantity': 1}] :param CartId: Id of Cart :param HMAC: HMAC of C...
[ "CartAdd", ".", ":", "param", "items", ":", "A", "dictionary", "containing", "the", "items", "to", "be", "added", "to", "the", "cart", ".", "Or", "a", "list", "containing", "these", "dictionaries", ".", "example", ":", "[", "{", "cart_item_id", ":", "rt2...
python
train
pyrogram/pyrogram
pyrogram/client/client.py
https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/client.py#L410-L431
def idle(self, stop_signals: tuple = (SIGINT, SIGTERM, SIGABRT)): """Blocks the program execution until one of the signals are received, then gently stop the Client by closing the underlying connection. Args: stop_signals (``tuple``, *optional*): Iterable containing ...
[ "def", "idle", "(", "self", ",", "stop_signals", ":", "tuple", "=", "(", "SIGINT", ",", "SIGTERM", ",", "SIGABRT", ")", ")", ":", "def", "signal_handler", "(", "*", "args", ")", ":", "self", ".", "is_idle", "=", "False", "for", "s", "in", "stop_signa...
Blocks the program execution until one of the signals are received, then gently stop the Client by closing the underlying connection. Args: stop_signals (``tuple``, *optional*): Iterable containing signals the signal handler will listen to. Defaults to (SIGIN...
[ "Blocks", "the", "program", "execution", "until", "one", "of", "the", "signals", "are", "received", "then", "gently", "stop", "the", "Client", "by", "closing", "the", "underlying", "connection", "." ]
python
train
Opentrons/opentrons
api/src/opentrons/legacy_api/instruments/pipette.py
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/api/src/opentrons/legacy_api/instruments/pipette.py#L1256-L1371
def transfer(self, volume, source, dest, **kwargs): """ Transfer will move a volume of liquid from a source location(s) to a dest location(s). It is a higher-level command, incorporating other :any:`Pipette` commands, like :any:`aspirate` and :any:`dispense`, designed to make pro...
[ "def", "transfer", "(", "self", ",", "volume", ",", "source", ",", "dest", ",", "*", "*", "kwargs", ")", ":", "# Note: currently it varies whether the pipette should have a tip on", "# or not depending on the parameters for this call, so we cannot", "# create a very reliable asse...
Transfer will move a volume of liquid from a source location(s) to a dest location(s). It is a higher-level command, incorporating other :any:`Pipette` commands, like :any:`aspirate` and :any:`dispense`, designed to make protocol writing easier at the cost of specificity. Parame...
[ "Transfer", "will", "move", "a", "volume", "of", "liquid", "from", "a", "source", "location", "(", "s", ")", "to", "a", "dest", "location", "(", "s", ")", ".", "It", "is", "a", "higher", "-", "level", "command", "incorporating", "other", ":", "any", ...
python
train
ZELLMECHANIK-DRESDEN/fcswrite
fcswrite/fcswrite.py
https://github.com/ZELLMECHANIK-DRESDEN/fcswrite/blob/5584983aa1eb927660183252039e73285c0724b3/fcswrite/fcswrite.py#L13-L201
def write_fcs(filename, chn_names, data, endianness="big", compat_chn_names=True, compat_copy=True, compat_negative=True, compat_percent=True, compat_max_int16=10000): """Write numpy data to an .fcs file (FCS3.0 file format) P...
[ "def", "write_fcs", "(", "filename", ",", "chn_names", ",", "data", ",", "endianness", "=", "\"big\"", ",", "compat_chn_names", "=", "True", ",", "compat_copy", "=", "True", ",", "compat_negative", "=", "True", ",", "compat_percent", "=", "True", ",", "compa...
Write numpy data to an .fcs file (FCS3.0 file format) Parameters ---------- filename: str or pathlib.Path Path to the output .fcs file ch_names: list of str, length C Names of the output channels data: 2d ndarray of shape (N,C) The numpy array data to store as .fcs file for...
[ "Write", "numpy", "data", "to", "an", ".", "fcs", "file", "(", "FCS3", ".", "0", "file", "format", ")" ]
python
test
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_vswitch.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_vswitch.py#L457-L468
def get_vnetwork_dvpgs_output_instance_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_vnetwork_dvpgs = ET.Element("get_vnetwork_dvpgs") config = get_vnetwork_dvpgs output = ET.SubElement(get_vnetwork_dvpgs, "output") instance_id =...
[ "def", "get_vnetwork_dvpgs_output_instance_id", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "get_vnetwork_dvpgs", "=", "ET", ".", "Element", "(", "\"get_vnetwork_dvpgs\"", ")", "config", "=", "ge...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
chaoss/grimoirelab-sortinghat
sortinghat/parsing/mozilla.py
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/parsing/mozilla.py#L84-L160
def __parse_identities(self, json): """Parse identities using Mozillians format. The Mozillians identities format is a JSON document under the "results" key. The document should follow the next schema: { "results" : [ { "_url": "https://example.co...
[ "def", "__parse_identities", "(", "self", ",", "json", ")", ":", "try", ":", "for", "mozillian", "in", "json", "[", "'results'", "]", ":", "name", "=", "self", ".", "__encode", "(", "mozillian", "[", "'full_name'", "]", "[", "'value'", "]", ")", "email...
Parse identities using Mozillians format. The Mozillians identities format is a JSON document under the "results" key. The document should follow the next schema: { "results" : [ { "_url": "https://example.com/api/v2/users/1/", "alternate_e...
[ "Parse", "identities", "using", "Mozillians", "format", "." ]
python
train
pmelchior/proxmin
proxmin/operators.py
https://github.com/pmelchior/proxmin/blob/60e49d90c67c46329cc1d3b5c484951dc8bd2c3f/proxmin/operators.py#L91-L94
def prox_hard_plus(X, step, thresh=0): """Hard thresholding with projection onto non-negative numbers """ return prox_plus(prox_hard(X, step, thresh=thresh), step)
[ "def", "prox_hard_plus", "(", "X", ",", "step", ",", "thresh", "=", "0", ")", ":", "return", "prox_plus", "(", "prox_hard", "(", "X", ",", "step", ",", "thresh", "=", "thresh", ")", ",", "step", ")" ]
Hard thresholding with projection onto non-negative numbers
[ "Hard", "thresholding", "with", "projection", "onto", "non", "-", "negative", "numbers" ]
python
train