repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
lordmauve/lepton
lepton/system.py
https://github.com/lordmauve/lepton/blob/bf03f2c20ea8c51ade632f692d0a21e520fbba7c/lepton/system.py#L72-L88
def run_ahead(self, time, framerate): """Run the particle system for the specified time frame at the specified framerate to move time forward as quickly as possible. Useful for "warming up" the particle system to reach a steady-state before anything is drawn or to simply "skip ahead" in ...
[ "def", "run_ahead", "(", "self", ",", "time", ",", "framerate", ")", ":", "if", "time", ":", "td", "=", "1.0", "/", "framerate", "update", "=", "self", ".", "update", "for", "i", "in", "range", "(", "int", "(", "time", "/", "td", ")", ")", ":", ...
Run the particle system for the specified time frame at the specified framerate to move time forward as quickly as possible. Useful for "warming up" the particle system to reach a steady-state before anything is drawn or to simply "skip ahead" in time. time -- The amount of simulation t...
[ "Run", "the", "particle", "system", "for", "the", "specified", "time", "frame", "at", "the", "specified", "framerate", "to", "move", "time", "forward", "as", "quickly", "as", "possible", ".", "Useful", "for", "warming", "up", "the", "particle", "system", "to...
python
train
42
underscorephil/dayonelib
dayonelib/__init__.py
https://github.com/underscorephil/dayonelib/blob/4df134f601abcb033ec04cf7596f25ee25d44661/dayonelib/__init__.py#L143-L146
def _file_path(self, uid): """Create and return full file path for DayOne entry""" file_name = '%s.doentry' % (uid) return os.path.join(self.dayone_journal_path, file_name)
[ "def", "_file_path", "(", "self", ",", "uid", ")", ":", "file_name", "=", "'%s.doentry'", "%", "(", "uid", ")", "return", "os", ".", "path", ".", "join", "(", "self", ".", "dayone_journal_path", ",", "file_name", ")" ]
Create and return full file path for DayOne entry
[ "Create", "and", "return", "full", "file", "path", "for", "DayOne", "entry" ]
python
valid
48.25
Phylliade/ikpy
scripts/hand_follow.py
https://github.com/Phylliade/ikpy/blob/60e36d6163136942bf520d952db17123c658d0b6/scripts/hand_follow.py#L27-L30
def follow_hand(poppy, delta): """Tell the right hand to follow the left hand""" right_arm_position = poppy.l_arm_chain.end_effector + delta poppy.r_arm_chain.goto(right_arm_position, 0.5, wait=True)
[ "def", "follow_hand", "(", "poppy", ",", "delta", ")", ":", "right_arm_position", "=", "poppy", ".", "l_arm_chain", ".", "end_effector", "+", "delta", "poppy", ".", "r_arm_chain", ".", "goto", "(", "right_arm_position", ",", "0.5", ",", "wait", "=", "True", ...
Tell the right hand to follow the left hand
[ "Tell", "the", "right", "hand", "to", "follow", "the", "left", "hand" ]
python
train
52
dottedmag/pychm
chm/chm.py
https://github.com/dottedmag/pychm/blob/fd87831a8c23498e65304fce341718bd2968211b/chm/chm.py#L444-L450
def GetString(self, text, idx): '''Internal method. Retrieves a string from the #STRINGS buffer. ''' next = string.find(text, '\x00', idx) chunk = text[idx:next] return chunk
[ "def", "GetString", "(", "self", ",", "text", ",", "idx", ")", ":", "next", "=", "string", ".", "find", "(", "text", ",", "'\\x00'", ",", "idx", ")", "chunk", "=", "text", "[", "idx", ":", "next", "]", "return", "chunk" ]
Internal method. Retrieves a string from the #STRINGS buffer.
[ "Internal", "method", ".", "Retrieves", "a", "string", "from", "the", "#STRINGS", "buffer", "." ]
python
train
30.857143
ruipgil/changepy
changepy/costs.py
https://github.com/ruipgil/changepy/blob/95a903a24d532d658d4f1775d298c7fd51cdf47c/changepy/costs.py#L43-L75
def normal_var(data, mean): """ Creates a segment cost function for a time series with a Normal distribution with changing variance Args: data (:obj:`list` of float): 1D time series data variance (float): variance Returns: function: Function with signature (int, ...
[ "def", "normal_var", "(", "data", ",", "mean", ")", ":", "if", "not", "isinstance", "(", "data", ",", "np", ".", "ndarray", ")", ":", "data", "=", "np", ".", "array", "(", "data", ")", "cumm", "=", "[", "0.0", "]", "cumm", ".", "extend", "(", "...
Creates a segment cost function for a time series with a Normal distribution with changing variance Args: data (:obj:`list` of float): 1D time series data variance (float): variance Returns: function: Function with signature (int, int) -> float where the ...
[ "Creates", "a", "segment", "cost", "function", "for", "a", "time", "series", "with", "a", "Normal", "distribution", "with", "changing", "variance" ]
python
train
29.090909
tgsmith61591/pmdarima
pmdarima/preprocessing/endog/boxcox.py
https://github.com/tgsmith61591/pmdarima/blob/a133de78ba5bd68da9785b061f519ba28cd514cc/pmdarima/preprocessing/endog/boxcox.py#L127-L164
def inverse_transform(self, y, exogenous=None): """Inverse transform a transformed array Inverse the Box-Cox transformation on the transformed array. Note that if truncation happened in the ``transform`` method, invertibility will not be preserved, and the transformed array may not be p...
[ "def", "inverse_transform", "(", "self", ",", "y", ",", "exogenous", "=", "None", ")", ":", "check_is_fitted", "(", "self", ",", "\"lam1_\"", ")", "lam1", "=", "self", ".", "lam1_", "lam2", "=", "self", ".", "lam2_", "y", ",", "exog", "=", "self", "....
Inverse transform a transformed array Inverse the Box-Cox transformation on the transformed array. Note that if truncation happened in the ``transform`` method, invertibility will not be preserved, and the transformed array may not be perfectly inverse-transformed. Parameters ...
[ "Inverse", "transform", "a", "transformed", "array" ]
python
train
35.315789
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_common_def.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_common_def.py#L889-L908
def ip_rtm_config_route_static_bfd_bfd_static_route_bfd_interval_attributes_interval(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip = ET.SubElement(config, "ip", xmlns="urn:brocade.com:mgmt:brocade-common-def") rtm_config = ET.SubElement(ip, "rtm-con...
[ "def", "ip_rtm_config_route_static_bfd_bfd_static_route_bfd_interval_attributes_interval", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "ip", "=", "ET", ".", "SubElement", "(", "config", ",", "\"ip\""...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
59.65
awslabs/aws-shell
awsshell/resource/index.py
https://github.com/awslabs/aws-shell/blob/8950f03d9d720879890af6c11537b8f9789ce5a9/awsshell/resource/index.py#L105-L137
def describe_autocomplete(self, service, operation, param): """Describe operation and args needed for server side completion. :type service: str :param service: The AWS service name. :type operation: str :param operation: The AWS operation name. :type param: str ...
[ "def", "describe_autocomplete", "(", "self", ",", "service", ",", "operation", ",", "param", ")", ":", "service_index", "=", "self", ".", "_index", "[", "service", "]", "LOG", ".", "debug", "(", "service_index", ")", "if", "param", "not", "in", "service_in...
Describe operation and args needed for server side completion. :type service: str :param service: The AWS service name. :type operation: str :param operation: The AWS operation name. :type param: str :param param: The name of the parameter being completed. This must ...
[ "Describe", "operation", "and", "args", "needed", "for", "server", "side", "completion", "." ]
python
train
41.181818
pyamg/pyamg
pyamg/relaxation/smoothing.py
https://github.com/pyamg/pyamg/blob/89dc54aa27e278f65d2f54bdaf16ab97d7768fa6/pyamg/relaxation/smoothing.py#L378-L416
def matrix_asformat(lvl, name, format, blocksize=None): """Set a matrix to a specific format. This routine looks for the matrix "name" in the specified format as a member of the level instance, lvl. For example, if name='A', format='bsr' and blocksize=(4,4), and if lvl.Absr44 exists with the correct b...
[ "def", "matrix_asformat", "(", "lvl", ",", "name", ",", "format", ",", "blocksize", "=", "None", ")", ":", "desired_matrix", "=", "name", "+", "format", "M", "=", "getattr", "(", "lvl", ",", "name", ")", "if", "format", "==", "'bsr'", ":", "desired_mat...
Set a matrix to a specific format. This routine looks for the matrix "name" in the specified format as a member of the level instance, lvl. For example, if name='A', format='bsr' and blocksize=(4,4), and if lvl.Absr44 exists with the correct blocksize, then lvl.Absr is returned. If the matrix doesn't...
[ "Set", "a", "matrix", "to", "a", "specific", "format", "." ]
python
train
38.25641
cherrypy/cheroot
cheroot/ssl/builtin.py
https://github.com/cherrypy/cheroot/blob/2af3b1798d66da697957480d3a8b4831a405770b/cheroot/ssl/builtin.py#L41-L49
def _assert_ssl_exc_contains(exc, *msgs): """Check whether SSL exception contains either of messages provided.""" if len(msgs) < 1: raise TypeError( '_assert_ssl_exc_contains() requires ' 'at least one message to be passed.', ) err_msg_lower = str(exc).lower() ret...
[ "def", "_assert_ssl_exc_contains", "(", "exc", ",", "*", "msgs", ")", ":", "if", "len", "(", "msgs", ")", "<", "1", ":", "raise", "TypeError", "(", "'_assert_ssl_exc_contains() requires '", "'at least one message to be passed.'", ",", ")", "err_msg_lower", "=", "s...
Check whether SSL exception contains either of messages provided.
[ "Check", "whether", "SSL", "exception", "contains", "either", "of", "messages", "provided", "." ]
python
train
40.111111
Cito/DBUtils
DBUtils/SteadyDB.py
https://github.com/Cito/DBUtils/blob/90e8825e038f08c82044b8e50831480175fa026a/DBUtils/SteadyDB.py#L564-L574
def _setsizes(self, cursor=None): """Set stored input and output sizes for cursor execution.""" if cursor is None: cursor = self._cursor if self._inputsizes: cursor.setinputsizes(self._inputsizes) for column, size in self._outputsizes.items(): if colum...
[ "def", "_setsizes", "(", "self", ",", "cursor", "=", "None", ")", ":", "if", "cursor", "is", "None", ":", "cursor", "=", "self", ".", "_cursor", "if", "self", ".", "_inputsizes", ":", "cursor", ".", "setinputsizes", "(", "self", ".", "_inputsizes", ")"...
Set stored input and output sizes for cursor execution.
[ "Set", "stored", "input", "and", "output", "sizes", "for", "cursor", "execution", "." ]
python
train
39.272727
ethereum/web3.py
web3/_utils/encoding.py
https://github.com/ethereum/web3.py/blob/71b8bf03dc6d332dd97d8902a38ffab6f8b5a5ab/web3/_utils/encoding.py#L188-L200
def text_if_str(to_type, text_or_primitive): """ Convert to a type, assuming that strings can be only unicode text (not a hexstr) @param to_type is a function that takes the arguments (primitive, hexstr=hexstr, text=text), eg~ to_bytes, to_text, to_hex, to_int, etc @param hexstr_or_primitive in...
[ "def", "text_if_str", "(", "to_type", ",", "text_or_primitive", ")", ":", "if", "isinstance", "(", "text_or_primitive", ",", "str", ")", ":", "(", "primitive", ",", "text", ")", "=", "(", "None", ",", "text_or_primitive", ")", "else", ":", "(", "primitive"...
Convert to a type, assuming that strings can be only unicode text (not a hexstr) @param to_type is a function that takes the arguments (primitive, hexstr=hexstr, text=text), eg~ to_bytes, to_text, to_hex, to_int, etc @param hexstr_or_primitive in bytes, str, or int.
[ "Convert", "to", "a", "type", "assuming", "that", "strings", "can", "be", "only", "unicode", "text", "(", "not", "a", "hexstr", ")" ]
python
train
41.384615
staugur/Flask-PluginKit
flask_pluginkit/utils.py
https://github.com/staugur/Flask-PluginKit/blob/512aabf87fa13f4dc1082abd08d1d1dcf3b03f16/flask_pluginkit/utils.py#L129-L138
def isValidSemver(version): """Semantic version number - determines whether the version is qualified. The format is MAJOR.Minor.PATCH, more with https://semver.org/""" if version and isinstance(version, string_types): try: semver.parse(version) except (TypeError,ValueError): ...
[ "def", "isValidSemver", "(", "version", ")", ":", "if", "version", "and", "isinstance", "(", "version", ",", "string_types", ")", ":", "try", ":", "semver", ".", "parse", "(", "version", ")", "except", "(", "TypeError", ",", "ValueError", ")", ":", "retu...
Semantic version number - determines whether the version is qualified. The format is MAJOR.Minor.PATCH, more with https://semver.org/
[ "Semantic", "version", "number", "-", "determines", "whether", "the", "version", "is", "qualified", ".", "The", "format", "is", "MAJOR", ".", "Minor", ".", "PATCH", "more", "with", "https", ":", "//", "semver", ".", "org", "/" ]
python
train
38.2
draios/python-sdc-client
sdcclient/_scanning.py
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_scanning.py#L139-L150
def query_image_metadata(self, image, metadata_type=""): '''**Description** Find the image with the tag <image> and return its metadata. **Arguments** - image: Input image can be in the following formats: registry/repo:tag - metadata_type: The metadata type can be on...
[ "def", "query_image_metadata", "(", "self", ",", "image", ",", "metadata_type", "=", "\"\"", ")", ":", "return", "self", ".", "_query_image", "(", "image", ",", "query_group", "=", "'metadata'", ",", "query_type", "=", "metadata_type", ")" ]
**Description** Find the image with the tag <image> and return its metadata. **Arguments** - image: Input image can be in the following formats: registry/repo:tag - metadata_type: The metadata type can be one of the types returned by running without a type specified ...
[ "**", "Description", "**", "Find", "the", "image", "with", "the", "tag", "<image", ">", "and", "return", "its", "metadata", "." ]
python
test
46.916667
trevisanj/f311
f311/scripts/programs.py
https://github.com/trevisanj/f311/blob/9e502a3d1e1f74d4290a8a0bae9a34ef8d7b29f7/f311/scripts/programs.py#L27-L33
def _get_programs_dict(pkgname_only, flag_protected, flag_no_pfant=False): """Returns dictionary {(package description): [ExeInfo0, ...], ...}""" allinfo = f311.get_programs_dict(pkgname_only, flag_protected) if not flag_no_pfant and "pyfant" in allinfo: _add_PFANT(allinfo) return allinfo
[ "def", "_get_programs_dict", "(", "pkgname_only", ",", "flag_protected", ",", "flag_no_pfant", "=", "False", ")", ":", "allinfo", "=", "f311", ".", "get_programs_dict", "(", "pkgname_only", ",", "flag_protected", ")", "if", "not", "flag_no_pfant", "and", "\"pyfant...
Returns dictionary {(package description): [ExeInfo0, ...], ...}
[ "Returns", "dictionary", "{", "(", "package", "description", ")", ":", "[", "ExeInfo0", "...", "]", "...", "}" ]
python
train
44
smdabdoub/phylotoast
phylotoast/biom_calc.py
https://github.com/smdabdoub/phylotoast/blob/0b74ef171e6a84761710548501dfac71285a58a3/phylotoast/biom_calc.py#L95-L135
def raw_abundance(biomf, sampleIDs=None, sample_abd=True): """ Calculate the total number of sequences in each OTU or SampleID. :type biomf: A BIOM file. :param biomf: OTU table format. :type sampleIDs: List :param sampleIDs: A list of column id's from BIOM format OTU table. By default, the ...
[ "def", "raw_abundance", "(", "biomf", ",", "sampleIDs", "=", "None", ",", "sample_abd", "=", "True", ")", ":", "results", "=", "defaultdict", "(", "int", ")", "if", "sampleIDs", "is", "None", ":", "sampleIDs", "=", "biomf", ".", "ids", "(", ")", "else"...
Calculate the total number of sequences in each OTU or SampleID. :type biomf: A BIOM file. :param biomf: OTU table format. :type sampleIDs: List :param sampleIDs: A list of column id's from BIOM format OTU table. By default, the list has been set to None. :type sample_abd: B...
[ "Calculate", "the", "total", "number", "of", "sequences", "in", "each", "OTU", "or", "SampleID", "." ]
python
train
35.219512
cnobile2012/pololu-motors
pololu/motors/qik.py
https://github.com/cnobile2012/pololu-motors/blob/453d2283a63cfe15cda96cad6dffa73372d52a7c/pololu/motors/qik.py#L558-L605
def _setSpeed(self, speed, motor, device): """ Set motor speed. This method takes into consideration the PWM frequency that the hardware is currently running at and limits the values passed to the hardware accordingly. :Parameters: speed : `int` Motor speed...
[ "def", "_setSpeed", "(", "self", ",", "speed", ",", "motor", ",", "device", ")", ":", "reverse", "=", "False", "if", "speed", "<", "0", ":", "speed", "=", "-", "speed", "reverse", "=", "True", "# 0 and 2 for Qik 2s9v1, 0, 2, and 4 for 2s12v10", "if", "self",...
Set motor speed. This method takes into consideration the PWM frequency that the hardware is currently running at and limits the values passed to the hardware accordingly. :Parameters: speed : `int` Motor speed as an integer. Negative numbers indicate reverse s...
[ "Set", "motor", "speed", ".", "This", "method", "takes", "into", "consideration", "the", "PWM", "frequency", "that", "the", "hardware", "is", "currently", "running", "at", "and", "limits", "the", "values", "passed", "to", "the", "hardware", "accordingly", "." ...
python
train
32.8125
neptune-ml/steppy
steppy/base.py
https://github.com/neptune-ml/steppy/blob/856b95f1f5189e1d2ca122b891bc670adac9692b/steppy/base.py#L258-L272
def upstream_structure(self): """Build dictionary with entire upstream pipeline structure (with regard to the current Step). Returns: dict: dictionary describing the upstream pipeline structure. It has two keys: ``'edges'`` and ``'nodes'``, where: - value of...
[ "def", "upstream_structure", "(", "self", ")", ":", "structure_dict", "=", "{", "'edges'", ":", "set", "(", ")", ",", "'nodes'", ":", "set", "(", ")", "}", "structure_dict", "=", "self", ".", "_build_structure_dict", "(", "structure_dict", ")", "return", "...
Build dictionary with entire upstream pipeline structure (with regard to the current Step). Returns: dict: dictionary describing the upstream pipeline structure. It has two keys: ``'edges'`` and ``'nodes'``, where: - value of ``'edges'`` is set of tuples ``(input_st...
[ "Build", "dictionary", "with", "entire", "upstream", "pipeline", "structure", "(", "with", "regard", "to", "the", "current", "Step", ")", "." ]
python
train
42.933333
abilian/abilian-core
abilian/services/conversion/handlers.py
https://github.com/abilian/abilian-core/blob/0a71275bf108c3d51e13ca9e093c0249235351e3/abilian/services/conversion/handlers.py#L314-L361
def convert(self, blob, **kw): """Convert using unoconv converter.""" timeout = self.run_timeout with make_temp_file(blob) as in_fn, make_temp_file( prefix="tmp-unoconv-", suffix=".pdf" ) as out_fn: args = ["-f", "pdf", "-o", out_fn, in_fn] # Hack for...
[ "def", "convert", "(", "self", ",", "blob", ",", "*", "*", "kw", ")", ":", "timeout", "=", "self", ".", "run_timeout", "with", "make_temp_file", "(", "blob", ")", "as", "in_fn", ",", "make_temp_file", "(", "prefix", "=", "\"tmp-unoconv-\"", ",", "suffix"...
Convert using unoconv converter.
[ "Convert", "using", "unoconv", "converter", "." ]
python
train
38.1875
junaruga/rpm-py-installer
install.py
https://github.com/junaruga/rpm-py-installer/blob/12f45feb0ba533dec8d0d16ef1e9b7fb8cfbd4ed/install.py#L1636-L1643
def lib_dir(self): """Return standard library directory path used by RPM libs.""" if not self._lib_dir: lib_files = glob.glob("/usr/lib/*/librpm.so*") if not lib_files: raise InstallError("Can not find lib directory.") self._lib_dir = os.path.dirname(l...
[ "def", "lib_dir", "(", "self", ")", ":", "if", "not", "self", ".", "_lib_dir", ":", "lib_files", "=", "glob", ".", "glob", "(", "\"/usr/lib/*/librpm.so*\"", ")", "if", "not", "lib_files", ":", "raise", "InstallError", "(", "\"Can not find lib directory.\"", ")...
Return standard library directory path used by RPM libs.
[ "Return", "standard", "library", "directory", "path", "used", "by", "RPM", "libs", "." ]
python
train
44.25
MartinThoma/hwrt
hwrt/datasets/mathbrush.py
https://github.com/MartinThoma/hwrt/blob/725c21a3d0f5a30b8492cbc184b3688ceb364e1c/hwrt/datasets/mathbrush.py#L80-L105
def get_latex(ink_filename): """Get the LaTeX string from a file by the *.ink filename.""" tex_file = os.path.splitext(ink_filename)[0] + ".tex" with open(tex_file) as f: tex_content = f.read().strip() pattern = re.compile(r"\\begin\{displaymath\}(.*?)\\end\{displaymath\}", ...
[ "def", "get_latex", "(", "ink_filename", ")", ":", "tex_file", "=", "os", ".", "path", ".", "splitext", "(", "ink_filename", ")", "[", "0", "]", "+", "\".tex\"", "with", "open", "(", "tex_file", ")", "as", "f", ":", "tex_content", "=", "f", ".", "rea...
Get the LaTeX string from a file by the *.ink filename.
[ "Get", "the", "LaTeX", "string", "from", "a", "file", "by", "the", "*", ".", "ink", "filename", "." ]
python
train
38.846154
tensorflow/probability
tensorflow_probability/python/distributions/internal/slicing.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/internal/slicing.py#L145-L155
def _apply_single_step(dist, params_event_ndims, slices, params_overrides): """Applies a single slicing step to `dist`, returning a new instance.""" if len(slices) == 1 and slices[0] == Ellipsis: # The path used by Distribution.copy: batch_slice(...args..., Ellipsis) override_dict = {} else: override_...
[ "def", "_apply_single_step", "(", "dist", ",", "params_event_ndims", ",", "slices", ",", "params_overrides", ")", ":", "if", "len", "(", "slices", ")", "==", "1", "and", "slices", "[", "0", "]", "==", "Ellipsis", ":", "# The path used by Distribution.copy: batch...
Applies a single slicing step to `dist`, returning a new instance.
[ "Applies", "a", "single", "slicing", "step", "to", "dist", "returning", "a", "new", "instance", "." ]
python
test
47.545455
tensorflow/tensor2tensor
tensor2tensor/rl/rl_utils.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/rl_utils.py#L100-L117
def evaluate_all_configs( hparams, agent_model_dir, eval_fn=_eval_fn_with_learner ): """Evaluate the agent with multiple eval configurations.""" metrics = {} # Iterate over all combinations of sampling temperatures and whether to do # initial no-ops. for sampling_temp in hparams.eval_sampling_temps: #...
[ "def", "evaluate_all_configs", "(", "hparams", ",", "agent_model_dir", ",", "eval_fn", "=", "_eval_fn_with_learner", ")", ":", "metrics", "=", "{", "}", "# Iterate over all combinations of sampling temperatures and whether to do", "# initial no-ops.", "for", "sampling_temp", ...
Evaluate the agent with multiple eval configurations.
[ "Evaluate", "the", "agent", "with", "multiple", "eval", "configurations", "." ]
python
train
41.611111
materialsproject/pymatgen
pymatgen/io/qchem_deprecated.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/qchem_deprecated.py#L533-L556
def scale_geom_opt_threshold(self, gradient=0.1, displacement=0.1, energy=0.1): """ Adjust the convergence criteria of geometry optimization. Args: gradient: the scale factor for gradient criteria. If less than 1.0, you are tightening...
[ "def", "scale_geom_opt_threshold", "(", "self", ",", "gradient", "=", "0.1", ",", "displacement", "=", "0.1", ",", "energy", "=", "0.1", ")", ":", "if", "gradient", "<", "1.0", "/", "(", "300", "-", "1", ")", "or", "displacement", "<", "1.0", "/", "(...
Adjust the convergence criteria of geometry optimization. Args: gradient: the scale factor for gradient criteria. If less than 1.0, you are tightening the threshold. The base value is 300 × 10E−6 displacement: the scale factor for atomic displacement. If ...
[ "Adjust", "the", "convergence", "criteria", "of", "geometry", "optimization", "." ]
python
train
53.125
aws/sagemaker-python-sdk
src/sagemaker/workflow/airflow.py
https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/workflow/airflow.py#L283-L303
def update_submit_s3_uri(estimator, job_name): """Updated the S3 URI of the framework source directory in given estimator. Args: estimator (sagemaker.estimator.Framework): The Framework estimator to update. job_name (str): The new job name included in the submit S3 URI Returns: str...
[ "def", "update_submit_s3_uri", "(", "estimator", ",", "job_name", ")", ":", "if", "estimator", ".", "uploaded_code", "is", "None", ":", "return", "pattern", "=", "r'(?<=/)[^/]+?(?=/source/sourcedir.tar.gz)'", "# update the S3 URI with the latest training job.", "# s3://path/o...
Updated the S3 URI of the framework source directory in given estimator. Args: estimator (sagemaker.estimator.Framework): The Framework estimator to update. job_name (str): The new job name included in the submit S3 URI Returns: str: The updated S3 URI of framework source directory
[ "Updated", "the", "S3", "URI", "of", "the", "framework", "source", "directory", "in", "given", "estimator", "." ]
python
train
41.238095
raiden-network/raiden
raiden/network/upnpsock.py
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/upnpsock.py#L37-L70
def connect(): """Try to connect to the router. Returns: u (miniupnc.UPnP): the connected upnp-instance router (string): the connection information """ upnp = miniupnpc.UPnP() upnp.discoverdelay = 200 providers = upnp.discover() if providers > 1: log.debug('multiple ...
[ "def", "connect", "(", ")", ":", "upnp", "=", "miniupnpc", ".", "UPnP", "(", ")", "upnp", ".", "discoverdelay", "=", "200", "providers", "=", "upnp", ".", "discover", "(", ")", "if", "providers", ">", "1", ":", "log", ".", "debug", "(", "'multiple up...
Try to connect to the router. Returns: u (miniupnc.UPnP): the connected upnp-instance router (string): the connection information
[ "Try", "to", "connect", "to", "the", "router", "." ]
python
train
34.647059
dmlc/gluon-nlp
scripts/word_embeddings/evaluate_pretrained.py
https://github.com/dmlc/gluon-nlp/blob/4b83eb6bcc8881e5f1081a3675adaa19fac5c0ba/scripts/word_embeddings/evaluate_pretrained.py#L100-L131
def validate_args(args): """Validate provided arguments and act on --help.""" if args.list_embedding_sources: print('Listing all sources for {} embeddings.'.format( args.embedding_name)) print('Specify --embedding-name if you wish to ' 'list sources of other embeddings'...
[ "def", "validate_args", "(", "args", ")", ":", "if", "args", ".", "list_embedding_sources", ":", "print", "(", "'Listing all sources for {} embeddings.'", ".", "format", "(", "args", ".", "embedding_name", ")", ")", "print", "(", "'Specify --embedding-name if you wish...
Validate provided arguments and act on --help.
[ "Validate", "provided", "arguments", "and", "act", "on", "--", "help", "." ]
python
train
44.21875
tensorflow/tensor2tensor
tensor2tensor/visualization/visualization.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/visualization/visualization.py#L159-L205
def get_att_mats(translate_model): """Get's the tensors representing the attentions from a build model. The attentions are stored in a dict on the Transformer object while building the graph. Args: translate_model: Transformer object to fetch the attention weights from. Returns: Tuple of attention ma...
[ "def", "get_att_mats", "(", "translate_model", ")", ":", "enc_atts", "=", "[", "]", "dec_atts", "=", "[", "]", "encdec_atts", "=", "[", "]", "prefix", "=", "\"transformer/body/\"", "postfix_self_attention", "=", "\"/multihead_attention/dot_product_attention\"", "if", ...
Get's the tensors representing the attentions from a build model. The attentions are stored in a dict on the Transformer object while building the graph. Args: translate_model: Transformer object to fetch the attention weights from. Returns: Tuple of attention matrices; ( enc_atts: Encoder self a...
[ "Get", "s", "the", "tensors", "representing", "the", "attentions", "from", "a", "build", "model", "." ]
python
train
37.744681
pandas-dev/pandas
pandas/core/generic.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/generic.py#L379-L385
def _get_block_manager_axis(cls, axis): """Map the axis to the block_manager axis.""" axis = cls._get_axis_number(axis) if cls._AXIS_REVERSED: m = cls._AXIS_LEN - 1 return m - axis return axis
[ "def", "_get_block_manager_axis", "(", "cls", ",", "axis", ")", ":", "axis", "=", "cls", ".", "_get_axis_number", "(", "axis", ")", "if", "cls", ".", "_AXIS_REVERSED", ":", "m", "=", "cls", ".", "_AXIS_LEN", "-", "1", "return", "m", "-", "axis", "retur...
Map the axis to the block_manager axis.
[ "Map", "the", "axis", "to", "the", "block_manager", "axis", "." ]
python
train
34.571429
census-instrumentation/opencensus-python
opencensus/stats/measurement_map.py
https://github.com/census-instrumentation/opencensus-python/blob/992b223f7e34c5dcb65922b7d5c827e7a1351e7d/opencensus/stats/measurement_map.py#L61-L66
def measure_int_put(self, measure, value): """associates the measure of type Int with the given value""" if value < 0: # Should be an error in a later release. logger.warning("Cannot record negative values") self._measurement_map[measure] = value
[ "def", "measure_int_put", "(", "self", ",", "measure", ",", "value", ")", ":", "if", "value", "<", "0", ":", "# Should be an error in a later release.", "logger", ".", "warning", "(", "\"Cannot record negative values\"", ")", "self", ".", "_measurement_map", "[", ...
associates the measure of type Int with the given value
[ "associates", "the", "measure", "of", "type", "Int", "with", "the", "given", "value" ]
python
train
48.166667
log2timeline/plaso
plaso/parsers/olecf_plugins/automatic_destinations.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/parsers/olecf_plugins/automatic_destinations.py#L202-L237
def Process(self, parser_mediator, root_item=None, **kwargs): """Parses an OLECF file. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. root_item (Optional[pyolecf.item]): root item of the OLECF file. Raise...
[ "def", "Process", "(", "self", ",", "parser_mediator", ",", "root_item", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# This will raise if unhandled keyword arguments are passed.", "super", "(", "AutomaticDestinationsOLECFPlugin", ",", "self", ")", ".", "Process",...
Parses an OLECF file. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. root_item (Optional[pyolecf.item]): root item of the OLECF file. Raises: ValueError: If the root_item is not set.
[ "Parses", "an", "OLECF", "file", "." ]
python
train
34.527778
blockcypher/blockcypher-python
blockcypher/utils.py
https://github.com/blockcypher/blockcypher-python/blob/7601ea21916957ff279384fd699527ff9c28a56e/blockcypher/utils.py#L310-L350
def flatten_txns_by_hash(tx_list, nesting=True): ''' Flattens a response from querying a list of address (or wallet) transactions If nesting==True then it will return an ordered dictionary where the keys are tranasaction hashes, otherwise it will be a list of dicts. (nesting==False is good for django t...
[ "def", "flatten_txns_by_hash", "(", "tx_list", ",", "nesting", "=", "True", ")", ":", "nested_cleaned_txs", "=", "OrderedDict", "(", ")", "for", "tx", "in", "tx_list", ":", "tx_hash", "=", "tx", ".", "get", "(", "'tx_hash'", ")", "satoshis", "=", "tx", "...
Flattens a response from querying a list of address (or wallet) transactions If nesting==True then it will return an ordered dictionary where the keys are tranasaction hashes, otherwise it will be a list of dicts. (nesting==False is good for django templates)
[ "Flattens", "a", "response", "from", "querying", "a", "list", "of", "address", "(", "or", "wallet", ")", "transactions" ]
python
train
42.439024
deepmind/pysc2
pysc2/lib/renderer_human.py
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/renderer_human.py#L1002-L1010
def draw_selection(self, surf): """Draw the selection rectange.""" select_start = self._select_start # Cache to avoid a race condition. if select_start: mouse_pos = self.get_mouse_pos() if (mouse_pos and mouse_pos.surf.surf_type & SurfType.SCREEN and mouse_pos.surf.surf_type == select...
[ "def", "draw_selection", "(", "self", ",", "surf", ")", ":", "select_start", "=", "self", ".", "_select_start", "# Cache to avoid a race condition.", "if", "select_start", ":", "mouse_pos", "=", "self", ".", "get_mouse_pos", "(", ")", "if", "(", "mouse_pos", "an...
Draw the selection rectange.
[ "Draw", "the", "selection", "rectange", "." ]
python
train
50.222222
andresriancho/splunk-logger
splunk_logger/utils.py
https://github.com/andresriancho/splunk-logger/blob/448d5ba54464fc355786ffb64f11fd6367792381/splunk_logger/utils.py#L5-L24
def parse_config_file(): """ Find the .splunk_logger config file in the current directory, or in the user's home and parse it. The one in the current directory has precedence. :return: A tuple with: - project_id - access_token """ for filename in ('.splunk_lo...
[ "def", "parse_config_file", "(", ")", ":", "for", "filename", "in", "(", "'.splunk_logger'", ",", "os", ".", "path", ".", "expanduser", "(", "'~/.splunk_logger'", ")", ")", ":", "project_id", ",", "access_token", ",", "api_domain", "=", "_parse_config_file_impl"...
Find the .splunk_logger config file in the current directory, or in the user's home and parse it. The one in the current directory has precedence. :return: A tuple with: - project_id - access_token
[ "Find", "the", ".", "splunk_logger", "config", "file", "in", "the", "current", "directory", "or", "in", "the", "user", "s", "home", "and", "parse", "it", ".", "The", "one", "in", "the", "current", "directory", "has", "precedence", ".", ":", "return", ":"...
python
valid
31.95
gwpy/gwpy
gwpy/signal/qtransform.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/signal/qtransform.py#L482-L583
def interpolate(self, tres="<default>", fres="<default>", logf=False, outseg=None): """Interpolate this `QGram` over a regularly-gridded spectrogram Parameters ---------- tres : `float`, optional desired time resolution (seconds) of output `Spectrogram`, ...
[ "def", "interpolate", "(", "self", ",", "tres", "=", "\"<default>\"", ",", "fres", "=", "\"<default>\"", ",", "logf", "=", "False", ",", "outseg", "=", "None", ")", ":", "from", "scipy", ".", "interpolate", "import", "(", "interp2d", ",", "InterpolatedUniv...
Interpolate this `QGram` over a regularly-gridded spectrogram Parameters ---------- tres : `float`, optional desired time resolution (seconds) of output `Spectrogram`, default is `abs(outseg) / 1000.` fres : `float`, `int`, `None`, optional desired f...
[ "Interpolate", "this", "QGram", "over", "a", "regularly", "-", "gridded", "spectrogram" ]
python
train
43.598039
marshmallow-code/webargs
src/webargs/bottleparser.py
https://github.com/marshmallow-code/webargs/blob/40cc2d25421d15d9630b1a819f1dcefbbf01ed95/src/webargs/bottleparser.py#L66-L76
def handle_error(self, error, req, schema, error_status_code, error_headers): """Handles errors during parsing. Aborts the current request with a 400 error. """ status_code = error_status_code or self.DEFAULT_VALIDATION_STATUS raise bottle.HTTPError( status=status_cod...
[ "def", "handle_error", "(", "self", ",", "error", ",", "req", ",", "schema", ",", "error_status_code", ",", "error_headers", ")", ":", "status_code", "=", "error_status_code", "or", "self", ".", "DEFAULT_VALIDATION_STATUS", "raise", "bottle", ".", "HTTPError", "...
Handles errors during parsing. Aborts the current request with a 400 error.
[ "Handles", "errors", "during", "parsing", ".", "Aborts", "the", "current", "request", "with", "a", "400", "error", "." ]
python
train
38.090909
pypa/pipenv
pipenv/patched/notpip/_internal/download.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/download.py#L484-L492
def path_to_url(path): # type: (Union[str, Text]) -> str """ Convert a path to a file: URL. The path will be made absolute and have quoted path parts. """ path = os.path.normpath(os.path.abspath(path)) url = urllib_parse.urljoin('file:', urllib_request.pathname2url(path)) return url
[ "def", "path_to_url", "(", "path", ")", ":", "# type: (Union[str, Text]) -> str", "path", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "abspath", "(", "path", ")", ")", "url", "=", "urllib_parse", ".", "urljoin", "(", "'file:'", ...
Convert a path to a file: URL. The path will be made absolute and have quoted path parts.
[ "Convert", "a", "path", "to", "a", "file", ":", "URL", ".", "The", "path", "will", "be", "made", "absolute", "and", "have", "quoted", "path", "parts", "." ]
python
train
34.222222
lmjohns3/theanets
theanets/recurrent.py
https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/recurrent.py#L97-L110
def encode(self, txt): '''Encode a text string by replacing characters with alphabet index. Parameters ---------- txt : str A string to encode. Returns ------- classes : list of int A sequence of alphabet index values corresponding to the...
[ "def", "encode", "(", "self", ",", "txt", ")", ":", "return", "list", "(", "self", ".", "_fwd_index", ".", "get", "(", "c", ",", "0", ")", "for", "c", "in", "txt", ")" ]
Encode a text string by replacing characters with alphabet index. Parameters ---------- txt : str A string to encode. Returns ------- classes : list of int A sequence of alphabet index values corresponding to the given text.
[ "Encode", "a", "text", "string", "by", "replacing", "characters", "with", "alphabet", "index", "." ]
python
test
27.928571
flatangle/flatlib
flatlib/angle.py
https://github.com/flatangle/flatlib/blob/44e05b2991a296c678adbc17a1d51b6a21bc867c/flatlib/angle.py#L112-L119
def toFloat(value): """ Converts string or signed list to float. """ if isinstance(value, str): return strFloat(value) elif isinstance(value, list): return slistFloat(value) else: return value
[ "def", "toFloat", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "str", ")", ":", "return", "strFloat", "(", "value", ")", "elif", "isinstance", "(", "value", ",", "list", ")", ":", "return", "slistFloat", "(", "value", ")", "else", "...
Converts string or signed list to float.
[ "Converts", "string", "or", "signed", "list", "to", "float", "." ]
python
train
28.125
pyca/pyopenssl
src/OpenSSL/SSL.py
https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/SSL.py#L1937-L1947
def connect(self, addr): """ Call the :meth:`connect` method of the underlying socket and set up SSL on the socket, using the :class:`Context` object supplied to this :class:`Connection` object at creation. :param addr: A remote address :return: What the socket's connect...
[ "def", "connect", "(", "self", ",", "addr", ")", ":", "_lib", ".", "SSL_set_connect_state", "(", "self", ".", "_ssl", ")", "return", "self", ".", "_socket", ".", "connect", "(", "addr", ")" ]
Call the :meth:`connect` method of the underlying socket and set up SSL on the socket, using the :class:`Context` object supplied to this :class:`Connection` object at creation. :param addr: A remote address :return: What the socket's connect method returns
[ "Call", "the", ":", "meth", ":", "connect", "method", "of", "the", "underlying", "socket", "and", "set", "up", "SSL", "on", "the", "socket", "using", "the", ":", "class", ":", "Context", "object", "supplied", "to", "this", ":", "class", ":", "Connection"...
python
test
38.636364
empymod/empymod
empymod/scripts/fdesign.py
https://github.com/empymod/empymod/blob/4a78ca4191ed4b4d42d019ce715a9a3889dba1bc/empymod/scripts/fdesign.py#L1197-L1276
def _get_min_val(spaceshift, *params): r"""Calculate minimum resolved amplitude or maximum r.""" # Get parameters from tuples spacing, shift = spaceshift n, fI, fC, r, r_def, error, reim, cvar, verb, plot, log = params # Get filter for these parameters dlf = _calculate_filter(n, spacing, shift...
[ "def", "_get_min_val", "(", "spaceshift", ",", "*", "params", ")", ":", "# Get parameters from tuples", "spacing", ",", "shift", "=", "spaceshift", "n", ",", "fI", ",", "fC", ",", "r", ",", "r_def", ",", "error", ",", "reim", ",", "cvar", ",", "verb", ...
r"""Calculate minimum resolved amplitude or maximum r.
[ "r", "Calculate", "minimum", "resolved", "amplitude", "or", "maximum", "r", "." ]
python
train
36.5625
SCIP-Interfaces/PySCIPOpt
examples/finished/atsp.py
https://github.com/SCIP-Interfaces/PySCIPOpt/blob/9c960b40d94a48b0304d73dbe28b467b9c065abe/examples/finished/atsp.py#L129-L168
def mcf(n,c): """mcf: multi-commodity flow formulation for the (asymmetric) traveling salesman problem Parameters: - n: number of nodes - c[i,j]: cost for traversing arc (i,j) Returns a model, ready to be solved. """ model = Model("mcf") x,f = {},{} for i in range(1,n+1): ...
[ "def", "mcf", "(", "n", ",", "c", ")", ":", "model", "=", "Model", "(", "\"mcf\"", ")", "x", ",", "f", "=", "{", "}", ",", "{", "}", "for", "i", "in", "range", "(", "1", ",", "n", "+", "1", ")", ":", "for", "j", "in", "range", "(", "1",...
mcf: multi-commodity flow formulation for the (asymmetric) traveling salesman problem Parameters: - n: number of nodes - c[i,j]: cost for traversing arc (i,j) Returns a model, ready to be solved.
[ "mcf", ":", "multi", "-", "commodity", "flow", "formulation", "for", "the", "(", "asymmetric", ")", "traveling", "salesman", "problem", "Parameters", ":", "-", "n", ":", "number", "of", "nodes", "-", "c", "[", "i", "j", "]", ":", "cost", "for", "traver...
python
train
38.525
iamlikeme/rainflow
src/rainflow.py
https://github.com/iamlikeme/rainflow/blob/7725ea2c591ad3d4aab688d1c1d8385d665a07d4/src/rainflow.py#L76-L122
def extract_cycles(series, left=False, right=False): """Iterate cycles in the series. Parameters ---------- series : iterable sequence of numbers left: bool, optional If True, treat the first point in the series as a reversal. right: bool, optional If True, treat the last point ...
[ "def", "extract_cycles", "(", "series", ",", "left", "=", "False", ",", "right", "=", "False", ")", ":", "points", "=", "deque", "(", ")", "for", "x", "in", "reversals", "(", "series", ",", "left", "=", "left", ",", "right", "=", "right", ")", ":",...
Iterate cycles in the series. Parameters ---------- series : iterable sequence of numbers left: bool, optional If True, treat the first point in the series as a reversal. right: bool, optional If True, treat the last point in the series as a reversal. Yields ------ cycl...
[ "Iterate", "cycles", "in", "the", "series", "." ]
python
valid
33.893617
cackharot/suds-py3
suds/wsdl.py
https://github.com/cackharot/suds-py3/blob/7387ec7806e9be29aad0a711bea5cb3c9396469c/suds/wsdl.py#L307-L321
def load(self, definitions): """ Load the object by opening the URL """ url = self.location log.debug('importing (%s)', url) if '://' not in url: url = urljoin(definitions.url, url) options = definitions.options d = Definitions(url, options) if d.root....
[ "def", "load", "(", "self", ",", "definitions", ")", ":", "url", "=", "self", ".", "location", "log", ".", "debug", "(", "'importing (%s)'", ",", "url", ")", "if", "'://'", "not", "in", "url", ":", "url", "=", "urljoin", "(", "definitions", ".", "url...
Load the object by opening the URL
[ "Load", "the", "object", "by", "opening", "the", "URL" ]
python
train
39.266667
SmileyChris/easy-thumbnails
easy_thumbnails/optimize/post_processor.py
https://github.com/SmileyChris/easy-thumbnails/blob/b08ab44883bf7b221a98dadb9b589cb95d35b0bf/easy_thumbnails/optimize/post_processor.py#L37-L65
def optimize_thumbnail(thumbnail): '''Optimize thumbnail images by removing unnecessary data''' try: optimize_command = settings.THUMBNAIL_OPTIMIZE_COMMAND[ determinetype(thumbnail.path)] if not optimize_command: return except (TypeError, KeyError, NotImplementedError...
[ "def", "optimize_thumbnail", "(", "thumbnail", ")", ":", "try", ":", "optimize_command", "=", "settings", ".", "THUMBNAIL_OPTIMIZE_COMMAND", "[", "determinetype", "(", "thumbnail", ".", "path", ")", "]", "if", "not", "optimize_command", ":", "return", "except", ...
Optimize thumbnail images by removing unnecessary data
[ "Optimize", "thumbnail", "images", "by", "removing", "unnecessary", "data" ]
python
train
40.448276
b3j0f/schema
b3j0f/schema/lang/factory.py
https://github.com/b3j0f/schema/blob/1c88c23337f5fef50254e65bd407112c43396dd9/b3j0f/schema/lang/factory.py#L203-L213
def getschemacls(resource, besteffort=False): """Get schema class related to input resource. :param resource: resource from which get schema class. :param bool besteffort: if True (default) try a best effort in parsing the inheritance tree of resource if resource is a class. :rtype: type ...
[ "def", "getschemacls", "(", "resource", ",", "besteffort", "=", "False", ")", ":", "return", "_SCHEMAFACTORY", ".", "getschemacls", "(", "resource", "=", "resource", ",", "besteffort", "=", "besteffort", ")" ]
Get schema class related to input resource. :param resource: resource from which get schema class. :param bool besteffort: if True (default) try a best effort in parsing the inheritance tree of resource if resource is a class. :rtype: type
[ "Get", "schema", "class", "related", "to", "input", "resource", "." ]
python
train
37.272727
tgbugs/pyontutils
ilxutils/ilxutils/scicrunch_client_helper.py
https://github.com/tgbugs/pyontutils/blob/3d913db29c177db39151592909a4f56170ef8b35/ilxutils/ilxutils/scicrunch_client_helper.py#L16-L68
def preferred_change(data): ''' Determines preferred existing id based on curie prefix in the ranking list ''' ranking = [ 'CHEBI', 'NCBITaxon', 'COGPO', 'CAO', 'DICOM', 'UBERON', 'NLX', 'NLXANAT', 'NLXCELL', 'NLXFUNC', 'NLX...
[ "def", "preferred_change", "(", "data", ")", ":", "ranking", "=", "[", "'CHEBI'", ",", "'NCBITaxon'", ",", "'COGPO'", ",", "'CAO'", ",", "'DICOM'", ",", "'UBERON'", ",", "'NLX'", ",", "'NLXANAT'", ",", "'NLXCELL'", ",", "'NLXFUNC'", ",", "'NLXINV'", ",", ...
Determines preferred existing id based on curie prefix in the ranking list
[ "Determines", "preferred", "existing", "id", "based", "on", "curie", "prefix", "in", "the", "ranking", "list" ]
python
train
27.150943
andrewramsay/sk8-drivers
pysk8/pysk8/core.py
https://github.com/andrewramsay/sk8-drivers/blob/67347a71762fb421f5ae65a595def5c7879e8b0c/pysk8/pysk8/core.py#L64-L73
def update(self, name, rssi): """Update the device name and/or RSSI. During an ongoing scan, multiple records from the same device can be received during the scan. Each time that happens this method is called to update the :attr:`name` and/or :attr:`rssi` attributes. """ ...
[ "def", "update", "(", "self", ",", "name", ",", "rssi", ")", ":", "self", ".", "name", "=", "name", "self", ".", "rssi", "=", "rssi", "self", ".", "_age", "=", "time", ".", "time", "(", ")" ]
Update the device name and/or RSSI. During an ongoing scan, multiple records from the same device can be received during the scan. Each time that happens this method is called to update the :attr:`name` and/or :attr:`rssi` attributes.
[ "Update", "the", "device", "name", "and", "/", "or", "RSSI", "." ]
python
train
38.7
kodexlab/reliure
reliure/utils/cli.py
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/utils/cli.py#L74-L117
def arguments_from_optionable(parser, component, prefix=""): """ Add argparse arguments from all options of one :class:`Optionable` >>> # Let's build a dummy optionable component: >>> comp = Optionable() >>> comp.add_option("num", Numeric(default=1, max=12, help="An exemple of option")) >>> comp.ad...
[ "def", "arguments_from_optionable", "(", "parser", ",", "component", ",", "prefix", "=", "\"\"", ")", ":", "for", "option", "in", "component", ".", "options", ":", "if", "component", ".", "options", "[", "option", "]", ".", "hidden", ":", "continue", "argu...
Add argparse arguments from all options of one :class:`Optionable` >>> # Let's build a dummy optionable component: >>> comp = Optionable() >>> comp.add_option("num", Numeric(default=1, max=12, help="An exemple of option")) >>> comp.add_option("title", Text(help="The title of the title")) >>> comp.a...
[ "Add", "argparse", "arguments", "from", "all", "options", "of", "one", ":", "class", ":", "Optionable" ]
python
train
38.022727
mkoura/dump2polarion
dump2polarion/results/csvtools.py
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/results/csvtools.py#L118-L143
def get_imported_data(csv_file, **kwargs): """Reads the content of the Polarion exported csv file and returns imported data.""" open_args = [] open_kwargs = {} try: # pylint: disable=pointless-statement unicode open_args.append("rb") except NameError: open_kwargs["enc...
[ "def", "get_imported_data", "(", "csv_file", ",", "*", "*", "kwargs", ")", ":", "open_args", "=", "[", "]", "open_kwargs", "=", "{", "}", "try", ":", "# pylint: disable=pointless-statement", "unicode", "open_args", ".", "append", "(", "\"rb\"", ")", "except", ...
Reads the content of the Polarion exported csv file and returns imported data.
[ "Reads", "the", "content", "of", "the", "Polarion", "exported", "csv", "file", "and", "returns", "imported", "data", "." ]
python
train
36.884615
mitsei/dlkit
dlkit/json_/resource/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L1809-L1831
def get_agent_ids_by_resource(self, resource_id): """Gets the list of ``Agent`` ``Ids`` mapped to a ``Resource``. arg: resource_id (osid.id.Id): ``Id`` of a ``Resource`` return: (osid.id.IdList) - list of agent ``Ids`` raise: NotFound - ``resource_id`` is not found raise: ...
[ "def", "get_agent_ids_by_resource", "(", "self", ",", "resource_id", ")", ":", "collection", "=", "JSONClientValidated", "(", "'resource'", ",", "collection", "=", "'Resource'", ",", "runtime", "=", "self", ".", "_runtime", ")", "resource", "=", "collection", "....
Gets the list of ``Agent`` ``Ids`` mapped to a ``Resource``. arg: resource_id (osid.id.Id): ``Id`` of a ``Resource`` return: (osid.id.IdList) - list of agent ``Ids`` raise: NotFound - ``resource_id`` is not found raise: NullArgument - ``resource_id`` is ``null`` raise: Op...
[ "Gets", "the", "list", "of", "Agent", "Ids", "mapped", "to", "a", "Resource", "." ]
python
train
44.521739
hugapi/hug
hug/decorators.py
https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/decorators.py#L73-L83
def directive(apply_globally=False, api=None): """A decorator that registers a single hug directive""" def decorator(directive_method): if apply_globally: hug.defaults.directives[underscore(directive_method.__name__)] = directive_method else: apply_to_api = hug.API(api) i...
[ "def", "directive", "(", "apply_globally", "=", "False", ",", "api", "=", "None", ")", ":", "def", "decorator", "(", "directive_method", ")", ":", "if", "apply_globally", ":", "hug", ".", "defaults", ".", "directives", "[", "underscore", "(", "directive_meth...
A decorator that registers a single hug directive
[ "A", "decorator", "that", "registers", "a", "single", "hug", "directive" ]
python
train
46.363636
henrysher/kotocore
kotocore/resources.py
https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/resources.py#L489-L519
def post_process_get(self, result): """ Given an object with identifiers, fetches the data for that object from the service. This alters the data on the object itself & simply passes through what was received. :param result: The response data :type result: dict ...
[ "def", "post_process_get", "(", "self", ",", "result", ")", ":", "if", "not", "hasattr", "(", "result", ",", "'items'", ")", ":", "# If it's not a dict, give up & just return whatever you get.", "return", "result", "# We need to possibly drill into the response & get out the ...
Given an object with identifiers, fetches the data for that object from the service. This alters the data on the object itself & simply passes through what was received. :param result: The response data :type result: dict :returns: The unmodified response data
[ "Given", "an", "object", "with", "identifiers", "fetches", "the", "data", "for", "that", "object", "from", "the", "service", "." ]
python
train
30.580645
datamachine/twx.botapi
twx/botapi/botapi.py
https://github.com/datamachine/twx.botapi/blob/c85184da738169e8f9d6d8e62970540f427c486e/twx/botapi/botapi.py#L4354-L4356
def get_user_profile_photos(self, *args, **kwargs): """See :func:`get_user_profile_photos`""" return get_user_profile_photos(*args, **self._merge_overrides(**kwargs)).run()
[ "def", "get_user_profile_photos", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "get_user_profile_photos", "(", "*", "args", ",", "*", "*", "self", ".", "_merge_overrides", "(", "*", "*", "kwargs", ")", ")", ".", "run", "(...
See :func:`get_user_profile_photos`
[ "See", ":", "func", ":", "get_user_profile_photos" ]
python
train
62
pandas-dev/pandas
pandas/core/internals/blocks.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/internals/blocks.py#L2987-L3030
def get_block_type(values, dtype=None): """ Find the appropriate Block subclass to use for the given values and dtype. Parameters ---------- values : ndarray-like dtype : numpy or pandas dtype Returns ------- cls : class, subclass of Block """ dtype = dtype or values.dtype ...
[ "def", "get_block_type", "(", "values", ",", "dtype", "=", "None", ")", ":", "dtype", "=", "dtype", "or", "values", ".", "dtype", "vtype", "=", "dtype", ".", "type", "if", "is_sparse", "(", "dtype", ")", ":", "# Need this first(ish) so that Sparse[datetime] is...
Find the appropriate Block subclass to use for the given values and dtype. Parameters ---------- values : ndarray-like dtype : numpy or pandas dtype Returns ------- cls : class, subclass of Block
[ "Find", "the", "appropriate", "Block", "subclass", "to", "use", "for", "the", "given", "values", "and", "dtype", "." ]
python
train
28.931818
DLR-RM/RAFCON
source/rafcon/gui/controllers/graphical_editor_gaphas.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L705-L721
def set_focus_to_state_model(self, state_m, ratio_requested=0.8): """ Focus a state view of respective state model :param rafcon.gui.model.state state_m: Respective state model of state view to be focused :param ratio_requested: Minimum ratio of the screen which is requested, so can be more ...
[ "def", "set_focus_to_state_model", "(", "self", ",", "state_m", ",", "ratio_requested", "=", "0.8", ")", ":", "state_machine_m", "=", "self", ".", "model", "state_v", "=", "self", ".", "canvas", ".", "get_view_for_model", "(", "state_m", ")", "if", "state_v", ...
Focus a state view of respective state model :param rafcon.gui.model.state state_m: Respective state model of state view to be focused :param ratio_requested: Minimum ratio of the screen which is requested, so can be more :return:
[ "Focus", "a", "state", "view", "of", "respective", "state", "model", ":", "param", "rafcon", ".", "gui", ".", "model", ".", "state", "state_m", ":", "Respective", "state", "model", "of", "state", "view", "to", "be", "focused", ":", "param", "ratio_requeste...
python
train
67.411765
astorfi/speechpy
speechpy/processing.py
https://github.com/astorfi/speechpy/blob/9e99ae81398e7584e6234db371d6d7b5e8736192/speechpy/processing.py#L239-L271
def cmvn(vec, variance_normalization=False): """ This function is aimed to perform global cepstral mean and variance normalization (CMVN) on input feature vector "vec". The code assumes that there is one observation per row. Args: vec (array): input feature matrix (size:(num...
[ "def", "cmvn", "(", "vec", ",", "variance_normalization", "=", "False", ")", ":", "eps", "=", "2", "**", "-", "30", "rows", ",", "cols", "=", "vec", ".", "shape", "# Mean calculation", "norm", "=", "np", ".", "mean", "(", "vec", ",", "axis", "=", "...
This function is aimed to perform global cepstral mean and variance normalization (CMVN) on input feature vector "vec". The code assumes that there is one observation per row. Args: vec (array): input feature matrix (size:(num_observation,num_features)) variance_normaliz...
[ "This", "function", "is", "aimed", "to", "perform", "global", "cepstral", "mean", "and", "variance", "normalization", "(", "CMVN", ")", "on", "input", "feature", "vector", "vec", ".", "The", "code", "assumes", "that", "there", "is", "one", "observation", "pe...
python
train
29.909091
dnanexus/dx-toolkit
src/python/dxpy/utils/resolver.py
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L36-L99
def pick(choices, default=None, str_choices=None, prompt=None, allow_mult=False, more_choices=False): ''' :param choices: Strings between which the user will make a choice :type choices: list of strings :param default: Number the index to be used as the default :type default: int or None :param ...
[ "def", "pick", "(", "choices", ",", "default", "=", "None", ",", "str_choices", "=", "None", ",", "prompt", "=", "None", ",", "allow_mult", "=", "False", ",", "more_choices", "=", "False", ")", ":", "for", "i", "in", "range", "(", "len", "(", "choice...
:param choices: Strings between which the user will make a choice :type choices: list of strings :param default: Number the index to be used as the default :type default: int or None :param str_choices: Strings to be used as aliases for the choices; must be of the same length as choices and each string ...
[ ":", "param", "choices", ":", "Strings", "between", "which", "the", "user", "will", "make", "a", "choice", ":", "type", "choices", ":", "list", "of", "strings", ":", "param", "default", ":", "Number", "the", "index", "to", "be", "used", "as", "the", "d...
python
train
37.1875
pylast/pylast
src/pylast/__init__.py
https://github.com/pylast/pylast/blob/a52f66d316797fc819b5f1d186d77f18ba97b4ff/src/pylast/__init__.py#L2790-L2797
def cleanup_nodes(doc): """ Remove text nodes containing only whitespace """ for node in doc.documentElement.childNodes: if node.nodeType == Node.TEXT_NODE and node.nodeValue.isspace(): doc.documentElement.removeChild(node) return doc
[ "def", "cleanup_nodes", "(", "doc", ")", ":", "for", "node", "in", "doc", ".", "documentElement", ".", "childNodes", ":", "if", "node", ".", "nodeType", "==", "Node", ".", "TEXT_NODE", "and", "node", ".", "nodeValue", ".", "isspace", "(", ")", ":", "do...
Remove text nodes containing only whitespace
[ "Remove", "text", "nodes", "containing", "only", "whitespace" ]
python
train
33.375
useblocks/groundwork
groundwork/patterns/gw_recipes_pattern.py
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_recipes_pattern.py#L91-L97
def build(self, recipe): """ Builds a recipe :param recipe: Name of the recipe to build. """ return self.__app.recipes.build(recipe, self._plugin)
[ "def", "build", "(", "self", ",", "recipe", ")", ":", "return", "self", ".", "__app", ".", "recipes", ".", "build", "(", "recipe", ",", "self", ".", "_plugin", ")" ]
Builds a recipe :param recipe: Name of the recipe to build.
[ "Builds", "a", "recipe" ]
python
train
25.857143
fossasia/knittingpattern
knittingpattern/Mesh.py
https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/Mesh.py#L363-L368
def can_connect_to(self, other): """Whether a connection can be established between those two meshes.""" assert other.is_mesh() disconnected = not other.is_connected() and not self.is_connected() types_differ = self._is_consumed_mesh() != other._is_consumed_mesh() return disconne...
[ "def", "can_connect_to", "(", "self", ",", "other", ")", ":", "assert", "other", ".", "is_mesh", "(", ")", "disconnected", "=", "not", "other", ".", "is_connected", "(", ")", "and", "not", "self", ".", "is_connected", "(", ")", "types_differ", "=", "self...
Whether a connection can be established between those two meshes.
[ "Whether", "a", "connection", "can", "be", "established", "between", "those", "two", "meshes", "." ]
python
valid
56
unt-libraries/pyuntl
pyuntl/untldoc.py
https://github.com/unt-libraries/pyuntl/blob/f92413302897dab948aac18ee9e482ace0187bd4/pyuntl/untldoc.py#L496-L502
def generate_dc_json(dc_dict): """Generate DC JSON data. Returns data as a JSON formatted string. """ formatted_dict = formatted_dc_dict(dc_dict) return json.dumps(formatted_dict, sort_keys=True, indent=4)
[ "def", "generate_dc_json", "(", "dc_dict", ")", ":", "formatted_dict", "=", "formatted_dc_dict", "(", "dc_dict", ")", "return", "json", ".", "dumps", "(", "formatted_dict", ",", "sort_keys", "=", "True", ",", "indent", "=", "4", ")" ]
Generate DC JSON data. Returns data as a JSON formatted string.
[ "Generate", "DC", "JSON", "data", "." ]
python
train
31.428571
roboogle/gtkmvc3
gtkmvco/gtkmvc3/support/factories.py
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/support/factories.py#L68-L82
def make(base_classes=(), have_mt=False): """Use this static method to build a model class that possibly derives from other classes. If have_mt is True, then returned class will take into account multi-threading issues when dealing with observable properties.""" good_bc = ModelF...
[ "def", "make", "(", "base_classes", "=", "(", ")", ",", "have_mt", "=", "False", ")", ":", "good_bc", "=", "ModelFactory", ".", "__fix_bases", "(", "base_classes", ",", "have_mt", ")", "print", "\"Base classes are:\"", ",", "good_bc", "key", "=", "\"\"", "...
Use this static method to build a model class that possibly derives from other classes. If have_mt is True, then returned class will take into account multi-threading issues when dealing with observable properties.
[ "Use", "this", "static", "method", "to", "build", "a", "model", "class", "that", "possibly", "derives", "from", "other", "classes", ".", "If", "have_mt", "is", "True", "then", "returned", "class", "will", "take", "into", "account", "multi", "-", "threading",...
python
train
44.666667
projectshift/shift-boiler
boiler/errors.py
https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/errors.py#L23-L48
def default_error_handler(exception): """ Default error handler Will display an error page with the corresponding error code from template directory, for example, a not found will load a 404.html etc. Will first look in userland app templates and if not found, fallback to boiler templates to dis...
[ "def", "default_error_handler", "(", "exception", ")", ":", "http_exception", "=", "isinstance", "(", "exception", ",", "exceptions", ".", "HTTPException", ")", "code", "=", "exception", ".", "code", "if", "http_exception", "else", "500", "# log exceptions only (app...
Default error handler Will display an error page with the corresponding error code from template directory, for example, a not found will load a 404.html etc. Will first look in userland app templates and if not found, fallback to boiler templates to display a default page. :param exception: Except...
[ "Default", "error", "handler", "Will", "display", "an", "error", "page", "with", "the", "corresponding", "error", "code", "from", "template", "directory", "for", "example", "a", "not", "found", "will", "load", "a", "404", ".", "html", "etc", ".", "Will", "...
python
train
36.961538
MonashBI/arcana
arcana/repository/xnat.py
https://github.com/MonashBI/arcana/blob/d6271a29d13733d00422d11417af8d200be62acc/arcana/repository/xnat.py#L690-L712
def get_xsession(self, item): """ Returns the XNAT session and cache dir corresponding to the item. """ subj_label, sess_label = self._get_item_labels(item) with self: xproject = self._login.projects[self.project_id] try: xsubject =...
[ "def", "get_xsession", "(", "self", ",", "item", ")", ":", "subj_label", ",", "sess_label", "=", "self", ".", "_get_item_labels", "(", "item", ")", "with", "self", ":", "xproject", "=", "self", ".", "_login", ".", "projects", "[", "self", ".", "project_i...
Returns the XNAT session and cache dir corresponding to the item.
[ "Returns", "the", "XNAT", "session", "and", "cache", "dir", "corresponding", "to", "the", "item", "." ]
python
train
40
pandas-dev/pandas
pandas/core/groupby/groupby.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/groupby.py#L2137-L2160
def head(self, n=5): """ Return first n rows of each group. Essentially equivalent to ``.apply(lambda x: x.head(n))``, except ignores as_index flag. %(see_also)s Examples -------- >>> df = pd.DataFrame([[1, 2], [1, 4], [5, 6]], ...
[ "def", "head", "(", "self", ",", "n", "=", "5", ")", ":", "self", ".", "_reset_group_selection", "(", ")", "mask", "=", "self", ".", "_cumcount_array", "(", ")", "<", "n", "return", "self", ".", "_selected_obj", "[", "mask", "]" ]
Return first n rows of each group. Essentially equivalent to ``.apply(lambda x: x.head(n))``, except ignores as_index flag. %(see_also)s Examples -------- >>> df = pd.DataFrame([[1, 2], [1, 4], [5, 6]], columns=['A', 'B']) >>> df.gr...
[ "Return", "first", "n", "rows", "of", "each", "group", "." ]
python
train
26.5
openstack/networking-cisco
networking_cisco/apps/saf/agent/topo_disc/topo_disc.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/agent/topo_disc/topo_disc.py#L149-L154
def remote_port_uneq_store(self, remote_port): """This function saves the port, if different from stored. """ if remote_port != self.remote_port: self.remote_port = remote_port return True return False
[ "def", "remote_port_uneq_store", "(", "self", ",", "remote_port", ")", ":", "if", "remote_port", "!=", "self", ".", "remote_port", ":", "self", ".", "remote_port", "=", "remote_port", "return", "True", "return", "False" ]
This function saves the port, if different from stored.
[ "This", "function", "saves", "the", "port", "if", "different", "from", "stored", "." ]
python
train
40.666667
specialunderwear/django-easymode
easymode/views.py
https://github.com/specialunderwear/django-easymode/blob/92f674b91fb8c54d6e379e2664e2000872d9c95e/easymode/views.py#L9-L32
def preview(request, content_type_id, object_id): """ This is an override for django.views.default.shortcut. It assumes that get_absolute_url returns an absolute url, so it does not do any of the very elaborate link checking that shortcut does. This version adds the language code to the url. (/...
[ "def", "preview", "(", "request", ",", "content_type_id", ",", "object_id", ")", ":", "try", ":", "content_type", "=", "ContentType", ".", "objects", ".", "get", "(", "pk", "=", "content_type_id", ")", "obj", "=", "content_type", ".", "get_object_for_this_type...
This is an override for django.views.default.shortcut. It assumes that get_absolute_url returns an absolute url, so it does not do any of the very elaborate link checking that shortcut does. This version adds the language code to the url. (/en/blaat/).
[ "This", "is", "an", "override", "for", "django", ".", "views", ".", "default", ".", "shortcut", ".", "It", "assumes", "that", "get_absolute_url", "returns", "an", "absolute", "url", "so", "it", "does", "not", "do", "any", "of", "the", "very", "elaborate", ...
python
train
45.416667
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_aaa.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_aaa.py#L83-L94
def username_user_password(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") username = ET.SubElement(config, "username", xmlns="urn:brocade.com:mgmt:brocade-aaa") name_key = ET.SubElement(username, "name") name_key.text = kwargs.pop('name') ...
[ "def", "username_user_password", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "username", "=", "ET", ".", "SubElement", "(", "config", ",", "\"username\"", ",", "xmlns", "=", "\"urn:brocade.co...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
42.916667
barryp/py-amqplib
amqplib/client_0_8/channel.py
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/channel.py#L2513-L2554
def _basic_return(self, args, msg): """ return a failed message This method returns an undeliverable message that was published with the "immediate" flag set, or an unroutable message published with the "mandatory" flag set. The reply code and text provide information ab...
[ "def", "_basic_return", "(", "self", ",", "args", ",", "msg", ")", ":", "reply_code", "=", "args", ".", "read_short", "(", ")", "reply_text", "=", "args", ".", "read_shortstr", "(", ")", "exchange", "=", "args", ".", "read_shortstr", "(", ")", "routing_k...
return a failed message This method returns an undeliverable message that was published with the "immediate" flag set, or an unroutable message published with the "mandatory" flag set. The reply code and text provide information about the reason that the message was undeliverabl...
[ "return", "a", "failed", "message" ]
python
train
29.785714
saltstack/salt
salt/runners/bgp.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/bgp.py#L232-L409
def neighbors(*asns, **kwargs): ''' Search for BGP neighbors details in the mines of the ``bgp.neighbors`` function. Arguments: asns A list of AS numbers to search for. The runner will return only the neighbors of these AS numbers. device Filter by device name (minion ID)....
[ "def", "neighbors", "(", "*", "asns", ",", "*", "*", "kwargs", ")", ":", "opts", "=", "_get_bgp_runner_opts", "(", ")", "title", "=", "kwargs", ".", "pop", "(", "'title'", ",", "None", ")", "display", "=", "kwargs", ".", "pop", "(", "'display'", ",",...
Search for BGP neighbors details in the mines of the ``bgp.neighbors`` function. Arguments: asns A list of AS numbers to search for. The runner will return only the neighbors of these AS numbers. device Filter by device name (minion ID). ip Search BGP neighbor using t...
[ "Search", "for", "BGP", "neighbors", "details", "in", "the", "mines", "of", "the", "bgp", ".", "neighbors", "function", "." ]
python
train
57.550562
Kensuke-Mitsuzawa/JapaneseTokenizers
JapaneseTokenizer/common/sever_handler.py
https://github.com/Kensuke-Mitsuzawa/JapaneseTokenizers/blob/3bdfb6be73de0f78e5c08f3a51376ad3efa00b6c/JapaneseTokenizer/common/sever_handler.py#L44-L67
def launch_process(self, command): # type: (Union[bytes,text_type])->None """* What you can do - It starts process and keep it. """ if not self.option is None: command_plus_option = self.command + " " + self.option else: command_plus_option = self....
[ "def", "launch_process", "(", "self", ",", "command", ")", ":", "# type: (Union[bytes,text_type])->None", "if", "not", "self", ".", "option", "is", "None", ":", "command_plus_option", "=", "self", ".", "command", "+", "\" \"", "+", "self", ".", "option", "else...
* What you can do - It starts process and keep it.
[ "*", "What", "you", "can", "do", "-", "It", "starts", "process", "and", "keep", "it", "." ]
python
train
41.25
staticdev/django-sorting-bootstrap
sorting_bootstrap/sort.py
https://github.com/staticdev/django-sorting-bootstrap/blob/cfdc6e671b1b57aad04e44b041b9df10ee8288d3/sorting_bootstrap/sort.py#L1-L26
def sort_queryset(queryset, request, context=None): """ Returns a sorted queryset The context argument is only used in the template tag """ sort_by = request.GET.get('sort_by') if sort_by: if sort_by in [el.name for el in queryset.model._meta.fields]: queryset = queryset.order_by...
[ "def", "sort_queryset", "(", "queryset", ",", "request", ",", "context", "=", "None", ")", ":", "sort_by", "=", "request", ".", "GET", ".", "get", "(", "'sort_by'", ")", "if", "sort_by", ":", "if", "sort_by", "in", "[", "el", ".", "name", "for", "el"...
Returns a sorted queryset The context argument is only used in the template tag
[ "Returns", "a", "sorted", "queryset", "The", "context", "argument", "is", "only", "used", "in", "the", "template", "tag" ]
python
train
40.961538
python-wink/python-wink
src/pywink/devices/piggy_bank.py
https://github.com/python-wink/python-wink/blob/cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da/src/pywink/devices/piggy_bank.py#L83-L89
def deposit(self, amount): """ :param amount: (int +/-) amount to be deposited or withdrawn in cents """ _json = {"amount": amount} self.api_interface.piggy_bank_deposit(self, _json)
[ "def", "deposit", "(", "self", ",", "amount", ")", ":", "_json", "=", "{", "\"amount\"", ":", "amount", "}", "self", ".", "api_interface", ".", "piggy_bank_deposit", "(", "self", ",", "_json", ")" ]
:param amount: (int +/-) amount to be deposited or withdrawn in cents
[ ":", "param", "amount", ":", "(", "int", "+", "/", "-", ")", "amount", "to", "be", "deposited", "or", "withdrawn", "in", "cents" ]
python
train
31.857143
JustinLovinger/optimal
optimal/benchmark.py
https://github.com/JustinLovinger/optimal/blob/ab48a4961697338cc32d50e3a6b06ac989e39c3f/optimal/benchmark.py#L37-L96
def compare(optimizers, problems, runs=20, all_kwargs={}): """Compare a set of optimizers. Args: optimizers: list/Optimizer; Either a list of optimizers to compare, or a single optimizer to test on each problem. problems: list/Problem; Either a problem instance or a list of problem ...
[ "def", "compare", "(", "optimizers", ",", "problems", ",", "runs", "=", "20", ",", "all_kwargs", "=", "{", "}", ")", ":", "if", "not", "(", "isinstance", "(", "optimizers", ",", "collections", ".", "Iterable", ")", "or", "isinstance", "(", "problems", ...
Compare a set of optimizers. Args: optimizers: list/Optimizer; Either a list of optimizers to compare, or a single optimizer to test on each problem. problems: list/Problem; Either a problem instance or a list of problem instances, one for each optimizer. all_kwargs:...
[ "Compare", "a", "set", "of", "optimizers", "." ]
python
train
39.533333
slickqa/python-client
slickqa/micromodels/models.py
https://github.com/slickqa/python-client/blob/1d36b4977cd4140d7d24917cab2b3f82b60739c2/slickqa/micromodels/models.py#L72-L81
def from_dict(cls, D, is_json=False): '''This factory for :class:`Model` takes either a native Python dictionary or a JSON dictionary/object if ``is_json`` is ``True``. The dictionary passed does not need to contain all of the values that the Model declares. ''' instance...
[ "def", "from_dict", "(", "cls", ",", "D", ",", "is_json", "=", "False", ")", ":", "instance", "=", "cls", "(", ")", "instance", ".", "set_data", "(", "D", ",", "is_json", "=", "is_json", ")", "return", "instance" ]
This factory for :class:`Model` takes either a native Python dictionary or a JSON dictionary/object if ``is_json`` is ``True``. The dictionary passed does not need to contain all of the values that the Model declares.
[ "This", "factory", "for", ":", "class", ":", "Model", "takes", "either", "a", "native", "Python", "dictionary", "or", "a", "JSON", "dictionary", "/", "object", "if", "is_json", "is", "True", ".", "The", "dictionary", "passed", "does", "not", "need", "to", ...
python
train
38.9
web-push-libs/pywebpush
pywebpush/__main__.py
https://github.com/web-push-libs/pywebpush/blob/2a23f45b7819e31bd030de9fe1357a1cf7dcfdc4/pywebpush/__main__.py#L45-L59
def main(): """ Send data """ try: args = get_config() result = webpush( args.sub_info, data=args.data, vapid_private_key=args.key, vapid_claims=args.claims, curl=args.curl, content_encoding=args.encoding) print(res...
[ "def", "main", "(", ")", ":", "try", ":", "args", "=", "get_config", "(", ")", "result", "=", "webpush", "(", "args", ".", "sub_info", ",", "data", "=", "args", ".", "data", ",", "vapid_private_key", "=", "args", ".", "key", ",", "vapid_claims", "=",...
Send data
[ "Send", "data" ]
python
train
25.066667
eventbrite/eventbrite-sdk-python
eventbrite/access_methods.py
https://github.com/eventbrite/eventbrite-sdk-python/blob/f2e5dc5aa1aa3e45766de13f16fd65722163d91a/eventbrite/access_methods.py#L72-L79
def post_event(self, id, **data): """ POST /events/:id/ Updates an event. Returns an :format:`event` for the specified event. Does not support updating a repeating event series parent (see POST /series/:id/). """ return self.post("/events/{0}/".format(id), data=d...
[ "def", "post_event", "(", "self", ",", "id", ",", "*", "*", "data", ")", ":", "return", "self", ".", "post", "(", "\"/events/{0}/\"", ".", "format", "(", "id", ")", ",", "data", "=", "data", ")" ]
POST /events/:id/ Updates an event. Returns an :format:`event` for the specified event. Does not support updating a repeating event series parent (see POST /series/:id/).
[ "POST", "/", "events", "/", ":", "id", "/", "Updates", "an", "event", ".", "Returns", "an", ":", "format", ":", "event", "for", "the", "specified", "event", ".", "Does", "not", "support", "updating", "a", "repeating", "event", "series", "parent", "(", ...
python
train
39.625
shexSpec/grammar
parsers/python/pyshexc/parser_impl/shex_node_expression_parser.py
https://github.com/shexSpec/grammar/blob/4497cd1f73fa6703bca6e2cb53ba9c120f22e48c/parsers/python/pyshexc/parser_impl/shex_node_expression_parser.py#L86-L97
def visitIriRange(self, ctx: ShExDocParser.IriRangeContext): """ iriRange: iri (STEM_MARK iriExclusion*)? """ baseiri = self.context.iri_to_iriref(ctx.iri()) if not ctx.STEM_MARK(): vsvalue = baseiri # valueSetValue = objectValue / objectValue = IRI else: ...
[ "def", "visitIriRange", "(", "self", ",", "ctx", ":", "ShExDocParser", ".", "IriRangeContext", ")", ":", "baseiri", "=", "self", ".", "context", ".", "iri_to_iriref", "(", "ctx", ".", "iri", "(", ")", ")", "if", "not", "ctx", ".", "STEM_MARK", "(", ")"...
iriRange: iri (STEM_MARK iriExclusion*)?
[ "iriRange", ":", "iri", "(", "STEM_MARK", "iriExclusion", "*", ")", "?" ]
python
train
59.75
LudovicRousseau/pyscard
smartcard/Examples/wx/pcscdiag/pcscdiag.py
https://github.com/LudovicRousseau/pyscard/blob/62e675028086c75656444cc21d563d9f08ebf8e7/smartcard/Examples/wx/pcscdiag/pcscdiag.py#L48-L58
def getATR(reader): """Return the ATR of the card inserted into the reader.""" connection = reader.createConnection() atr = "" try: connection.connect() atr = smartcard.util.toHexString(connection.getATR()) connection.disconnect() except smartcard.Exceptions.NoCardException: ...
[ "def", "getATR", "(", "reader", ")", ":", "connection", "=", "reader", ".", "createConnection", "(", ")", "atr", "=", "\"\"", "try", ":", "connection", ".", "connect", "(", ")", "atr", "=", "smartcard", ".", "util", ".", "toHexString", "(", "connection",...
Return the ATR of the card inserted into the reader.
[ "Return", "the", "ATR", "of", "the", "card", "inserted", "into", "the", "reader", "." ]
python
train
32.454545
TheHive-Project/TheHive4py
thehive4py/api.py
https://github.com/TheHive-Project/TheHive4py/blob/35762bbd50d8376943268464326b59c752d6241b/thehive4py/api.py#L191-L219
def create_case_observable(self, case_id, case_observable): """ :param case_id: Case identifier :param case_observable: TheHive observable :type case_observable: CaseObservable defined in models.py :return: TheHive observable :rtype: json """ req = self....
[ "def", "create_case_observable", "(", "self", ",", "case_id", ",", "case_observable", ")", ":", "req", "=", "self", ".", "url", "+", "\"/api/case/{}/artifact\"", ".", "format", "(", "case_id", ")", "if", "case_observable", ".", "dataType", "==", "'file'", ":",...
:param case_id: Case identifier :param case_observable: TheHive observable :type case_observable: CaseObservable defined in models.py :return: TheHive observable :rtype: json
[ ":", "param", "case_id", ":", "Case", "identifier", ":", "param", "case_observable", ":", "TheHive", "observable", ":", "type", "case_observable", ":", "CaseObservable", "defined", "in", "models", ".", "py", ":", "return", ":", "TheHive", "observable", ":", "r...
python
train
48.068966
SBRG/ssbio
ssbio/utils.py
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L801-L835
def combinations(iterable, r): """Calculate combinations >>> list(combinations('ABCD',2)) [['A', 'B'], ['A', 'C'], ['A', 'D'], ['B', 'C'], ['B', 'D'], ['C', 'D']] >>> list(combinations(range(4), 3)) [[0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3]] Args: iterable: Any iterable object. ...
[ "def", "combinations", "(", "iterable", ",", "r", ")", ":", "pool", "=", "tuple", "(", "iterable", ")", "n", "=", "len", "(", "pool", ")", "if", "r", ">", "n", ":", "return", "indices", "=", "list", "(", "range", "(", "r", ")", ")", "yield", "l...
Calculate combinations >>> list(combinations('ABCD',2)) [['A', 'B'], ['A', 'C'], ['A', 'D'], ['B', 'C'], ['B', 'D'], ['C', 'D']] >>> list(combinations(range(4), 3)) [[0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3]] Args: iterable: Any iterable object. r: Size of combination. Yield...
[ "Calculate", "combinations" ]
python
train
23.228571
pyroscope/pyrocore
src/pyrocore/scripts/rtcontrol.py
https://github.com/pyroscope/pyrocore/blob/89ad01346a570943d20311a0b488440975876612/src/pyrocore/scripts/rtcontrol.py#L358-L383
def emit(self, item, defaults=None, stencil=None, to_log=False, item_formatter=None): """ Print an item to stdout, or the log on INFO level. """ item_text = self.format_item(item, defaults, stencil) # Post-process line? if item_formatter: item_text = item_formatter(i...
[ "def", "emit", "(", "self", ",", "item", ",", "defaults", "=", "None", ",", "stencil", "=", "None", ",", "to_log", "=", "False", ",", "item_formatter", "=", "None", ")", ":", "item_text", "=", "self", ".", "format_item", "(", "item", ",", "defaults", ...
Print an item to stdout, or the log on INFO level.
[ "Print", "an", "item", "to", "stdout", "or", "the", "log", "on", "INFO", "level", "." ]
python
train
34.230769
tomplus/kubernetes_asyncio
kubernetes_asyncio/client/api/custom_objects_api.py
https://github.com/tomplus/kubernetes_asyncio/blob/f9ab15317ec921409714c7afef11aeb0f579985d/kubernetes_asyncio/client/api/custom_objects_api.py#L1727-L1751
def patch_cluster_custom_object_scale(self, group, version, plural, name, body, **kwargs): # noqa: E501 """patch_cluster_custom_object_scale # noqa: E501 partially update scale of the specified cluster scoped custom object # noqa: E501 This method makes a synchronous HTTP request by default....
[ "def", "patch_cluster_custom_object_scale", "(", "self", ",", "group", ",", "version", ",", "plural", ",", "name", ",", "body", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", "....
patch_cluster_custom_object_scale # noqa: E501 partially update scale of the specified cluster scoped custom object # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.patch_cluster_cus...
[ "patch_cluster_custom_object_scale", "#", "noqa", ":", "E501" ]
python
train
57.48
langloisjp/pysvcmetrics
statsdclient.py
https://github.com/langloisjp/pysvcmetrics/blob/a126fc029ab645d9db46c0f5712c416cdf80e370/statsdclient.py#L50-L58
def set(self, stats, value): """ Log set >>> client = StatsdClient() >>> client.set('example.set', "set") >>> client.set(('example.set61', 'example.set67'), "2701") """ self.update_stats(stats, value, self.SC_SET)
[ "def", "set", "(", "self", ",", "stats", ",", "value", ")", ":", "self", ".", "update_stats", "(", "stats", ",", "value", ",", "self", ".", "SC_SET", ")" ]
Log set >>> client = StatsdClient() >>> client.set('example.set', "set") >>> client.set(('example.set61', 'example.set67'), "2701")
[ "Log", "set" ]
python
train
29.111111
horazont/aioxmpp
aioxmpp/node.py
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/node.py#L1203-L1213
def connected(self, *, presence=structs.PresenceState(False), **kwargs): """ Return a :class:`.node.UseConnected` context manager which does not modify the presence settings. The keyword arguments are passed to the :class:`.node.UseConnected` context manager constructor. ...
[ "def", "connected", "(", "self", ",", "*", ",", "presence", "=", "structs", ".", "PresenceState", "(", "False", ")", ",", "*", "*", "kwargs", ")", ":", "return", "UseConnected", "(", "self", ",", "presence", "=", "presence", ",", "*", "*", "kwargs", ...
Return a :class:`.node.UseConnected` context manager which does not modify the presence settings. The keyword arguments are passed to the :class:`.node.UseConnected` context manager constructor. .. versionadded:: 0.8
[ "Return", "a", ":", "class", ":", ".", "node", ".", "UseConnected", "context", "manager", "which", "does", "not", "modify", "the", "presence", "settings", "." ]
python
train
37.090909
SavinaRoja/OpenAccess_EPUB
src/openaccess_epub/navigation/__init__.py
https://github.com/SavinaRoja/OpenAccess_EPUB/blob/6b77ba30b7394fd003920e7a7957bca963a90656/src/openaccess_epub/navigation/__init__.py#L63-L88
def process(self, article): """ Ingests an Article to create navigation structures and parse global metadata. """ if self.article is not None and not self.collection: log.warning('Could not process additional article. Navigation only \ handles one article unless colle...
[ "def", "process", "(", "self", ",", "article", ")", ":", "if", "self", ".", "article", "is", "not", "None", "and", "not", "self", ".", "collection", ":", "log", ".", "warning", "(", "'Could not process additional article. Navigation only \\\nhandles one article unle...
Ingests an Article to create navigation structures and parse global metadata.
[ "Ingests", "an", "Article", "to", "create", "navigation", "structures", "and", "parse", "global", "metadata", "." ]
python
train
37
jgillick/LendingClub
lendingclub/__init__.py
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/__init__.py#L1185-L1231
def __place_order(self, token): """ Use the struts token to place the order. Parameters ---------- token : string The struts token received from the place order page Returns ------- int The completed order ID. """ ...
[ "def", "__place_order", "(", "self", ",", "token", ")", ":", "order_id", "=", "0", "response", "=", "None", "if", "not", "token", "or", "token", "[", "'value'", "]", "==", "''", ":", "raise", "LendingClubError", "(", "'The token parameter is False, None or unk...
Use the struts token to place the order. Parameters ---------- token : string The struts token received from the place order page Returns ------- int The completed order ID.
[ "Use", "the", "struts", "token", "to", "place", "the", "order", "." ]
python
train
32.361702
LuminosoInsight/luminoso-api-client-python
luminoso_api/v4_client.py
https://github.com/LuminosoInsight/luminoso-api-client-python/blob/3bedf2a454aee39214c11fbf556ead3eecc27881/luminoso_api/v4_client.py#L290-L311
def post_data(self, path, data, content_type, **params): """ Make a POST request to the given path, with `data` in its body. Return the JSON-decoded result. The content_type must be set to reflect the kind of data being sent, which is often `application/json`. Keyword p...
[ "def", "post_data", "(", "self", ",", "path", ",", "data", ",", "content_type", ",", "*", "*", "params", ")", ":", "params", "=", "jsonify_parameters", "(", "params", ")", "url", "=", "ensure_trailing_slash", "(", "self", ".", "url", "+", "path", ".", ...
Make a POST request to the given path, with `data` in its body. Return the JSON-decoded result. The content_type must be set to reflect the kind of data being sent, which is often `application/json`. Keyword parameters will be converted to URL parameters. This is unlike other P...
[ "Make", "a", "POST", "request", "to", "the", "given", "path", "with", "data", "in", "its", "body", ".", "Return", "the", "JSON", "-", "decoded", "result", "." ]
python
test
38.545455
cloudmesh/cloudmesh-common
cloudmesh/common/FlatDict.py
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/FlatDict.py#L156-L183
def object_to_dict(cls, obj): """ This function converts Objects into Dictionary """ dict_obj = dict() if obj is not None: if type(obj) == list: dict_list = [] for inst in obj: dict_list.append(cls.object_to_dict...
[ "def", "object_to_dict", "(", "cls", ",", "obj", ")", ":", "dict_obj", "=", "dict", "(", ")", "if", "obj", "is", "not", "None", ":", "if", "type", "(", "obj", ")", "==", "list", ":", "dict_list", "=", "[", "]", "for", "inst", "in", "obj", ":", ...
This function converts Objects into Dictionary
[ "This", "function", "converts", "Objects", "into", "Dictionary" ]
python
train
39.357143
ska-sa/purr
Purr/Plugins/local_pychart/area.py
https://github.com/ska-sa/purr/blob/4c848768d0485d0f88b30850d0d5372221b21b66/Purr/Plugins/local_pychart/area.py#L193-L255
def draw(self, can=None): "Draw the charts." if can == None: can = canvas.default_canvas() assert self.check_integrity() for plot in self.__plots: plot.check_integrity() self.x_range, self.x_grid_interval = \ self.__get_data_range(self.x_ra...
[ "def", "draw", "(", "self", ",", "can", "=", "None", ")", ":", "if", "can", "==", "None", ":", "can", "=", "canvas", ".", "default_canvas", "(", ")", "assert", "self", ".", "check_integrity", "(", ")", "for", "plot", "in", "self", ".", "__plots", "...
Draw the charts.
[ "Draw", "the", "charts", "." ]
python
train
31.666667
MacHu-GWU/angora-project
angora/math/outlier.py
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/math/outlier.py#L47-L64
def std_filter(array, n_std=2.0, return_index=False): """Standard deviation outlier detector. :param array: array of data. :param n_std: default 2.0, exclude data out of ``n_std`` standard deviation. :param return_index: boolean, default False, if True, only returns index. """ if not isinstance...
[ "def", "std_filter", "(", "array", ",", "n_std", "=", "2.0", ",", "return_index", "=", "False", ")", ":", "if", "not", "isinstance", "(", "array", ",", "np", ".", "ndarray", ")", ":", "array", "=", "np", ".", "array", "(", "array", ")", "mean", ","...
Standard deviation outlier detector. :param array: array of data. :param n_std: default 2.0, exclude data out of ``n_std`` standard deviation. :param return_index: boolean, default False, if True, only returns index.
[ "Standard", "deviation", "outlier", "detector", "." ]
python
train
35.666667
nlm/nagplug
nagplug/__init__.py
https://github.com/nlm/nagplug/blob/9de70d8031caffbfa57ab9d8d03567e897e9e119/nagplug/__init__.py#L180-L199
def exit(self, code=None, message=None, perfdata=None, extdata=None): """ manual exit from the plugin arguments: code: exit status code message: a short, one-line message to display perfdata: perfdata, if any extdata: multi-line message to give mo...
[ "def", "exit", "(", "self", ",", "code", "=", "None", ",", "message", "=", "None", ",", "perfdata", "=", "None", ",", "extdata", "=", "None", ")", ":", "code", "=", "UNKNOWN", "if", "code", "is", "None", "else", "int", "(", "code", ")", "message", ...
manual exit from the plugin arguments: code: exit status code message: a short, one-line message to display perfdata: perfdata, if any extdata: multi-line message to give more details
[ "manual", "exit", "from", "the", "plugin" ]
python
train
40.5
resonai/ybt
yabt/target_utils.py
https://github.com/resonai/ybt/blob/5b40df0922ef3383eb85f2b04a26a2db4b81b3fd/yabt/target_utils.py#L129-L132
def hashify_targets(targets: list, build_context) -> list: """Return sorted hashes of `targets`.""" return sorted(build_context.targets[target_name].hash(build_context) for target_name in listify(targets))
[ "def", "hashify_targets", "(", "targets", ":", "list", ",", "build_context", ")", "->", "list", ":", "return", "sorted", "(", "build_context", ".", "targets", "[", "target_name", "]", ".", "hash", "(", "build_context", ")", "for", "target_name", "in", "listi...
Return sorted hashes of `targets`.
[ "Return", "sorted", "hashes", "of", "targets", "." ]
python
train
57
CZ-NIC/yangson
yangson/schemanode.py
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L484-L486
def _child_inst_names(self) -> Set[InstanceName]: """Return the set of instance names under the receiver.""" return frozenset([c.iname() for c in self.data_children()])
[ "def", "_child_inst_names", "(", "self", ")", "->", "Set", "[", "InstanceName", "]", ":", "return", "frozenset", "(", "[", "c", ".", "iname", "(", ")", "for", "c", "in", "self", ".", "data_children", "(", ")", "]", ")" ]
Return the set of instance names under the receiver.
[ "Return", "the", "set", "of", "instance", "names", "under", "the", "receiver", "." ]
python
train
60.666667
Clinical-Genomics/trailblazer
trailblazer/mip/start.py
https://github.com/Clinical-Genomics/trailblazer/blob/27f3cd21043a1077bd7029e85783459a50a7b798/trailblazer/mip/start.py#L63-L69
def execute(self, command): """Start a new MIP run.""" process = subprocess.Popen( command, preexec_fn=lambda: signal.signal(signal.SIGPIPE, signal.SIG_DFL) ) return process
[ "def", "execute", "(", "self", ",", "command", ")", ":", "process", "=", "subprocess", ".", "Popen", "(", "command", ",", "preexec_fn", "=", "lambda", ":", "signal", ".", "signal", "(", "signal", ".", "SIGPIPE", ",", "signal", ".", "SIG_DFL", ")", ")",...
Start a new MIP run.
[ "Start", "a", "new", "MIP", "run", "." ]
python
train
31.857143
bububa/pyTOP
pyTOP/campaign.py
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/campaign.py#L456-L466
def recommend_get(self, adgroup_id, **kwargs): '''xxxxx.xxxxx.keywords.recommend.get =================================== 取得一个推广组的推荐关键词列表''' request = TOPRequest('xxxxx.xxxxx.keywords.recommend.get') request['adgroup_id'] = adgroup_id for k, v in kwargs.iteritems(): ...
[ "def", "recommend_get", "(", "self", ",", "adgroup_id", ",", "*", "*", "kwargs", ")", ":", "request", "=", "TOPRequest", "(", "'xxxxx.xxxxx.keywords.recommend.get'", ")", "request", "[", "'adgroup_id'", "]", "=", "adgroup_id", "for", "k", ",", "v", "in", "kw...
xxxxx.xxxxx.keywords.recommend.get =================================== 取得一个推广组的推荐关键词列表
[ "xxxxx", ".", "xxxxx", ".", "keywords", ".", "recommend", ".", "get", "===================================", "取得一个推广组的推荐关键词列表" ]
python
train
50.363636
QualiSystems/vCenterShell
package/cloudshell/cp/vcenter/commands/command_orchestrator.py
https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/commands/command_orchestrator.py#L293-L318
def deploy_from_image(self, context, deploy_action, cancellation_context): """ Deploy From Image Command, will deploy vm from ovf image :param CancellationContext cancellation_context: :param ResourceCommandContext context: the context of the command :param DeployApp deploy_acti...
[ "def", "deploy_from_image", "(", "self", ",", "context", ",", "deploy_action", ",", "cancellation_context", ")", ":", "deploy_action", ".", "actionParams", ".", "deployment", ".", "attributes", "[", "'vCenter Name'", "]", "=", "context", ".", "resource", ".", "n...
Deploy From Image Command, will deploy vm from ovf image :param CancellationContext cancellation_context: :param ResourceCommandContext context: the context of the command :param DeployApp deploy_action: :return str deploy results
[ "Deploy", "From", "Image", "Command", "will", "deploy", "vm", "from", "ovf", "image" ]
python
train
45.692308
PyFilesystem/pyfilesystem2
fs/walk.py
https://github.com/PyFilesystem/pyfilesystem2/blob/047f3593f297d1442194cda3da7a7335bcc9c14a/fs/walk.py#L536-L595
def walk( self, path="/", # type: Text namespaces=None, # type: Optional[Collection[Text]] **kwargs # type: Any ): # type: (...) -> Iterator[Step] """Walk the directory structure of a filesystem. Arguments: path (str): namespaces (l...
[ "def", "walk", "(", "self", ",", "path", "=", "\"/\"", ",", "# type: Text", "namespaces", "=", "None", ",", "# type: Optional[Collection[Text]]", "*", "*", "kwargs", "# type: Any", ")", ":", "# type: (...) -> Iterator[Step]", "walker", "=", "self", ".", "_make_wal...
Walk the directory structure of a filesystem. Arguments: path (str): namespaces (list, optional): A list of namespaces to include in the resource information, e.g. ``['basic', 'access']`` (defaults to ``['basic']``). Keyword Arguments: ...
[ "Walk", "the", "directory", "structure", "of", "a", "filesystem", "." ]
python
train
47.983333
spotify/snakebite
snakebite/minicluster.py
https://github.com/spotify/snakebite/blob/6a456e6100b0c1be66cc1f7f9d7f50494f369da3/snakebite/minicluster.py#L87-L93
def put(self, src, dst): '''Upload a file to HDFS This will take a file from the ``testfiles_path`` supplied in the constuctor. ''' src = "%s%s" % (self._testfiles_path, src) return self._getStdOutCmd([self._hadoop_cmd, 'fs', '-put', src, self._full_hdfs_path(dst)], True)
[ "def", "put", "(", "self", ",", "src", ",", "dst", ")", ":", "src", "=", "\"%s%s\"", "%", "(", "self", ".", "_testfiles_path", ",", "src", ")", "return", "self", ".", "_getStdOutCmd", "(", "[", "self", ".", "_hadoop_cmd", ",", "'fs'", ",", "'-put'", ...
Upload a file to HDFS This will take a file from the ``testfiles_path`` supplied in the constuctor.
[ "Upload", "a", "file", "to", "HDFS" ]
python
train
43.857143