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
tanghaibao/jcvi
jcvi/formats/vcf.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/formats/vcf.py#L199-L233
def sample(args): """ %prog sample vcffile 0.9 Sample subset of vcf file. """ from random import random p = OptionParser(sample.__doc__) opts, args = p.parse_args(args) if len(args) != 2: sys.exit(not p.print_help()) vcffile, ratio = args ratio = float(ratio) fp =...
[ "def", "sample", "(", "args", ")", ":", "from", "random", "import", "random", "p", "=", "OptionParser", "(", "sample", ".", "__doc__", ")", "opts", ",", "args", "=", "p", ".", "parse_args", "(", "args", ")", "if", "len", "(", "args", ")", "!=", "2"...
%prog sample vcffile 0.9 Sample subset of vcf file.
[ "%prog", "sample", "vcffile", "0", ".", "9" ]
python
train
25.971429
bovee/Aston
aston/peak/integrators.py
https://github.com/bovee/Aston/blob/007630fdf074690373d03398fe818260d3d3cf5a/aston/peak/integrators.py#L223-L233
def _integrate_mpwrap(ts_and_pks, integrate, fopts): """ Take a zipped timeseries and peaks found in it and integrate it to return peaks. Used to allow multiprocessing support. """ ts, tpks = ts_and_pks pks = integrate(ts, tpks, **fopts) # for p in pks: # p.info['mz'] = str(ts.na...
[ "def", "_integrate_mpwrap", "(", "ts_and_pks", ",", "integrate", ",", "fopts", ")", ":", "ts", ",", "tpks", "=", "ts_and_pks", "pks", "=", "integrate", "(", "ts", ",", "tpks", ",", "*", "*", "fopts", ")", "# for p in pks:", "# p.info['mz'] = str(ts.name)",...
Take a zipped timeseries and peaks found in it and integrate it to return peaks. Used to allow multiprocessing support.
[ "Take", "a", "zipped", "timeseries", "and", "peaks", "found", "in", "it", "and", "integrate", "it", "to", "return", "peaks", ".", "Used", "to", "allow", "multiprocessing", "support", "." ]
python
train
29.818182
coleifer/walrus
walrus/database.py
https://github.com/coleifer/walrus/blob/82bf15a6613487b5b5fefeb488f186d7e0106547/walrus/database.py#L190-L199
def get_key(self, key): """ Return a rich object for the given key. For instance, if a hash key is requested, then a :py:class:`Hash` will be returned. :param str key: Key to retrieve. :returns: A hash, set, list, zset or array. """ return self.__mapping....
[ "def", "get_key", "(", "self", ",", "key", ")", ":", "return", "self", ".", "__mapping", ".", "get", "(", "self", ".", "type", "(", "key", ")", ",", "self", ".", "__getitem__", ")", "(", "key", ")" ]
Return a rich object for the given key. For instance, if a hash key is requested, then a :py:class:`Hash` will be returned. :param str key: Key to retrieve. :returns: A hash, set, list, zset or array.
[ "Return", "a", "rich", "object", "for", "the", "given", "key", ".", "For", "instance", "if", "a", "hash", "key", "is", "requested", "then", "a", ":", "py", ":", "class", ":", "Hash", "will", "be", "returned", "." ]
python
train
35.3
EUDAT-B2SAFE/B2HANDLE
b2handle/handlesystemconnector.py
https://github.com/EUDAT-B2SAFE/B2HANDLE/blob/a6d216d459644e01fbdfd5b318a535950bc5cdbb/b2handle/handlesystemconnector.py#L252-L292
def send_handle_get_request(self, handle, indices=None): ''' Send a HTTP GET request to the handle server to read either an entire handle or to some specified values from a handle record, using the requests module. :param handle: The handle. :param indices: Optio...
[ "def", "send_handle_get_request", "(", "self", ",", "handle", ",", "indices", "=", "None", ")", ":", "# Assemble required info:", "url", "=", "self", ".", "make_handle_URL", "(", "handle", ",", "indices", ")", "LOGGER", ".", "debug", "(", "'GET Request to '", ...
Send a HTTP GET request to the handle server to read either an entire handle or to some specified values from a handle record, using the requests module. :param handle: The handle. :param indices: Optional. A list of indices to delete. Defaults to None (i.e. the enti...
[ "Send", "a", "HTTP", "GET", "request", "to", "the", "handle", "server", "to", "read", "either", "an", "entire", "handle", "or", "to", "some", "specified", "values", "from", "a", "handle", "record", "using", "the", "requests", "module", "." ]
python
train
36.219512
rackerlabs/simpl
simpl/config.py
https://github.com/rackerlabs/simpl/blob/60ed3336a931cd6a7a7246e60f26165d9dc7c99c/simpl/config.py#L378-L382
def init(cls, *args, **kwargs): """Initialize the config like as you would a regular dict.""" instance = cls() instance._values.update(dict(*args, **kwargs)) return instance
[ "def", "init", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "instance", "=", "cls", "(", ")", "instance", ".", "_values", ".", "update", "(", "dict", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")", "return", "instance" ]
Initialize the config like as you would a regular dict.
[ "Initialize", "the", "config", "like", "as", "you", "would", "a", "regular", "dict", "." ]
python
train
40.2
chrisspen/burlap
burlap/deb.py
https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/deb.py#L45-L56
def is_installed(pkg_name): """ Check if a package is installed. """ with settings(hide('running', 'stdout', 'stderr', 'warnings'), warn_only=True): res = run("dpkg -s %(pkg_name)s" % locals()) for line in res.splitlines(): if line.startswith("Status: "): stat...
[ "def", "is_installed", "(", "pkg_name", ")", ":", "with", "settings", "(", "hide", "(", "'running'", ",", "'stdout'", ",", "'stderr'", ",", "'warnings'", ")", ",", "warn_only", "=", "True", ")", ":", "res", "=", "run", "(", "\"dpkg -s %(pkg_name)s\"", "%",...
Check if a package is installed.
[ "Check", "if", "a", "package", "is", "installed", "." ]
python
valid
35.666667
taskcluster/taskcluster-client.py
taskcluster/aio/ec2manager.py
https://github.com/taskcluster/taskcluster-client.py/blob/bcc95217f8bf80bed2ae5885a19fa0035da7ebc9/taskcluster/aio/ec2manager.py#L149-L158
async def terminateInstance(self, *args, **kwargs): """ Terminate an instance Terminate an instance in a specified region This method is ``experimental`` """ return await self._makeApiCall(self.funcinfo["terminateInstance"], *args, **kwargs)
[ "async", "def", "terminateInstance", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "await", "self", ".", "_makeApiCall", "(", "self", ".", "funcinfo", "[", "\"terminateInstance\"", "]", ",", "*", "args", ",", "*", "*", "kw...
Terminate an instance Terminate an instance in a specified region This method is ``experimental``
[ "Terminate", "an", "instance" ]
python
train
28.3
bpython/curtsies
curtsies/input.py
https://github.com/bpython/curtsies/blob/223e42b97fbf6c86b479ed4f0963a067333c5a63/curtsies/input.py#L267-L274
def event_trigger(self, event_type): """Returns a callback that creates events. Returned callback function will add an event of type event_type to a queue which will be checked the next time an event is requested.""" def callback(**kwargs): self.queued_events.append(event_ty...
[ "def", "event_trigger", "(", "self", ",", "event_type", ")", ":", "def", "callback", "(", "*", "*", "kwargs", ")", ":", "self", ".", "queued_events", ".", "append", "(", "event_type", "(", "*", "*", "kwargs", ")", ")", "return", "callback" ]
Returns a callback that creates events. Returned callback function will add an event of type event_type to a queue which will be checked the next time an event is requested.
[ "Returns", "a", "callback", "that", "creates", "events", "." ]
python
train
43.75
amaas-fintech/amaas-core-sdk-python
amaascore/transactions/interface.py
https://github.com/amaas-fintech/amaas-core-sdk-python/blob/347b71f8e776b2dde582b015e31b4802d91e8040/amaascore/transactions/interface.py#L763-L780
def clear(self, asset_manager_id, book_ids=None): """ This method deletes all the data for an asset_manager_id and option book_ids. It should be used with extreme caution. In production it is almost always better to Inactivate rather than delete. """ self.logger.info...
[ "def", "clear", "(", "self", ",", "asset_manager_id", ",", "book_ids", "=", "None", ")", ":", "self", ".", "logger", ".", "info", "(", "'Clear Transactions & Positions - Asset Manager: %s'", ",", "asset_manager_id", ")", "url", "=", "'%s/clear/%s'", "%", "(", "s...
This method deletes all the data for an asset_manager_id and option book_ids. It should be used with extreme caution. In production it is almost always better to Inactivate rather than delete.
[ "This", "method", "deletes", "all", "the", "data", "for", "an", "asset_manager_id", "and", "option", "book_ids", ".", "It", "should", "be", "used", "with", "extreme", "caution", ".", "In", "production", "it", "is", "almost", "always", "better", "to", "Inacti...
python
train
56.611111
persephone-tools/persephone
persephone/results.py
https://github.com/persephone-tools/persephone/blob/f94c63e4d5fe719fb1deba449b177bb299d225fb/persephone/results.py#L57-L96
def fmt_latex_output(hyps: Sequence[Sequence[str]], refs: Sequence[Sequence[str]], prefixes: Sequence[str], out_fn: Path, ) -> None: """ Output the hypotheses and references to a LaTeX source file for pretty printing. """ ...
[ "def", "fmt_latex_output", "(", "hyps", ":", "Sequence", "[", "Sequence", "[", "str", "]", "]", ",", "refs", ":", "Sequence", "[", "Sequence", "[", "str", "]", "]", ",", "prefixes", ":", "Sequence", "[", "str", "]", ",", "out_fn", ":", "Path", ",", ...
Output the hypotheses and references to a LaTeX source file for pretty printing.
[ "Output", "the", "hypotheses", "and", "references", "to", "a", "LaTeX", "source", "file", "for", "pretty", "printing", "." ]
python
train
40.95
bird-house/twitcher
twitcher/store/mongodb.py
https://github.com/bird-house/twitcher/blob/e6a36b3aeeacf44eec537434b0fb87c09ab54b5f/twitcher/store/mongodb.py#L102-L109
def fetch_by_url(self, url): """ Gets service for given ``url`` from mongodb storage. """ service = self.collection.find_one({'url': url}) if not service: raise ServiceNotFound return Service(service)
[ "def", "fetch_by_url", "(", "self", ",", "url", ")", ":", "service", "=", "self", ".", "collection", ".", "find_one", "(", "{", "'url'", ":", "url", "}", ")", "if", "not", "service", ":", "raise", "ServiceNotFound", "return", "Service", "(", "service", ...
Gets service for given ``url`` from mongodb storage.
[ "Gets", "service", "for", "given", "url", "from", "mongodb", "storage", "." ]
python
valid
31.625
gem/oq-engine
openquake/hmtk/faults/mfd/anderson_luco_area_mmax.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hmtk/faults/mfd/anderson_luco_area_mmax.py#L155-L175
def cumulative_value(self, slip, mmax, mag_value, bbar, dbar, beta): ''' Returns the rate of events with M > mag_value :param float slip: Slip rate in mm/yr :param float mmax: Maximum magnitude :param float mag_value: Magnitude value :...
[ "def", "cumulative_value", "(", "self", ",", "slip", ",", "mmax", ",", "mag_value", ",", "bbar", ",", "dbar", ",", "beta", ")", ":", "delta_m", "=", "mmax", "-", "mag_value", "a_3", "=", "self", ".", "_get_a3_value", "(", "bbar", ",", "dbar", ",", "s...
Returns the rate of events with M > mag_value :param float slip: Slip rate in mm/yr :param float mmax: Maximum magnitude :param float mag_value: Magnitude value :param float bbar: \bar{b} parameter (effectively = b * log(10.)) :par...
[ "Returns", "the", "rate", "of", "events", "with", "M", ">", "mag_value" ]
python
train
37
skyfielders/python-skyfield
skyfield/precessionlib.py
https://github.com/skyfielders/python-skyfield/blob/51d9e042e06457f6b1f2415296d50a38cb3a300f/skyfield/precessionlib.py#L5-L69
def compute_precession(jd_tdb): """Return the rotation matrices for precessing to an array of epochs. `jd_tdb` - array of TDB Julian dates The array returned has the shape `(3, 3, n)` where `n` is the number of dates that have been provided as input. """ eps0 = 84381.406 # 't' is time in...
[ "def", "compute_precession", "(", "jd_tdb", ")", ":", "eps0", "=", "84381.406", "# 't' is time in TDB centuries.", "t", "=", "(", "jd_tdb", "-", "T0", ")", "/", "36525.0", "# Numerical coefficients of psi_a, omega_a, and chi_a, along with", "# epsilon_0, the obliquity at J200...
Return the rotation matrices for precessing to an array of epochs. `jd_tdb` - array of TDB Julian dates The array returned has the shape `(3, 3, n)` where `n` is the number of dates that have been provided as input.
[ "Return", "the", "rotation", "matrices", "for", "precessing", "to", "an", "array", "of", "epochs", "." ]
python
train
30.892308
CalebBell/thermo
thermo/chemical.py
https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/chemical.py#L1799-L1816
def rhol(self): r'''Liquid-phase mass density of the chemical at its current temperature and pressure, in units of [kg/m^3]. For calculation of this property at other temperatures and pressures, or specifying manually the method used to calculate it, and more - see the object oriented ...
[ "def", "rhol", "(", "self", ")", ":", "Vml", "=", "self", ".", "Vml", "if", "Vml", ":", "return", "Vm_to_rho", "(", "Vml", ",", "self", ".", "MW", ")", "return", "None" ]
r'''Liquid-phase mass density of the chemical at its current temperature and pressure, in units of [kg/m^3]. For calculation of this property at other temperatures and pressures, or specifying manually the method used to calculate it, and more - see the object oriented interface :obj:`th...
[ "r", "Liquid", "-", "phase", "mass", "density", "of", "the", "chemical", "at", "its", "current", "temperature", "and", "pressure", "in", "units", "of", "[", "kg", "/", "m^3", "]", ".", "For", "calculation", "of", "this", "property", "at", "other", "tempe...
python
valid
39.944444
proteanhq/protean
src/protean/impl/repository/dict_repo.py
https://github.com/proteanhq/protean/blob/0e29873f4aa634aa93cc08ed675dd749c7ed4b0f/src/protean/impl/repository/dict_repo.py#L160-L188
def _filter(self, criteria: Q, db): """Recursive function to filter items from dictionary""" # Filter the dictionary objects based on the filters negated = criteria.negated input_db = None if criteria.connector == criteria.AND: # Trim database records over successive...
[ "def", "_filter", "(", "self", ",", "criteria", ":", "Q", ",", "db", ")", ":", "# Filter the dictionary objects based on the filters", "negated", "=", "criteria", ".", "negated", "input_db", "=", "None", "if", "criteria", ".", "connector", "==", "criteria", ".",...
Recursive function to filter items from dictionary
[ "Recursive", "function", "to", "filter", "items", "from", "dictionary" ]
python
train
42.62069
UDST/urbansim
urbansim/models/regression.py
https://github.com/UDST/urbansim/blob/79f815a6503e109f50be270cee92d0f4a34f49ef/urbansim/models/regression.py#L909-L931
def to_dict(self): """ Returns a dict representation of this instance suitable for conversion to YAML. """ return { 'model_type': 'segmented_regression', 'name': self.name, 'segmentation_col': self.segmentation_col, 'fit_filters': ...
[ "def", "to_dict", "(", "self", ")", ":", "return", "{", "'model_type'", ":", "'segmented_regression'", ",", "'name'", ":", "self", ".", "name", ",", "'segmentation_col'", ":", "self", ".", "segmentation_col", ",", "'fit_filters'", ":", "self", ".", "fit_filter...
Returns a dict representation of this instance suitable for conversion to YAML.
[ "Returns", "a", "dict", "representation", "of", "this", "instance", "suitable", "for", "conversion", "to", "YAML", "." ]
python
train
36.347826
mamrhein/identifiers
identifiers/gs1.py
https://github.com/mamrhein/identifiers/blob/93ab2609e461faff245d1f582411bf831b428eef/identifiers/gs1.py#L71-L74
def company_prefix(self): """Return the identifier's company prefix part.""" offset = self.EXTRA_DIGITS return self._id[offset:self._ref_idx]
[ "def", "company_prefix", "(", "self", ")", ":", "offset", "=", "self", ".", "EXTRA_DIGITS", "return", "self", ".", "_id", "[", "offset", ":", "self", ".", "_ref_idx", "]" ]
Return the identifier's company prefix part.
[ "Return", "the", "identifier", "s", "company", "prefix", "part", "." ]
python
train
40.5
django-salesforce/django-salesforce
salesforce/backend/utils.py
https://github.com/django-salesforce/django-salesforce/blob/6fd5643dba69d49c5881de50875cf90204a8f808/salesforce/backend/utils.py#L453-L455
def str_dict(some_dict): """Convert dict of ascii str/unicode to dict of str, if necessary""" return {str(k): str(v) for k, v in some_dict.items()}
[ "def", "str_dict", "(", "some_dict", ")", ":", "return", "{", "str", "(", "k", ")", ":", "str", "(", "v", ")", "for", "k", ",", "v", "in", "some_dict", ".", "items", "(", ")", "}" ]
Convert dict of ascii str/unicode to dict of str, if necessary
[ "Convert", "dict", "of", "ascii", "str", "/", "unicode", "to", "dict", "of", "str", "if", "necessary" ]
python
train
51
exa-analytics/exa
exa/core/composer.py
https://github.com/exa-analytics/exa/blob/40fb3c22b531d460dbc51e603de75b856cc28f0d/exa/core/composer.py#L116-L118
def get_kwargs(self): """Return kwargs from attached attributes.""" return {k: v for k, v in vars(self).items() if k not in self._ignored}
[ "def", "get_kwargs", "(", "self", ")", ":", "return", "{", "k", ":", "v", "for", "k", ",", "v", "in", "vars", "(", "self", ")", ".", "items", "(", ")", "if", "k", "not", "in", "self", ".", "_ignored", "}" ]
Return kwargs from attached attributes.
[ "Return", "kwargs", "from", "attached", "attributes", "." ]
python
train
51.333333
saltstack/salt
salt/states/gnomedesktop.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/gnomedesktop.py#L95-L142
def wm_preferences(name, user=None, action_double_click_titlebar=None, action_middle_click_titlebar=None, action_right_click_titlebar=None, application_based=None, audible_bell=None, auto...
[ "def", "wm_preferences", "(", "name", ",", "user", "=", "None", ",", "action_double_click_titlebar", "=", "None", ",", "action_middle_click_titlebar", "=", "None", ",", "action_right_click_titlebar", "=", "None", ",", "application_based", "=", "None", ",", "audible_...
wm_preferences: sets values in the org.gnome.desktop.wm.preferences schema
[ "wm_preferences", ":", "sets", "values", "in", "the", "org", ".", "gnome", ".", "desktop", ".", "wm", ".", "preferences", "schema" ]
python
train
40.416667
choderalab/pymbar
pymbar/old_mbar.py
https://github.com/choderalab/pymbar/blob/69d1f0ff680e9ac1c6a51a5a207ea28f3ed86740/pymbar/old_mbar.py#L2300-L2428
def _adaptive(self, gamma=1.0, relative_tolerance=1.0e-8, maximum_iterations=1000, verbose=True, print_warning=True): """ Determine dimensionless free energies by a combination of Newton-Raphson iteration and self-consistent iteration. Picks whichever method gives the lowest gradient. Is...
[ "def", "_adaptive", "(", "self", ",", "gamma", "=", "1.0", ",", "relative_tolerance", "=", "1.0e-8", ",", "maximum_iterations", "=", "1000", ",", "verbose", "=", "True", ",", "print_warning", "=", "True", ")", ":", "if", "verbose", ":", "print", "(", "\"...
Determine dimensionless free energies by a combination of Newton-Raphson iteration and self-consistent iteration. Picks whichever method gives the lowest gradient. Is slower than NR (approximated, not calculated) since it calculates the log norms twice each iteration. OPTIONAL ARGUMENTS ...
[ "Determine", "dimensionless", "free", "energies", "by", "a", "combination", "of", "Newton", "-", "Raphson", "iteration", "and", "self", "-", "consistent", "iteration", ".", "Picks", "whichever", "method", "gives", "the", "lowest", "gradient", ".", "Is", "slower"...
python
train
45.069767
watson-developer-cloud/python-sdk
ibm_watson/compare_comply_v1.py
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/compare_comply_v1.py#L3709-L3716
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'types') and self.types is not None: _dict['types'] = [x._to_dict() for x in self.types] if hasattr(self, 'categories') and self.categories is not None: _dict['...
[ "def", "_to_dict", "(", "self", ")", ":", "_dict", "=", "{", "}", "if", "hasattr", "(", "self", ",", "'types'", ")", "and", "self", ".", "types", "is", "not", "None", ":", "_dict", "[", "'types'", "]", "=", "[", "x", ".", "_to_dict", "(", ")", ...
Return a json dictionary representing this model.
[ "Return", "a", "json", "dictionary", "representing", "this", "model", "." ]
python
train
48.5
spacetelescope/synphot_refactor
synphot/reddening.py
https://github.com/spacetelescope/synphot_refactor/blob/9c064f3cff0c41dd8acadc0f67c6350931275b9f/synphot/reddening.py#L131-L163
def from_file(cls, filename, **kwargs): """Create a reddening law from file. If filename has 'fits' or 'fit' suffix, it is read as FITS. Otherwise, it is read as ASCII. Parameters ---------- filename : str Reddening law filename. kwargs : dict ...
[ "def", "from_file", "(", "cls", ",", "filename", ",", "*", "*", "kwargs", ")", ":", "if", "'flux_unit'", "not", "in", "kwargs", ":", "kwargs", "[", "'flux_unit'", "]", "=", "cls", ".", "_internal_flux_unit", "if", "(", "(", "filename", ".", "endswith", ...
Create a reddening law from file. If filename has 'fits' or 'fit' suffix, it is read as FITS. Otherwise, it is read as ASCII. Parameters ---------- filename : str Reddening law filename. kwargs : dict Keywords acceptable by :func:`~s...
[ "Create", "a", "reddening", "law", "from", "file", "." ]
python
train
30.454545
aio-libs/janus
janus/__init__.py
https://github.com/aio-libs/janus/blob/8dc80530db1144fbd1dba75d4a1c1a54bb520c21/janus/__init__.py#L187-L210
def task_done(self): '''Indicate that a formerly enqueued task is complete. Used by Queue consumer threads. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete. If a join() is currently blocking, it ...
[ "def", "task_done", "(", "self", ")", ":", "self", ".", "_parent", ".", "_check_closing", "(", ")", "with", "self", ".", "_parent", ".", "_all_tasks_done", ":", "unfinished", "=", "self", ".", "_parent", ".", "_unfinished_tasks", "-", "1", "if", "unfinishe...
Indicate that a formerly enqueued task is complete. Used by Queue consumer threads. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete. If a join() is currently blocking, it will resume when all items ...
[ "Indicate", "that", "a", "formerly", "enqueued", "task", "is", "complete", "." ]
python
train
44.625
toumorokoshi/transmute-core
transmute_core/function/parameters.py
https://github.com/toumorokoshi/transmute-core/blob/a2c26625d5d8bab37e00038f9d615a26167fc7f4/transmute_core/function/parameters.py#L84-L99
def _extract_path_parameters_from_paths(paths): """ from a list of paths, return back a list of the arguments present in those paths. the arguments available in all of the paths must match: if not, an exception will be raised. """ params = set() for path in paths: parts = PART_R...
[ "def", "_extract_path_parameters_from_paths", "(", "paths", ")", ":", "params", "=", "set", "(", ")", "for", "path", "in", "paths", ":", "parts", "=", "PART_REGEX", ".", "split", "(", "path", ")", "for", "p", "in", "parts", ":", "match", "=", "PARAM_REGE...
from a list of paths, return back a list of the arguments present in those paths. the arguments available in all of the paths must match: if not, an exception will be raised.
[ "from", "a", "list", "of", "paths", "return", "back", "a", "list", "of", "the", "arguments", "present", "in", "those", "paths", "." ]
python
train
29.625
glitchassassin/lackey
lackey/InputEmulation.py
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/InputEmulation.py#L59-L73
def moveSpeed(self, location, seconds=0.3): """ Moves cursor to specified ``Location`` over ``seconds``. If ``seconds`` is 0, moves the cursor immediately. Used for smooth somewhat-human-like motion. """ self._lock.acquire() original_location = mouse.get_position() ...
[ "def", "moveSpeed", "(", "self", ",", "location", ",", "seconds", "=", "0.3", ")", ":", "self", ".", "_lock", ".", "acquire", "(", ")", "original_location", "=", "mouse", ".", "get_position", "(", ")", "mouse", ".", "move", "(", "location", ".", "x", ...
Moves cursor to specified ``Location`` over ``seconds``. If ``seconds`` is 0, moves the cursor immediately. Used for smooth somewhat-human-like motion.
[ "Moves", "cursor", "to", "specified", "Location", "over", "seconds", "." ]
python
train
48.266667
cloudera/cm_api
python/src/cm_api/endpoints/clusters.py
https://github.com/cloudera/cm_api/blob/5d2512375bd94684b4da36df9e0d9177865ffcbb/python/src/cm_api/endpoints/clusters.py#L100-L104
def _put_cluster(self, dic, params=None): """Change cluster attributes""" cluster = self._put('', ApiCluster, data=dic, params=params) self._update(cluster) return self
[ "def", "_put_cluster", "(", "self", ",", "dic", ",", "params", "=", "None", ")", ":", "cluster", "=", "self", ".", "_put", "(", "''", ",", "ApiCluster", ",", "data", "=", "dic", ",", "params", "=", "params", ")", "self", ".", "_update", "(", "clust...
Change cluster attributes
[ "Change", "cluster", "attributes" ]
python
train
36
saltstack/salt
salt/modules/firewalld.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/firewalld.py#L48-L55
def __mgmt(name, _type, action): ''' Perform zone management ''' # It's permanent because the 4 concerned functions need the permanent option, it's wrong without cmd = '--{0}-{1}={2} --permanent'.format(action, _type, name) return __firewall_cmd(cmd)
[ "def", "__mgmt", "(", "name", ",", "_type", ",", "action", ")", ":", "# It's permanent because the 4 concerned functions need the permanent option, it's wrong without", "cmd", "=", "'--{0}-{1}={2} --permanent'", ".", "format", "(", "action", ",", "_type", ",", "name", ")"...
Perform zone management
[ "Perform", "zone", "management" ]
python
train
33.5
PythonCharmers/python-future
src/future/types/newrange.py
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/types/newrange.py#L133-L141
def __getitem_slice(self, slce): """Return a range which represents the requested slce of the sequence represented by this range. """ scaled_indices = (self._step * n for n in slce.indices(self._len)) start_offset, stop_offset, new_step = scaled_indices return newrange(se...
[ "def", "__getitem_slice", "(", "self", ",", "slce", ")", ":", "scaled_indices", "=", "(", "self", ".", "_step", "*", "n", "for", "n", "in", "slce", ".", "indices", "(", "self", ".", "_len", ")", ")", "start_offset", ",", "stop_offset", ",", "new_step",...
Return a range which represents the requested slce of the sequence represented by this range.
[ "Return", "a", "range", "which", "represents", "the", "requested", "slce", "of", "the", "sequence", "represented", "by", "this", "range", "." ]
python
train
46.888889
bitesofcode/projexui
projexui/widgets/xoverlaywidget.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xoverlaywidget.py#L97-L106
def keyPressEvent(self, event): """ Exits the modal window on an escape press. :param event | <QtCore.QKeyPressEvent> """ if event.key() == QtCore.Qt.Key_Escape: self.reject() super(XOverlayWidget, self).keyPressEvent(event)
[ "def", "keyPressEvent", "(", "self", ",", "event", ")", ":", "if", "event", ".", "key", "(", ")", "==", "QtCore", ".", "Qt", ".", "Key_Escape", ":", "self", ".", "reject", "(", ")", "super", "(", "XOverlayWidget", ",", "self", ")", ".", "keyPressEven...
Exits the modal window on an escape press. :param event | <QtCore.QKeyPressEvent>
[ "Exits", "the", "modal", "window", "on", "an", "escape", "press", "." ]
python
train
28.2
jason-weirather/py-seq-tools
seqtools/graph/__init__.py
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/graph/__init__.py#L176-L182
def find_cycle(self): """greedy search for a cycle""" for node in self.nodes: cyc = self._follow_children(node) if len(cyc) > 0: return [self._nodes[x] for x in cyc] return None
[ "def", "find_cycle", "(", "self", ")", ":", "for", "node", "in", "self", ".", "nodes", ":", "cyc", "=", "self", ".", "_follow_children", "(", "node", ")", "if", "len", "(", "cyc", ")", ">", "0", ":", "return", "[", "self", ".", "_nodes", "[", "x"...
greedy search for a cycle
[ "greedy", "search", "for", "a", "cycle" ]
python
train
31.285714
peterbrittain/asciimatics
asciimatics/widgets.py
https://github.com/peterbrittain/asciimatics/blob/f471427d7786ce2d5f1eeb2dae0e67d19e46e085/asciimatics/widgets.py#L3680-L3688
def is_mouse_over(self, event): """ Check whether a MouseEvent is over thus scroll bar. :param event: The MouseEvent to check. :returns: True if the mouse event is over the scroll bar. """ return event.x == self._x and self._y <= event.y < self._y + self._height
[ "def", "is_mouse_over", "(", "self", ",", "event", ")", ":", "return", "event", ".", "x", "==", "self", ".", "_x", "and", "self", ".", "_y", "<=", "event", ".", "y", "<", "self", ".", "_y", "+", "self", ".", "_height" ]
Check whether a MouseEvent is over thus scroll bar. :param event: The MouseEvent to check. :returns: True if the mouse event is over the scroll bar.
[ "Check", "whether", "a", "MouseEvent", "is", "over", "thus", "scroll", "bar", "." ]
python
train
33.777778
hadrianl/huobi
huobitrade/service.py
https://github.com/hadrianl/huobi/blob/bbfa2036703ee84a76d5d8e9f89c25fc8a55f2c7/huobitrade/service.py#L1269-L1288
def margin_to_exchange(self, symbol, currency, amount): """ 借贷账户划出至现货账户 :param amount: :param currency: :param symbol: :return: """ params = {'symbol': symbol, 'currency': currency, 'amount': amount} path = '/v1/dw/transfer-out/margin' de...
[ "def", "margin_to_exchange", "(", "self", ",", "symbol", ",", "currency", ",", "amount", ")", ":", "params", "=", "{", "'symbol'", ":", "symbol", ",", "'currency'", ":", "currency", ",", "'amount'", ":", "amount", "}", "path", "=", "'/v1/dw/transfer-out/marg...
借贷账户划出至现货账户 :param amount: :param currency: :param symbol: :return:
[ "借贷账户划出至现货账户", ":", "param", "amount", ":", ":", "param", "currency", ":", ":", "param", "symbol", ":", ":", "return", ":" ]
python
train
23.65
swisscom/cleanerversion
versions/models.py
https://github.com/swisscom/cleanerversion/blob/becadbab5d7b474a0e9a596b99e97682402d2f2c/versions/models.py#L298-L323
def as_sql(self, qn, connection): """ This method identifies joined table aliases in order for VersionedExtraWhere.as_sql() to be able to add time restrictions for those tables based on the VersionedQuery's querytime value. :param qn: In Django 1.7 & 1.8 this is a compiler ...
[ "def", "as_sql", "(", "self", ",", "qn", ",", "connection", ")", ":", "# self.children is an array of VersionedExtraWhere-objects", "from", "versions", ".", "fields", "import", "VersionedExtraWhere", "for", "child", "in", "self", ".", "children", ":", "if", "isinsta...
This method identifies joined table aliases in order for VersionedExtraWhere.as_sql() to be able to add time restrictions for those tables based on the VersionedQuery's querytime value. :param qn: In Django 1.7 & 1.8 this is a compiler :param connection: A DB connection :return:...
[ "This", "method", "identifies", "joined", "table", "aliases", "in", "order", "for", "VersionedExtraWhere", ".", "as_sql", "()", "to", "be", "able", "to", "add", "time", "restrictions", "for", "those", "tables", "based", "on", "the", "VersionedQuery", "s", "que...
python
train
48.230769
shoebot/shoebot
lib/colors/__init__.py
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L805-L813
def blend(self, clr, factor=0.5): """ Returns a mix of two colors. """ r = self.r * (1 - factor) + clr.r * factor g = self.g * (1 - factor) + clr.g * factor b = self.b * (1 - factor) + clr.b * factor a = self.a * (1 - factor) + clr.a * factor return Color(...
[ "def", "blend", "(", "self", ",", "clr", ",", "factor", "=", "0.5", ")", ":", "r", "=", "self", ".", "r", "*", "(", "1", "-", "factor", ")", "+", "clr", ".", "r", "*", "factor", "g", "=", "self", ".", "g", "*", "(", "1", "-", "factor", ")...
Returns a mix of two colors.
[ "Returns", "a", "mix", "of", "two", "colors", "." ]
python
valid
37.222222
vladsaveliev/TargQC
targqc/utilz/jsontemplate/_jsontemplate.py
https://github.com/vladsaveliev/TargQC/blob/e887c36b2194dbd73c6ea32989b6cb84c6c0e58d/targqc/utilz/jsontemplate/_jsontemplate.py#L1797-L1816
def expand_with_style(template, style, data, body_subtree='body'): """Expand a data dictionary with a template AND a style. DEPRECATED -- Remove this entire function in favor of expand(d, style=style) A style is a Template instance that factors out the common strings in several "body" templates. Args: ...
[ "def", "expand_with_style", "(", "template", ",", "style", ",", "data", ",", "body_subtree", "=", "'body'", ")", ":", "if", "template", ".", "has_defines", ":", "return", "template", ".", "expand", "(", "data", ",", "style", "=", "style", ")", "else", ":...
Expand a data dictionary with a template AND a style. DEPRECATED -- Remove this entire function in favor of expand(d, style=style) A style is a Template instance that factors out the common strings in several "body" templates. Args: template: Template instance for the inner "page content" style: Temp...
[ "Expand", "a", "data", "dictionary", "with", "a", "template", "AND", "a", "style", "." ]
python
train
38.05
lesscpy/lesscpy
lesscpy/lessc/lexer.py
https://github.com/lesscpy/lesscpy/blob/51e392fb4a3cd4ccfb6175e0e42ce7d2f6b78126/lesscpy/lessc/lexer.py#L340-L346
def t_t_eopen(self, t): r'~"|~\'' if t.value[1] == '"': t.lexer.push_state('escapequotes') elif t.value[1] == '\'': t.lexer.push_state('escapeapostrophe') return t
[ "def", "t_t_eopen", "(", "self", ",", "t", ")", ":", "if", "t", ".", "value", "[", "1", "]", "==", "'\"'", ":", "t", ".", "lexer", ".", "push_state", "(", "'escapequotes'", ")", "elif", "t", ".", "value", "[", "1", "]", "==", "'\\''", ":", "t",...
r'~"|~\
[ "r", "~", "|~", "\\" ]
python
valid
30.428571
openvax/pyensembl
pyensembl/database.py
https://github.com/openvax/pyensembl/blob/4b995fb72e848206d6fbf11950cf30964cd9b3aa/pyensembl/database.py#L111-L151
def _all_possible_indices(self, column_names): """ Create list of tuples containing all possible index groups we might want to create over tables in this database. If a set of genome annotations is missing some column we want to index on, we have to drop any indices which use th...
[ "def", "_all_possible_indices", "(", "self", ",", "column_names", ")", ":", "candidate_column_groups", "=", "[", "[", "'seqname'", ",", "'start'", ",", "'end'", "]", ",", "[", "'gene_name'", "]", ",", "[", "'gene_id'", "]", ",", "[", "'transcript_id'", "]", ...
Create list of tuples containing all possible index groups we might want to create over tables in this database. If a set of genome annotations is missing some column we want to index on, we have to drop any indices which use that column. A specific table may later drop some of these i...
[ "Create", "list", "of", "tuples", "containing", "all", "possible", "index", "groups", "we", "might", "want", "to", "create", "over", "tables", "in", "this", "database", "." ]
python
train
38.926829
boakley/robotframework-lint
rflint/parser/tables.py
https://github.com/boakley/robotframework-lint/blob/3e3578f4e39af9af9961aa0a715f146b74474091/rflint/parser/tables.py#L35-L71
def statements(self): '''Return a list of statements This is done by joining together any rows that have continuations ''' # FIXME: no need to do this every time; we should cache the # result if len(self.rows) == 0: return [] current_statemen...
[ "def", "statements", "(", "self", ")", ":", "# FIXME: no need to do this every time; we should cache the", "# result", "if", "len", "(", "self", ".", "rows", ")", "==", "0", ":", "return", "[", "]", "current_statement", "=", "Statement", "(", "self", ".", "rows"...
Return a list of statements This is done by joining together any rows that have continuations
[ "Return", "a", "list", "of", "statements" ]
python
valid
37.918919
bpsmith/tia
tia/analysis/ta.py
https://github.com/bpsmith/tia/blob/a7043b6383e557aeea8fc7112bbffd6e36a230e9/tia/analysis/ta.py#L198-L277
def cross_signal(s1, s2, continuous=0): """ return a signal with the following 1 : when all values of s1 cross all values of s2 -1 : when all values of s2 cross below all values of s2 0 : if s1 < max(s2) and s1 > min(s2) np.nan : if s1 or s2 contains np.nan at position s1: Series, DataFrame, f...
[ "def", "cross_signal", "(", "s1", ",", "s2", ",", "continuous", "=", "0", ")", ":", "def", "_convert", "(", "src", ",", "other", ")", ":", "if", "isinstance", "(", "src", ",", "pd", ".", "DataFrame", ")", ":", "return", "src", ".", "min", "(", "a...
return a signal with the following 1 : when all values of s1 cross all values of s2 -1 : when all values of s2 cross below all values of s2 0 : if s1 < max(s2) and s1 > min(s2) np.nan : if s1 or s2 contains np.nan at position s1: Series, DataFrame, float, int, or tuple(float|int) s2: Series, D...
[ "return", "a", "signal", "with", "the", "following", "1", ":", "when", "all", "values", "of", "s1", "cross", "all", "values", "of", "s2", "-", "1", ":", "when", "all", "values", "of", "s2", "cross", "below", "all", "values", "of", "s2", "0", ":", "...
python
train
38.7875
AtmaHou/atma
tool.py
https://github.com/AtmaHou/atma/blob/41cd8ea9443a9c3b2dd71432f46f44a0f83093c7/tool.py#L39-L64
def wrap_star_digger(item, type_str, data_name='Value'): """ code used to extract data from Bing's wrap star :param item: wrap star obj :param type_str: target type string :param data_name: target data label, might be "Entities", "Properties", 'Value' :return: list of all matched target, arrange...
[ "def", "wrap_star_digger", "(", "item", ",", "type_str", ",", "data_name", "=", "'Value'", ")", ":", "ret", "=", "[", "]", "if", "type", "(", "item", ")", "==", "dict", ":", "if", "'Type'", "in", "item", "and", "item", "[", "'Type'", "]", "==", "ty...
code used to extract data from Bing's wrap star :param item: wrap star obj :param type_str: target type string :param data_name: target data label, might be "Entities", "Properties", 'Value' :return: list of all matched target, arranged in occurance
[ "code", "used", "to", "extract", "data", "from", "Bing", "s", "wrap", "star", ":", "param", "item", ":", "wrap", "star", "obj", ":", "param", "type_str", ":", "target", "type", "string", ":", "param", "data_name", ":", "target", "data", "label", "might",...
python
train
38.346154
saltstack/salt
salt/runners/reactor.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/reactor.py#L36-L59
def list_(saltenv='base', test=None): ''' List currently configured reactors CLI Example: .. code-block:: bash salt-run reactor.list ''' sevent = salt.utils.event.get_event( 'master', __opts__['sock_dir'], __opts__['transport'], opts=__o...
[ "def", "list_", "(", "saltenv", "=", "'base'", ",", "test", "=", "None", ")", ":", "sevent", "=", "salt", ".", "utils", ".", "event", ".", "get_event", "(", "'master'", ",", "__opts__", "[", "'sock_dir'", "]", ",", "__opts__", "[", "'transport'", "]", ...
List currently configured reactors CLI Example: .. code-block:: bash salt-run reactor.list
[ "List", "currently", "configured", "reactors" ]
python
train
25.583333
secdev/scapy
scapy/layers/tls/keyexchange_tls13.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/keyexchange_tls13.py#L59-L89
def create_privkey(self): """ This is called by post_build() for key creation. """ if self.group in _tls_named_ffdh_groups: params = _ffdh_groups[_tls_named_ffdh_groups[self.group]][0] privkey = params.generate_private_key() self.privkey = privkey ...
[ "def", "create_privkey", "(", "self", ")", ":", "if", "self", ".", "group", "in", "_tls_named_ffdh_groups", ":", "params", "=", "_ffdh_groups", "[", "_tls_named_ffdh_groups", "[", "self", ".", "group", "]", "]", "[", "0", "]", "privkey", "=", "params", "."...
This is called by post_build() for key creation.
[ "This", "is", "called", "by", "post_build", "()", "for", "key", "creation", "." ]
python
train
47.290323
rkcosmos/deepcut
deepcut/train.py
https://github.com/rkcosmos/deepcut/blob/9a2729071d01972af805acede85d7aa9e7a6da30/deepcut/train.py#L107-L142
def prepare_feature(best_processed_path, option='train'): """ Transform processed path into feature matrix and output array Input ===== best_processed_path: str, path to processed BEST dataset option: str, 'train' or 'test' """ # padding for training and testing set n_pad = 21 ...
[ "def", "prepare_feature", "(", "best_processed_path", ",", "option", "=", "'train'", ")", ":", "# padding for training and testing set", "n_pad", "=", "21", "n_pad_2", "=", "int", "(", "(", "n_pad", "-", "1", ")", "/", "2", ")", "pad", "=", "[", "{", "'cha...
Transform processed path into feature matrix and output array Input ===== best_processed_path: str, path to processed BEST dataset option: str, 'train' or 'test'
[ "Transform", "processed", "path", "into", "feature", "matrix", "and", "output", "array" ]
python
valid
36.166667
saltstack/salt
salt/master.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/master.py#L876-L937
def __bind(self): ''' Binds the reply server ''' if self.log_queue is not None: salt.log.setup.set_multiprocessing_logging_queue(self.log_queue) if self.log_queue_level is not None: salt.log.setup.set_multiprocessing_logging_level(self.log_queue_level) ...
[ "def", "__bind", "(", "self", ")", ":", "if", "self", ".", "log_queue", "is", "not", "None", ":", "salt", ".", "log", ".", "setup", ".", "set_multiprocessing_logging_queue", "(", "self", ".", "log_queue", ")", "if", "self", ".", "log_queue_level", "is", ...
Binds the reply server
[ "Binds", "the", "reply", "server" ]
python
train
48.064516
numenta/nupic
src/nupic/algorithms/fdrutilities.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/fdrutilities.py#L319-L411
def generateL2Sequences(nL1Patterns=10, l1Hubs=[2,6], l1SeqLength=[5,6,7], nL1SimpleSequences=50, nL1HubSequences=50, l1Pooling=4, perfectStability=False, spHysteresisFactor=1.0, patternLen=500, patternActivity=50): """ Generate the simulated output from a spat...
[ "def", "generateL2Sequences", "(", "nL1Patterns", "=", "10", ",", "l1Hubs", "=", "[", "2", ",", "6", "]", ",", "l1SeqLength", "=", "[", "5", ",", "6", ",", "7", "]", ",", "nL1SimpleSequences", "=", "50", ",", "nL1HubSequences", "=", "50", ",", "l1Poo...
Generate the simulated output from a spatial pooler that's sitting on top of another spatial pooler / temporal memory pair. The average on-time of the outputs from the simulated TM is given by the l1Pooling argument. In this routine, L1 refers to the first spatial and temporal memory and L2 refers to the spat...
[ "Generate", "the", "simulated", "output", "from", "a", "spatial", "pooler", "that", "s", "sitting", "on", "top", "of", "another", "spatial", "pooler", "/", "temporal", "memory", "pair", ".", "The", "average", "on", "-", "time", "of", "the", "outputs", "fro...
python
valid
45.043011
libyal/dtfabric
dtfabric/registry.py
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/registry.py#L61-L92
def RegisterDefinition(self, data_type_definition): """Registers a data type definition. The data type definitions are identified based on their lower case name. Args: data_type_definition (DataTypeDefinition): data type definitions. Raises: KeyError: if data type definition is already se...
[ "def", "RegisterDefinition", "(", "self", ",", "data_type_definition", ")", ":", "name_lower", "=", "data_type_definition", ".", "name", ".", "lower", "(", ")", "if", "name_lower", "in", "self", ".", "_definitions", ":", "raise", "KeyError", "(", "'Definition al...
Registers a data type definition. The data type definitions are identified based on their lower case name. Args: data_type_definition (DataTypeDefinition): data type definitions. Raises: KeyError: if data type definition is already set for the corresponding name.
[ "Registers", "a", "data", "type", "definition", "." ]
python
train
35.1875
kshlm/gant
gant/utils/ssh.py
https://github.com/kshlm/gant/blob/eabaa17ebfd31b1654ee1f27e7026f6d7b370609/gant/utils/ssh.py#L10-L20
def launch_shell(username, hostname, password, port=22): """ Launches an ssh shell """ if not username or not hostname or not password: return False with tempfile.NamedTemporaryFile() as tmpFile: os.system(sshCmdLine.format(password, tmpFile.name, username, hostname, ...
[ "def", "launch_shell", "(", "username", ",", "hostname", ",", "password", ",", "port", "=", "22", ")", ":", "if", "not", "username", "or", "not", "hostname", "or", "not", "password", ":", "return", "False", "with", "tempfile", ".", "NamedTemporaryFile", "(...
Launches an ssh shell
[ "Launches", "an", "ssh", "shell" ]
python
train
32.090909
ciena/afkak
afkak/consumer.py
https://github.com/ciena/afkak/blob/6f5e05ba6f135ea3c29cdb80efda009f7845569a/afkak/consumer.py#L236-L283
def start(self, start_offset): """ Starts fetching messages from Kafka and delivering them to the :attr:`.processor` function. :param int start_offset: The offset within the partition from which to start fetching. Special values include: :const:`OFFSET_EARLIEST`,...
[ "def", "start", "(", "self", ",", "start_offset", ")", ":", "# Have we been started already, and not stopped?", "if", "self", ".", "_start_d", "is", "not", "None", ":", "raise", "RestartError", "(", "\"Start called on already-started consumer\"", ")", "# Keep track of sta...
Starts fetching messages from Kafka and delivering them to the :attr:`.processor` function. :param int start_offset: The offset within the partition from which to start fetching. Special values include: :const:`OFFSET_EARLIEST`, :const:`OFFSET_LATEST`, and :const:`OF...
[ "Starts", "fetching", "messages", "from", "Kafka", "and", "delivering", "them", "to", "the", ":", "attr", ":", ".", "processor", "function", "." ]
python
train
45.6875
bcbio/bcbio-nextgen
bcbio/structural/pindel.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/pindel.py#L20-L44
def _pindel_options(items, config, out_file, region, tmp_path): """parse pindel options. Add region to cmd. :param items: (dict) information from yaml :param config: (dict) information from yaml (items[0]['config']) :param region: (str or tupple) region to analyze :param tmp_path: (str) temporal fol...
[ "def", "_pindel_options", "(", "items", ",", "config", ",", "out_file", ",", "region", ",", "tmp_path", ")", ":", "variant_regions", "=", "utils", ".", "get_in", "(", "config", ",", "(", "\"algorithm\"", ",", "\"variant_regions\"", ")", ")", "target", "=", ...
parse pindel options. Add region to cmd. :param items: (dict) information from yaml :param config: (dict) information from yaml (items[0]['config']) :param region: (str or tupple) region to analyze :param tmp_path: (str) temporal folder :returns: (list) options for pindel
[ "parse", "pindel", "options", ".", "Add", "region", "to", "cmd", ".", ":", "param", "items", ":", "(", "dict", ")", "information", "from", "yaml", ":", "param", "config", ":", "(", "dict", ")", "information", "from", "yaml", "(", "items", "[", "0", "...
python
train
49.16
tensorflow/tensor2tensor
tensor2tensor/data_generators/multi_problem_v2.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/multi_problem_v2.py#L397-L410
def decode_schedule(string): """Decodes a string into a schedule tuple. Args: string: The string encoding of a schedule tuple. Returns: A schedule tuple, see encode_schedule for details. """ splits = string.split() steps = [int(x[1:]) for x in splits[1:] if x[0] == '@'] pmfs = np.reshape( ...
[ "def", "decode_schedule", "(", "string", ")", ":", "splits", "=", "string", ".", "split", "(", ")", "steps", "=", "[", "int", "(", "x", "[", "1", ":", "]", ")", "for", "x", "in", "splits", "[", "1", ":", "]", "if", "x", "[", "0", "]", "==", ...
Decodes a string into a schedule tuple. Args: string: The string encoding of a schedule tuple. Returns: A schedule tuple, see encode_schedule for details.
[ "Decodes", "a", "string", "into", "a", "schedule", "tuple", "." ]
python
train
30.071429
vatlab/SoS
src/sos/task_engines.py
https://github.com/vatlab/SoS/blob/6b60ed0770916d135e17322e469520d778e9d4e7/src/sos/task_engines.py#L651-L702
def _submit_task_with_template(self, task_ids): '''Submit tasks by interpolating a shell script defined in job_template''' runtime = self.config runtime.update({ 'workdir': os.getcwd(), 'cur_dir': os.getcwd(), # for backward compatibility 'verbosity': env.ver...
[ "def", "_submit_task_with_template", "(", "self", ",", "task_ids", ")", ":", "runtime", "=", "self", ".", "config", "runtime", ".", "update", "(", "{", "'workdir'", ":", "os", ".", "getcwd", "(", ")", ",", "'cur_dir'", ":", "os", ".", "getcwd", "(", ")...
Submit tasks by interpolating a shell script defined in job_template
[ "Submit", "tasks", "by", "interpolating", "a", "shell", "script", "defined", "in", "job_template" ]
python
train
39.961538
spencerahill/aospy
aospy/data_loader.py
https://github.com/spencerahill/aospy/blob/2f6e775b9b9956c54af117fdcdce2c87196afb6c/aospy/data_loader.py#L463-L471
def _generate_file_set(self, var=None, start_date=None, end_date=None, domain=None, intvl_in=None, dtype_in_vert=None, dtype_in_time=None, intvl_out=None): """Returns the file_set for the given interval in.""" try: return self.file_map[in...
[ "def", "_generate_file_set", "(", "self", ",", "var", "=", "None", ",", "start_date", "=", "None", ",", "end_date", "=", "None", ",", "domain", "=", "None", ",", "intvl_in", "=", "None", ",", "dtype_in_vert", "=", "None", ",", "dtype_in_time", "=", "None...
Returns the file_set for the given interval in.
[ "Returns", "the", "file_set", "for", "the", "given", "interval", "in", "." ]
python
train
52.888889
fxsjy/jieba
jieba/posseg/__init__.py
https://github.com/fxsjy/jieba/blob/8212b6c5725d08311952a3a08e5509eeaee33eb7/jieba/posseg/__init__.py#L272-L291
def cut(sentence, HMM=True): """ Global `cut` function that supports parallel processing. Note that this only works using dt, custom POSTokenizer instances are not supported. """ global dt if jieba.pool is None: for w in dt.cut(sentence, HMM=HMM): yield w else: ...
[ "def", "cut", "(", "sentence", ",", "HMM", "=", "True", ")", ":", "global", "dt", "if", "jieba", ".", "pool", "is", "None", ":", "for", "w", "in", "dt", ".", "cut", "(", "sentence", ",", "HMM", "=", "HMM", ")", ":", "yield", "w", "else", ":", ...
Global `cut` function that supports parallel processing. Note that this only works using dt, custom POSTokenizer instances are not supported.
[ "Global", "cut", "function", "that", "supports", "parallel", "processing", "." ]
python
train
28.8
wbond/asn1crypto
asn1crypto/keys.py
https://github.com/wbond/asn1crypto/blob/ecda20176f55d37021cbca1f6da9083a8e491197/asn1crypto/keys.py#L753-L761
def algorithm(self): """ :return: A unicode string of "rsa", "dsa" or "ec" """ if self._algorithm is None: self._algorithm = self['private_key_algorithm']['algorithm'].native return self._algorithm
[ "def", "algorithm", "(", "self", ")", ":", "if", "self", ".", "_algorithm", "is", "None", ":", "self", ".", "_algorithm", "=", "self", "[", "'private_key_algorithm'", "]", "[", "'algorithm'", "]", ".", "native", "return", "self", ".", "_algorithm" ]
:return: A unicode string of "rsa", "dsa" or "ec"
[ ":", "return", ":", "A", "unicode", "string", "of", "rsa", "dsa", "or", "ec" ]
python
train
28.222222
limpyd/redis-limpyd
limpyd/database.py
https://github.com/limpyd/redis-limpyd/blob/3c745dde1390a0bd09690b77a089dcc08c6c7e43/limpyd/database.py#L171-L200
def call_script(self, script_dict, keys=None, args=None): """Call a redis script with keys and args The first time we call a script, we register it to speed up later calls. We expect a dict with a ``lua`` key having the script, and the dict will be updated with a ``script_object`` key, ...
[ "def", "call_script", "(", "self", ",", "script_dict", ",", "keys", "=", "None", ",", "args", "=", "None", ")", ":", "if", "keys", "is", "None", ":", "keys", "=", "[", "]", "if", "args", "is", "None", ":", "args", "=", "[", "]", "if", "'script_ob...
Call a redis script with keys and args The first time we call a script, we register it to speed up later calls. We expect a dict with a ``lua`` key having the script, and the dict will be updated with a ``script_object`` key, with the content returned by the the redis-py ``register_scri...
[ "Call", "a", "redis", "script", "with", "keys", "and", "args" ]
python
train
39.233333
tomokinakamaru/mapletree
mapletree/defaults/request/validators.py
https://github.com/tomokinakamaru/mapletree/blob/19ec68769ef2c1cd2e4164ed8623e0c4280279bb/mapletree/defaults/request/validators.py#L258-L268
def int_option(string, options): """ Requires values (int) to be in `args` :param string: Value to validate :type string: str """ i = int(string) if i in options: return i raise ValueError('Not in allowed options')
[ "def", "int_option", "(", "string", ",", "options", ")", ":", "i", "=", "int", "(", "string", ")", "if", "i", "in", "options", ":", "return", "i", "raise", "ValueError", "(", "'Not in allowed options'", ")" ]
Requires values (int) to be in `args` :param string: Value to validate :type string: str
[ "Requires", "values", "(", "int", ")", "to", "be", "in", "args" ]
python
train
22
Gorialis/jishaku
jishaku/cog.py
https://github.com/Gorialis/jishaku/blob/fc7c479b9d510ede189a929c8aa6f7c8ef7f9a6e/jishaku/cog.py#L175-L184
async def jsk_hide(self, ctx: commands.Context): """ Hides Jishaku from the help command. """ if self.jsk.hidden: return await ctx.send("Jishaku is already hidden.") self.jsk.hidden = True await ctx.send("Jishaku is now hidden.")
[ "async", "def", "jsk_hide", "(", "self", ",", "ctx", ":", "commands", ".", "Context", ")", ":", "if", "self", ".", "jsk", ".", "hidden", ":", "return", "await", "ctx", ".", "send", "(", "\"Jishaku is already hidden.\"", ")", "self", ".", "jsk", ".", "h...
Hides Jishaku from the help command.
[ "Hides", "Jishaku", "from", "the", "help", "command", "." ]
python
train
28.2
ml4ai/delphi
delphi/GrFN/networks.py
https://github.com/ml4ai/delphi/blob/6d03d8aafeab99610387c51b89c99738ff2abbe3/delphi/GrFN/networks.py#L126-L152
def to_CAG(self): """ Export to a Causal Analysis Graph (CAG) PyGraphviz AGraph object. The CAG shows the influence relationships between the variables and elides the function nodes.""" G = nx.DiGraph() for (name, attrs) in self.nodes(data=True): if attrs["type"] == ...
[ "def", "to_CAG", "(", "self", ")", ":", "G", "=", "nx", ".", "DiGraph", "(", ")", "for", "(", "name", ",", "attrs", ")", "in", "self", ".", "nodes", "(", "data", "=", "True", ")", ":", "if", "attrs", "[", "\"type\"", "]", "==", "\"variable\"", ...
Export to a Causal Analysis Graph (CAG) PyGraphviz AGraph object. The CAG shows the influence relationships between the variables and elides the function nodes.
[ "Export", "to", "a", "Causal", "Analysis", "Graph", "(", "CAG", ")", "PyGraphviz", "AGraph", "object", ".", "The", "CAG", "shows", "the", "influence", "relationships", "between", "the", "variables", "and", "elides", "the", "function", "nodes", "." ]
python
train
43.259259
asmodehn/filefinder2
filefinder2/_fileloader2.py
https://github.com/asmodehn/filefinder2/blob/3f0b211ce11a34562e2a2160e039ae5290b68d6b/filefinder2/_fileloader2.py#L154-L160
def is_package(self, fullname): """Concrete implementation of InspectLoader.is_package by checking if the path returned by get_filename has a filename of '__init__.py'.""" filename = os.path.split(self.get_filename(fullname))[1] filename_base = filename.rsplit('.', 1)[0] tail_nam...
[ "def", "is_package", "(", "self", ",", "fullname", ")", ":", "filename", "=", "os", ".", "path", ".", "split", "(", "self", ".", "get_filename", "(", "fullname", ")", ")", "[", "1", "]", "filename_base", "=", "filename", ".", "rsplit", "(", "'.'", ",...
Concrete implementation of InspectLoader.is_package by checking if the path returned by get_filename has a filename of '__init__.py'.
[ "Concrete", "implementation", "of", "InspectLoader", ".", "is_package", "by", "checking", "if", "the", "path", "returned", "by", "get_filename", "has", "a", "filename", "of", "__init__", ".", "py", "." ]
python
train
59.428571
collectiveacuity/labPack
labpack/platforms/aws/ec2.py
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L918-L1000
def list_images(self, tag_values=None): ''' a method to retrieve the list of images of account on AWS EC2 :param tag_values: [optional] list of tag values :return: list of image AWS ids ''' title = '%s.list_images' % self.__class__.__name__ # validate inputs ...
[ "def", "list_images", "(", "self", ",", "tag_values", "=", "None", ")", ":", "title", "=", "'%s.list_images'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'tag_values'", ":", "tag_values", "}", "for", "key", ...
a method to retrieve the list of images of account on AWS EC2 :param tag_values: [optional] list of tag values :return: list of image AWS ids
[ "a", "method", "to", "retrieve", "the", "list", "of", "images", "of", "account", "on", "AWS", "EC2" ]
python
train
34.795181
glitchassassin/lackey
lackey/RegionMatching.py
https://github.com/glitchassassin/lackey/blob/7adadfacd7f45d81186710be992f5668b15399fe/lackey/RegionMatching.py#L1226-L1229
def setCenter(self, loc): """ Move this region so it is centered on ``loc`` """ offset = self.getCenter().getOffset(loc) # Calculate offset from current center return self.setLocation(self.getTopLeft().offset(offset)) # Move top left corner by the same offset
[ "def", "setCenter", "(", "self", ",", "loc", ")", ":", "offset", "=", "self", ".", "getCenter", "(", ")", ".", "getOffset", "(", "loc", ")", "# Calculate offset from current center", "return", "self", ".", "setLocation", "(", "self", ".", "getTopLeft", "(", ...
Move this region so it is centered on ``loc``
[ "Move", "this", "region", "so", "it", "is", "centered", "on", "loc" ]
python
train
70
tcalmant/ipopo
pelix/ipopo/waiting.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/waiting.py#L93-L121
def _try_instantiate(self, ipopo, factory, component): # type: (Any, str, str) -> None """ Tries to instantiate a component from the queue. Hides all exceptions. :param ipopo: The iPOPO service :param factory: Component factory :param component: Component name ""...
[ "def", "_try_instantiate", "(", "self", ",", "ipopo", ",", "factory", ",", "component", ")", ":", "# type: (Any, str, str) -> None", "try", ":", "# Get component properties", "with", "self", ".", "__lock", ":", "properties", "=", "self", ".", "__queue", "[", "fa...
Tries to instantiate a component from the queue. Hides all exceptions. :param ipopo: The iPOPO service :param factory: Component factory :param component: Component name
[ "Tries", "to", "instantiate", "a", "component", "from", "the", "queue", ".", "Hides", "all", "exceptions", "." ]
python
train
35.655172
FutunnOpen/futuquant
futuquant/examples/learn/make_order_and_cancel.py
https://github.com/FutunnOpen/futuquant/blob/1512b321845f92ec9c578ce2689aa4e8482669e4/futuquant/examples/learn/make_order_and_cancel.py#L25-L136
def make_order_and_cancel(api_svr_ip, api_svr_port, unlock_password, test_code, trade_env, acc_id): """ 使用请先配置正确参数: :param api_svr_ip: (string) ip :param api_svr_port: (string) ip :param unlock_password: (string) 交易解锁密码, 必需修改! :param test_code: (string) 股票 :param trade_env: 参见 ft.TrdEnv的定义 ...
[ "def", "make_order_and_cancel", "(", "api_svr_ip", ",", "api_svr_port", ",", "unlock_password", ",", "test_code", ",", "trade_env", ",", "acc_id", ")", ":", "if", "unlock_password", "==", "\"\"", ":", "raise", "Exception", "(", "\"请先配置交易解锁密码!\")", "", "quote_ctx",...
使用请先配置正确参数: :param api_svr_ip: (string) ip :param api_svr_port: (string) ip :param unlock_password: (string) 交易解锁密码, 必需修改! :param test_code: (string) 股票 :param trade_env: 参见 ft.TrdEnv的定义 :param acc_id: 交易子账号id
[ "使用请先配置正确参数", ":", ":", "param", "api_svr_ip", ":", "(", "string", ")", "ip", ":", "param", "api_svr_port", ":", "(", "string", ")", "ip", ":", "param", "unlock_password", ":", "(", "string", ")", "交易解锁密码", "必需修改!", ":", "param", "test_code", ":", "(", ...
python
train
36.1875
DataONEorg/d1_python
client_cli/src/d1_cli/impl/command_parser.py
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/client_cli/src/d1_cli/impl/command_parser.py#L565-L587
def _print_help(self): """Custom help message to group commands by functionality.""" msg = """Commands (type help <command> for details) CLI: help history exit quit Session, General: set load save reset Session, Access Control: allowaccess denyaccess clearaccess Session, Repl...
[ "def", "_print_help", "(", "self", ")", ":", "msg", "=", "\"\"\"Commands (type help <command> for details)\n\nCLI: help history exit quit\nSession, General: set load save reset\nSession, Access Control: allowaccess denyaccess clearaccess\nSession, Replication: allowrep ...
Custom help message to group commands by functionality.
[ "Custom", "help", "message", "to", "group", "commands", "by", "functionality", "." ]
python
train
44.913043
ARMmbed/mbed-cloud-sdk-python
src/mbed_cloud/connect/notifications.py
https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/connect/notifications.py#L107-L123
def check_error(self): """Check if the async response is an error. Take care to call `is_done` before calling `error`. Note that the error messages are always encoded as strings. :raises CloudUnhandledError: When not checking `is_done` first :return: status_code, error_msg, pay...
[ "def", "check_error", "(", "self", ")", ":", "if", "not", "self", ".", "is_done", ":", "raise", "CloudUnhandledError", "(", "\"Need to check if request is done, before checking for error\"", ")", "response", "=", "self", ".", "db", "[", "self", ".", "async_id", "]...
Check if the async response is an error. Take care to call `is_done` before calling `error`. Note that the error messages are always encoded as strings. :raises CloudUnhandledError: When not checking `is_done` first :return: status_code, error_msg, payload :rtype: tuple
[ "Check", "if", "the", "async", "response", "is", "an", "error", "." ]
python
train
40.470588
satellogic/telluric
telluric/georaster.py
https://github.com/satellogic/telluric/blob/e752cd3ee71e339f79717e526fde362e80055d9e/telluric/georaster.py#L736-L740
def band_names(self): """Raster affine.""" if self._band_names is None: self._populate_from_rasterio_object(read_image=False) return self._band_names
[ "def", "band_names", "(", "self", ")", ":", "if", "self", ".", "_band_names", "is", "None", ":", "self", ".", "_populate_from_rasterio_object", "(", "read_image", "=", "False", ")", "return", "self", ".", "_band_names" ]
Raster affine.
[ "Raster", "affine", "." ]
python
train
36.2
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L81-L117
def visualize_explanation(explanation, label=None): """ Given the output of the explain() endpoint, produces a terminal visual that plots response strength over a sequence """ if not sys.version_info[:2] >= (3, 5): raise IndicoError("Python >= 3.5+ is required for explanation visualization") ...
[ "def", "visualize_explanation", "(", "explanation", ",", "label", "=", "None", ")", ":", "if", "not", "sys", ".", "version_info", "[", ":", "2", "]", ">=", "(", "3", ",", "5", ")", ":", "raise", "IndicoError", "(", "\"Python >= 3.5+ is required for explanati...
Given the output of the explain() endpoint, produces a terminal visual that plots response strength over a sequence
[ "Given", "the", "output", "of", "the", "explain", "()", "endpoint", "produces", "a", "terminal", "visual", "that", "plots", "response", "strength", "over", "a", "sequence" ]
python
train
33.486486
rosenbrockc/fortpy
fortpy/isense/classes.py
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/classes.py#L62-L82
def description(self): """Returns the full docstring information for the element suggested as a completion.""" result = "" if isinstance(self._element, ValueElement): if self._element.kind is not None: result = "{}({}) | {}".format(self._element.dtype, self._...
[ "def", "description", "(", "self", ")", ":", "result", "=", "\"\"", "if", "isinstance", "(", "self", ".", "_element", ",", "ValueElement", ")", ":", "if", "self", ".", "_element", ".", "kind", "is", "not", "None", ":", "result", "=", "\"{}({}) | {}\"", ...
Returns the full docstring information for the element suggested as a completion.
[ "Returns", "the", "full", "docstring", "information", "for", "the", "element", "suggested", "as", "a", "completion", "." ]
python
train
47.904762
pyviz/holoviews
holoviews/core/dimension.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/dimension.py#L97-L129
def process_dimensions(kdims, vdims): """Converts kdims and vdims to Dimension objects. Args: kdims: List or single key dimension(s) specified as strings, tuples dicts or Dimension objects. vdims: List or single value dimension(s) specified as strings, tuples dicts or Di...
[ "def", "process_dimensions", "(", "kdims", ",", "vdims", ")", ":", "dimensions", "=", "{", "}", "for", "group", ",", "dims", "in", "[", "(", "'kdims'", ",", "kdims", ")", ",", "(", "'vdims'", ",", "vdims", ")", "]", ":", "if", "dims", "is", "None",...
Converts kdims and vdims to Dimension objects. Args: kdims: List or single key dimension(s) specified as strings, tuples dicts or Dimension objects. vdims: List or single value dimension(s) specified as strings, tuples dicts or Dimension objects. Returns: Dictio...
[ "Converts", "kdims", "and", "vdims", "to", "Dimension", "objects", "." ]
python
train
45
ocadotechnology/django-closuretree
closuretree/models.py
https://github.com/ocadotechnology/django-closuretree/blob/432717b20907f2e475a28de3605924f69b7d67b5/closuretree/models.py#L259-L266
def get_root(self): """Return the furthest ancestor of this node.""" if self.is_root_node(): return self return self.get_ancestors().order_by( "-%s__depth" % self._closure_parentref() )[0]
[ "def", "get_root", "(", "self", ")", ":", "if", "self", ".", "is_root_node", "(", ")", ":", "return", "self", "return", "self", ".", "get_ancestors", "(", ")", ".", "order_by", "(", "\"-%s__depth\"", "%", "self", ".", "_closure_parentref", "(", ")", ")",...
Return the furthest ancestor of this node.
[ "Return", "the", "furthest", "ancestor", "of", "this", "node", "." ]
python
train
29.75
dead-beef/markovchain
markovchain/image/type.py
https://github.com/dead-beef/markovchain/blob/9bd10b2f01089341c4a875a0fa569d50caba22c7/markovchain/image/type.py#L77-L97
def merge(self, imgs): """Merge image channels. Parameters ---------- imgs : `list` of `PIL.Image.Image` Returns ------- `PIL.Image.Image` Raises ------ ValueError If image channel list is empty. """ if not im...
[ "def", "merge", "(", "self", ",", "imgs", ")", ":", "if", "not", "imgs", ":", "raise", "ValueError", "(", "'empty channel list'", ")", "if", "len", "(", "imgs", ")", "==", "1", ":", "return", "imgs", "[", "0", "]", "return", "Image", ".", "merge", ...
Merge image channels. Parameters ---------- imgs : `list` of `PIL.Image.Image` Returns ------- `PIL.Image.Image` Raises ------ ValueError If image channel list is empty.
[ "Merge", "image", "channels", "." ]
python
train
21.52381
NuGrid/NuGridPy
nugridpy/data_plot.py
https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L4594-L4656
def density_profile(self,ixaxis='mass',ifig=None,colour=None,label=None,fname=None): ''' Plot density as a function of either mass coordiate or radius. Parameters ---------- ixaxis : string 'mass' or 'radius' The default value is 'mass' ifig : int...
[ "def", "density_profile", "(", "self", ",", "ixaxis", "=", "'mass'", ",", "ifig", "=", "None", ",", "colour", "=", "None", ",", "label", "=", "None", ",", "fname", "=", "None", ")", ":", "pT", "=", "self", ".", "_classTest", "(", ")", "# Class-specif...
Plot density as a function of either mass coordiate or radius. Parameters ---------- ixaxis : string 'mass' or 'radius' The default value is 'mass' ifig : integer or string The figure label The default value is None colour : string...
[ "Plot", "density", "as", "a", "function", "of", "either", "mass", "coordiate", "or", "radius", "." ]
python
train
31.15873
RI-imaging/qpsphere
qpsphere/edgefit.py
https://github.com/RI-imaging/qpsphere/blob/3cfa0e9fb8e81be8c820abbeccd47242e7972ac1/qpsphere/edgefit.py#L174-L200
def circle_radii(params, xedge, yedge): """Compute the distance to the center from cartesian coordinates This method is used for fitting a circle to a set of contour points. Parameters ---------- params: lmfit.Parameters Must contain the keys: - "cx": origin of x coordinate [p...
[ "def", "circle_radii", "(", "params", ",", "xedge", ",", "yedge", ")", ":", "cx", "=", "params", "[", "\"cx\"", "]", ".", "value", "cy", "=", "params", "[", "\"cy\"", "]", ".", "value", "radii", "=", "np", ".", "sqrt", "(", "(", "cx", "-", "xedge...
Compute the distance to the center from cartesian coordinates This method is used for fitting a circle to a set of contour points. Parameters ---------- params: lmfit.Parameters Must contain the keys: - "cx": origin of x coordinate [px] - "cy": origin of y coordinate [px] ...
[ "Compute", "the", "distance", "to", "the", "center", "from", "cartesian", "coordinates" ]
python
train
26.185185
ArchiveTeam/wpull
wpull/converter.py
https://github.com/ArchiveTeam/wpull/blob/ddf051aa3322479325ba20aa778cb2cb97606bf5/wpull/converter.py#L51-L57
def convert_all(self): '''Convert all links in URL table.''' for url_record in self._url_table.get_all(): if url_record.status != Status.done: continue self.convert_by_record(url_record)
[ "def", "convert_all", "(", "self", ")", ":", "for", "url_record", "in", "self", ".", "_url_table", ".", "get_all", "(", ")", ":", "if", "url_record", ".", "status", "!=", "Status", ".", "done", ":", "continue", "self", ".", "convert_by_record", "(", "url...
Convert all links in URL table.
[ "Convert", "all", "links", "in", "URL", "table", "." ]
python
train
33.857143
inveniosoftware/invenio-migrator
invenio_migrator/records.py
https://github.com/inveniosoftware/invenio-migrator/blob/6902c6968a39b747d15e32363f43b7dffe2622c2/invenio_migrator/records.py#L260-L268
def missing_pids(self): """Filter persistent identifiers.""" missing = [] for p in self.pids: try: PersistentIdentifier.get(p.pid_type, p.pid_value) except PIDDoesNotExistError: missing.append(p) return missing
[ "def", "missing_pids", "(", "self", ")", ":", "missing", "=", "[", "]", "for", "p", "in", "self", ".", "pids", ":", "try", ":", "PersistentIdentifier", ".", "get", "(", "p", ".", "pid_type", ",", "p", ".", "pid_value", ")", "except", "PIDDoesNotExistEr...
Filter persistent identifiers.
[ "Filter", "persistent", "identifiers", "." ]
python
test
32.222222
vsoch/helpme
helpme/utils/terminal.py
https://github.com/vsoch/helpme/blob/e609172260b10cddadb2d2023ab26da8082a9feb/helpme/utils/terminal.py#L91-L104
def which(software, strip_newline=True): '''get_install will return the path to where an executable is installed. ''' if software is None: software = "singularity" cmd = ['which', software ] try: result = run_command(cmd) if strip_newline is True: result['message'...
[ "def", "which", "(", "software", ",", "strip_newline", "=", "True", ")", ":", "if", "software", "is", "None", ":", "software", "=", "\"singularity\"", "cmd", "=", "[", "'which'", ",", "software", "]", "try", ":", "result", "=", "run_command", "(", "cmd",...
get_install will return the path to where an executable is installed.
[ "get_install", "will", "return", "the", "path", "to", "where", "an", "executable", "is", "installed", "." ]
python
train
29.642857
aio-libs/aioredis
aioredis/commands/generic.py
https://github.com/aio-libs/aioredis/blob/e8c33e39558d4cc91cf70dde490d8b330c97dc2e/aioredis/commands/generic.py#L88-L120
def migrate_keys(self, host, port, keys, dest_db, timeout, *, copy=False, replace=False): """Atomically transfer keys from one Redis instance to another one. Keys argument must be list/tuple of keys to migrate. """ if not isinstance(host, str): raise Typ...
[ "def", "migrate_keys", "(", "self", ",", "host", ",", "port", ",", "keys", ",", "dest_db", ",", "timeout", ",", "*", ",", "copy", "=", "False", ",", "replace", "=", "False", ")", ":", "if", "not", "isinstance", "(", "host", ",", "str", ")", ":", ...
Atomically transfer keys from one Redis instance to another one. Keys argument must be list/tuple of keys to migrate.
[ "Atomically", "transfer", "keys", "from", "one", "Redis", "instance", "to", "another", "one", "." ]
python
train
38.818182
ayust/kitnirc
kitnirc/contrib/admintools.py
https://github.com/ayust/kitnirc/blob/cf19fe39219da75f053e1a3976bf21331b6fefea/kitnirc/contrib/admintools.py#L11-L30
def is_admin(controller, client, actor): """Used to determine whether someone issuing a command is an admin. By default, checks to see if there's a line of the type nick=host that matches the command's actor in the [admins] section of the config file, or a key that matches the entire mask (e.g. "foo@ba...
[ "def", "is_admin", "(", "controller", ",", "client", ",", "actor", ")", ":", "config", "=", "controller", ".", "config", "if", "not", "config", ".", "has_section", "(", "\"admins\"", ")", ":", "logging", ".", "debug", "(", "\"Ignoring is_admin check - no [admi...
Used to determine whether someone issuing a command is an admin. By default, checks to see if there's a line of the type nick=host that matches the command's actor in the [admins] section of the config file, or a key that matches the entire mask (e.g. "foo@bar" or "foo@bar=1").
[ "Used", "to", "determine", "whether", "someone", "issuing", "a", "command", "is", "an", "admin", "." ]
python
train
46.45
ccubed/PyMoe
Pymoe/Kitsu/auth.py
https://github.com/ccubed/PyMoe/blob/5b2a2591bb113bd80d838e65aaa06f3a97ff3670/Pymoe/Kitsu/auth.py#L69-L88
def get(self, username): """ If using the remember option and KitsuAuth is storing your tokens, this function will retrieve one. :param username: The username whose token we are retrieving :return: A token, NotFound or NotSaving error """ if not self.remember: ...
[ "def", "get", "(", "self", ",", "username", ")", ":", "if", "not", "self", ".", "remember", ":", "raise", "NotSaving", "if", "username", "not", "in", "self", ".", "token_storage", ":", "raise", "UserNotFound", "if", "self", ".", "token_storage", "[", "us...
If using the remember option and KitsuAuth is storing your tokens, this function will retrieve one. :param username: The username whose token we are retrieving :return: A token, NotFound or NotSaving error
[ "If", "using", "the", "remember", "option", "and", "KitsuAuth", "is", "storing", "your", "tokens", "this", "function", "will", "retrieve", "one", "." ]
python
train
39.15
SecurityInnovation/PGPy
pgpy/pgp.py
https://github.com/SecurityInnovation/PGPy/blob/f1c3d68e32c334f5aa14c34580925e97f17f4fde/pgpy/pgp.py#L609-L636
def new(cls, pn, comment="", email=""): """ Create a new User ID or photo. :param pn: User ID name, or photo. If this is a ``bytearray``, it will be loaded as a photo. Otherwise, it will be used as the name field for a User ID. :type pn: ``bytearray``, ``str``, ``unic...
[ "def", "new", "(", "cls", ",", "pn", ",", "comment", "=", "\"\"", ",", "email", "=", "\"\"", ")", ":", "uid", "=", "PGPUID", "(", ")", "if", "isinstance", "(", "pn", ",", "bytearray", ")", ":", "uid", ".", "_uid", "=", "UserAttribute", "(", ")", ...
Create a new User ID or photo. :param pn: User ID name, or photo. If this is a ``bytearray``, it will be loaded as a photo. Otherwise, it will be used as the name field for a User ID. :type pn: ``bytearray``, ``str``, ``unicode`` :param comment: The comment field for a User I...
[ "Create", "a", "new", "User", "ID", "or", "photo", "." ]
python
train
37.607143
google/grr
grr/client/grr_response_client/client_actions/file_finder_utils/globbing.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/file_finder_utils/globbing.py#L279-L293
def ExpandPath(path, opts=None): """Applies all expansion mechanisms to the given path. Args: path: A path to expand. opts: A `PathOpts` object. Yields: All paths possible to obtain from a given path by performing expansions. """ precondition.AssertType(path, Text) for grouped_path in ExpandG...
[ "def", "ExpandPath", "(", "path", ",", "opts", "=", "None", ")", ":", "precondition", ".", "AssertType", "(", "path", ",", "Text", ")", "for", "grouped_path", "in", "ExpandGroups", "(", "path", ")", ":", "for", "globbed_path", "in", "ExpandGlobs", "(", "...
Applies all expansion mechanisms to the given path. Args: path: A path to expand. opts: A `PathOpts` object. Yields: All paths possible to obtain from a given path by performing expansions.
[ "Applies", "all", "expansion", "mechanisms", "to", "the", "given", "path", "." ]
python
train
26.666667
StackStorm/pybind
pybind/nos/v6_0_2f/rbridge_id/crypto/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/rbridge_id/crypto/__init__.py#L127-L148
def _set_ca(self, v, load=False): """ Setter method for ca, mapped from YANG variable /rbridge_id/crypto/ca (list) If this variable is read-only (config: false) in the source YANG file, then _set_ca is considered as a private method. Backends looking to populate this variable should do so via ca...
[ "def", "_set_ca", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "base", "=...
Setter method for ca, mapped from YANG variable /rbridge_id/crypto/ca (list) If this variable is read-only (config: false) in the source YANG file, then _set_ca is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_ca() directly.
[ "Setter", "method", "for", "ca", "mapped", "from", "YANG", "variable", "/", "rbridge_id", "/", "crypto", "/", "ca", "(", "list", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "in", "the", "source", "YANG", ...
python
train
101.681818
wikimedia/editquality
editquality/codegen/generate.py
https://github.com/wikimedia/editquality/blob/73bab7bdd0ef3dba9a000f91f2fd810b1772d1f0/editquality/codegen/generate.py#L4-L33
def generate(variables, templates_path, main_template): """ :Parameters: variables : dict Template parameters, passed through. templates_path : str Root directory for transclusions. main_template : str Contents of the main template. Returns the re...
[ "def", "generate", "(", "variables", ",", "templates_path", ",", "main_template", ")", ":", "env", "=", "jinja2", ".", "Environment", "(", "loader", "=", "jinja2", ".", "FileSystemLoader", "(", "templates_path", ")", ",", "lstrip_blocks", "=", "True", ",", "...
:Parameters: variables : dict Template parameters, passed through. templates_path : str Root directory for transclusions. main_template : str Contents of the main template. Returns the rendered output.
[ ":", "Parameters", ":", "variables", ":", "dict", "Template", "parameters", "passed", "through", ".", "templates_path", ":", "str", "Root", "directory", "for", "transclusions", ".", "main_template", ":", "str", "Contents", "of", "the", "main", "template", "." ]
python
train
31.333333
IRC-SPHERE/HyperStream
hyperstream/tool/base_tool.py
https://github.com/IRC-SPHERE/HyperStream/blob/98478f4d31ed938f4aa7c958ed0d4c3ffcb2e780/hyperstream/tool/base_tool.py#L131-L147
def parameters_from_model(parameters_model): """ Get the tool parameters model from dictionaries :param parameters_model: The parameters as a mongoengine model :return: The tool parameters as a dictionary """ parameters = {} for p in parameters_model: ...
[ "def", "parameters_from_model", "(", "parameters_model", ")", ":", "parameters", "=", "{", "}", "for", "p", "in", "parameters_model", ":", "if", "p", ".", "is_function", ":", "code", ",", "defaults", ",", "closure", "=", "pickle", ".", "loads", "(", "p", ...
Get the tool parameters model from dictionaries :param parameters_model: The parameters as a mongoengine model :return: The tool parameters as a dictionary
[ "Get", "the", "tool", "parameters", "model", "from", "dictionaries" ]
python
train
37.529412
finklabs/metrics
metrics/position.py
https://github.com/finklabs/metrics/blob/fd9974af498831664b9ae8e8f3834e1ec2e8a699/metrics/position.py#L95-L110
def add_scope(self, scope_type, scope_name, scope_start, is_method=False): """we identified a scope and add it to positions.""" if self._curr is not None: self._curr['end'] = scope_start - 1 # close last scope self._curr = { 'type': scope_type, 'name': scope_name, ...
[ "def", "add_scope", "(", "self", ",", "scope_type", ",", "scope_name", ",", "scope_start", ",", "is_method", "=", "False", ")", ":", "if", "self", ".", "_curr", "is", "not", "None", ":", "self", ".", "_curr", "[", "'end'", "]", "=", "scope_start", "-",...
we identified a scope and add it to positions.
[ "we", "identified", "a", "scope", "and", "add", "it", "to", "positions", "." ]
python
train
39.125
pgxcentre/geneparse
geneparse/core.py
https://github.com/pgxcentre/geneparse/blob/f698f9708af4c7962d384a70a5a14006b1cb7108/geneparse/core.py#L456-L465
def iter_variants_by_names(self, names): """Iterates over the genotypes for variants using a list of names. Args: names (list): The list of names for variant extraction. """ for name in names: for result in self.get_variant_by_name(name): yield r...
[ "def", "iter_variants_by_names", "(", "self", ",", "names", ")", ":", "for", "name", "in", "names", ":", "for", "result", "in", "self", ".", "get_variant_by_name", "(", "name", ")", ":", "yield", "result" ]
Iterates over the genotypes for variants using a list of names. Args: names (list): The list of names for variant extraction.
[ "Iterates", "over", "the", "genotypes", "for", "variants", "using", "a", "list", "of", "names", "." ]
python
train
31.6
redhat-cip/dci-control-server
dci/api/v1/jobs.py
https://github.com/redhat-cip/dci-control-server/blob/b416cf935ec93e4fdd5741f61a21cabecf8454d2/dci/api/v1/jobs.py#L521-L551
def get_all_results_from_jobs(user, j_id): """Get all results from job. """ job = v1_utils.verify_existence_and_get(j_id, _TABLE) if not user.is_in_team(job['team_id']) and not user.is_read_only_user(): raise dci_exc.Unauthorized() # get testscases from tests_results query = sql.selec...
[ "def", "get_all_results_from_jobs", "(", "user", ",", "j_id", ")", ":", "job", "=", "v1_utils", ".", "verify_existence_and_get", "(", "j_id", ",", "_TABLE", ")", "if", "not", "user", ".", "is_in_team", "(", "job", "[", "'team_id'", "]", ")", "and", "not", ...
Get all results from job.
[ "Get", "all", "results", "from", "job", "." ]
python
train
41.806452
matthewdeanmartin/jiggle_version
sample_projects/ver_in_weird_file/setup_helpers.py
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/sample_projects/ver_in_weird_file/setup_helpers.py#L70-L100
def get_version(filename, pattern=None): """Extract the __version__ from a file without importing it. While you could get the __version__ by importing the module, the very act of importing can cause unintended consequences. For example, Distribute's automatic 2to3 support will break. Instead, this se...
[ "def", "get_version", "(", "filename", ",", "pattern", "=", "None", ")", ":", "if", "pattern", "is", "None", ":", "cre", "=", "DEFAULT_VERSION_RE", "else", ":", "cre", "=", "re", ".", "compile", "(", "pattern", ")", "with", "open", "(", "filename", ")"...
Extract the __version__ from a file without importing it. While you could get the __version__ by importing the module, the very act of importing can cause unintended consequences. For example, Distribute's automatic 2to3 support will break. Instead, this searches the file for a line that starts with ...
[ "Extract", "the", "__version__", "from", "a", "file", "without", "importing", "it", "." ]
python
train
41.516129
wummel/linkchecker
linkcheck/log.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/log.py#L88-L95
def info (logname, msg, *args, **kwargs): """Log an informational message. return: None """ log = logging.getLogger(logname) if log.isEnabledFor(logging.INFO): _log(log.info, msg, args, **kwargs)
[ "def", "info", "(", "logname", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "logname", ")", "if", "log", ".", "isEnabledFor", "(", "logging", ".", "INFO", ")", ":", "_log", "(", "l...
Log an informational message. return: None
[ "Log", "an", "informational", "message", "." ]
python
train
27.125
odlgroup/odl
odl/phantom/geometric.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/phantom/geometric.py#L21-L91
def cuboid(space, min_pt=None, max_pt=None): """Rectangular cuboid. Parameters ---------- space : `DiscreteLp` Space in which the phantom should be created. min_pt : array-like of shape ``(space.ndim,)``, optional Lower left corner of the cuboid. If ``None`` is given, a quarter ...
[ "def", "cuboid", "(", "space", ",", "min_pt", "=", "None", ",", "max_pt", "=", "None", ")", ":", "dom_min_pt", "=", "np", ".", "asarray", "(", "space", ".", "domain", ".", "min", "(", ")", ")", "dom_max_pt", "=", "np", ".", "asarray", "(", "space",...
Rectangular cuboid. Parameters ---------- space : `DiscreteLp` Space in which the phantom should be created. min_pt : array-like of shape ``(space.ndim,)``, optional Lower left corner of the cuboid. If ``None`` is given, a quarter of the extent from ``space.min_pt`` towards the ...
[ "Rectangular", "cuboid", "." ]
python
train
33.84507
PredixDev/predixpy
predix/admin/cf/spaces.py
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/spaces.py#L46-L52
def _get_spaces(self): """ Get the marketplace services. """ guid = self.api.config.get_organization_guid() uri = '/v2/organizations/%s/spaces' % (guid) return self.api.get(uri)
[ "def", "_get_spaces", "(", "self", ")", ":", "guid", "=", "self", ".", "api", ".", "config", ".", "get_organization_guid", "(", ")", "uri", "=", "'/v2/organizations/%s/spaces'", "%", "(", "guid", ")", "return", "self", ".", "api", ".", "get", "(", "uri",...
Get the marketplace services.
[ "Get", "the", "marketplace", "services", "." ]
python
train
31.285714
scot-dev/scot
scot/connectivity_statistics.py
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity_statistics.py#L67-L123
def jackknife_connectivity(measures, data, var, nfft=512, leaveout=1, n_jobs=1, verbose=0): """Calculate jackknife estimates of connectivity. For each jackknife estimate a block of trials is left out. This is repeated until each trial was left out exactly once. The number of esti...
[ "def", "jackknife_connectivity", "(", "measures", ",", "data", ",", "var", ",", "nfft", "=", "512", ",", "leaveout", "=", "1", ",", "n_jobs", "=", "1", ",", "verbose", "=", "0", ")", ":", "data", "=", "atleast_3d", "(", "data", ")", "t", ",", "m", ...
Calculate jackknife estimates of connectivity. For each jackknife estimate a block of trials is left out. This is repeated until each trial was left out exactly once. The number of estimates depends on the number of trials and the value of `leaveout`. It is calculated by repeats = `n_trials` // `leaveo...
[ "Calculate", "jackknife", "estimates", "of", "connectivity", "." ]
python
train
39.719298
CxAalto/gtfspy
gtfspy/gtfs.py
https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/gtfs.py#L147-L164
def get_directly_accessible_stops_within_distance(self, stop, distance): """ Returns stops that are accessible without transfer from the stops that are within a specific walking distance :param stop: int :param distance: int :return: """ query = """SELECT stop.* F...
[ "def", "get_directly_accessible_stops_within_distance", "(", "self", ",", "stop", ",", "distance", ")", ":", "query", "=", "\"\"\"SELECT stop.* FROM\n (SELECT st2.* FROM \n (SELECT * FROM stop_distances\n WHERE from_stop_I = %s) sd,\n ...
Returns stops that are accessible without transfer from the stops that are within a specific walking distance :param stop: int :param distance: int :return:
[ "Returns", "stops", "that", "are", "accessible", "without", "transfer", "from", "the", "stops", "that", "are", "within", "a", "specific", "walking", "distance", ":", "param", "stop", ":", "int", ":", "param", "distance", ":", "int", ":", "return", ":" ]
python
valid
47.611111
esheldon/fitsio
fitsio/hdu/table.py
https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L933-L961
def get_rec_dtype(self, **keys): """ Get the dtype for the specified columns parameters ---------- colnums: integer array The column numbers, 0 offset vstorage: string, optional See docs in read_columns """ colnums = keys.get('coln...
[ "def", "get_rec_dtype", "(", "self", ",", "*", "*", "keys", ")", ":", "colnums", "=", "keys", ".", "get", "(", "'colnums'", ",", "None", ")", "vstorage", "=", "keys", ".", "get", "(", "'vstorage'", ",", "self", ".", "_vstorage", ")", "if", "colnums",...
Get the dtype for the specified columns parameters ---------- colnums: integer array The column numbers, 0 offset vstorage: string, optional See docs in read_columns
[ "Get", "the", "dtype", "for", "the", "specified", "columns" ]
python
train
31.62069
zimeon/iiif
iiif_cgi.py
https://github.com/zimeon/iiif/blob/9d10018d01202fa2a76dfa61598dc6eca07b471f/iiif_cgi.py#L115-L162
def do_GET_body(self): """Create body of GET.""" iiif = self.iiif if (len(self.path) > 1024): raise IIIFError(code=414, text="URI Too Long: Max 1024 chars, got %d\n" % len(self.path)) try: # self.path has leading / then identifier/param...
[ "def", "do_GET_body", "(", "self", ")", ":", "iiif", "=", "self", ".", "iiif", "if", "(", "len", "(", "self", ".", "path", ")", ">", "1024", ")", ":", "raise", "IIIFError", "(", "code", "=", "414", ",", "text", "=", "\"URI Too Long: Max 1024 chars, got...
Create body of GET.
[ "Create", "body", "of", "GET", "." ]
python
train
49.875
lambdalisue/e4u
e4u/__init__.py
https://github.com/lambdalisue/e4u/blob/108635c5ba37e7ae33001adbf07a95878f31fd50/e4u/__init__.py#L40-L63
def translate_char(source_char, carrier, reverse=False, encoding=False): u"""translate unicode emoji character to unicode carrier emoji character (or reverse) Attributes: source_char - emoji character. it must be unicode instance or have to set `encoding` attribute to decode carrier ...
[ "def", "translate_char", "(", "source_char", ",", "carrier", ",", "reverse", "=", "False", ",", "encoding", "=", "False", ")", ":", "if", "not", "isinstance", "(", "source_char", ",", "unicode", ")", "and", "encoding", ":", "source_char", "=", "source_char",...
u"""translate unicode emoji character to unicode carrier emoji character (or reverse) Attributes: source_char - emoji character. it must be unicode instance or have to set `encoding` attribute to decode carrier - the target carrier reverse - if you want to translate CARRIE...
[ "u", "translate", "unicode", "emoji", "character", "to", "unicode", "carrier", "emoji", "character", "(", "or", "reverse", ")", "Attributes", ":", "source_char", "-", "emoji", "character", ".", "it", "must", "be", "unicode", "instance", "or", "have", "to", "...
python
train
51.208333
PMEAL/porespy
porespy/networks/__snow__.py
https://github.com/PMEAL/porespy/blob/1e13875b56787d8f5b7ffdabce8c4342c33ba9f8/porespy/networks/__snow__.py#L11-L110
def snow(im, voxel_size=1, boundary_faces=['top', 'bottom', 'left', 'right', 'front', 'back'], marching_cubes_area=False): r""" Analyzes an image that has been partitioned into void and solid regions and extracts the void and solid phase geometry as well as network connectivity. P...
[ "def", "snow", "(", "im", ",", "voxel_size", "=", "1", ",", "boundary_faces", "=", "[", "'top'", ",", "'bottom'", ",", "'left'", ",", "'right'", ",", "'front'", ",", "'back'", "]", ",", "marching_cubes_area", "=", "False", ")", ":", "# --------------------...
r""" Analyzes an image that has been partitioned into void and solid regions and extracts the void and solid phase geometry as well as network connectivity. Parameters ---------- im : ND-array Binary image in the Boolean form with True’s as void phase and False’s as solid phase....
[ "r", "Analyzes", "an", "image", "that", "has", "been", "partitioned", "into", "void", "and", "solid", "regions", "and", "extracts", "the", "void", "and", "solid", "phase", "geometry", "as", "well", "as", "network", "connectivity", "." ]
python
train
49.88
pycontribs/pyrax
pyrax/autoscale.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/autoscale.py#L134-L143
def add_policy(self, name, policy_type, cooldown, change=None, is_percent=False, desired_capacity=None, args=None): """ Adds a policy with the given values to this scaling group. The 'change' parameter is treated as an absolute amount, unless 'is_percent' is True, in which ca...
[ "def", "add_policy", "(", "self", ",", "name", ",", "policy_type", ",", "cooldown", ",", "change", "=", "None", ",", "is_percent", "=", "False", ",", "desired_capacity", "=", "None", ",", "args", "=", "None", ")", ":", "return", "self", ".", "manager", ...
Adds a policy with the given values to this scaling group. The 'change' parameter is treated as an absolute amount, unless 'is_percent' is True, in which case it is treated as a percentage.
[ "Adds", "a", "policy", "with", "the", "given", "values", "to", "this", "scaling", "group", ".", "The", "change", "parameter", "is", "treated", "as", "an", "absolute", "amount", "unless", "is_percent", "is", "True", "in", "which", "case", "it", "is", "treat...
python
train
54.6
rckclmbr/pyportify
pyportify/pkcs1/primitives.py
https://github.com/rckclmbr/pyportify/blob/696a1caad8a47b191f3bec44cc8fc3c437779512/pyportify/pkcs1/primitives.py#L67-L79
def i2osp(x, x_len): '''Converts the integer x to its big-endian representation of length x_len. ''' if x > 256**x_len: raise exceptions.IntegerTooLarge h = hex(x)[2:] if h[-1] == 'L': h = h[:-1] if len(h) & 1 == 1: h = '0%s' % h x = binascii.unhexlify(h) r...
[ "def", "i2osp", "(", "x", ",", "x_len", ")", ":", "if", "x", ">", "256", "**", "x_len", ":", "raise", "exceptions", ".", "IntegerTooLarge", "h", "=", "hex", "(", "x", ")", "[", "2", ":", "]", "if", "h", "[", "-", "1", "]", "==", "'L'", ":", ...
Converts the integer x to its big-endian representation of length x_len.
[ "Converts", "the", "integer", "x", "to", "its", "big", "-", "endian", "representation", "of", "length", "x_len", "." ]
python
train
26.538462