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
pycontribs/pyversion
version/version.py
https://github.com/pycontribs/pyversion/blob/6bbb799846ed4e97e84a3f0f2dbe14685f2ddb39/version/version.py#L100-L174
def increment(version): """Return an incremented version string.""" release_version = os.environ.get("RELEASE_VERSION", None) if release_version is not None: return release_version if isinstance(version, LegacyVersion): msg = """{0} is considered a legacy version ...
[ "def", "increment", "(", "version", ")", ":", "release_version", "=", "os", ".", "environ", ".", "get", "(", "\"RELEASE_VERSION\"", ",", "None", ")", "if", "release_version", "is", "not", "None", ":", "return", "release_version", "if", "isinstance", "(", "ve...
Return an incremented version string.
[ "Return", "an", "incremented", "version", "string", "." ]
python
train
39.6
apache/incubator-mxnet
python/mxnet/contrib/onnx/mx2onnx/_op_translations.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/contrib/onnx/mx2onnx/_op_translations.py#L341-L361
def convert_batchnorm(node, **kwargs): """Map MXNet's BatchNorm operator attributes to onnx's BatchNormalization operator and return the created node. """ name, input_nodes, attrs = get_inputs(node, kwargs) momentum = float(attrs.get("momentum", 0.9)) eps = float(attrs.get("eps", 0.001)) b...
[ "def", "convert_batchnorm", "(", "node", ",", "*", "*", "kwargs", ")", ":", "name", ",", "input_nodes", ",", "attrs", "=", "get_inputs", "(", "node", ",", "kwargs", ")", "momentum", "=", "float", "(", "attrs", ".", "get", "(", "\"momentum\"", ",", "0.9...
Map MXNet's BatchNorm operator attributes to onnx's BatchNormalization operator and return the created node.
[ "Map", "MXNet", "s", "BatchNorm", "operator", "attributes", "to", "onnx", "s", "BatchNormalization", "operator", "and", "return", "the", "created", "node", "." ]
python
train
31.714286
pingali/dgit
dgitcore/plugins/common.py
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/plugins/common.py#L96-L102
def discover_all_plugins(self): """ Load all plugins from dgit extension """ for v in pkg_resources.iter_entry_points('dgit.plugins'): m = v.load() m.setup(self)
[ "def", "discover_all_plugins", "(", "self", ")", ":", "for", "v", "in", "pkg_resources", ".", "iter_entry_points", "(", "'dgit.plugins'", ")", ":", "m", "=", "v", ".", "load", "(", ")", "m", ".", "setup", "(", "self", ")" ]
Load all plugins from dgit extension
[ "Load", "all", "plugins", "from", "dgit", "extension" ]
python
valid
30.142857
biocore/burrito-fillings
bfillings/muscle_v38.py
https://github.com/biocore/burrito-fillings/blob/02ab71a46119b40793bd56a4ae00ca15f6dc3329/bfillings/muscle_v38.py#L531-L569
def align_unaligned_seqs(seqs, moltype=DNA, params=None): """Returns an Alignment object from seqs. seqs: SequenceCollection object, or data that can be used to build one. moltype: a MolType object. DNA, RNA, or PROTEIN. params: dict of parameters to pass in to the Muscle app controller. Result...
[ "def", "align_unaligned_seqs", "(", "seqs", ",", "moltype", "=", "DNA", ",", "params", "=", "None", ")", ":", "if", "not", "params", ":", "params", "=", "{", "}", "#create SequenceCollection object from seqs", "seq_collection", "=", "SequenceCollection", "(", "s...
Returns an Alignment object from seqs. seqs: SequenceCollection object, or data that can be used to build one. moltype: a MolType object. DNA, RNA, or PROTEIN. params: dict of parameters to pass in to the Muscle app controller. Result will be an Alignment object.
[ "Returns", "an", "Alignment", "object", "from", "seqs", "." ]
python
train
37.179487
tensorflow/tensor2tensor
tensor2tensor/layers/common_image_attention.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_image_attention.py#L190-L222
def dilated_attention_1d(x, hparams, attention_type="masked_dilated_1d", q_padding="VALID", kv_padding="VALID", gap_size=2): """Dilated 1d self attention.""" # self-attention x, x_shape, is...
[ "def", "dilated_attention_1d", "(", "x", ",", "hparams", ",", "attention_type", "=", "\"masked_dilated_1d\"", ",", "q_padding", "=", "\"VALID\"", ",", "kv_padding", "=", "\"VALID\"", ",", "gap_size", "=", "2", ")", ":", "# self-attention", "x", ",", "x_shape", ...
Dilated 1d self attention.
[ "Dilated", "1d", "self", "attention", "." ]
python
train
35.727273
ARMmbed/yotta
yotta/lib/component.py
https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L233-L247
def hasDependencyRecursively(self, name, target=None, test_dependencies=False): ''' Check if this module, or any of its dependencies, have a dependencies with the specified name in their dependencies, or in their targetDependencies corresponding to the specified target. Note...
[ "def", "hasDependencyRecursively", "(", "self", ",", "name", ",", "target", "=", "None", ",", "test_dependencies", "=", "False", ")", ":", "# checking dependencies recursively isn't entirely straightforward, so", "# use the existing method to resolve them all before checking:", "...
Check if this module, or any of its dependencies, have a dependencies with the specified name in their dependencies, or in their targetDependencies corresponding to the specified target. Note that if recursive dependencies are not installed, this test may return a false-...
[ "Check", "if", "this", "module", "or", "any", "of", "its", "dependencies", "have", "a", "dependencies", "with", "the", "specified", "name", "in", "their", "dependencies", "or", "in", "their", "targetDependencies", "corresponding", "to", "the", "specified", "targ...
python
valid
51.8
ungarj/mapchete
mapchete/config.py
https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/config.py#L694-L711
def raw_conf_process_pyramid(raw_conf): """ Loads the process pyramid of a raw configuration. Parameters ---------- raw_conf : dict Raw mapchete configuration as dictionary. Returns ------- BufferedTilePyramid """ return BufferedTilePyramid( raw_conf["pyramid"][...
[ "def", "raw_conf_process_pyramid", "(", "raw_conf", ")", ":", "return", "BufferedTilePyramid", "(", "raw_conf", "[", "\"pyramid\"", "]", "[", "\"grid\"", "]", ",", "metatiling", "=", "raw_conf", "[", "\"pyramid\"", "]", ".", "get", "(", "\"metatiling\"", ",", ...
Loads the process pyramid of a raw configuration. Parameters ---------- raw_conf : dict Raw mapchete configuration as dictionary. Returns ------- BufferedTilePyramid
[ "Loads", "the", "process", "pyramid", "of", "a", "raw", "configuration", "." ]
python
valid
24.444444
delfick/harpoon
harpoon/actions.py
https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/actions.py#L313-L342
def tag(collector, image, artifact, **kwargs): """Tag an image!""" if artifact in (None, "", NotSpecified): raise BadOption("Please specify a tag using the artifact option") if image.image_index in (None, "", NotSpecified): raise BadOption("Please specify an image with an image_index option...
[ "def", "tag", "(", "collector", ",", "image", ",", "artifact", ",", "*", "*", "kwargs", ")", ":", "if", "artifact", "in", "(", "None", ",", "\"\"", ",", "NotSpecified", ")", ":", "raise", "BadOption", "(", "\"Please specify a tag using the artifact option\"", ...
Tag an image!
[ "Tag", "an", "image!" ]
python
train
41.533333
tamasgal/km3pipe
km3pipe/core.py
https://github.com/tamasgal/km3pipe/blob/7a9b59ac899a28775b5bdc5d391d9a5340d08040/km3pipe/core.py#L531-L537
def get(self, name, default=None): """Return the value of the requested parameter or `default` if None.""" value = self.parameters.get(name) self._processed_parameters.append(name) if value is None: return default return value
[ "def", "get", "(", "self", ",", "name", ",", "default", "=", "None", ")", ":", "value", "=", "self", ".", "parameters", ".", "get", "(", "name", ")", "self", ".", "_processed_parameters", ".", "append", "(", "name", ")", "if", "value", "is", "None", ...
Return the value of the requested parameter or `default` if None.
[ "Return", "the", "value", "of", "the", "requested", "parameter", "or", "default", "if", "None", "." ]
python
train
38.857143
sigsep/sigsep-mus-eval
museval/metrics.py
https://github.com/sigsep/sigsep-mus-eval/blob/a7c9af3647f0c0bb9bbaeccec0b1a6a9e09d1e2d/museval/metrics.py#L488-L497
def _zeropad(sig, N, axis=0): """pads with N zeros at the end of the signal, along given axis""" # ensures concatenation dimension is the first sig = np.moveaxis(sig, axis, 0) # zero pad out = np.zeros((sig.shape[0] + N,) + sig.shape[1:]) out[:sig.shape[0], ...] = sig # put back axis in plac...
[ "def", "_zeropad", "(", "sig", ",", "N", ",", "axis", "=", "0", ")", ":", "# ensures concatenation dimension is the first", "sig", "=", "np", ".", "moveaxis", "(", "sig", ",", "axis", ",", "0", ")", "# zero pad", "out", "=", "np", ".", "zeros", "(", "(...
pads with N zeros at the end of the signal, along given axis
[ "pads", "with", "N", "zeros", "at", "the", "end", "of", "the", "signal", "along", "given", "axis" ]
python
train
36.3
pingali/dgit
dgitcore/datasets/validation.py
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/validation.py#L17-L82
def instantiate(repo, validator_name=None, filename=None, rulesfiles=None): """ Instantiate the validation specification """ default_validators = repo.options.get('validator', {}) validators = {} if validator_name is not None: # Handle the case validator is specified.. if valid...
[ "def", "instantiate", "(", "repo", ",", "validator_name", "=", "None", ",", "filename", "=", "None", ",", "rulesfiles", "=", "None", ")", ":", "default_validators", "=", "repo", ".", "options", ".", "get", "(", "'validator'", ",", "{", "}", ")", "validat...
Instantiate the validation specification
[ "Instantiate", "the", "validation", "specification" ]
python
valid
36.651515
geographika/mappyfile
docs/examples/geometry/geometry.py
https://github.com/geographika/mappyfile/blob/aecbc5e66ec06896bc4c5db41313503468829d00/docs/examples/geometry/geometry.py#L23-L45
def erosion(mapfile, dilated): """ We will continue to work with the modified Mapfile If we wanted to start from scratch we could simply reread it """ ll = mappyfile.find(mapfile["layers"], "name", "line") ll["status"] = "OFF" pl = mappyfile.find(mapfile["layers"], "name", "polygon") #...
[ "def", "erosion", "(", "mapfile", ",", "dilated", ")", ":", "ll", "=", "mappyfile", ".", "find", "(", "mapfile", "[", "\"layers\"", "]", ",", "\"name\"", ",", "\"line\"", ")", "ll", "[", "\"status\"", "]", "=", "\"OFF\"", "pl", "=", "mappyfile", ".", ...
We will continue to work with the modified Mapfile If we wanted to start from scratch we could simply reread it
[ "We", "will", "continue", "to", "work", "with", "the", "modified", "Mapfile", "If", "we", "wanted", "to", "start", "from", "scratch", "we", "could", "simply", "reread", "it" ]
python
train
29.956522
openclimatedata/pymagicc
pymagicc/core.py
https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/core.py#L903-L925
def set_emission_scenario_setup(self, scenario, config_dict): """Set the emissions flags correctly. Parameters ---------- scenario : :obj:`pymagicc.io.MAGICCData` Scenario to run. config_dict : dict Dictionary with current input configurations which is t...
[ "def", "set_emission_scenario_setup", "(", "self", ",", "scenario", ",", "config_dict", ")", ":", "self", ".", "write", "(", "scenario", ",", "self", ".", "_scen_file_name", ")", "# can be lazy in this line as fix backwards key handles errors for us", "config_dict", "[", ...
Set the emissions flags correctly. Parameters ---------- scenario : :obj:`pymagicc.io.MAGICCData` Scenario to run. config_dict : dict Dictionary with current input configurations which is to be validated and updated where necessary. Returns ...
[ "Set", "the", "emissions", "flags", "correctly", "." ]
python
train
32.956522
SmokinCaterpillar/pypet
pypet/naturalnaming.py
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1824-L1838
def _make_child_iterator(node, with_links, current_depth=0): """Returns an iterator over a node's children. In case of using a trajectory as a run (setting 'v_crun') some sub branches that do not belong to the run are blinded out. """ cdp1 = current_depth + 1 if with_li...
[ "def", "_make_child_iterator", "(", "node", ",", "with_links", ",", "current_depth", "=", "0", ")", ":", "cdp1", "=", "current_depth", "+", "1", "if", "with_links", ":", "iterator", "=", "(", "(", "cdp1", ",", "x", "[", "0", "]", ",", "x", "[", "1", ...
Returns an iterator over a node's children. In case of using a trajectory as a run (setting 'v_crun') some sub branches that do not belong to the run are blinded out.
[ "Returns", "an", "iterator", "over", "a", "node", "s", "children", "." ]
python
test
41.333333
payu-org/payu
payu/models/um.py
https://github.com/payu-org/payu/blob/1442a9a226012eff248b8097cc1eaabc3e224867/payu/models/um.py#L212-L219
def date_to_um_date(date): """ Convert a date object to 'year, month, day, hour, minute, second.' """ assert date.hour == 0 and date.minute == 0 and date.second == 0 return [date.year, date.month, date.day, 0, 0, 0]
[ "def", "date_to_um_date", "(", "date", ")", ":", "assert", "date", ".", "hour", "==", "0", "and", "date", ".", "minute", "==", "0", "and", "date", ".", "second", "==", "0", "return", "[", "date", ".", "year", ",", "date", ".", "month", ",", "date",...
Convert a date object to 'year, month, day, hour, minute, second.'
[ "Convert", "a", "date", "object", "to", "year", "month", "day", "hour", "minute", "second", "." ]
python
train
28.75
atztogo/phonopy
phonopy/structure/grid_points.py
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/structure/grid_points.py#L221-L246
def _shift2boolean(self, q_mesh_shift, is_gamma_center=False, tolerance=1e-5): """ Tolerance is used to judge zero/half gird shift. This value is not necessary to be changed usually. """ if q_mesh_shift is None:...
[ "def", "_shift2boolean", "(", "self", ",", "q_mesh_shift", ",", "is_gamma_center", "=", "False", ",", "tolerance", "=", "1e-5", ")", ":", "if", "q_mesh_shift", "is", "None", ":", "shift", "=", "np", ".", "zeros", "(", "3", ",", "dtype", "=", "'double'", ...
Tolerance is used to judge zero/half gird shift. This value is not necessary to be changed usually.
[ "Tolerance", "is", "used", "to", "judge", "zero", "/", "half", "gird", "shift", ".", "This", "value", "is", "not", "necessary", "to", "be", "changed", "usually", "." ]
python
train
34.5
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/lib/input_reader/_gcs.py
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/lib/input_reader/_gcs.py#L379-L405
def next(self): """Returns the next input from this input reader, a record. Returns: The next input from this input reader in the form of a record read from an LevelDB file. Raises: StopIteration: The ordered set records has been exhausted. """ while True: if not hasattr(se...
[ "def", "next", "(", "self", ")", ":", "while", "True", ":", "if", "not", "hasattr", "(", "self", ",", "\"_cur_handle\"", ")", "or", "self", ".", "_cur_handle", "is", "None", ":", "# If there are no more files, StopIteration is raised here", "self", ".", "_cur_ha...
Returns the next input from this input reader, a record. Returns: The next input from this input reader in the form of a record read from an LevelDB file. Raises: StopIteration: The ordered set records has been exhausted.
[ "Returns", "the", "next", "input", "from", "this", "input", "reader", "a", "record", "." ]
python
train
37.740741
72squared/redpipe
redpipe/keyspaces.py
https://github.com/72squared/redpipe/blob/e6ee518bc9f3e2fee323c8c53d08997799bd9b1b/redpipe/keyspaces.py#L1343-L1356
def rpoplpush(self, src, dst): """ RPOP a value off of the ``src`` list and atomically LPUSH it on to the ``dst`` list. Returns the value. """ with self.pipe as pipe: f = Future() res = pipe.rpoplpush(self.redis_key(src), self.redis_key(dst)) ...
[ "def", "rpoplpush", "(", "self", ",", "src", ",", "dst", ")", ":", "with", "self", ".", "pipe", "as", "pipe", ":", "f", "=", "Future", "(", ")", "res", "=", "pipe", ".", "rpoplpush", "(", "self", ".", "redis_key", "(", "src", ")", ",", "self", ...
RPOP a value off of the ``src`` list and atomically LPUSH it on to the ``dst`` list. Returns the value.
[ "RPOP", "a", "value", "off", "of", "the", "src", "list", "and", "atomically", "LPUSH", "it", "on", "to", "the", "dst", "list", ".", "Returns", "the", "value", "." ]
python
train
30.642857
alexras/pylsdj
pylsdj/project.py
https://github.com/alexras/pylsdj/blob/1c45a7919dd324e941f76b315558b9647892e4d5/pylsdj/project.py#L55-L82
def load_srm(filename): """Load a Project from an ``.srm`` file. :param filename: the name of the file from which to load :rtype: :py:class:`pylsdj.Project` """ # .srm files are just decompressed projects without headers # In order to determine the file's size in compressed blocks, we have to...
[ "def", "load_srm", "(", "filename", ")", ":", "# .srm files are just decompressed projects without headers", "# In order to determine the file's size in compressed blocks, we have to", "# compress it first", "with", "open", "(", "filename", ",", "'rb'", ")", "as", "fp", ":", "r...
Load a Project from an ``.srm`` file. :param filename: the name of the file from which to load :rtype: :py:class:`pylsdj.Project`
[ "Load", "a", "Project", "from", "an", ".", "srm", "file", "." ]
python
train
27.392857
odlgroup/odl
odl/space/weighting.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/space/weighting.py#L530-L552
def equiv(self, other): """Return True if other is an equivalent weighting. Returns ------- equivalent : bool ``True`` if ``other`` is a `Weighting` instance with the same `Weighting.impl`, which yields the same result as this weighting for any input,...
[ "def", "equiv", "(", "self", ",", "other", ")", ":", "# Optimization for equality", "if", "self", "==", "other", ":", "return", "True", "elif", "(", "not", "isinstance", "(", "other", ",", "Weighting", ")", "or", "self", ".", "exponent", "!=", "other", "...
Return True if other is an equivalent weighting. Returns ------- equivalent : bool ``True`` if ``other`` is a `Weighting` instance with the same `Weighting.impl`, which yields the same result as this weighting for any input, ``False`` otherwise. This is check...
[ "Return", "True", "if", "other", "is", "an", "equivalent", "weighting", "." ]
python
train
38.26087
note35/sinon
sinon/lib/matcher.py
https://github.com/note35/sinon/blob/f1d551b679b393d64d926a8a279320904c38d0f5/sinon/lib/matcher.py#L46-L61
def __value_compare(self, target): """ Comparing result based on expectation if arg_type is "VALUE" Args: Anything Return: Boolean """ if self.expectation == "__ANY__": return True elif self.expectation == "__DEFINED__": return True if targ...
[ "def", "__value_compare", "(", "self", ",", "target", ")", ":", "if", "self", ".", "expectation", "==", "\"__ANY__\"", ":", "return", "True", "elif", "self", ".", "expectation", "==", "\"__DEFINED__\"", ":", "return", "True", "if", "target", "is", "not", "...
Comparing result based on expectation if arg_type is "VALUE" Args: Anything Return: Boolean
[ "Comparing", "result", "based", "on", "expectation", "if", "arg_type", "is", "VALUE", "Args", ":", "Anything", "Return", ":", "Boolean" ]
python
train
43.5625
tensorflow/tensorboard
tensorboard/plugins/debugger/debugger_plugin.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/debugger_plugin.py#L139-L152
def is_active(self): """Determines whether this plugin is active. This plugin is active if any health pills information is present for any run. Returns: A boolean. Whether this plugin is active. """ return bool( self._grpc_port is not None and self._event_multiplexer and ...
[ "def", "is_active", "(", "self", ")", ":", "return", "bool", "(", "self", ".", "_grpc_port", "is", "not", "None", "and", "self", ".", "_event_multiplexer", "and", "self", ".", "_event_multiplexer", ".", "PluginRunToTagToContent", "(", "constants", ".", "DEBUGG...
Determines whether this plugin is active. This plugin is active if any health pills information is present for any run. Returns: A boolean. Whether this plugin is active.
[ "Determines", "whether", "this", "plugin", "is", "active", "." ]
python
train
29.142857
emlazzarin/acrylic
acrylic/datatable.py
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L856-L873
def writexlsx(self, path, sheetname="default"): """ Writes this table to an .xlsx file at the specified path. If you'd like to specify a sheetname, you may do so. If you'd like to write one workbook with different DataTables for each sheet, import the `excel` function from acry...
[ "def", "writexlsx", "(", "self", ",", "path", ",", "sheetname", "=", "\"default\"", ")", ":", "writer", "=", "ExcelRW", ".", "UnicodeWriter", "(", "path", ")", "writer", ".", "set_active_sheet", "(", "sheetname", ")", "writer", ".", "writerow", "(", "self"...
Writes this table to an .xlsx file at the specified path. If you'd like to specify a sheetname, you may do so. If you'd like to write one workbook with different DataTables for each sheet, import the `excel` function from acrylic. You can see that code in `utils.py`. Note that...
[ "Writes", "this", "table", "to", "an", ".", "xlsx", "file", "at", "the", "specified", "path", "." ]
python
train
35.666667
OpenKMIP/PyKMIP
kmip/pie/sqltypes.py
https://github.com/OpenKMIP/PyKMIP/blob/b51c5b044bd05f8c85a1d65d13a583a4d8fc1b0e/kmip/pie/sqltypes.py#L46-L59
def process_bind_param(self, value, dialect): """ Returns the integer value of the usage mask bitmask. This value is stored in the database. Args: value(list<enums.CryptographicUsageMask>): list of enums in the usage mask dialect(string): SQL dialect ...
[ "def", "process_bind_param", "(", "self", ",", "value", ",", "dialect", ")", ":", "bitmask", "=", "0x00", "for", "e", "in", "value", ":", "bitmask", "=", "bitmask", "|", "e", ".", "value", "return", "bitmask" ]
Returns the integer value of the usage mask bitmask. This value is stored in the database. Args: value(list<enums.CryptographicUsageMask>): list of enums in the usage mask dialect(string): SQL dialect
[ "Returns", "the", "integer", "value", "of", "the", "usage", "mask", "bitmask", ".", "This", "value", "is", "stored", "in", "the", "database", "." ]
python
test
30.571429
saltstack/salt
salt/spm/pkgdb/sqlite3.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/spm/pkgdb/sqlite3.py#L110-L126
def list_packages(conn=None): ''' List files for an installed package ''' close = False if conn is None: close = True conn = init() ret = [] data = conn.execute('SELECT package FROM packages') for pkg in data.fetchall(): ret.append(pkg) if close: con...
[ "def", "list_packages", "(", "conn", "=", "None", ")", ":", "close", "=", "False", "if", "conn", "is", "None", ":", "close", "=", "True", "conn", "=", "init", "(", ")", "ret", "=", "[", "]", "data", "=", "conn", ".", "execute", "(", "'SELECT packag...
List files for an installed package
[ "List", "files", "for", "an", "installed", "package" ]
python
train
19.294118
google/grr
grr/server/grr_response_server/aff4_objects/standard.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/standard.py#L205-L225
def _ReadPartial(self, length): """Read as much as possible, but not more than length.""" chunk = self.offset // self.chunksize chunk_offset = self.offset % self.chunksize # If we're past the end of the file, we don't have a chunk to read from, so # we can't read anymore. We return the empty string...
[ "def", "_ReadPartial", "(", "self", ",", "length", ")", ":", "chunk", "=", "self", ".", "offset", "//", "self", ".", "chunksize", "chunk_offset", "=", "self", ".", "offset", "%", "self", ".", "chunksize", "# If we're past the end of the file, we don't have a chunk...
Read as much as possible, but not more than length.
[ "Read", "as", "much", "as", "possible", "but", "not", "more", "than", "length", "." ]
python
train
32.142857
numba/llvmlite
llvmlite/ir/builder.py
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/builder.py#L742-L755
def store_atomic(self, value, ptr, ordering, align): """ Store value to pointer, with optional guaranteed alignment: *ptr = name """ if not isinstance(ptr.type, types.PointerType): raise TypeError("cannot store to value of type %s (%r): not a pointer" ...
[ "def", "store_atomic", "(", "self", ",", "value", ",", "ptr", ",", "ordering", ",", "align", ")", ":", "if", "not", "isinstance", "(", "ptr", ".", "type", ",", "types", ".", "PointerType", ")", ":", "raise", "TypeError", "(", "\"cannot store to value of ty...
Store value to pointer, with optional guaranteed alignment: *ptr = name
[ "Store", "value", "to", "pointer", "with", "optional", "guaranteed", "alignment", ":", "*", "ptr", "=", "name" ]
python
train
45.785714
postlund/pyatv
pyatv/mrp/pairing.py
https://github.com/postlund/pyatv/blob/655dfcda4e2f9d1c501540e18da4f480d8bf0e70/pyatv/mrp/pairing.py#L88-L116
async def verify_credentials(self): """Verify credentials with device.""" _, public_key = self.srp.initialize() msg = messages.crypto_pairing({ tlv8.TLV_SEQ_NO: b'\x01', tlv8.TLV_PUBLIC_KEY: public_key}) resp = await self.protocol.send_and_receive( ms...
[ "async", "def", "verify_credentials", "(", "self", ")", ":", "_", ",", "public_key", "=", "self", ".", "srp", ".", "initialize", "(", ")", "msg", "=", "messages", ".", "crypto_pairing", "(", "{", "tlv8", ".", "TLV_SEQ_NO", ":", "b'\\x01'", ",", "tlv8", ...
Verify credentials with device.
[ "Verify", "credentials", "with", "device", "." ]
python
train
35.827586
h2oai/datatable
datatable/utils/misc.py
https://github.com/h2oai/datatable/blob/dd5fba74d2ca85b66f82ae3c1e0b6ea2fd792564/datatable/utils/misc.py#L130-L166
def normalize_range(e, n): """ Return the range tuple normalized for an ``n``-element object. The semantics of a range is slightly different than that of a slice. In particular, a range is similar to a list in meaning (and on Py2 it was eagerly expanded into a list). Thus we do not allow the range...
[ "def", "normalize_range", "(", "e", ",", "n", ")", ":", "if", "e", ".", "step", ">", "0", ":", "count", "=", "max", "(", "0", ",", "(", "e", ".", "stop", "-", "e", ".", "start", "-", "1", ")", "//", "e", ".", "step", "+", "1", ")", "else"...
Return the range tuple normalized for an ``n``-element object. The semantics of a range is slightly different than that of a slice. In particular, a range is similar to a list in meaning (and on Py2 it was eagerly expanded into a list). Thus we do not allow the range to generate indices that would be ...
[ "Return", "the", "range", "tuple", "normalized", "for", "an", "n", "-", "element", "object", "." ]
python
train
37.486486
cthorey/pdsimage
pdsimage/PDS_Extractor.py
https://github.com/cthorey/pdsimage/blob/f71de6dfddd3d538d76da229b4b9605c40f3fbac/pdsimage/PDS_Extractor.py#L647-L657
def _control_longitude(self): ''' Control on longitude values ''' if self.lonm < 0.0: self.lonm = 360.0 + self.lonm if self.lonM < 0.0: self.lonM = 360.0 + self.lonM if self.lonm > 360.0: self.lonm = self.lonm - 360.0 if self.lonM > 360.0: ...
[ "def", "_control_longitude", "(", "self", ")", ":", "if", "self", ".", "lonm", "<", "0.0", ":", "self", ".", "lonm", "=", "360.0", "+", "self", ".", "lonm", "if", "self", ".", "lonM", "<", "0.0", ":", "self", ".", "lonM", "=", "360.0", "+", "self...
Control on longitude values
[ "Control", "on", "longitude", "values" ]
python
train
31.636364
mikedh/trimesh
trimesh/creation.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/creation.py#L711-L784
def cylinder(radius=1.0, height=1.0, sections=32, segment=None, transform=None, **kwargs): """ Create a mesh of a cylinder along Z centered at the origin. Parameters ---------- radius : float The radius of the cylinder heigh...
[ "def", "cylinder", "(", "radius", "=", "1.0", ",", "height", "=", "1.0", ",", "sections", "=", "32", ",", "segment", "=", "None", ",", "transform", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "segment", "is", "not", "None", ":", "segment"...
Create a mesh of a cylinder along Z centered at the origin. Parameters ---------- radius : float The radius of the cylinder height : float The height of the cylinder sections : int How many pie wedges should the cylinder have segment : (2, 3) float Endpoints of axis, ove...
[ "Create", "a", "mesh", "of", "a", "cylinder", "along", "Z", "centered", "at", "the", "origin", "." ]
python
train
35.054054
rwl/godot
godot/mapping.py
https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/mapping.py#L295-L329
def map_element(self, obj, name, event): """ Handles mapping elements to diagram components """ canvas = self.diagram.diagram_canvas parser = XDotParser() for element in event.added: logger.debug("Mapping new element [%s] to diagram node" % element) for node_map...
[ "def", "map_element", "(", "self", ",", "obj", ",", "name", ",", "event", ")", ":", "canvas", "=", "self", ".", "diagram", ".", "diagram_canvas", "parser", "=", "XDotParser", "(", ")", "for", "element", "in", "event", ".", "added", ":", "logger", ".", ...
Handles mapping elements to diagram components
[ "Handles", "mapping", "elements", "to", "diagram", "components" ]
python
test
43.628571
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/color/colormap.py
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/colormap.py#L160-L167
def _process_glsl_template(template, colors): """Replace $color_i by color #i in the GLSL template.""" for i in range(len(colors) - 1, -1, -1): color = colors[i] assert len(color) == 4 vec4_color = 'vec4(%.3f, %.3f, %.3f, %.3f)' % tuple(color) template = template.replace('$color_...
[ "def", "_process_glsl_template", "(", "template", ",", "colors", ")", ":", "for", "i", "in", "range", "(", "len", "(", "colors", ")", "-", "1", ",", "-", "1", ",", "-", "1", ")", ":", "color", "=", "colors", "[", "i", "]", "assert", "len", "(", ...
Replace $color_i by color #i in the GLSL template.
[ "Replace", "$color_i", "by", "color", "#i", "in", "the", "GLSL", "template", "." ]
python
train
44.125
numenta/nupic
src/nupic/algorithms/spatial_pooler.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/spatial_pooler.py#L1177-L1190
def _bumpUpWeakColumns(self): """ This method increases the permanence values of synapses of columns whose activity level has been too low. Such columns are identified by having an overlap duty cycle that drops too much below those of their peers. The permanence values for such columns are increased...
[ "def", "_bumpUpWeakColumns", "(", "self", ")", ":", "weakColumns", "=", "numpy", ".", "where", "(", "self", ".", "_overlapDutyCycles", "<", "self", ".", "_minOverlapDutyCycles", ")", "[", "0", "]", "for", "columnIndex", "in", "weakColumns", ":", "perm", "=",...
This method increases the permanence values of synapses of columns whose activity level has been too low. Such columns are identified by having an overlap duty cycle that drops too much below those of their peers. The permanence values for such columns are increased.
[ "This", "method", "increases", "the", "permanence", "values", "of", "synapses", "of", "columns", "whose", "activity", "level", "has", "been", "too", "low", ".", "Such", "columns", "are", "identified", "by", "having", "an", "overlap", "duty", "cycle", "that", ...
python
valid
53.071429
humilis/humilis-lambdautils
lambdautils/state.py
https://github.com/humilis/humilis-lambdautils/blob/58f75eb5ace23523c283708d56a9193181ea7e8e/lambdautils/state.py#L270-L324
def set_state(key, value, namespace=None, table_name=None, environment=None, layer=None, stage=None, shard_id=None, consistent=True, serializer=json.dumps, wait_exponential_multiplier=500, wait_exponential_max=5000, stop_max_delay=10000, ttl=None): """Set Lambda state value...
[ "def", "set_state", "(", "key", ",", "value", ",", "namespace", "=", "None", ",", "table_name", "=", "None", ",", "environment", "=", "None", ",", "layer", "=", "None", ",", "stage", "=", "None", ",", "shard_id", "=", "None", ",", "consistent", "=", ...
Set Lambda state value.
[ "Set", "Lambda", "state", "value", "." ]
python
train
33.836364
fracpete/python-weka-wrapper3
python/weka/core/dataset.py
https://github.com/fracpete/python-weka-wrapper3/blob/d850ab1bdb25fbd5a8d86e99f34a397975425838/python/weka/core/dataset.py#L235-L247
def add_instance(self, inst, index=None): """ Adds the specified instance to the dataset. :param inst: the Instance to add :type inst: Instance :param index: the 0-based index where to add the Instance :type index: int """ if index is None: se...
[ "def", "add_instance", "(", "self", ",", "inst", ",", "index", "=", "None", ")", ":", "if", "index", "is", "None", ":", "self", ".", "__append_instance", "(", "inst", ".", "jobject", ")", "else", ":", "self", ".", "__insert_instance", "(", "index", ","...
Adds the specified instance to the dataset. :param inst: the Instance to add :type inst: Instance :param index: the 0-based index where to add the Instance :type index: int
[ "Adds", "the", "specified", "instance", "to", "the", "dataset", "." ]
python
train
31.692308
timothyb0912/pylogit
pylogit/mixed_logit.py
https://github.com/timothyb0912/pylogit/blob/f83b0fd6debaa7358d87c3828428f6d4ead71357/pylogit/mixed_logit.py#L135-L168
def add_mixl_specific_results_to_estimation_res(estimator, results_dict): """ Stores particular items in the results dictionary that are unique to mixed logit-type models. In particular, this function calculates and adds `sequence_probs` and `expanded_sequence_probs` to the results dictionary. The `...
[ "def", "add_mixl_specific_results_to_estimation_res", "(", "estimator", ",", "results_dict", ")", ":", "# Get the probability of each sequence of choices, given the draws", "prob_res", "=", "mlc", ".", "calc_choice_sequence_probs", "(", "results_dict", "[", "\"long_probs\"", "]",...
Stores particular items in the results dictionary that are unique to mixed logit-type models. In particular, this function calculates and adds `sequence_probs` and `expanded_sequence_probs` to the results dictionary. The `constrained_pos` object is also stored to the results_dict. Parameters ------...
[ "Stores", "particular", "items", "in", "the", "results", "dictionary", "that", "are", "unique", "to", "mixed", "logit", "-", "type", "models", ".", "In", "particular", "this", "function", "calculates", "and", "adds", "sequence_probs", "and", "expanded_sequence_pro...
python
train
45.235294
3DLIRIOUS/MeshLabXML
meshlabxml/files.py
https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/files.py#L253-L279
def measure_all(fbasename=None, log=None, ml_version=ml_version): """Measures mesh geometry, aabb and topology.""" ml_script1_file = 'TEMP3D_measure_gAndT.mlx' if ml_version == '1.3.4BETA': file_out = 'TEMP3D_aabb.xyz' else: file_out = None ml_script1 = mlx.FilterScript(file_in=fbas...
[ "def", "measure_all", "(", "fbasename", "=", "None", ",", "log", "=", "None", ",", "ml_version", "=", "ml_version", ")", ":", "ml_script1_file", "=", "'TEMP3D_measure_gAndT.mlx'", "if", "ml_version", "==", "'1.3.4BETA'", ":", "file_out", "=", "'TEMP3D_aabb.xyz'", ...
Measures mesh geometry, aabb and topology.
[ "Measures", "mesh", "geometry", "aabb", "and", "topology", "." ]
python
test
36.259259
saltstack/salt
salt/utils/network.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L200-L224
def get_fqhostname(): ''' Returns the fully qualified hostname ''' # try getaddrinfo() fqdn = None try: addrinfo = socket.getaddrinfo( socket.gethostname(), 0, socket.AF_UNSPEC, socket.SOCK_STREAM, socket.SOL_TCP, socket.AI_CANONNAME ) for info in ...
[ "def", "get_fqhostname", "(", ")", ":", "# try getaddrinfo()", "fqdn", "=", "None", "try", ":", "addrinfo", "=", "socket", ".", "getaddrinfo", "(", "socket", ".", "gethostname", "(", ")", ",", "0", ",", "socket", ".", "AF_UNSPEC", ",", "socket", ".", "SO...
Returns the fully qualified hostname
[ "Returns", "the", "fully", "qualified", "hostname" ]
python
train
34.88
googleapis/google-cloud-python
error_reporting/google/cloud/errorreporting_v1beta1/gapic/error_stats_service_client.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/error_reporting/google/cloud/errorreporting_v1beta1/gapic/error_stats_service_client.py#L472-L542
def delete_events( self, project_name, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Deletes all error events of a given project. Example: >>> from google.cloud import...
[ "def", "delete_events", "(", "self", ",", "project_name", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "...
Deletes all error events of a given project. Example: >>> from google.cloud import errorreporting_v1beta1 >>> >>> client = errorreporting_v1beta1.ErrorStatsServiceClient() >>> >>> project_name = client.project_path('[PROJECT]') >>> ...
[ "Deletes", "all", "error", "events", "of", "a", "given", "project", "." ]
python
train
42.070423
dpkp/kafka-python
kafka/record/util.py
https://github.com/dpkp/kafka-python/blob/f6a8a38937688ea2cc5dc13d3d1039493be5c9b5/kafka/record/util.py#L63-L85
def size_of_varint(value): """ Number of bytes needed to encode an integer in variable-length format. """ value = (value << 1) ^ (value >> 63) if value <= 0x7f: return 1 if value <= 0x3fff: return 2 if value <= 0x1fffff: return 3 if value <= 0xfffffff: return ...
[ "def", "size_of_varint", "(", "value", ")", ":", "value", "=", "(", "value", "<<", "1", ")", "^", "(", "value", ">>", "63", ")", "if", "value", "<=", "0x7f", ":", "return", "1", "if", "value", "<=", "0x3fff", ":", "return", "2", "if", "value", "<...
Number of bytes needed to encode an integer in variable-length format.
[ "Number", "of", "bytes", "needed", "to", "encode", "an", "integer", "in", "variable", "-", "length", "format", "." ]
python
train
24.391304
angr/angr
angr/state_plugins/heap/heap_freelist.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_freelist.py#L59-L64
def next_chunk(self): """ Returns the chunk immediately following (and adjacent to) this one. """ raise NotImplementedError("%s not implemented for %s" % (self.next_chunk.__func__.__name__, self.__class__.__name__))
[ "def", "next_chunk", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "next_chunk", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ")" ]
Returns the chunk immediately following (and adjacent to) this one.
[ "Returns", "the", "chunk", "immediately", "following", "(", "and", "adjacent", "to", ")", "this", "one", "." ]
python
train
51.166667
lreis2415/PyGeoC
pygeoc/hydro.py
https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/hydro.py#L103-L109
def get_cell_length(flow_model): """Get flow direction induced cell length dict. Args: flow_model: Currently, "TauDEM", "ArcGIS", and "Whitebox" are supported. """ assert flow_model.lower() in FlowModelConst.d8_lens return FlowModelConst.d8_lens.get(flow_model.lower()...
[ "def", "get_cell_length", "(", "flow_model", ")", ":", "assert", "flow_model", ".", "lower", "(", ")", "in", "FlowModelConst", ".", "d8_lens", "return", "FlowModelConst", ".", "d8_lens", ".", "get", "(", "flow_model", ".", "lower", "(", ")", ")" ]
Get flow direction induced cell length dict. Args: flow_model: Currently, "TauDEM", "ArcGIS", and "Whitebox" are supported.
[ "Get", "flow", "direction", "induced", "cell", "length", "dict", ".", "Args", ":", "flow_model", ":", "Currently", "TauDEM", "ArcGIS", "and", "Whitebox", "are", "supported", "." ]
python
train
45
CalebBell/ht
ht/conv_internal.py
https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/conv_internal.py#L1024-L1063
def turbulent_Nunner(Re, Pr, fd, fd_smooth): r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as shown in [1]_. .. math:: Nu = \frac{RePr(f/8)}{1 + 1.5Re^{-1/8}Pr^{-1/6}[Pr(f/f_s)-1]} Parameters ---------- Re : float Reynolds numbe...
[ "def", "turbulent_Nunner", "(", "Re", ",", "Pr", ",", "fd", ",", "fd_smooth", ")", ":", "return", "Re", "*", "Pr", "*", "fd", "/", "8.", "/", "(", "1", "+", "1.5", "*", "Re", "**", "-", "0.125", "*", "Pr", "**", "(", "-", "1", "/", "6.", ")...
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as shown in [1]_. .. math:: Nu = \frac{RePr(f/8)}{1 + 1.5Re^{-1/8}Pr^{-1/6}[Pr(f/f_s)-1]} Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number, [-]...
[ "r", "Calculates", "internal", "convection", "Nusselt", "number", "for", "turbulent", "flows", "in", "pipe", "according", "to", "[", "2", "]", "_", "as", "shown", "in", "[", "1", "]", "_", "." ]
python
train
27.075
coldfix/udiskie
udiskie/config.py
https://github.com/coldfix/udiskie/blob/804c9d27df6f7361fec3097c432398f2d702f911/udiskie/config.py#L159-L174
def match_config(filters, device, kind, default): """ Matches devices against multiple :class:`DeviceFilter`s. :param list filters: device filters :param Device device: device to be mounted :param str kind: value kind :param default: default value :returns: value of the first matching filte...
[ "def", "match_config", "(", "filters", ",", "device", ",", "kind", ",", "default", ")", ":", "if", "device", "is", "None", ":", "return", "default", "matches", "=", "(", "f", ".", "value", "(", "kind", ",", "device", ")", "for", "f", "in", "filters",...
Matches devices against multiple :class:`DeviceFilter`s. :param list filters: device filters :param Device device: device to be mounted :param str kind: value kind :param default: default value :returns: value of the first matching filter
[ "Matches", "devices", "against", "multiple", ":", "class", ":", "DeviceFilter", "s", "." ]
python
train
32.5
spdx/tools-python
spdx/parsers/tagvaluebuilders.py
https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/tagvaluebuilders.py#L1074-L1090
def set_lic_text(self, doc, text): """Sets license extracted text. Raises SPDXValueError if text is not free form text. Raises OrderError if no license ID defined. """ if self.has_extr_lic(doc): if not self.extr_text_set: self.extr_text_set = True ...
[ "def", "set_lic_text", "(", "self", ",", "doc", ",", "text", ")", ":", "if", "self", ".", "has_extr_lic", "(", "doc", ")", ":", "if", "not", "self", ".", "extr_text_set", ":", "self", ".", "extr_text_set", "=", "True", "if", "validations", ".", "valida...
Sets license extracted text. Raises SPDXValueError if text is not free form text. Raises OrderError if no license ID defined.
[ "Sets", "license", "extracted", "text", ".", "Raises", "SPDXValueError", "if", "text", "is", "not", "free", "form", "text", ".", "Raises", "OrderError", "if", "no", "license", "ID", "defined", "." ]
python
valid
41.352941
SwissDataScienceCenter/renku-python
renku/cli/rerun.py
https://github.com/SwissDataScienceCenter/renku-python/blob/691644d695b055a01e0ca22b2620e55bbd928c0d/renku/cli/rerun.py#L68-L77
def show_inputs(client, workflow): """Show workflow inputs and exit.""" for input_ in workflow.inputs: click.echo( '{id}: {default}'.format( id=input_.id, default=_format_default(client, input_.default), ) ) sys.exit(0)
[ "def", "show_inputs", "(", "client", ",", "workflow", ")", ":", "for", "input_", "in", "workflow", ".", "inputs", ":", "click", ".", "echo", "(", "'{id}: {default}'", ".", "format", "(", "id", "=", "input_", ".", "id", ",", "default", "=", "_format_defau...
Show workflow inputs and exit.
[ "Show", "workflow", "inputs", "and", "exit", "." ]
python
train
29.4
MediaFire/mediafire-python-open-sdk
mediafire/client.py
https://github.com/MediaFire/mediafire-python-open-sdk/blob/8f1f23db1b16f16e026f5c6777aec32d00baa05f/mediafire/client.py#L255-L280
def get_folder_contents_iter(self, uri): """Return iterator for directory contents. uri -- mediafire URI Example: for item in get_folder_contents_iter('mf:///Documents'): print(item) """ resource = self.get_resource_by_uri(uri) if not isins...
[ "def", "get_folder_contents_iter", "(", "self", ",", "uri", ")", ":", "resource", "=", "self", ".", "get_resource_by_uri", "(", "uri", ")", "if", "not", "isinstance", "(", "resource", ",", "Folder", ")", ":", "raise", "NotAFolderError", "(", "uri", ")", "f...
Return iterator for directory contents. uri -- mediafire URI Example: for item in get_folder_contents_iter('mf:///Documents'): print(item)
[ "Return", "iterator", "for", "directory", "contents", "." ]
python
train
30.576923
475Cumulus/TBone
tbone/db/models.py
https://github.com/475Cumulus/TBone/blob/5a6672d8bbac449a0ab9e99560609f671fe84d4d/tbone/db/models.py#L336-L378
async def create_collection(db, model_class: MongoCollectionMixin): ''' Creates a MongoDB collection and all the declared indices in the model's ``Meta`` class :param db: A database handle :type db: motor.motor_asyncio.AsyncIOMotorClient :param model_class: The model to cre...
[ "async", "def", "create_collection", "(", "db", ",", "model_class", ":", "MongoCollectionMixin", ")", ":", "name", "=", "model_class", ".", "get_collection_name", "(", ")", "if", "name", ":", "try", ":", "# create collection", "coll", "=", "await", "db", ".", ...
Creates a MongoDB collection and all the declared indices in the model's ``Meta`` class :param db: A database handle :type db: motor.motor_asyncio.AsyncIOMotorClient :param model_class: The model to create :type model_class: Subclass of ``Model`` mixed with ``MongoColle...
[ "Creates", "a", "MongoDB", "collection", "and", "all", "the", "declared", "indices", "in", "the", "model", "s", "Meta", "class" ]
python
train
40.511628
eaton-lab/toytree
toytree/etemini.py
https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/etemini.py#L303-L319
def remove_sister(self, sister=None): """ Removes a sister node. It has the same effect as **`TreeNode.up.remove_child(sister)`** If a sister node is not supplied, the first sister will be deleted and returned. :argument sister: A node instance :return: The nod...
[ "def", "remove_sister", "(", "self", ",", "sister", "=", "None", ")", ":", "sisters", "=", "self", ".", "get_sisters", "(", ")", "if", "len", "(", "sisters", ")", ">", "0", ":", "if", "sister", "is", "None", ":", "sister", "=", "sisters", ".", "pop...
Removes a sister node. It has the same effect as **`TreeNode.up.remove_child(sister)`** If a sister node is not supplied, the first sister will be deleted and returned. :argument sister: A node instance :return: The node removed
[ "Removes", "a", "sister", "node", ".", "It", "has", "the", "same", "effect", "as", "**", "TreeNode", ".", "up", ".", "remove_child", "(", "sister", ")", "**" ]
python
train
30
tanghaibao/goatools
goatools/rpt/goea_nt_xfrm.py
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/rpt/goea_nt_xfrm.py#L25-L30
def get_study_items(self): """Get all study items (e.g., geneids).""" study_items = set() for rec in self.goea_results: study_items |= rec.study_items return study_items
[ "def", "get_study_items", "(", "self", ")", ":", "study_items", "=", "set", "(", ")", "for", "rec", "in", "self", ".", "goea_results", ":", "study_items", "|=", "rec", ".", "study_items", "return", "study_items" ]
Get all study items (e.g., geneids).
[ "Get", "all", "study", "items", "(", "e", ".", "g", ".", "geneids", ")", "." ]
python
train
34.666667
mozilla/amo-validator
validator/errorbundler.py
https://github.com/mozilla/amo-validator/blob/0251bfbd7d93106e01ecdb6de5fcd1dc1a180664/validator/errorbundler.py#L186-L255
def _save_message(self, stack, type_, message, context=None, from_merge=False): 'Stores a message in the appropriate message stack.' uid = uuid.uuid4().hex message['uid'] = uid # Get the context for the message (if there's a context available) if context i...
[ "def", "_save_message", "(", "self", ",", "stack", ",", "type_", ",", "message", ",", "context", "=", "None", ",", "from_merge", "=", "False", ")", ":", "uid", "=", "uuid", ".", "uuid4", "(", ")", ".", "hex", "message", "[", "'uid'", "]", "=", "uid...
Stores a message in the appropriate message stack.
[ "Stores", "a", "message", "in", "the", "appropriate", "message", "stack", "." ]
python
train
38.8
BernardFW/bernard
src/bernard/platforms/facebook/platform.py
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/platforms/facebook/platform.py#L437-L470
async def receive_events(self, request: HttpRequest): """ Events received from Facebook """ body = await request.read() s = self.settings() try: content = ujson.loads(body) except ValueError: return json_response({ 'error'...
[ "async", "def", "receive_events", "(", "self", ",", "request", ":", "HttpRequest", ")", ":", "body", "=", "await", "request", ".", "read", "(", ")", "s", "=", "self", ".", "settings", "(", ")", "try", ":", "content", "=", "ujson", ".", "loads", "(", ...
Events received from Facebook
[ "Events", "received", "from", "Facebook" ]
python
train
29.088235
jpscaletti/pyceo
pyceo/params.py
https://github.com/jpscaletti/pyceo/blob/7f37eaf8e557d25f8e54634176139e0aad84b8df/pyceo/params.py#L20-L30
def param(name, help=""): """Decorator that add a parameter to the wrapped command or function.""" def decorator(func): params = getattr(func, "params", []) _param = Param(name, help) # Insert at the beginning so the apparent order is preserved params.insert(0, _param) fu...
[ "def", "param", "(", "name", ",", "help", "=", "\"\"", ")", ":", "def", "decorator", "(", "func", ")", ":", "params", "=", "getattr", "(", "func", ",", "\"params\"", ",", "[", "]", ")", "_param", "=", "Param", "(", "name", ",", "help", ")", "# In...
Decorator that add a parameter to the wrapped command or function.
[ "Decorator", "that", "add", "a", "parameter", "to", "the", "wrapped", "command", "or", "function", "." ]
python
train
33.636364
cltk/cltk
cltk/corpus/utils/formatter.py
https://github.com/cltk/cltk/blob/ed9c025b7ec43c949481173251b70e05e4dffd27/cltk/corpus/utils/formatter.py#L165-L170
def assemble_tlg_author_filepaths(): """Reads TLG index and builds a list of absolute filepaths.""" plaintext_dir_rel = '~/cltk_data/greek/text/tlg/plaintext/' plaintext_dir = os.path.expanduser(plaintext_dir_rel) filepaths = [os.path.join(plaintext_dir, x + '.TXT') for x in TLG_INDEX] return filepa...
[ "def", "assemble_tlg_author_filepaths", "(", ")", ":", "plaintext_dir_rel", "=", "'~/cltk_data/greek/text/tlg/plaintext/'", "plaintext_dir", "=", "os", ".", "path", ".", "expanduser", "(", "plaintext_dir_rel", ")", "filepaths", "=", "[", "os", ".", "path", ".", "joi...
Reads TLG index and builds a list of absolute filepaths.
[ "Reads", "TLG", "index", "and", "builds", "a", "list", "of", "absolute", "filepaths", "." ]
python
train
53
ff0000/scarlet
scarlet/assets/crops.py
https://github.com/ff0000/scarlet/blob/6c37befd810916a2d7ffff2cdb2dab57bcb6d12e/scarlet/assets/crops.py#L158-L185
def create_crop(self, name, file_obj, x=None, x2=None, y=None, y2=None): """ Generate Version for an Image. value has to be a serverpath relative to MEDIA_ROOT. Returns the spec for the crop that was created. """ if name not in self._registry: ...
[ "def", "create_crop", "(", "self", ",", "name", ",", "file_obj", ",", "x", "=", "None", ",", "x2", "=", "None", ",", "y", "=", "None", ",", "y2", "=", "None", ")", ":", "if", "name", "not", "in", "self", ".", "_registry", ":", "return", "file_obj...
Generate Version for an Image. value has to be a serverpath relative to MEDIA_ROOT. Returns the spec for the crop that was created.
[ "Generate", "Version", "for", "an", "Image", ".", "value", "has", "to", "be", "a", "serverpath", "relative", "to", "MEDIA_ROOT", "." ]
python
train
33.071429
quodlibet/mutagen
mutagen/_senf/_fsnative.py
https://github.com/quodlibet/mutagen/blob/e393df5971ba41ba5a50de9c2c9e7e5484d82c4e/mutagen/_senf/_fsnative.py#L49-L56
def _swap_bytes(data): """swaps bytes for 16 bit, leaves remaining trailing bytes alone""" a, b = data[1::2], data[::2] data = bytearray().join(bytearray(x) for x in zip(a, b)) if len(b) > len(a): data += b[-1:] return bytes(data)
[ "def", "_swap_bytes", "(", "data", ")", ":", "a", ",", "b", "=", "data", "[", "1", ":", ":", "2", "]", ",", "data", "[", ":", ":", "2", "]", "data", "=", "bytearray", "(", ")", ".", "join", "(", "bytearray", "(", "x", ")", "for", "x", "in",...
swaps bytes for 16 bit, leaves remaining trailing bytes alone
[ "swaps", "bytes", "for", "16", "bit", "leaves", "remaining", "trailing", "bytes", "alone" ]
python
train
31.5
c0fec0de/anytree
anytree/walker.py
https://github.com/c0fec0de/anytree/blob/775477e206a75e697983e70dae6372b5a7e42dcf/anytree/walker.py#L10-L85
def walk(self, start, end): """ Walk from `start` node to `end` node. Returns: (upwards, common, downwards): `upwards` is a list of nodes to go upward to. `common` top node. `downwards` is a list of nodes to go downward to. Raises: WalkError: on no c...
[ "def", "walk", "(", "self", ",", "start", ",", "end", ")", ":", "s", "=", "start", ".", "path", "e", "=", "end", ".", "path", "if", "start", ".", "root", "!=", "end", ".", "root", ":", "msg", "=", "\"%r and %r are not part of the same tree.\"", "%", ...
Walk from `start` node to `end` node. Returns: (upwards, common, downwards): `upwards` is a list of nodes to go upward to. `common` top node. `downwards` is a list of nodes to go downward to. Raises: WalkError: on no common root node. >>> from anytree impor...
[ "Walk", "from", "start", "node", "to", "end", "node", "." ]
python
train
30.355263
Qiskit/qiskit-terra
qiskit/qasm/qasmlexer.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/qasm/qasmlexer.py#L52-L55
def input(self, data): """Set the input text data.""" self.data = data self.lexer.input(data)
[ "def", "input", "(", "self", ",", "data", ")", ":", "self", ".", "data", "=", "data", "self", ".", "lexer", ".", "input", "(", "data", ")" ]
Set the input text data.
[ "Set", "the", "input", "text", "data", "." ]
python
test
28.5
SystemRDL/systemrdl-compiler
systemrdl/core/backports.py
https://github.com/SystemRDL/systemrdl-compiler/blob/6ae64f2bb6ecbbe9db356e20e8ac94e85bdeed3a/systemrdl/core/backports.py#L9-L57
def subprocess_run(*popenargs, input=None, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes wil...
[ "def", "subprocess_run", "(", "*", "popenargs", ",", "input", "=", "None", ",", "timeout", "=", "None", ",", "check", "=", "False", ",", "*", "*", "kwargs", ")", ":", "#pylint: disable=redefined-builtin", "if", "input", "is", "not", "None", ":", "if", "'...
Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check i...
[ "Run", "command", "with", "arguments", "and", "return", "a", "CompletedProcess", "instance", "." ]
python
train
43.653061
tjcsl/ion
intranet/apps/events/views.py
https://github.com/tjcsl/ion/blob/5d722b0725d572039bb0929fd5715a4070c82c72/intranet/apps/events/views.py#L94-L119
def join_event_view(request, id): """Join event page. If a POST request, actually add or remove the attendance of the current user. Otherwise, display a page with confirmation. id: event id """ event = get_object_or_404(Event, id=id) if request.method == "POST": if not event.show_att...
[ "def", "join_event_view", "(", "request", ",", "id", ")", ":", "event", "=", "get_object_or_404", "(", "Event", ",", "id", "=", "id", ")", "if", "request", ".", "method", "==", "\"POST\"", ":", "if", "not", "event", ".", "show_attending", ":", "return", ...
Join event page. If a POST request, actually add or remove the attendance of the current user. Otherwise, display a page with confirmation. id: event id
[ "Join", "event", "page", ".", "If", "a", "POST", "request", "actually", "add", "or", "remove", "the", "attendance", "of", "the", "current", "user", ".", "Otherwise", "display", "a", "page", "with", "confirmation", "." ]
python
train
31.730769
LudovicRousseau/pyscard
smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py
https://github.com/LudovicRousseau/pyscard/blob/62e675028086c75656444cc21d563d9f08ebf8e7/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py#L95-L100
def OnSelectReader(self, reader): """Called when a reader is selected by clicking on the reader tree control or toolbar.""" SimpleSCardAppEventObserver.OnSelectReader(self, reader) self.feedbacktext.SetLabel('Selected reader: ' + repr(reader)) self.transmitbutton.Disable()
[ "def", "OnSelectReader", "(", "self", ",", "reader", ")", ":", "SimpleSCardAppEventObserver", ".", "OnSelectReader", "(", "self", ",", "reader", ")", "self", ".", "feedbacktext", ".", "SetLabel", "(", "'Selected reader: '", "+", "repr", "(", "reader", ")", ")"...
Called when a reader is selected by clicking on the reader tree control or toolbar.
[ "Called", "when", "a", "reader", "is", "selected", "by", "clicking", "on", "the", "reader", "tree", "control", "or", "toolbar", "." ]
python
train
51.333333
zomux/deepy
deepy/core/graph.py
https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/core/graph.py#L158-L194
def fill_parameters(self, path, blocks, exclude_free_params=False, check_parameters=False): """ Load parameters from file to fill all blocks sequentially. :type blocks: list of deepy.layers.Block """ if not os.path.exists(path): raise Exception("model {} does not exis...
[ "def", "fill_parameters", "(", "self", ",", "path", ",", "blocks", ",", "exclude_free_params", "=", "False", ",", "check_parameters", "=", "False", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "raise", "Exception", "(",...
Load parameters from file to fill all blocks sequentially. :type blocks: list of deepy.layers.Block
[ "Load", "parameters", "from", "file", "to", "fill", "all", "blocks", "sequentially", ".", ":", "type", "blocks", ":", "list", "of", "deepy", ".", "layers", ".", "Block" ]
python
test
54.972973
coghost/izen
izen/helper.py
https://github.com/coghost/izen/blob/432db017f99dd2ba809e1ba1792145ab6510263d/izen/helper.py#L729-L762
def crc16(cmd, use_byte=False): """ CRC16 检验 - 启用``use_byte`` 则返回 bytes 类型. :param cmd: 无crc检验的指令 :type cmd: :param use_byte: 是否返回byte类型 :type use_byte: :return: 返回crc值 :rtype: """ crc = 0xFFFF # crc16 计算方法, 需要使用 byte if hasattr(cmd, 'encode'): cmd =...
[ "def", "crc16", "(", "cmd", ",", "use_byte", "=", "False", ")", ":", "crc", "=", "0xFFFF", "# crc16 计算方法, 需要使用 byte", "if", "hasattr", "(", "cmd", ",", "'encode'", ")", ":", "cmd", "=", "bytes", ".", "fromhex", "(", "cmd", ")", "for", "_", "in", "cmd...
CRC16 检验 - 启用``use_byte`` 则返回 bytes 类型. :param cmd: 无crc检验的指令 :type cmd: :param use_byte: 是否返回byte类型 :type use_byte: :return: 返回crc值 :rtype:
[ "CRC16", "检验", "-", "启用", "use_byte", "则返回", "bytes", "类型", "." ]
python
train
20.647059
juju/theblues
theblues/charmstore.py
https://github.com/juju/theblues/blob/f4431f29e43d04fc32f38f4f86cea45cd4e6ae98/theblues/charmstore.py#L148-L159
def entities(self, entity_ids): '''Get the default data for entities. @param entity_ids A list of entity ids either as strings or references. ''' url = '%s/meta/any?include=id&' % self.url for entity_id in entity_ids: url += 'id=%s&' % _get_path(entity_id) # ...
[ "def", "entities", "(", "self", ",", "entity_ids", ")", ":", "url", "=", "'%s/meta/any?include=id&'", "%", "self", ".", "url", "for", "entity_id", "in", "entity_ids", ":", "url", "+=", "'id=%s&'", "%", "_get_path", "(", "entity_id", ")", "# Remove the trailing...
Get the default data for entities. @param entity_ids A list of entity ids either as strings or references.
[ "Get", "the", "default", "data", "for", "entities", "." ]
python
train
35.5
keon/algorithms
algorithms/linkedlist/remove_duplicates.py
https://github.com/keon/algorithms/blob/4d6569464a62a75c1357acc97e2dd32ee2f9f4a3/algorithms/linkedlist/remove_duplicates.py#L6-L19
def remove_dups(head): """ Time Complexity: O(N) Space Complexity: O(N) """ hashset = set() prev = Node() while head: if head.val in hashset: prev.next = head.next else: hashset.add(head.val) prev = head head = head.next
[ "def", "remove_dups", "(", "head", ")", ":", "hashset", "=", "set", "(", ")", "prev", "=", "Node", "(", ")", "while", "head", ":", "if", "head", ".", "val", "in", "hashset", ":", "prev", ".", "next", "=", "head", ".", "next", "else", ":", "hashse...
Time Complexity: O(N) Space Complexity: O(N)
[ "Time", "Complexity", ":", "O", "(", "N", ")", "Space", "Complexity", ":", "O", "(", "N", ")" ]
python
train
21.071429
kodexlab/reliure
reliure/engine.py
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/engine.py#L489-L531
def select(self, comp_name, options=None): """ Select the components that will by played (with given options). `options` will be passed to :func:`.Optionable.parse_options` if the component is a subclass of :class:`Optionable`. .. Warning:: this function also setup the options (if give...
[ "def", "select", "(", "self", ",", "comp_name", ",", "options", "=", "None", ")", ":", "self", ".", "_logger", ".", "info", "(", "\"select comp '%s' for block '%s' (options: %s)\"", "%", "(", "comp_name", ",", "self", ".", "_name", ",", "options", ")", ")", ...
Select the components that will by played (with given options). `options` will be passed to :func:`.Optionable.parse_options` if the component is a subclass of :class:`Optionable`. .. Warning:: this function also setup the options (if given) of the selected component. Use :func:`cl...
[ "Select", "the", "components", "that", "will", "by", "played", "(", "with", "given", "options", ")", "." ]
python
train
46.302326
synw/dataswim
dataswim/data/export.py
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/export.py#L41-L56
def to_javascript_(self, table_name: str="data") -> str: """Convert the main dataframe to javascript code :param table_name: javascript variable name, defaults to "data" :param table_name: str, optional :return: a javascript constant with the data :rtype: str :example: ...
[ "def", "to_javascript_", "(", "self", ",", "table_name", ":", "str", "=", "\"data\"", ")", "->", "str", ":", "try", ":", "renderer", "=", "pytablewriter", ".", "JavaScriptTableWriter", "data", "=", "self", ".", "_build_export", "(", "renderer", ",", "table_n...
Convert the main dataframe to javascript code :param table_name: javascript variable name, defaults to "data" :param table_name: str, optional :return: a javascript constant with the data :rtype: str :example: ``ds.to_javastript_("myconst")``
[ "Convert", "the", "main", "dataframe", "to", "javascript", "code" ]
python
train
37.6875
pkgw/pwkit
pwkit/io.py
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/io.py#L616-L642
def rmtree (self, errors='warn'): """Recursively delete this directory and its contents. The *errors* keyword specifies how errors are handled: "warn" (the default) Print a warning to standard error. "ignore" Ignore errors. """ import shutil ...
[ "def", "rmtree", "(", "self", ",", "errors", "=", "'warn'", ")", ":", "import", "shutil", "if", "errors", "==", "'ignore'", ":", "ignore_errors", "=", "True", "onerror", "=", "None", "elif", "errors", "==", "'warn'", ":", "ignore_errors", "=", "False", "...
Recursively delete this directory and its contents. The *errors* keyword specifies how errors are handled: "warn" (the default) Print a warning to standard error. "ignore" Ignore errors.
[ "Recursively", "delete", "this", "directory", "and", "its", "contents", ".", "The", "*", "errors", "*", "keyword", "specifies", "how", "errors", "are", "handled", ":" ]
python
train
31.37037
twisted/txacme
src/txacme/challenges/_libcloud.py
https://github.com/twisted/txacme/blob/9478381cc63c6d53d14bf8db8407c923f472989a/src/txacme/challenges/_libcloud.py#L27-L43
def _defer_to_worker(deliver, worker, work, *args, **kwargs): """ Run a task in a worker, delivering the result as a ``Deferred`` in the reactor thread. """ deferred = Deferred() def wrapped_work(): try: result = work(*args, **kwargs) except BaseException: ...
[ "def", "_defer_to_worker", "(", "deliver", ",", "worker", ",", "work", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "deferred", "=", "Deferred", "(", ")", "def", "wrapped_work", "(", ")", ":", "try", ":", "result", "=", "work", "(", "*", "a...
Run a task in a worker, delivering the result as a ``Deferred`` in the reactor thread.
[ "Run", "a", "task", "in", "a", "worker", "delivering", "the", "result", "as", "a", "Deferred", "in", "the", "reactor", "thread", "." ]
python
train
28.529412
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_aaa.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_aaa.py#L496-L508
def ldap_server_host_use_vrf(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ldap_server = ET.SubElement(config, "ldap-server", xmlns="urn:brocade.com:mgmt:brocade-aaa") host = ET.SubElement(ldap_server, "host") hostname_key = ET.SubElement(host,...
[ "def", "ldap_server_host_use_vrf", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "ldap_server", "=", "ET", ".", "SubElement", "(", "config", ",", "\"ldap-server\"", ",", "xmlns", "=", "\"urn:br...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
42.769231
awslabs/aws-sam-cli
samcli/commands/local/lib/swagger/integration_uri.py
https://github.com/awslabs/aws-sam-cli/blob/c05af5e7378c6f05f7d82ad3f0bca17204177db6/samcli/commands/local/lib/swagger/integration_uri.py#L253-L267
def _is_sub_intrinsic(data): """ Is this input data a Fn::Sub intrinsic function Parameters ---------- data Data to check Returns ------- bool True if the data Fn::Sub intrinsic function """ return isinstance(data,...
[ "def", "_is_sub_intrinsic", "(", "data", ")", ":", "return", "isinstance", "(", "data", ",", "dict", ")", "and", "len", "(", "data", ")", "==", "1", "and", "LambdaUri", ".", "_FN_SUB", "in", "data" ]
Is this input data a Fn::Sub intrinsic function Parameters ---------- data Data to check Returns ------- bool True if the data Fn::Sub intrinsic function
[ "Is", "this", "input", "data", "a", "Fn", "::", "Sub", "intrinsic", "function" ]
python
train
24.066667
kajala/django-jutil
jutil/command.py
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/command.py#L89-L123
def parse_date_range_arguments(options: dict, default_range='last_month') -> (datetime, datetime, list): """ :param options: :param default_range: Default datetime range to return if no other selected :return: begin, end, [(begin1,end1), (begin2,end2), ...] """ begin, end = get_date_range_by_nam...
[ "def", "parse_date_range_arguments", "(", "options", ":", "dict", ",", "default_range", "=", "'last_month'", ")", "->", "(", "datetime", ",", "datetime", ",", "list", ")", ":", "begin", ",", "end", "=", "get_date_range_by_name", "(", "default_range", ")", "for...
:param options: :param default_range: Default datetime range to return if no other selected :return: begin, end, [(begin1,end1), (begin2,end2), ...]
[ ":", "param", "options", ":", ":", "param", "default_range", ":", "Default", "datetime", "range", "to", "return", "if", "no", "other", "selected", ":", "return", ":", "begin", "end", "[", "(", "begin1", "end1", ")", "(", "begin2", "end2", ")", "...", "...
python
train
40.514286
aws/aws-dynamodb-encryption-python
src/dynamodb_encryption_sdk/internal/formatting/deserialize/__init__.py
https://github.com/aws/aws-dynamodb-encryption-python/blob/8de3bbe13df39c59b21bf431010f7acfcf629a2f/src/dynamodb_encryption_sdk/internal/formatting/deserialize/__init__.py#L51-L61
def decode_value(stream): """Decode the contents of a value from a serialized stream. :param stream: Source data stream :type stream: io.BytesIO :returns: Decoded value :rtype: bytes """ length = decode_length(stream) (value,) = unpack_value(">{:d}s".format(length), stream) return v...
[ "def", "decode_value", "(", "stream", ")", ":", "length", "=", "decode_length", "(", "stream", ")", "(", "value", ",", ")", "=", "unpack_value", "(", "\">{:d}s\"", ".", "format", "(", "length", ")", ",", "stream", ")", "return", "value" ]
Decode the contents of a value from a serialized stream. :param stream: Source data stream :type stream: io.BytesIO :returns: Decoded value :rtype: bytes
[ "Decode", "the", "contents", "of", "a", "value", "from", "a", "serialized", "stream", "." ]
python
train
28.545455
SheffieldML/GPy
GPy/core/gp.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/core/gp.py#L714-L721
def posterior_covariance_between_points(self, X1, X2): """ Computes the posterior covariance between points. :param X1: some input observations :param X2: other input observations """ return self.posterior.covariance_between_points(self.kern, self.X, X1, X2)
[ "def", "posterior_covariance_between_points", "(", "self", ",", "X1", ",", "X2", ")", ":", "return", "self", ".", "posterior", ".", "covariance_between_points", "(", "self", ".", "kern", ",", "self", ".", "X", ",", "X1", ",", "X2", ")" ]
Computes the posterior covariance between points. :param X1: some input observations :param X2: other input observations
[ "Computes", "the", "posterior", "covariance", "between", "points", "." ]
python
train
37.5
bitesofcode/projexui
projexui/widgets/xviewwidget/xviewpanel.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewpanel.py#L867-L880
def addView(self, viewType): """ Adds a new view of the inputed view type. :param viewType | <subclass of XView> :return <XView> || None """ if not viewType: return None view = viewType.createInstance(self, self.view...
[ "def", "addView", "(", "self", ",", "viewType", ")", ":", "if", "not", "viewType", ":", "return", "None", "view", "=", "viewType", ".", "createInstance", "(", "self", ",", "self", ".", "viewWidget", "(", ")", ")", "self", ".", "addTab", "(", "view", ...
Adds a new view of the inputed view type. :param viewType | <subclass of XView> :return <XView> || None
[ "Adds", "a", "new", "view", "of", "the", "inputed", "view", "type", ".", ":", "param", "viewType", "|", "<subclass", "of", "XView", ">", ":", "return", "<XView", ">", "||", "None" ]
python
train
27.285714
afilipovich/gglsbl
gglsbl/storage.py
https://github.com/afilipovich/gglsbl/blob/89c4665bd6487a3689ccb6b1f3e53ff85e056103/gglsbl/storage.py#L361-L371
def dump_hash_prefix_values(self): """Export all hash prefix values. Returns a list of known hash prefix values """ q = '''SELECT distinct value from hash_prefix''' output = [] with self.get_cursor() as dbc: dbc.execute(q) output = [bytes(r[0]) fo...
[ "def", "dump_hash_prefix_values", "(", "self", ")", ":", "q", "=", "'''SELECT distinct value from hash_prefix'''", "output", "=", "[", "]", "with", "self", ".", "get_cursor", "(", ")", "as", "dbc", ":", "dbc", ".", "execute", "(", "q", ")", "output", "=", ...
Export all hash prefix values. Returns a list of known hash prefix values
[ "Export", "all", "hash", "prefix", "values", "." ]
python
train
32.181818
insightindustry/validator-collection
validator_collection/checkers.py
https://github.com/insightindustry/validator-collection/blob/8c8047a0fa36cc88a021771279898278c4cc98e3/validator_collection/checkers.py#L1406-L1450
def is_domain(value, **kwargs): """Indicate whether ``value`` is a valid domain. .. caution:: This validator does not verify that ``value`` **exists** as a domain. It merely verifies that its contents *might* exist as a domain. .. note:: This validator checks to validate that ``value``...
[ "def", "is_domain", "(", "value", ",", "*", "*", "kwargs", ")", ":", "try", ":", "value", "=", "validators", ".", "domain", "(", "value", ",", "*", "*", "kwargs", ")", "except", "SyntaxError", "as", "error", ":", "raise", "error", "except", "Exception"...
Indicate whether ``value`` is a valid domain. .. caution:: This validator does not verify that ``value`` **exists** as a domain. It merely verifies that its contents *might* exist as a domain. .. note:: This validator checks to validate that ``value`` resembles a valid domain name. I...
[ "Indicate", "whether", "value", "is", "a", "valid", "domain", "." ]
python
train
36.088889
Nukesor/pueue
pueue/daemon/daemon.py
https://github.com/Nukesor/pueue/blob/f1d276360454d4dd2738658a13df1e20caa4b926/pueue/daemon/daemon.py#L308-L317
def pipe_to_process(self, payload): """Send something to stdin of a specific process.""" message = payload['input'] key = payload['key'] if not self.process_handler.is_running(key): return {'message': 'No running process for this key', 'status': 'error'} ...
[ "def", "pipe_to_process", "(", "self", ",", "payload", ")", ":", "message", "=", "payload", "[", "'input'", "]", "key", "=", "payload", "[", "'key'", "]", "if", "not", "self", ".", "process_handler", ".", "is_running", "(", "key", ")", ":", "return", "...
Send something to stdin of a specific process.
[ "Send", "something", "to", "stdin", "of", "a", "specific", "process", "." ]
python
train
44.8
ns1/ns1-python
ns1/zones.py
https://github.com/ns1/ns1-python/blob/f3e1d90a3b76a1bd18f855f2c622a8a49d4b585e/ns1/zones.py#L67-L74
def search(self, q=None, has_geo=False, callback=None, errback=None): """ Search within a zone for specific metadata. Zone must already be loaded. """ if not self.data: raise ZoneException('zone not loaded') return self._rest.search(self.zone, q, has_geo, callback, e...
[ "def", "search", "(", "self", ",", "q", "=", "None", ",", "has_geo", "=", "False", ",", "callback", "=", "None", ",", "errback", "=", "None", ")", ":", "if", "not", "self", ".", "data", ":", "raise", "ZoneException", "(", "'zone not loaded'", ")", "r...
Search within a zone for specific metadata. Zone must already be loaded.
[ "Search", "within", "a", "zone", "for", "specific", "metadata", ".", "Zone", "must", "already", "be", "loaded", "." ]
python
train
40
gboeing/osmnx
osmnx/plot.py
https://github.com/gboeing/osmnx/blob/be59fd313bcb68af8fc79242c56194f1247e26e2/osmnx/plot.py#L763-L809
def make_folium_polyline(edge, edge_color, edge_width, edge_opacity, popup_attribute=None): """ Turn a row from the gdf_edges GeoDataFrame into a folium PolyLine with attributes. Parameters ---------- edge : GeoSeries a row from the gdf_edges GeoDataFrame edge_color : string ...
[ "def", "make_folium_polyline", "(", "edge", ",", "edge_color", ",", "edge_width", ",", "edge_opacity", ",", "popup_attribute", "=", "None", ")", ":", "# check if we were able to import folium successfully", "if", "not", "folium", ":", "raise", "ImportError", "(", "'Th...
Turn a row from the gdf_edges GeoDataFrame into a folium PolyLine with attributes. Parameters ---------- edge : GeoSeries a row from the gdf_edges GeoDataFrame edge_color : string color of the edge lines edge_width : numeric width of the edge lines edge_opacity : num...
[ "Turn", "a", "row", "from", "the", "gdf_edges", "GeoDataFrame", "into", "a", "folium", "PolyLine", "with", "attributes", "." ]
python
train
33.234043
SeattleTestbed/seash
seash_helper.py
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/seash_helper.py#L909-L1044
def print_vessel_errors(retdict): """ <Purpose> Prints out any errors that occurred while performing an action on vessels, in a human readable way. Errors will be printed out in the following format: description [reason] Affected vessels: nodelist To define a new error, add the following e...
[ "def", "print_vessel_errors", "(", "retdict", ")", ":", "ERROR_RESPONSES", "=", "{", "\"Node Manager error 'Insufficient Permissions'\"", ":", "{", "'error'", ":", "\"You lack sufficient permissions to perform this action.\"", ",", "'reason'", ":", "\"Did you release the resource...
<Purpose> Prints out any errors that occurred while performing an action on vessels, in a human readable way. Errors will be printed out in the following format: description [reason] Affected vessels: nodelist To define a new error, add the following entry to ERROR_RESPONSES in this functi...
[ "<Purpose", ">", "Prints", "out", "any", "errors", "that", "occurred", "while", "performing", "an", "action", "on", "vessels", "in", "a", "human", "readable", "way", "." ]
python
train
35.838235
gem/oq-engine
openquake/hazardlib/gsim/nga_east.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/nga_east.py#L683-L700
def _get_tau_vector(self, tau_mean, tau_std, imt_list): """ Gets the vector of mean and variance of tau values corresponding to the specific model and returns them as dictionaries """ self.magnitude_limits = MAG_LIMS_KEYS[self.tau_model]["mag"] self.tau_keys = MAG_LIMS_KE...
[ "def", "_get_tau_vector", "(", "self", ",", "tau_mean", ",", "tau_std", ",", "imt_list", ")", ":", "self", ".", "magnitude_limits", "=", "MAG_LIMS_KEYS", "[", "self", ".", "tau_model", "]", "[", "\"mag\"", "]", "self", ".", "tau_keys", "=", "MAG_LIMS_KEYS", ...
Gets the vector of mean and variance of tau values corresponding to the specific model and returns them as dictionaries
[ "Gets", "the", "vector", "of", "mean", "and", "variance", "of", "tau", "values", "corresponding", "to", "the", "specific", "model", "and", "returns", "them", "as", "dictionaries" ]
python
train
42.333333
MacHu-GWU/windtalker-project
windtalker/files.py
https://github.com/MacHu-GWU/windtalker-project/blob/1dcff7c3692d5883cf1b55d1ea745723cfc6c3ce/windtalker/files.py#L45-L79
def transform(src, dst, converter, overwrite=False, stream=True, chunksize=1024**2, **kwargs): """ A file stream transform IO utility function. :param src: original file path :param dst: destination file path :param converter: binary content converter function :param overwrite: de...
[ "def", "transform", "(", "src", ",", "dst", ",", "converter", ",", "overwrite", "=", "False", ",", "stream", "=", "True", ",", "chunksize", "=", "1024", "**", "2", ",", "*", "*", "kwargs", ")", ":", "if", "not", "overwrite", ":", "# pragma: no cover", ...
A file stream transform IO utility function. :param src: original file path :param dst: destination file path :param converter: binary content converter function :param overwrite: default False, :param stream: default True, if True, use stream IO mode, chunksize has to be specified. :para...
[ "A", "file", "stream", "transform", "IO", "utility", "function", "." ]
python
train
36.742857
mojaie/chorus
chorus/molutil.py
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/molutil.py#L25-L34
def assign_descriptors(mol): """ Throws: RuntimeError: if minify_ring failed """ topology.recognize(mol) descriptor.assign_valence(mol) descriptor.assign_rotatable(mol) topology.minify_ring(mol) descriptor.assign_aromatic(mol)
[ "def", "assign_descriptors", "(", "mol", ")", ":", "topology", ".", "recognize", "(", "mol", ")", "descriptor", ".", "assign_valence", "(", "mol", ")", "descriptor", ".", "assign_rotatable", "(", "mol", ")", "topology", ".", "minify_ring", "(", "mol", ")", ...
Throws: RuntimeError: if minify_ring failed
[ "Throws", ":", "RuntimeError", ":", "if", "minify_ring", "failed" ]
python
train
25.7
hazelcast/hazelcast-python-client
hazelcast/cluster.py
https://github.com/hazelcast/hazelcast-python-client/blob/3f6639443c23d6d036aa343f8e094f052250d2c1/hazelcast/cluster.py#L277-L289
def get_members(self, selector): """ Returns the members that satisfy the given selector. :param selector: (:class:`~hazelcast.core.MemberSelector`), Selector to be applied to the members. :return: (List), List of members. """ members = [] for member in self.get_...
[ "def", "get_members", "(", "self", ",", "selector", ")", ":", "members", "=", "[", "]", "for", "member", "in", "self", ".", "get_member_list", "(", ")", ":", "if", "selector", ".", "select", "(", "member", ")", ":", "members", ".", "append", "(", "me...
Returns the members that satisfy the given selector. :param selector: (:class:`~hazelcast.core.MemberSelector`), Selector to be applied to the members. :return: (List), List of members.
[ "Returns", "the", "members", "that", "satisfy", "the", "given", "selector", "." ]
python
train
32.692308
ontio/ontology-python-sdk
ontology/account/account.py
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/account/account.py#L229-L245
def get_private_key_from_wif(wif: str) -> bytes: """ This interface is used to decode a WIF encode ECDSA private key. :param wif: a WIF encode private key. :return: a ECDSA private key in the form of bytes. """ if wif is None or wif is "": raise Exception("no...
[ "def", "get_private_key_from_wif", "(", "wif", ":", "str", ")", "->", "bytes", ":", "if", "wif", "is", "None", "or", "wif", "is", "\"\"", ":", "raise", "Exception", "(", "\"none wif\"", ")", "data", "=", "base58", ".", "b58decode", "(", "wif", ")", "if...
This interface is used to decode a WIF encode ECDSA private key. :param wif: a WIF encode private key. :return: a ECDSA private key in the form of bytes.
[ "This", "interface", "is", "used", "to", "decode", "a", "WIF", "encode", "ECDSA", "private", "key", "." ]
python
train
38.588235
bcbio/bcbio-nextgen
bcbio/variation/germline.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/germline.py#L91-L123
def filter_to_pass_and_reject(in_file, paired, out_dir=None): """Filter VCF to only those with a strict PASS/REJECT: somatic + germline. Removes low quality calls filtered but also labeled with REJECT. """ from bcbio.heterogeneity import bubbletree out_file = "%s-prfilter.vcf.gz" % utils.splitext_p...
[ "def", "filter_to_pass_and_reject", "(", "in_file", ",", "paired", ",", "out_dir", "=", "None", ")", ":", "from", "bcbio", ".", "heterogeneity", "import", "bubbletree", "out_file", "=", "\"%s-prfilter.vcf.gz\"", "%", "utils", ".", "splitext_plus", "(", "in_file", ...
Filter VCF to only those with a strict PASS/REJECT: somatic + germline. Removes low quality calls filtered but also labeled with REJECT.
[ "Filter", "VCF", "to", "only", "those", "with", "a", "strict", "PASS", "/", "REJECT", ":", "somatic", "+", "germline", "." ]
python
train
61.969697
idlesign/django-sitetree
sitetree/templatetags/sitetree.py
https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/templatetags/sitetree.py#L12-L35
def sitetree_tree(parser, token): """Parses sitetree tag parameters. Two notation types are possible: 1. Two arguments: {% sitetree_tree from "mytree" %} Used to render tree for "mytree" site tree. 2. Four arguments: {% sitetree_tree from "mytree" template "sit...
[ "def", "sitetree_tree", "(", "parser", ",", "token", ")", ":", "tokens", "=", "token", ".", "split_contents", "(", ")", "use_template", "=", "detect_clause", "(", "parser", ",", "'template'", ",", "tokens", ")", "tokens_num", "=", "len", "(", "tokens", ")"...
Parses sitetree tag parameters. Two notation types are possible: 1. Two arguments: {% sitetree_tree from "mytree" %} Used to render tree for "mytree" site tree. 2. Four arguments: {% sitetree_tree from "mytree" template "sitetree/mytree.html" %} Used to ...
[ "Parses", "sitetree", "tag", "parameters", "." ]
python
test
35.916667
secdev/scapy
scapy/layers/tls/session.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/session.py#L699-L710
def compute_tls13_resumption_secret(self): """ self.handshake_messages should be ClientHello...ClientFinished. """ if self.connection_end == "server": hkdf = self.prcs.hkdf elif self.connection_end == "client": hkdf = self.pwcs.hkdf rs = hkdf.deriv...
[ "def", "compute_tls13_resumption_secret", "(", "self", ")", ":", "if", "self", ".", "connection_end", "==", "\"server\"", ":", "hkdf", "=", "self", ".", "prcs", ".", "hkdf", "elif", "self", ".", "connection_end", "==", "\"client\"", ":", "hkdf", "=", "self",...
self.handshake_messages should be ClientHello...ClientFinished.
[ "self", ".", "handshake_messages", "should", "be", "ClientHello", "...", "ClientFinished", "." ]
python
train
44.333333
inveniosoftware-attic/invenio-upgrader
invenio_upgrader/ext.py
https://github.com/inveniosoftware-attic/invenio-upgrader/blob/cee4bcb118515463ecf6de1421642007f79a9fcd/invenio_upgrader/ext.py#L40-L43
def init_app(self, app): """Flask application initialization.""" app.cli.add_command(upgrader_cmd) app.extensions['invenio-upgrader'] = self
[ "def", "init_app", "(", "self", ",", "app", ")", ":", "app", ".", "cli", ".", "add_command", "(", "upgrader_cmd", ")", "app", ".", "extensions", "[", "'invenio-upgrader'", "]", "=", "self" ]
Flask application initialization.
[ "Flask", "application", "initialization", "." ]
python
train
40.25
Azure/azure-cli-extensions
src/express-route/azext_express_route/vendored_sdks/network_management_client.py
https://github.com/Azure/azure-cli-extensions/blob/3d4854205b0f0d882f688cfa12383d14506c2e35/src/express-route/azext_express_route/vendored_sdks/network_management_client.py#L772-L782
def express_route_connections(self): """Instance depends on the API version: * 2018-08-01: :class:`ExpressRouteConnectionsOperations<azure.mgmt.network.v2018_08_01.operations.ExpressRouteConnectionsOperations>` """ api_version = self._get_api_version('express_route_connections') ...
[ "def", "express_route_connections", "(", "self", ")", ":", "api_version", "=", "self", ".", "_get_api_version", "(", "'express_route_connections'", ")", "if", "api_version", "==", "'2018-08-01'", ":", "from", ".", "v2018_08_01", ".", "operations", "import", "Express...
Instance depends on the API version: * 2018-08-01: :class:`ExpressRouteConnectionsOperations<azure.mgmt.network.v2018_08_01.operations.ExpressRouteConnectionsOperations>`
[ "Instance", "depends", "on", "the", "API", "version", ":" ]
python
train
63.454545
AnthonyBloomer/daftlistings
daftlistings/listing.py
https://github.com/AnthonyBloomer/daftlistings/blob/f6c1b52425bc740f443b5efe6632a4bf18ee997f/daftlistings/listing.py#L121-L140
def upcoming_viewings(self): """ Returns an array of upcoming viewings for a property. :return: """ upcoming_viewings = [] try: if self._data_from_search: viewings = self._data_from_search.find_all( 'div', {'class': 'smi-onv...
[ "def", "upcoming_viewings", "(", "self", ")", ":", "upcoming_viewings", "=", "[", "]", "try", ":", "if", "self", ".", "_data_from_search", ":", "viewings", "=", "self", ".", "_data_from_search", ".", "find_all", "(", "'div'", ",", "{", "'class'", ":", "'sm...
Returns an array of upcoming viewings for a property. :return:
[ "Returns", "an", "array", "of", "upcoming", "viewings", "for", "a", "property", ".", ":", "return", ":" ]
python
train
33.9
CZ-NIC/yangson
yangson/__main__.py
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/__main__.py#L34-L165
def main(ylib: str = None, path: str = None, scope: ValidationScope = ValidationScope.all, ctype: ContentType = ContentType.config, set_id: bool = False, tree: bool = False, no_types: bool = False, digest: bool = False, validate: str = None) -> int: """Entry-point for a validatio...
[ "def", "main", "(", "ylib", ":", "str", "=", "None", ",", "path", ":", "str", "=", "None", ",", "scope", ":", "ValidationScope", "=", "ValidationScope", ".", "all", ",", "ctype", ":", "ContentType", "=", "ContentType", ".", "config", ",", "set_id", ":"...
Entry-point for a validation script. Args: ylib: Name of the file with YANG library path: Colon-separated list of directories to search for YANG modules. scope: Validation scope (syntax, semantics or all). ctype: Content type of the data instance (config, nonconfig or all) ...
[ "Entry", "-", "point", "for", "a", "validation", "script", "." ]
python
train
38.674242
spyder-ide/conda-manager
conda_manager/api/download_api.py
https://github.com/spyder-ide/conda-manager/blob/89a2126cbecefc92185cf979347ccac1c5ee5d9d/conda_manager/api/download_api.py#L124-L161
def queryProxy(self, query): """Override Qt method.""" # Query is a QNetworkProxyQuery valid_proxies = [] query_scheme = query.url().scheme() query_host = query.url().host() query_scheme_host = '{0}://{1}'.format(query_scheme, query_host) proxy_servers = process_...
[ "def", "queryProxy", "(", "self", ",", "query", ")", ":", "# Query is a QNetworkProxyQuery", "valid_proxies", "=", "[", "]", "query_scheme", "=", "query", ".", "url", "(", ")", ".", "scheme", "(", ")", "query_host", "=", "query", ".", "url", "(", ")", "....
Override Qt method.
[ "Override", "Qt", "method", "." ]
python
train
37.236842
ambitioninc/rabbitmq-admin
rabbitmq_admin/api.py
https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/api.py#L140-L149
def get_channel(self, name): """ Details about an individual channel. :param name: The channel name :type name: str """ return self._api_get('/api/channels/{0}'.format( urllib.parse.quote_plus(name) ))
[ "def", "get_channel", "(", "self", ",", "name", ")", ":", "return", "self", ".", "_api_get", "(", "'/api/channels/{0}'", ".", "format", "(", "urllib", ".", "parse", ".", "quote_plus", "(", "name", ")", ")", ")" ]
Details about an individual channel. :param name: The channel name :type name: str
[ "Details", "about", "an", "individual", "channel", "." ]
python
train
26.1
rwl/pylon
pylon/dyn.py
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/dyn.py#L132-L198
def generatorInit(self, U0): """ Based on GeneratorInit.m from MatDyn by Stijn Cole, developed at Katholieke Universiteit Leuven. See U{http://www.esat.kuleuven.be/ electa/teaching/matdyn/} for more information. @rtype: tuple @return: Initial generator conditions. """ ...
[ "def", "generatorInit", "(", "self", ",", "U0", ")", ":", "j", "=", "0", "+", "1j", "generators", "=", "self", ".", "dyn_generators", "Efd0", "=", "zeros", "(", "len", "(", "generators", ")", ")", "Xgen0", "=", "zeros", "(", "(", "len", "(", "gener...
Based on GeneratorInit.m from MatDyn by Stijn Cole, developed at Katholieke Universiteit Leuven. See U{http://www.esat.kuleuven.be/ electa/teaching/matdyn/} for more information. @rtype: tuple @return: Initial generator conditions.
[ "Based", "on", "GeneratorInit", ".", "m", "from", "MatDyn", "by", "Stijn", "Cole", "developed", "at", "Katholieke", "Universiteit", "Leuven", ".", "See", "U", "{", "http", ":", "//", "www", ".", "esat", ".", "kuleuven", ".", "be", "/", "electa", "/", "...
python
train
30.865672
boriel/zxbasic
arch/zx48k/backend/__array.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__array.py#L127-L136
def _aloadstr(ins): ''' Loads a string value from a memory address. ''' output = _addr(ins.quad[2]) output.append('call __ILOADSTR') output.append('push hl') REQUIRES.add('loadstr.asm') return output
[ "def", "_aloadstr", "(", "ins", ")", ":", "output", "=", "_addr", "(", "ins", ".", "quad", "[", "2", "]", ")", "output", ".", "append", "(", "'call __ILOADSTR'", ")", "output", ".", "append", "(", "'push hl'", ")", "REQUIRES", ".", "add", "(", "'load...
Loads a string value from a memory address.
[ "Loads", "a", "string", "value", "from", "a", "memory", "address", "." ]
python
train
22
nerdvegas/rez
src/rez/solver.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/solver.py#L1039-L1057
def extract(self): """Extract a common dependency. Returns: A (_PackageScope, Requirement) tuple, containing the new scope copy with the extraction, and the extracted package range. If no package was extracted, then (self,None) is returned. """ if not...
[ "def", "extract", "(", "self", ")", ":", "if", "not", "self", ".", "package_request", ".", "conflict", ":", "new_slice", ",", "package_request", "=", "self", ".", "variant_slice", ".", "extract", "(", ")", "if", "package_request", ":", "assert", "(", "new_...
Extract a common dependency. Returns: A (_PackageScope, Requirement) tuple, containing the new scope copy with the extraction, and the extracted package range. If no package was extracted, then (self,None) is returned.
[ "Extract", "a", "common", "dependency", "." ]
python
train
40.157895
CivicSpleen/ambry
ambry/valuetype/geo.py
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/valuetype/geo.py#L115-L118
def dotted(self): """Return just the tract number, excluding the state and county, in the dotted format""" v = str(self.geoid.tract).zfill(6) return v[0:4] + '.' + v[4:]
[ "def", "dotted", "(", "self", ")", ":", "v", "=", "str", "(", "self", ".", "geoid", ".", "tract", ")", ".", "zfill", "(", "6", ")", "return", "v", "[", "0", ":", "4", "]", "+", "'.'", "+", "v", "[", "4", ":", "]" ]
Return just the tract number, excluding the state and county, in the dotted format
[ "Return", "just", "the", "tract", "number", "excluding", "the", "state", "and", "county", "in", "the", "dotted", "format" ]
python
train
47.5