repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
wummel/linkchecker
linkcheck/configuration/confparse.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/configuration/confparse.py#L230-L238
def read_plugin_config(self): """Read plugin-specific configuration values.""" folders = self.config["pluginfolders"] modules = plugins.get_plugin_modules(folders) for pluginclass in plugins.get_plugin_classes(modules): section = pluginclass.__name__ if self.has_s...
[ "def", "read_plugin_config", "(", "self", ")", ":", "folders", "=", "self", ".", "config", "[", "\"pluginfolders\"", "]", "modules", "=", "plugins", ".", "get_plugin_modules", "(", "folders", ")", "for", "pluginclass", "in", "plugins", ".", "get_plugin_classes",...
Read plugin-specific configuration values.
[ "Read", "plugin", "-", "specific", "configuration", "values", "." ]
python
train
gwastro/pycbc
pycbc/workflow/datafind.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/workflow/datafind.py#L1018-L1057
def datafind_keep_unique_backups(backup_outs, orig_outs): """This function will take a list of backup datafind files, presumably obtained by querying a remote datafind server, e.g. CIT, and compares these against a list of original datafind files, presumably obtained by querying the local datafind serve...
[ "def", "datafind_keep_unique_backups", "(", "backup_outs", ",", "orig_outs", ")", ":", "# NOTE: This function is not optimized and could be made considerably", "# quicker if speed becomes in issue. With 4s frame files this might", "# be slow, but for >1000s files I don't foresee any ...
This function will take a list of backup datafind files, presumably obtained by querying a remote datafind server, e.g. CIT, and compares these against a list of original datafind files, presumably obtained by querying the local datafind server. Only the datafind files in the backup list that do not app...
[ "This", "function", "will", "take", "a", "list", "of", "backup", "datafind", "files", "presumably", "obtained", "by", "querying", "a", "remote", "datafind", "server", "e", ".", "g", ".", "CIT", "and", "compares", "these", "against", "a", "list", "of", "ori...
python
train
h2oai/h2o-3
h2o-py/h2o/model/model_base.py
https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/model/model_base.py#L153-L169
def staged_predict_proba(self, test_data): """ Predict class probabilities at each stage of an H2O Model (only GBM models). The output structure is analogous to the output of function predict_leaf_node_assignment. For each tree t and class c there will be a column Tt.Cc (eg. T3.C1 for t...
[ "def", "staged_predict_proba", "(", "self", ",", "test_data", ")", ":", "if", "not", "isinstance", "(", "test_data", ",", "h2o", ".", "H2OFrame", ")", ":", "raise", "ValueError", "(", "\"test_data must be an instance of H2OFrame\"", ")", "j", "=", "h2o", ".", ...
Predict class probabilities at each stage of an H2O Model (only GBM models). The output structure is analogous to the output of function predict_leaf_node_assignment. For each tree t and class c there will be a column Tt.Cc (eg. T3.C1 for tree 3 and class 1). The value will be the corresponding ...
[ "Predict", "class", "probabilities", "at", "each", "stage", "of", "an", "H2O", "Model", "(", "only", "GBM", "models", ")", "." ]
python
test
mrjoes/sockjs-tornado
sockjs/tornado/session.py
https://github.com/mrjoes/sockjs-tornado/blob/bd3a99b407f1181f054b3b1730f438dde375ca1c/sockjs/tornado/session.py#L241-L252
def on_delete(self, forced): """Session expiration callback `forced` If session item explicitly deleted, forced will be set to True. If item expired, will be set to False. """ # Do not remove connection if it was not forced and there's running connection ...
[ "def", "on_delete", "(", "self", ",", "forced", ")", ":", "# Do not remove connection if it was not forced and there's running connection", "if", "not", "forced", "and", "self", ".", "handler", "is", "not", "None", "and", "not", "self", ".", "is_closed", ":", "self"...
Session expiration callback `forced` If session item explicitly deleted, forced will be set to True. If item expired, will be set to False.
[ "Session", "expiration", "callback" ]
python
train
msztolcman/versionner
versionner/config.py
https://github.com/msztolcman/versionner/blob/78fca02859e3e3eb71c9eb7ea230758944177c54/versionner/config.py#L106-L118
def _parse_config_file(self, cfg_files): """Parse config file (ini) and set properties :return: """ cfg_handler = configparser.ConfigParser(interpolation=None) if not cfg_handler.read(map(str, cfg_files)): return self._parse_global_section(cfg_handler) ...
[ "def", "_parse_config_file", "(", "self", ",", "cfg_files", ")", ":", "cfg_handler", "=", "configparser", ".", "ConfigParser", "(", "interpolation", "=", "None", ")", "if", "not", "cfg_handler", ".", "read", "(", "map", "(", "str", ",", "cfg_files", ")", "...
Parse config file (ini) and set properties :return:
[ "Parse", "config", "file", "(", "ini", ")", "and", "set", "properties" ]
python
train
google-research/batch-ppo
agents/algorithms/ppo/ppo.py
https://github.com/google-research/batch-ppo/blob/3d09705977bae4e7c3eb20339a3b384d2a5531e4/agents/algorithms/ppo/ppo.py#L81-L98
def begin_episode(self, agent_indices): """Reset the recurrent states and stored episode. Args: agent_indices: Tensor containing current batch indices. Returns: Summary tensor. """ with tf.name_scope('begin_episode/'): if self._last_state is None: reset_state = tf.no_op()...
[ "def", "begin_episode", "(", "self", ",", "agent_indices", ")", ":", "with", "tf", ".", "name_scope", "(", "'begin_episode/'", ")", ":", "if", "self", ".", "_last_state", "is", "None", ":", "reset_state", "=", "tf", ".", "no_op", "(", ")", "else", ":", ...
Reset the recurrent states and stored episode. Args: agent_indices: Tensor containing current batch indices. Returns: Summary tensor.
[ "Reset", "the", "recurrent", "states", "and", "stored", "episode", "." ]
python
train
internetarchive/brozzler
brozzler/chrome.py
https://github.com/internetarchive/brozzler/blob/411b3f266a38b9bb942021c0121ebd8e5ca66447/brozzler/chrome.py#L34-L60
def check_version(chrome_exe): ''' Raises SystemExit if `chrome_exe` is not a supported browser version. Must run in the main thread to have the desired effect. ''' # mac$ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version # Google Chrome 64.0.3282.140 # mac$ /Applica...
[ "def", "check_version", "(", "chrome_exe", ")", ":", "# mac$ /Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --version", "# Google Chrome 64.0.3282.140 ", "# mac$ /Applications/Google\\ Chrome\\ Canary.app/Contents/MacOS/Google\\ Chrome\\ Canary --version", "# Google Chrome 66.0.3...
Raises SystemExit if `chrome_exe` is not a supported browser version. Must run in the main thread to have the desired effect.
[ "Raises", "SystemExit", "if", "chrome_exe", "is", "not", "a", "supported", "browser", "version", "." ]
python
train
jmoiron/johnny-cache
johnny/cache.py
https://github.com/jmoiron/johnny-cache/blob/d96ea94c5dfcde517ff8f65d6ba4e435d8a0168c/johnny/cache.py#L232-L244
def get_multi_generation(self, tables, db='default'): """Takes a list of table names and returns an aggregate value for the generation""" generations = [] for table in tables: generations.append(self.get_single_generation(table, db)) key = self.keygen.gen_multi_key(ge...
[ "def", "get_multi_generation", "(", "self", ",", "tables", ",", "db", "=", "'default'", ")", ":", "generations", "=", "[", "]", "for", "table", "in", "tables", ":", "generations", ".", "append", "(", "self", ".", "get_single_generation", "(", "table", ",",...
Takes a list of table names and returns an aggregate value for the generation
[ "Takes", "a", "list", "of", "table", "names", "and", "returns", "an", "aggregate", "value", "for", "the", "generation" ]
python
train
mdsol/rwslib
rwslib/builders/modm.py
https://github.com/mdsol/rwslib/blob/1a86bc072d408c009ed1de8bf6e98a1769f54d18/rwslib/builders/modm.py#L200-L209
def add_milestone(self, milestone, codelistoid="MILESTONES"): """ Add a milestone :param codelistoid: specify the CodeListOID (defaults to MILESTONES) :param str milestone: Milestone to add """ if milestone not in self.milestone...
[ "def", "add_milestone", "(", "self", ",", "milestone", ",", "codelistoid", "=", "\"MILESTONES\"", ")", ":", "if", "milestone", "not", "in", "self", ".", "milestones", ".", "get", "(", "codelistoid", ",", "[", "]", ")", ":", "self", ".", "_milestones", "....
Add a milestone :param codelistoid: specify the CodeListOID (defaults to MILESTONES) :param str milestone: Milestone to add
[ "Add", "a", "milestone", ":", "param", "codelistoid", ":", "specify", "the", "CodeListOID", "(", "defaults", "to", "MILESTONES", ")", ":", "param", "str", "milestone", ":", "Milestone", "to", "add" ]
python
train
knipknap/exscript
Exscript/stdlib/ipv4.py
https://github.com/knipknap/exscript/blob/72718eee3e87b345d5a5255be9824e867e42927b/Exscript/stdlib/ipv4.py#L127-L140
def pfxmask(scope, ips, pfxlen): """ Applies the given prefix length to the given ips, resulting in a (list of) IP network addresses. :type ips: string :param ips: An IP address, or a list of IP addresses. :type pfxlen: int :param pfxlen: An IP prefix length. :rtype: string :retu...
[ "def", "pfxmask", "(", "scope", ",", "ips", ",", "pfxlen", ")", ":", "mask", "=", "ipv4", ".", "pfxlen2mask_int", "(", "pfxlen", "[", "0", "]", ")", "return", "[", "ipv4", ".", "int2ip", "(", "ipv4", ".", "ip2int", "(", "ip", ")", "&", "mask", ")...
Applies the given prefix length to the given ips, resulting in a (list of) IP network addresses. :type ips: string :param ips: An IP address, or a list of IP addresses. :type pfxlen: int :param pfxlen: An IP prefix length. :rtype: string :return: The mask(s) that result(s) from convertin...
[ "Applies", "the", "given", "prefix", "length", "to", "the", "given", "ips", "resulting", "in", "a", "(", "list", "of", ")", "IP", "network", "addresses", "." ]
python
train
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/win32/context_i386.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/win32/context_i386.py#L102-L112
def from_dict(cls, fsa): 'Instance a new structure from a Python dictionary.' fsa = dict(fsa) s = cls() for key in cls._integer_members: setattr(s, key, fsa.get(key)) ra = fsa.get('RegisterArea', None) if ra is not None: for index in compat.xrange(...
[ "def", "from_dict", "(", "cls", ",", "fsa", ")", ":", "fsa", "=", "dict", "(", "fsa", ")", "s", "=", "cls", "(", ")", "for", "key", "in", "cls", ".", "_integer_members", ":", "setattr", "(", "s", ",", "key", ",", "fsa", ".", "get", "(", "key", ...
Instance a new structure from a Python dictionary.
[ "Instance", "a", "new", "structure", "from", "a", "Python", "dictionary", "." ]
python
train
HDI-Project/BTB
btb/selection/recent.py
https://github.com/HDI-Project/BTB/blob/7f489ebc5591bd0886652ef743098c022d7f7460/btb/selection/recent.py#L56-L69
def compute_rewards(self, scores): """Compute the velocity of thte k+1 most recent scores. The velocity is the average distance between scores. Return a list with those k velocities padded out with zeros so that the count remains the same. """ # take the k + 1 most recent scores...
[ "def", "compute_rewards", "(", "self", ",", "scores", ")", ":", "# take the k + 1 most recent scores so we can get k velocities", "recent_scores", "=", "scores", "[", ":", "-", "self", ".", "k", "-", "2", ":", "-", "1", "]", "velocities", "=", "[", "recent_score...
Compute the velocity of thte k+1 most recent scores. The velocity is the average distance between scores. Return a list with those k velocities padded out with zeros so that the count remains the same.
[ "Compute", "the", "velocity", "of", "thte", "k", "+", "1", "most", "recent", "scores", "." ]
python
train
tensorflow/lucid
lucid/misc/gl/meshutil.py
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/misc/gl/meshutil.py#L78-L84
def _parse_vertex_tuple(s): """Parse vertex indices in '/' separated form (like 'i/j/k', 'i//k' ...).""" vt = [0, 0, 0] for i, c in enumerate(s.split('/')): if c: vt[i] = int(c) return tuple(vt)
[ "def", "_parse_vertex_tuple", "(", "s", ")", ":", "vt", "=", "[", "0", ",", "0", ",", "0", "]", "for", "i", ",", "c", "in", "enumerate", "(", "s", ".", "split", "(", "'/'", ")", ")", ":", "if", "c", ":", "vt", "[", "i", "]", "=", "int", "...
Parse vertex indices in '/' separated form (like 'i/j/k', 'i//k' ...).
[ "Parse", "vertex", "indices", "in", "/", "separated", "form", "(", "like", "i", "/", "j", "/", "k", "i", "//", "k", "...", ")", "." ]
python
train
mozilla-iot/webthing-python
webthing/utils.py
https://github.com/mozilla-iot/webthing-python/blob/65d467c89ed79d0bbc42b8b3c8f9e5a320edd237/webthing/utils.py#L17-L32
def get_ip(): """ Get the default local IP address. From: https://stackoverflow.com/a/28950776 """ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: s.connect(('10.255.255.255', 1)) ip = s.getsockname()[0] except (socket.error, IndexError): ip = '127.0.0.1' ...
[ "def", "get_ip", "(", ")", ":", "s", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_DGRAM", ")", "try", ":", "s", ".", "connect", "(", "(", "'10.255.255.255'", ",", "1", ")", ")", "ip", "=", "s", ".", "gets...
Get the default local IP address. From: https://stackoverflow.com/a/28950776
[ "Get", "the", "default", "local", "IP", "address", "." ]
python
test
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/namespace_range.py
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/namespace_range.py#L305-L322
def normalized_start(self): """Returns a NamespaceRange with leading non-existant namespaces removed. Returns: A copy of this NamespaceRange whose namespace_start is adjusted to exclude the portion of the range that contains no actual namespaces in the datastore. None is returned if the Names...
[ "def", "normalized_start", "(", "self", ")", ":", "namespaces_after_key", "=", "list", "(", "self", ".", "make_datastore_query", "(", ")", ".", "Run", "(", "limit", "=", "1", ")", ")", "if", "not", "namespaces_after_key", ":", "return", "None", "namespace_af...
Returns a NamespaceRange with leading non-existant namespaces removed. Returns: A copy of this NamespaceRange whose namespace_start is adjusted to exclude the portion of the range that contains no actual namespaces in the datastore. None is returned if the NamespaceRange contains no actual ...
[ "Returns", "a", "NamespaceRange", "with", "leading", "non", "-", "existant", "namespaces", "removed", "." ]
python
train
tanghaibao/jcvi
jcvi/assembly/geneticmap.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/assembly/geneticmap.py#L206-L292
def dotplot(args): """ %prog dotplot map.csv ref.fasta Make dotplot between chromosomes and linkage maps. The input map is csv formatted, for example: ScaffoldID,ScaffoldPosition,LinkageGroup,GeneticPosition scaffold_2707,11508,1,0 scaffold_2707,11525,1,1.2 """ from jcvi.assembly.a...
[ "def", "dotplot", "(", "args", ")", ":", "from", "jcvi", ".", "assembly", ".", "allmaps", "import", "CSVMapLine", "from", "jcvi", ".", "formats", ".", "sizes", "import", "Sizes", "from", "jcvi", ".", "utils", ".", "natsort", "import", "natsorted", "from", ...
%prog dotplot map.csv ref.fasta Make dotplot between chromosomes and linkage maps. The input map is csv formatted, for example: ScaffoldID,ScaffoldPosition,LinkageGroup,GeneticPosition scaffold_2707,11508,1,0 scaffold_2707,11525,1,1.2
[ "%prog", "dotplot", "map", ".", "csv", "ref", ".", "fasta" ]
python
train
softlayer/softlayer-python
SoftLayer/managers/dedicated_host.py
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/dedicated_host.py#L313-L326
def verify_order(self, hostname, domain, location, hourly, flavor, router=None): """Verifies an order for a dedicated host. See :func:`place_order` for a list of available options. """ create_options = self._generate_create_dict(hostname=hostname, ...
[ "def", "verify_order", "(", "self", ",", "hostname", ",", "domain", ",", "location", ",", "hourly", ",", "flavor", ",", "router", "=", "None", ")", ":", "create_options", "=", "self", ".", "_generate_create_dict", "(", "hostname", "=", "hostname", ",", "ro...
Verifies an order for a dedicated host. See :func:`place_order` for a list of available options.
[ "Verifies", "an", "order", "for", "a", "dedicated", "host", "." ]
python
train
AkihikoITOH/capybara
capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/build_py.py
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/setuptools/command/build_py.py#L141-L171
def check_package(self, package, package_dir): """Check namespace packages' __init__ for declare_namespace""" try: return self.packages_checked[package] except KeyError: pass init_py = orig.build_py.check_package(self, package, package_dir) self.packages_...
[ "def", "check_package", "(", "self", ",", "package", ",", "package_dir", ")", ":", "try", ":", "return", "self", ".", "packages_checked", "[", "package", "]", "except", "KeyError", ":", "pass", "init_py", "=", "orig", ".", "build_py", ".", "check_package", ...
Check namespace packages' __init__ for declare_namespace
[ "Check", "namespace", "packages", "__init__", "for", "declare_namespace" ]
python
test
secdev/scapy
scapy/layers/radius.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/radius.py#L566-L575
def compute_message_authenticator(radius_packet, packed_req_authenticator, shared_secret): """ Computes the "Message-Authenticator" of a given RADIUS packet. """ data = prepare_packed_data(radius_packet, packed_req_authenticator) radius_hmac...
[ "def", "compute_message_authenticator", "(", "radius_packet", ",", "packed_req_authenticator", ",", "shared_secret", ")", ":", "data", "=", "prepare_packed_data", "(", "radius_packet", ",", "packed_req_authenticator", ")", "radius_hmac", "=", "hmac", ".", "new", "(", ...
Computes the "Message-Authenticator" of a given RADIUS packet.
[ "Computes", "the", "Message", "-", "Authenticator", "of", "a", "given", "RADIUS", "packet", "." ]
python
train
crunchyroll/ef-open
efopen/ef_cf_diff.py
https://github.com/crunchyroll/ef-open/blob/59fff3761af07a59f8f1c1682f2be004bdac15f7/efopen/ef_cf_diff.py#L328-L363
def get_dict_registry_services(registry, template_files, warn_missing_files=True): """ Return a dict mapping service name to a dict containing the service's type ('fixtures', 'platform_services', 'application_services', 'internal_services'), the template file's absolute path, and a list of environments ...
[ "def", "get_dict_registry_services", "(", "registry", ",", "template_files", ",", "warn_missing_files", "=", "True", ")", ":", "with", "open", "(", "registry", ")", "as", "fr", ":", "parsed_registry", "=", "json", ".", "load", "(", "fr", ")", "services", "="...
Return a dict mapping service name to a dict containing the service's type ('fixtures', 'platform_services', 'application_services', 'internal_services'), the template file's absolute path, and a list of environments to which the service is intended to deploy. Service names that appear twice in the out...
[ "Return", "a", "dict", "mapping", "service", "name", "to", "a", "dict", "containing", "the", "service", "s", "type", "(", "fixtures", "platform_services", "application_services", "internal_services", ")", "the", "template", "file", "s", "absolute", "path", "and", ...
python
train
wheeler-microfluidics/dmf-control-board-firmware
dmf_control_board_firmware/__init__.py
https://github.com/wheeler-microfluidics/dmf-control-board-firmware/blob/1cd8cc9a148d530f9a11f634f2dbfe73f08aa27c/dmf_control_board_firmware/__init__.py#L2361-L2387
def write_all_series_channel_values(self, read_f, write_f, channel, values): ''' Return all values for the specified channel of the type corresponding to the function `f`, where `f` is either `self.series_resistance` or `self.series_capacitance`. ...
[ "def", "write_all_series_channel_values", "(", "self", ",", "read_f", ",", "write_f", ",", "channel", ",", "values", ")", ":", "# Create a copy of the new values we intend to write. Otherwise, if", "# `values` is a reference to the calibration object owned by the", "# control board, ...
Return all values for the specified channel of the type corresponding to the function `f`, where `f` is either `self.series_resistance` or `self.series_capacitance`.
[ "Return", "all", "values", "for", "the", "specified", "channel", "of", "the", "type", "corresponding", "to", "the", "function", "f", "where", "f", "is", "either", "self", ".", "series_resistance", "or", "self", ".", "series_capacitance", "." ]
python
train
log2timeline/dfdatetime
dfdatetime/interface.py
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L630-L642
def _GetDateValuesWithEpoch(self, number_of_days, date_time_epoch): """Determines date values. Args: number_of_days (int): number of days since epoch. date_time_epoch (DateTimeEpoch): date and time of the epoch. Returns: tuple[int, int, int]: year, month, day of month. """ retur...
[ "def", "_GetDateValuesWithEpoch", "(", "self", ",", "number_of_days", ",", "date_time_epoch", ")", ":", "return", "self", ".", "_GetDateValues", "(", "number_of_days", ",", "date_time_epoch", ".", "year", ",", "date_time_epoch", ".", "month", ",", "date_time_epoch",...
Determines date values. Args: number_of_days (int): number of days since epoch. date_time_epoch (DateTimeEpoch): date and time of the epoch. Returns: tuple[int, int, int]: year, month, day of month.
[ "Determines", "date", "values", "." ]
python
train
tradenity/python-sdk
tradenity/resources/states_geo_zone.py
https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/states_geo_zone.py#L426-L446
def delete_states_geo_zone_by_id(cls, states_geo_zone_id, **kwargs): """Delete StatesGeoZone Delete an instance of StatesGeoZone by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.dele...
[ "def", "delete_states_geo_zone_by_id", "(", "cls", ",", "states_geo_zone_id", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async'", ")", ":", "return", "cls", ".", "_delete...
Delete StatesGeoZone Delete an instance of StatesGeoZone by its ID. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.delete_states_geo_zone_by_id(states_geo_zone_id, async=True) >>> result = th...
[ "Delete", "StatesGeoZone" ]
python
train
fermiPy/fermipy
fermipy/wcs_utils.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/wcs_utils.py#L123-L182
def create_wcs(skydir, coordsys='CEL', projection='AIT', cdelt=1.0, crpix=1., naxis=2, energies=None): """Create a WCS object. Parameters ---------- skydir : `~astropy.coordinates.SkyCoord` Sky coordinate of the WCS reference point. coordsys : str projection : str c...
[ "def", "create_wcs", "(", "skydir", ",", "coordsys", "=", "'CEL'", ",", "projection", "=", "'AIT'", ",", "cdelt", "=", "1.0", ",", "crpix", "=", "1.", ",", "naxis", "=", "2", ",", "energies", "=", "None", ")", ":", "w", "=", "WCS", "(", "naxis", ...
Create a WCS object. Parameters ---------- skydir : `~astropy.coordinates.SkyCoord` Sky coordinate of the WCS reference point. coordsys : str projection : str cdelt : float or (float,float) In the first case the same value is used for x and y axes crpix : float or (float,f...
[ "Create", "a", "WCS", "object", "." ]
python
train
itamarst/eliot
eliot/_output.py
https://github.com/itamarst/eliot/blob/c03c96520c5492fadfc438b4b0f6336e2785ba2d/eliot/_output.py#L472-L480
def to_file(output_file, encoder=EliotJSONEncoder): """ Add a destination that writes a JSON message per line to the given file. @param output_file: A file-like object. """ Logger._destinations.add( FileDestination(file=output_file, encoder=encoder) )
[ "def", "to_file", "(", "output_file", ",", "encoder", "=", "EliotJSONEncoder", ")", ":", "Logger", ".", "_destinations", ".", "add", "(", "FileDestination", "(", "file", "=", "output_file", ",", "encoder", "=", "encoder", ")", ")" ]
Add a destination that writes a JSON message per line to the given file. @param output_file: A file-like object.
[ "Add", "a", "destination", "that", "writes", "a", "JSON", "message", "per", "line", "to", "the", "given", "file", "." ]
python
train
dereneaton/ipyrad
ipyrad/assemble/rawedit.py
https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/rawedit.py#L648-L686
def concat_multiple_inputs(data, sample): """ If multiple fastq files were appended into the list of fastqs for samples then we merge them here before proceeding. """ ## if more than one tuple in fastq list if len(sample.files.fastqs) > 1: ## create a cat command to append them all (d...
[ "def", "concat_multiple_inputs", "(", "data", ",", "sample", ")", ":", "## if more than one tuple in fastq list", "if", "len", "(", "sample", ".", "files", ".", "fastqs", ")", ">", "1", ":", "## create a cat command to append them all (doesn't matter if they ", "## are gz...
If multiple fastq files were appended into the list of fastqs for samples then we merge them here before proceeding.
[ "If", "multiple", "fastq", "files", "were", "appended", "into", "the", "list", "of", "fastqs", "for", "samples", "then", "we", "merge", "them", "here", "before", "proceeding", "." ]
python
valid
twilio/twilio-python
twilio/rest/preview/sync/service/document/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/preview/sync/service/document/__init__.py#L296-L309
def document_permissions(self): """ Access the document_permissions :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionList :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionList """ if self._do...
[ "def", "document_permissions", "(", "self", ")", ":", "if", "self", ".", "_document_permissions", "is", "None", ":", "self", ".", "_document_permissions", "=", "DocumentPermissionList", "(", "self", ".", "_version", ",", "service_sid", "=", "self", ".", "_soluti...
Access the document_permissions :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionList :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionList
[ "Access", "the", "document_permissions" ]
python
train
delph-in/pydelphin
delphin/repp.py
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/repp.py#L282-L340
def from_config(cls, path, directory=None): """ Instantiate a REPP from a PET-style `.set` configuration file. The *path* parameter points to the configuration file. Submodules are loaded from *directory*. If *directory* is not given, it is the directory part of *path*. ...
[ "def", "from_config", "(", "cls", ",", "path", ",", "directory", "=", "None", ")", ":", "if", "not", "exists", "(", "path", ")", ":", "raise", "REPPError", "(", "'REPP config file not found: {}'", ".", "format", "(", "path", ")", ")", "confdir", "=", "di...
Instantiate a REPP from a PET-style `.set` configuration file. The *path* parameter points to the configuration file. Submodules are loaded from *directory*. If *directory* is not given, it is the directory part of *path*. Args: path (str): the path to the REPP configuratio...
[ "Instantiate", "a", "REPP", "from", "a", "PET", "-", "style", ".", "set", "configuration", "file", "." ]
python
train
c0ntrol-x/p4rr0t007
p4rr0t007/lib/core.py
https://github.com/c0ntrol-x/p4rr0t007/blob/6fe88ec1231a778b9f1d13bc61332581715d646e/p4rr0t007/lib/core.py#L27-L37
def colorize_logger(logger, stream=None, level=logging.DEBUG): """resets the handlers and formatters in a given logger, and sets it up with Colorful() logs """ logger.handlers = [] logger.filters = [] stream = stream or sys.stderr handler = logging.StreamHandler(stream=stream) handler.setLev...
[ "def", "colorize_logger", "(", "logger", ",", "stream", "=", "None", ",", "level", "=", "logging", ".", "DEBUG", ")", ":", "logger", ".", "handlers", "=", "[", "]", "logger", ".", "filters", "=", "[", "]", "stream", "=", "stream", "or", "sys", ".", ...
resets the handlers and formatters in a given logger, and sets it up with Colorful() logs
[ "resets", "the", "handlers", "and", "formatters", "in", "a", "given", "logger", "and", "sets", "it", "up", "with", "Colorful", "()", "logs" ]
python
train
chaoss/grimoirelab-perceval
perceval/backends/core/redmine.py
https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/redmine.py#L411-L424
def sanitize_for_archive(url, headers, payload): """Sanitize payload of a HTTP request by removing the token information before storing/retrieving archived items :param: url: HTTP url request :param: headers: HTTP headers request :param: payload: HTTP payload request :r...
[ "def", "sanitize_for_archive", "(", "url", ",", "headers", ",", "payload", ")", ":", "if", "RedmineClient", ".", "PKEY", "in", "payload", ":", "payload", ".", "pop", "(", "RedmineClient", ".", "PKEY", ")", "return", "url", ",", "headers", ",", "payload" ]
Sanitize payload of a HTTP request by removing the token information before storing/retrieving archived items :param: url: HTTP url request :param: headers: HTTP headers request :param: payload: HTTP payload request :returns url, headers and the sanitized payload
[ "Sanitize", "payload", "of", "a", "HTTP", "request", "by", "removing", "the", "token", "information", "before", "storing", "/", "retrieving", "archived", "items" ]
python
test
coinbase/coinbase-python
coinbase/wallet/client.py
https://github.com/coinbase/coinbase-python/blob/497c28158f529e8c7d0228521b4386a890baf088/coinbase/wallet/client.py#L273-L276
def get_accounts(self, **params): """https://developers.coinbase.com/api/v2#list-accounts""" response = self._get('v2', 'accounts', params=params) return self._make_api_object(response, Account)
[ "def", "get_accounts", "(", "self", ",", "*", "*", "params", ")", ":", "response", "=", "self", ".", "_get", "(", "'v2'", ",", "'accounts'", ",", "params", "=", "params", ")", "return", "self", ".", "_make_api_object", "(", "response", ",", "Account", ...
https://developers.coinbase.com/api/v2#list-accounts
[ "https", ":", "//", "developers", ".", "coinbase", ".", "com", "/", "api", "/", "v2#list", "-", "accounts" ]
python
train
mobolic/facebook-sdk
facebook/__init__.py
https://github.com/mobolic/facebook-sdk/blob/65ff582e77f7ed68b6e9643a7490e5dee2a1031b/facebook/__init__.py#L126-L131
def get_permissions(self, user_id): """Fetches the permissions object from the graph.""" response = self.request( "{0}/{1}/permissions".format(self.version, user_id), {} )["data"] return {x["permission"] for x in response if x["status"] == "granted"}
[ "def", "get_permissions", "(", "self", ",", "user_id", ")", ":", "response", "=", "self", ".", "request", "(", "\"{0}/{1}/permissions\"", ".", "format", "(", "self", ".", "version", ",", "user_id", ")", ",", "{", "}", ")", "[", "\"data\"", "]", "return",...
Fetches the permissions object from the graph.
[ "Fetches", "the", "permissions", "object", "from", "the", "graph", "." ]
python
train
AtomHash/evernode
evernode/classes/form_data.py
https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/classes/form_data.py#L90-L103
def __get_file(self, file): """ Get request file and do a security check """ file_object = None if file['name'] in request.files: file_object = request.files[file['name']] clean_filename = secure_filename(file_object.filename) if clean_filename == '': ...
[ "def", "__get_file", "(", "self", ",", "file", ")", ":", "file_object", "=", "None", "if", "file", "[", "'name'", "]", "in", "request", ".", "files", ":", "file_object", "=", "request", ".", "files", "[", "file", "[", "'name'", "]", "]", "clean_filenam...
Get request file and do a security check
[ "Get", "request", "file", "and", "do", "a", "security", "check" ]
python
train
codeforamerica/epa_python
epa/pcs/pcs.py
https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/pcs/pcs.py#L46-L56
def code_description(self, column=None, value=None, **kwargs): """ The Permit Compliance System (PCS) records milestones, events, and many other parameters in code format. To provide text descriptions that explain the code meanings, the PCS_CODE_DESC provide s complete informatio...
[ "def", "code_description", "(", "self", ",", "column", "=", "None", ",", "value", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_resolve_call", "(", "'PCS_CODE_DESC'", ",", "column", ",", "value", ",", "*", "*", "kwargs", ")" ...
The Permit Compliance System (PCS) records milestones, events, and many other parameters in code format. To provide text descriptions that explain the code meanings, the PCS_CODE_DESC provide s complete information on all types of codes, and for each type, the text description of each po...
[ "The", "Permit", "Compliance", "System", "(", "PCS", ")", "records", "milestones", "events", "and", "many", "other", "parameters", "in", "code", "format", ".", "To", "provide", "text", "descriptions", "that", "explain", "the", "code", "meanings", "the", "PCS_C...
python
train
softlayer/softlayer-python
SoftLayer/CLI/environment.py
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/environment.py#L41-L43
def out(self, output, newline=True): """Outputs a string to the console (stdout).""" click.echo(output, nl=newline)
[ "def", "out", "(", "self", ",", "output", ",", "newline", "=", "True", ")", ":", "click", ".", "echo", "(", "output", ",", "nl", "=", "newline", ")" ]
Outputs a string to the console (stdout).
[ "Outputs", "a", "string", "to", "the", "console", "(", "stdout", ")", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/data_generators/cnn_dailymail.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/data_generators/cnn_dailymail.py#L137-L173
def example_generator(all_files, urls_path, sum_token): """Generate examples.""" def fix_run_on_sents(line): if u"@highlight" in line: return line if not line: return line if line[-1] in END_TOKENS: return line return line + u"." filelist = example_splits(urls_path, all_files) ...
[ "def", "example_generator", "(", "all_files", ",", "urls_path", ",", "sum_token", ")", ":", "def", "fix_run_on_sents", "(", "line", ")", ":", "if", "u\"@highlight\"", "in", "line", ":", "return", "line", "if", "not", "line", ":", "return", "line", "if", "l...
Generate examples.
[ "Generate", "examples", "." ]
python
train
richardkiss/pycoin
pycoin/services/blockexplorer.py
https://github.com/richardkiss/pycoin/blob/1e8d0d9fe20ce0347b97847bb529cd1bd84c7442/pycoin/services/blockexplorer.py#L15-L24
def tx_for_tx_hash(self, tx_hash): """ Get a Tx by its hash. """ url = "%s/rawtx/%s" % (self.url, b2h_rev(tx_hash)) d = urlopen(url).read() j = json.loads(d.decode("utf8")) tx = Tx.from_hex(j.get("rawtx", "")) if tx.hash() == tx_hash: return tx
[ "def", "tx_for_tx_hash", "(", "self", ",", "tx_hash", ")", ":", "url", "=", "\"%s/rawtx/%s\"", "%", "(", "self", ".", "url", ",", "b2h_rev", "(", "tx_hash", ")", ")", "d", "=", "urlopen", "(", "url", ")", ".", "read", "(", ")", "j", "=", "json", ...
Get a Tx by its hash.
[ "Get", "a", "Tx", "by", "its", "hash", "." ]
python
train
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_arp.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_arp.py#L12-L22
def hide_arp_holder_system_max_arp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") hide_arp_holder = ET.SubElement(config, "hide-arp-holder", xmlns="urn:brocade.com:mgmt:brocade-arp") system_max = ET.SubElement(hide_arp_holder, "system-max") arp ...
[ "def", "hide_arp_holder_system_max_arp", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "hide_arp_holder", "=", "ET", ".", "SubElement", "(", "config", ",", "\"hide-arp-holder\"", ",", "xmlns", "=...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
nimeshkverma/mongo_joins
mongojoin/processdata.py
https://github.com/nimeshkverma/mongo_joins/blob/64c416c3402d5906f707b73867fbc55e28d5ec37/mongojoin/processdata.py#L40-L71
def build_pipeline(self, collection): """ Creates aggregation pipeline for aggregation :param collection: Mongo collection for aggregation :type collection: MongoCollection :return pipeline: list of dicts """ pipeline = [] if isinstance(...
[ "def", "build_pipeline", "(", "self", ",", "collection", ")", ":", "pipeline", "=", "[", "]", "if", "isinstance", "(", "collection", ".", "where_dict", ",", "dict", ")", "and", "collection", ".", "where_dict", ":", "match_dict", "=", "{", "\"$match\"", ":"...
Creates aggregation pipeline for aggregation :param collection: Mongo collection for aggregation :type collection: MongoCollection :return pipeline: list of dicts
[ "Creates", "aggregation", "pipeline", "for", "aggregation", ":", "param", "collection", ":", "Mongo", "collection", "for", "aggregation", ":", "type", "collection", ":", "MongoCollection" ]
python
train
common-workflow-language/schema_salad
schema_salad/schema.py
https://github.com/common-workflow-language/schema_salad/blob/608ba207b9058fe0a9c3db161058ab3782eef015/schema_salad/schema.py#L506-L591
def extend_and_specialize(items, loader): # type: (List[Dict[Text, Any]], Loader) -> List[Dict[Text, Any]] """ Apply 'extend' and 'specialize' to fully materialize derived record types. """ items = deepcopy_strip(items) types = {i["name"]: i for i in items} # type: Dict[Text, Any] results ...
[ "def", "extend_and_specialize", "(", "items", ",", "loader", ")", ":", "# type: (List[Dict[Text, Any]], Loader) -> List[Dict[Text, Any]]", "items", "=", "deepcopy_strip", "(", "items", ")", "types", "=", "{", "i", "[", "\"name\"", "]", ":", "i", "for", "i", "in", ...
Apply 'extend' and 'specialize' to fully materialize derived record types.
[ "Apply", "extend", "and", "specialize", "to", "fully", "materialize", "derived", "record", "types", "." ]
python
train
bukun/TorCMS
torcms/handlers/post_handler.py
https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/post_handler.py#L711-L724
def _change_kind(self, post_uid): ''' To modify the category of the post, and kind. ''' post_data = self.get_post_data() logger.info('admin post update: {0}'.format(post_data)) MPost.update_misc(post_uid, kind=post_data['kcat']) # self.update_category(post_uid)...
[ "def", "_change_kind", "(", "self", ",", "post_uid", ")", ":", "post_data", "=", "self", ".", "get_post_data", "(", ")", "logger", ".", "info", "(", "'admin post update: {0}'", ".", "format", "(", "post_data", ")", ")", "MPost", ".", "update_misc", "(", "p...
To modify the category of the post, and kind.
[ "To", "modify", "the", "category", "of", "the", "post", "and", "kind", "." ]
python
train
Azure/azure-cli-extensions
src/interactive/azext_interactive/azclishell/gather_commands.py
https://github.com/Azure/azure-cli-extensions/blob/3d4854205b0f0d882f688cfa12383d14506c2e35/src/interactive/azext_interactive/azclishell/gather_commands.py#L165-L173
def get_all_subcommands(self): """ returns all the subcommands """ subcommands = [] for command in self.descrip: for word in command.split(): for kid in self.command_tree.children: if word != kid and word not in subcommands: ...
[ "def", "get_all_subcommands", "(", "self", ")", ":", "subcommands", "=", "[", "]", "for", "command", "in", "self", ".", "descrip", ":", "for", "word", "in", "command", ".", "split", "(", ")", ":", "for", "kid", "in", "self", ".", "command_tree", ".", ...
returns all the subcommands
[ "returns", "all", "the", "subcommands" ]
python
train
secdev/scapy
scapy/utils.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/utils.py#L51-L69
def get_temp_file(keep=False, autoext="", fd=False): """Creates a temporary file. :param keep: If False, automatically delete the file when Scapy exits. :param autoext: Suffix to add to the generated file name. :param fd: If True, this returns a file-like object with the temporary file o...
[ "def", "get_temp_file", "(", "keep", "=", "False", ",", "autoext", "=", "\"\"", ",", "fd", "=", "False", ")", ":", "f", "=", "tempfile", ".", "NamedTemporaryFile", "(", "prefix", "=", "\"scapy\"", ",", "suffix", "=", "autoext", ",", "delete", "=", "Fal...
Creates a temporary file. :param keep: If False, automatically delete the file when Scapy exits. :param autoext: Suffix to add to the generated file name. :param fd: If True, this returns a file-like object with the temporary file opened. If False (default), this returns a file path.
[ "Creates", "a", "temporary", "file", "." ]
python
train
apetrynet/pyfilemail
pyfilemail/transfer.py
https://github.com/apetrynet/pyfilemail/blob/eb81b0e69ff42f4335d5298833e4769b750bf397/pyfilemail/transfer.py#L581-L626
def update(self, message=None, subject=None, days=None, downloads=None, notify=None): """Update properties for a transfer. :param message: updated message to recipient(s) :param subject: updated subject for trasfer ...
[ "def", "update", "(", "self", ",", "message", "=", "None", ",", "subject", "=", "None", ",", "days", "=", "None", ",", "downloads", "=", "None", ",", "notify", "=", "None", ")", ":", "method", ",", "url", "=", "get_URL", "(", "'update'", ")", "payl...
Update properties for a transfer. :param message: updated message to recipient(s) :param subject: updated subject for trasfer :param days: updated amount of days transfer is available :param downloads: update amount of downloads allowed for transfer :param notify: update whether...
[ "Update", "properties", "for", "a", "transfer", "." ]
python
train
CyberReboot/vent
vent/api/tools.py
https://github.com/CyberReboot/vent/blob/9956a09146b11a89a0eabab3bc7ce8906d124885/vent/api/tools.py#L90-L145
def inventory(self, choices=None): """ Return a dictionary of the inventory items and status """ status = (True, None) if not choices: return (False, 'No choices made') try: # choices: repos, tools, images, built, running, enabled items = {'repos': [],...
[ "def", "inventory", "(", "self", ",", "choices", "=", "None", ")", ":", "status", "=", "(", "True", ",", "None", ")", "if", "not", "choices", ":", "return", "(", "False", ",", "'No choices made'", ")", "try", ":", "# choices: repos, tools, images, built, run...
Return a dictionary of the inventory items and status
[ "Return", "a", "dictionary", "of", "the", "inventory", "items", "and", "status" ]
python
train
inveniosoftware/invenio-base
invenio_base/app.py
https://github.com/inveniosoftware/invenio-base/blob/ed4b7a76516ab2675e19270844400f4e2308f52d/invenio_base/app.py#L282-L297
def configure_warnings(): """Configure warnings by routing warnings to the logging system. It also unhides ``DeprecationWarning``. .. versionadded: 1.0.0 """ if not sys.warnoptions: # Route warnings through python logging logging.captureWarnings(True) # DeprecationWarning ...
[ "def", "configure_warnings", "(", ")", ":", "if", "not", "sys", ".", "warnoptions", ":", "# Route warnings through python logging", "logging", ".", "captureWarnings", "(", "True", ")", "# DeprecationWarning is by default hidden, hence we force the", "# 'default' behavior on dep...
Configure warnings by routing warnings to the logging system. It also unhides ``DeprecationWarning``. .. versionadded: 1.0.0
[ "Configure", "warnings", "by", "routing", "warnings", "to", "the", "logging", "system", "." ]
python
train
buckmaxwell/neoapi
neoapi/serializable_structured_node.py
https://github.com/buckmaxwell/neoapi/blob/96c5d83c847d7a12d3d1f17931d85776f5280877/neoapi/serializable_structured_node.py#L891-L930
def create_relationships(cls, id, related_collection_name, request_json): r""" Used to create relationship(s) between the id node and the nodes identified in the included resource \ identifier objects. :param id: The 'id' field of the node on the left side of the relationship in the dat...
[ "def", "create_relationships", "(", "cls", ",", "id", ",", "related_collection_name", ",", "request_json", ")", ":", "try", ":", "this_resource", "=", "cls", ".", "nodes", ".", "get", "(", "id", "=", "id", ",", "active", "=", "True", ")", "related_collecti...
r""" Used to create relationship(s) between the id node and the nodes identified in the included resource \ identifier objects. :param id: The 'id' field of the node on the left side of the relationship in the database. The id field must \ be set in the model -- it is not the same as t...
[ "r", "Used", "to", "create", "relationship", "(", "s", ")", "between", "the", "id", "node", "and", "the", "nodes", "identified", "in", "the", "included", "resource", "\\", "identifier", "objects", "." ]
python
train
Esri/ArcREST
src/arcrest/enrichment/_geoenrichment.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/enrichment/_geoenrichment.py#L129-L145
def __geometryToDict(self, geom): """converts a geometry object to a dictionary""" if isinstance(geom, dict): return geom elif isinstance(geom, Point): pt = geom.asDictionary return {"geometry": {"x" : pt['x'], "y" : pt['y']}} elif isinstance(geom, Pol...
[ "def", "__geometryToDict", "(", "self", ",", "geom", ")", ":", "if", "isinstance", "(", "geom", ",", "dict", ")", ":", "return", "geom", "elif", "isinstance", "(", "geom", ",", "Point", ")", ":", "pt", "=", "geom", ".", "asDictionary", "return", "{", ...
converts a geometry object to a dictionary
[ "converts", "a", "geometry", "object", "to", "a", "dictionary" ]
python
train
klmitch/requiem
requiem/processor.py
https://github.com/klmitch/requiem/blob/0b3b5252e1b3487af732a8666b3bdc2e7035fef5/requiem/processor.py#L57-L69
def _safe_call(obj, methname, *args, **kwargs): """ Safely calls the method with the given methname on the given object. Remaining positional and keyword arguments are passed to the method. The return value is None, if the method is not available, or the return value of the method. """ me...
[ "def", "_safe_call", "(", "obj", ",", "methname", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "meth", "=", "getattr", "(", "obj", ",", "methname", ",", "None", ")", "if", "meth", "is", "None", "or", "not", "callable", "(", "meth", ")", "...
Safely calls the method with the given methname on the given object. Remaining positional and keyword arguments are passed to the method. The return value is None, if the method is not available, or the return value of the method.
[ "Safely", "calls", "the", "method", "with", "the", "given", "methname", "on", "the", "given", "object", ".", "Remaining", "positional", "and", "keyword", "arguments", "are", "passed", "to", "the", "method", ".", "The", "return", "value", "is", "None", "if", ...
python
train
tBaxter/tango-shared-core
build/lib/tango_shared/templatetags/formatting.py
https://github.com/tBaxter/tango-shared-core/blob/35fc10aef1ceedcdb4d6d866d44a22efff718812/build/lib/tango_shared/templatetags/formatting.py#L36-L72
def humanized_join(value, add_links=False): """ Given a list of strings, format them with commas and spaces, but with 'and' at the end. >>> humanized_join(['apples', 'oranges', 'pears']) "apples, oranges, and pears" In a template, if mylist = ['apples', 'oranges', 'pears'] then {{ mylist|h...
[ "def", "humanized_join", "(", "value", ",", "add_links", "=", "False", ")", ":", "if", "add_links", ":", "try", ":", "value", "=", "[", "'<a href=\"%s\">%s</a>'", "%", "(", "item", ".", "get_absolute_url", "(", ")", ",", "item", ")", "for", "item", "in",...
Given a list of strings, format them with commas and spaces, but with 'and' at the end. >>> humanized_join(['apples', 'oranges', 'pears']) "apples, oranges, and pears" In a template, if mylist = ['apples', 'oranges', 'pears'] then {{ mylist|humanized_join }} will output "apples, oranges, and p...
[ "Given", "a", "list", "of", "strings", "format", "them", "with", "commas", "and", "spaces", "but", "with", "and", "at", "the", "end", "." ]
python
train
saltstack/salt
salt/modules/github.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/github.py#L259-L292
def add_user(name, profile='github'): ''' Add a GitHub user. name The user for which to obtain information. profile The name of the profile configuration to use. Defaults to ``github``. CLI Example: .. code-block:: bash salt myminion github.add_user github-handle ...
[ "def", "add_user", "(", "name", ",", "profile", "=", "'github'", ")", ":", "client", "=", "_get_client", "(", "profile", ")", "organization", "=", "client", ".", "get_organization", "(", "_get_config_value", "(", "profile", ",", "'org_name'", ")", ")", "try"...
Add a GitHub user. name The user for which to obtain information. profile The name of the profile configuration to use. Defaults to ``github``. CLI Example: .. code-block:: bash salt myminion github.add_user github-handle
[ "Add", "a", "GitHub", "user", "." ]
python
train
maxpumperla/elephas
examples/hyperparam_optimization.py
https://github.com/maxpumperla/elephas/blob/84605acdc9564673c487637dcb27f5def128bcc7/examples/hyperparam_optimization.py#L10-L29
def data(): """Data providing function: Make sure to have every relevant import statement included here and return data as used in model function below. This function is separated from model() so that hyperopt won't reload data for each evaluation run. """ from keras.datasets import mnist f...
[ "def", "data", "(", ")", ":", "from", "keras", ".", "datasets", "import", "mnist", "from", "keras", ".", "utils", "import", "np_utils", "(", "x_train", ",", "y_train", ")", ",", "(", "x_test", ",", "y_test", ")", "=", "mnist", ".", "load_data", "(", ...
Data providing function: Make sure to have every relevant import statement included here and return data as used in model function below. This function is separated from model() so that hyperopt won't reload data for each evaluation run.
[ "Data", "providing", "function", ":" ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_system_monitor.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_system_monitor.py#L64-L75
def system_monitor_power_threshold_marginal_threshold(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") system_monitor = ET.SubElement(config, "system-monitor", xmlns="urn:brocade.com:mgmt:brocade-system-monitor") power = ET.SubElement(system_monitor, "pow...
[ "def", "system_monitor_power_threshold_marginal_threshold", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "system_monitor", "=", "ET", ".", "SubElement", "(", "config", ",", "\"system-monitor\"", ","...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
Swind/pure-python-adb
adb/sync/__init__.py
https://github.com/Swind/pure-python-adb/blob/8e076bc2b25ad33b6c5eb14293329a017d83455f/adb/sync/__init__.py#L95-L108
def _send_str(self, cmd, args): """ Format: {Command}{args length(little endian)}{str} Length: {4}{4}{str length} """ logger.debug("{} {}".format(cmd, args)) args = args.encode('utf-8') le_args_len = self._little_endian(len(args)) ...
[ "def", "_send_str", "(", "self", ",", "cmd", ",", "args", ")", ":", "logger", ".", "debug", "(", "\"{} {}\"", ".", "format", "(", "cmd", ",", "args", ")", ")", "args", "=", "args", ".", "encode", "(", "'utf-8'", ")", "le_args_len", "=", "self", "."...
Format: {Command}{args length(little endian)}{str} Length: {4}{4}{str length}
[ "Format", ":", "{", "Command", "}", "{", "args", "length", "(", "little", "endian", ")", "}", "{", "str", "}", "Length", ":", "{", "4", "}", "{", "4", "}", "{", "str", "length", "}" ]
python
train
chaimleib/intervaltree
intervaltree/intervaltree.py
https://github.com/chaimleib/intervaltree/blob/ffb2b1667f8b832e89324a75a175be8440504c9d/intervaltree/intervaltree.py#L380-L391
def discard(self, interval): """ Removes an interval from the tree, if present. If not, does nothing. Completes in O(log n) time. """ if interval not in self: return self.all_intervals.discard(interval) self.top_node = self.top_node.discard(in...
[ "def", "discard", "(", "self", ",", "interval", ")", ":", "if", "interval", "not", "in", "self", ":", "return", "self", ".", "all_intervals", ".", "discard", "(", "interval", ")", "self", ".", "top_node", "=", "self", ".", "top_node", ".", "discard", "...
Removes an interval from the tree, if present. If not, does nothing. Completes in O(log n) time.
[ "Removes", "an", "interval", "from", "the", "tree", "if", "present", ".", "If", "not", "does", "nothing", "." ]
python
train
ThreatConnect-Inc/tcex
tcex/tcex_ti_batch.py
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_ti_batch.py#L579-L592
def data_indicators(self, indicators, entity_count): """Process Indicator data.""" data = [] # process indicator objects for xid, indicator_data in indicators.items(): entity_count += 1 if isinstance(indicator_data, dict): data.append(indicator_dat...
[ "def", "data_indicators", "(", "self", ",", "indicators", ",", "entity_count", ")", ":", "data", "=", "[", "]", "# process indicator objects", "for", "xid", ",", "indicator_data", "in", "indicators", ".", "items", "(", ")", ":", "entity_count", "+=", "1", "i...
Process Indicator data.
[ "Process", "Indicator", "data", "." ]
python
train
linkedin/naarad
src/naarad/utils.py
https://github.com/linkedin/naarad/blob/261e2c0760fd6a6b0ee59064180bd8e3674311fe/src/naarad/utils.py#L137-L158
def get_run_time_period(run_steps): """ This method finds the time range which covers all the Run_Steps :param run_steps: list of Run_Step objects :return: tuple of start and end timestamps """ init_ts_start = get_standardized_timestamp('now', None) ts_start = init_ts_start ts_end = '0' for run_step ...
[ "def", "get_run_time_period", "(", "run_steps", ")", ":", "init_ts_start", "=", "get_standardized_timestamp", "(", "'now'", ",", "None", ")", "ts_start", "=", "init_ts_start", "ts_end", "=", "'0'", "for", "run_step", "in", "run_steps", ":", "if", "run_step", "."...
This method finds the time range which covers all the Run_Steps :param run_steps: list of Run_Step objects :return: tuple of start and end timestamps
[ "This", "method", "finds", "the", "time", "range", "which", "covers", "all", "the", "Run_Steps" ]
python
valid
tcalmant/ipopo
pelix/ipopo/instance.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L415-L475
def kill(self): # type: () -> bool """ This instance is killed : invalidate it if needed, clean up all members When this method is called, this StoredInstance object must have been removed from the registry :return: True if the component has been killed, False if it alr...
[ "def", "kill", "(", "self", ")", ":", "# type: () -> bool", "with", "self", ".", "_lock", ":", "# Already dead...", "if", "self", ".", "state", "==", "StoredInstance", ".", "KILLED", ":", "return", "False", "try", ":", "self", ".", "invalidate", "(", "True...
This instance is killed : invalidate it if needed, clean up all members When this method is called, this StoredInstance object must have been removed from the registry :return: True if the component has been killed, False if it already was
[ "This", "instance", "is", "killed", ":", "invalidate", "it", "if", "needed", "clean", "up", "all", "members" ]
python
train
petrjasek/eve-elastic
eve_elastic/elastic.py
https://github.com/petrjasek/eve-elastic/blob/f146f31b348d22ac5559cf78717b3bb02efcb2d7/eve_elastic/elastic.py#L410-L416
def get_settings(self, index): """Get settings for index. :param index: index name """ settings = self.es.indices.get_settings(index=index) return next(iter(settings.values()))
[ "def", "get_settings", "(", "self", ",", "index", ")", ":", "settings", "=", "self", ".", "es", ".", "indices", ".", "get_settings", "(", "index", "=", "index", ")", "return", "next", "(", "iter", "(", "settings", ".", "values", "(", ")", ")", ")" ]
Get settings for index. :param index: index name
[ "Get", "settings", "for", "index", "." ]
python
train
mrcagney/gtfstk
gtfstk/cleaners.py
https://github.com/mrcagney/gtfstk/blob/c91494e6fefc02523889655a0dc92d1c0eee8d03/gtfstk/cleaners.py#L72-L96
def clean_ids(feed: "Feed") -> "Feed": """ In the given "Feed", strip whitespace from all string IDs and then replace every remaining whitespace chunk with an underscore. Return the resulting "Feed". """ # Alter feed inputs only, and build a new feed from them. # The derived feed attributes,...
[ "def", "clean_ids", "(", "feed", ":", "\"Feed\"", ")", "->", "\"Feed\"", ":", "# Alter feed inputs only, and build a new feed from them.", "# The derived feed attributes, such as feed.trips_i,", "# will be automatically handled when creating the new feed.", "feed", "=", "feed", ".", ...
In the given "Feed", strip whitespace from all string IDs and then replace every remaining whitespace chunk with an underscore. Return the resulting "Feed".
[ "In", "the", "given", "Feed", "strip", "whitespace", "from", "all", "string", "IDs", "and", "then", "replace", "every", "remaining", "whitespace", "chunk", "with", "an", "underscore", ".", "Return", "the", "resulting", "Feed", "." ]
python
train
idank/bashlex
bashlex/parser.py
https://github.com/idank/bashlex/blob/800cb7e3c634eaa3c81f8a8648fd7fd4e27050ac/bashlex/parser.py#L397-L407
def p_compound_list(p): '''compound_list : list | newline_list list1''' if len(p) == 2: p[0] = p[1] else: parts = p[2] if len(parts) > 1: p[0] = ast.node(kind='list', parts=parts, pos=_partsspan(parts)) else: p[0] = parts[0]
[ "def", "p_compound_list", "(", "p", ")", ":", "if", "len", "(", "p", ")", "==", "2", ":", "p", "[", "0", "]", "=", "p", "[", "1", "]", "else", ":", "parts", "=", "p", "[", "2", "]", "if", "len", "(", "parts", ")", ">", "1", ":", "p", "[...
compound_list : list | newline_list list1
[ "compound_list", ":", "list", "|", "newline_list", "list1" ]
python
train
openego/ding0
ding0/grid/mv_grid/solvers/base.py
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/solvers/base.py#L107-L119
def length(self): """Returns the solution length (or cost) Returns ------- float Solution length (or cost). """ length = 0 for r in self._routes: length = length + r.length() return length
[ "def", "length", "(", "self", ")", ":", "length", "=", "0", "for", "r", "in", "self", ".", "_routes", ":", "length", "=", "length", "+", "r", ".", "length", "(", ")", "return", "length" ]
Returns the solution length (or cost) Returns ------- float Solution length (or cost).
[ "Returns", "the", "solution", "length", "(", "or", "cost", ")", "Returns", "-------", "float", "Solution", "length", "(", "or", "cost", ")", "." ]
python
train
yunojuno/elasticsearch-django
elasticsearch_django/apps.py
https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/apps.py#L40-L48
def _validate_mapping(index, strict=False): """Check that an index mapping JSON file exists.""" try: settings.get_index_mapping(index) except IOError: if strict: raise ImproperlyConfigured("Index '%s' has no mapping file." % index) else: logger.warning("Index ...
[ "def", "_validate_mapping", "(", "index", ",", "strict", "=", "False", ")", ":", "try", ":", "settings", ".", "get_index_mapping", "(", "index", ")", "except", "IOError", ":", "if", "strict", ":", "raise", "ImproperlyConfigured", "(", "\"Index '%s' has no mappin...
Check that an index mapping JSON file exists.
[ "Check", "that", "an", "index", "mapping", "JSON", "file", "exists", "." ]
python
train
dantezhu/melon
melon/melon.py
https://github.com/dantezhu/melon/blob/44d859fa85fbfb2d77479e01eade925a0d26e4f7/melon/melon.py#L161-L167
def _spawn_fork_workers(self): """ 通过线程启动多个worker """ thread = Thread(target=self._fork_workers, args=()) thread.daemon = True thread.start()
[ "def", "_spawn_fork_workers", "(", "self", ")", ":", "thread", "=", "Thread", "(", "target", "=", "self", ".", "_fork_workers", ",", "args", "=", "(", ")", ")", "thread", ".", "daemon", "=", "True", "thread", ".", "start", "(", ")" ]
通过线程启动多个worker
[ "通过线程启动多个worker" ]
python
train
bwohlberg/sporco
sporco/fista/fista.py
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/fista/fista.py#L562-L571
def compute_residuals(self): """Compute residuals and stopping thresholds.""" r = self.rsdl() adapt_tol = self.opt['RelStopTol'] if self.opt['AutoStop', 'Enabled']: adapt_tol = self.tau0 / (1. + self.k) return r, adapt_tol
[ "def", "compute_residuals", "(", "self", ")", ":", "r", "=", "self", ".", "rsdl", "(", ")", "adapt_tol", "=", "self", ".", "opt", "[", "'RelStopTol'", "]", "if", "self", ".", "opt", "[", "'AutoStop'", ",", "'Enabled'", "]", ":", "adapt_tol", "=", "se...
Compute residuals and stopping thresholds.
[ "Compute", "residuals", "and", "stopping", "thresholds", "." ]
python
train
log2timeline/plaso
plaso/formatters/manager.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/formatters/manager.py#L17-L34
def DeregisterFormatter(cls, formatter_class): """Deregisters a formatter class. The formatter classes are identified based on their lower case data type. Args: formatter_class (type): class of the formatter. Raises: KeyError: if formatter class is not set for the corresponding data type....
[ "def", "DeregisterFormatter", "(", "cls", ",", "formatter_class", ")", ":", "formatter_data_type", "=", "formatter_class", ".", "DATA_TYPE", ".", "lower", "(", ")", "if", "formatter_data_type", "not", "in", "cls", ".", "_formatter_classes", ":", "raise", "KeyError...
Deregisters a formatter class. The formatter classes are identified based on their lower case data type. Args: formatter_class (type): class of the formatter. Raises: KeyError: if formatter class is not set for the corresponding data type.
[ "Deregisters", "a", "formatter", "class", "." ]
python
train
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_util.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/lib/mp_util.py#L65-L78
def gps_newpos(lat, lon, bearing, distance): '''extrapolate latitude/longitude given a heading and distance thanks to http://www.movable-type.co.uk/scripts/latlong.html ''' lat1 = math.radians(lat) lon1 = math.radians(lon) brng = math.radians(bearing) dr = distance/radius_of_earth lat2 ...
[ "def", "gps_newpos", "(", "lat", ",", "lon", ",", "bearing", ",", "distance", ")", ":", "lat1", "=", "math", ".", "radians", "(", "lat", ")", "lon1", "=", "math", ".", "radians", "(", "lon", ")", "brng", "=", "math", ".", "radians", "(", "bearing",...
extrapolate latitude/longitude given a heading and distance thanks to http://www.movable-type.co.uk/scripts/latlong.html
[ "extrapolate", "latitude", "/", "longitude", "given", "a", "heading", "and", "distance", "thanks", "to", "http", ":", "//", "www", ".", "movable", "-", "type", ".", "co", ".", "uk", "/", "scripts", "/", "latlong", ".", "html" ]
python
train
apple/turicreate
src/unity/python/turicreate/toolkits/drawing_classifier/drawing_classifier.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/drawing_classifier/drawing_classifier.py#L603-L690
def evaluate(self, dataset, metric='auto', batch_size=None, verbose=True): """ Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset of new observations. Must inc...
[ "def", "evaluate", "(", "self", ",", "dataset", ",", "metric", "=", "'auto'", ",", "batch_size", "=", "None", ",", "verbose", "=", "True", ")", ":", "if", "self", ".", "target", "not", "in", "dataset", ".", "column_names", "(", ")", ":", "raise", "_T...
Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset of new observations. Must include columns with the same names as the feature and target columns used for model t...
[ "Evaluate", "the", "model", "by", "making", "predictions", "of", "target", "values", "and", "comparing", "these", "to", "actual", "values", ".", "Parameters", "----------", "dataset", ":", "SFrame", "Dataset", "of", "new", "observations", ".", "Must", "include",...
python
train
njsmith/colorspacious
colorspacious/basics.py
https://github.com/njsmith/colorspacious/blob/59e0226003fb1b894597c5081e8ca5a3aa4fcefd/colorspacious/basics.py#L44-L55
def XYZ100_to_sRGB1_linear(XYZ100): """Convert XYZ to linear sRGB, where XYZ is normalized so that reference white D65 is X=95.05, Y=100, Z=108.90 and sRGB is on the 0-1 scale. Linear sRGB has a linear relationship to actual light, so it is an appropriate space for simulating light (e.g. for alpha blend...
[ "def", "XYZ100_to_sRGB1_linear", "(", "XYZ100", ")", ":", "XYZ100", "=", "np", ".", "asarray", "(", "XYZ100", ",", "dtype", "=", "float", ")", "# this is broadcasting matrix * array-of-vectors, where the vector is the", "# last dim", "RGB_linear", "=", "np", ".", "ein...
Convert XYZ to linear sRGB, where XYZ is normalized so that reference white D65 is X=95.05, Y=100, Z=108.90 and sRGB is on the 0-1 scale. Linear sRGB has a linear relationship to actual light, so it is an appropriate space for simulating light (e.g. for alpha blending).
[ "Convert", "XYZ", "to", "linear", "sRGB", "where", "XYZ", "is", "normalized", "so", "that", "reference", "white", "D65", "is", "X", "=", "95", ".", "05", "Y", "=", "100", "Z", "=", "108", ".", "90", "and", "sRGB", "is", "on", "the", "0", "-", "1"...
python
train
tehmaze/ipcalc
ipcalc.py
https://github.com/tehmaze/ipcalc/blob/d436b95d2783347c3e0084d76ec3c52d1f5d2f0b/ipcalc.py#L673-L677
def check_collision(self, other): """Check another network against the given network.""" other = Network(other) return self.network_long() <= other.network_long() <= self.broadcast_long() or \ other.network_long() <= self.network_long() <= other.broadcast_long()
[ "def", "check_collision", "(", "self", ",", "other", ")", ":", "other", "=", "Network", "(", "other", ")", "return", "self", ".", "network_long", "(", ")", "<=", "other", ".", "network_long", "(", ")", "<=", "self", ".", "broadcast_long", "(", ")", "or...
Check another network against the given network.
[ "Check", "another", "network", "against", "the", "given", "network", "." ]
python
train
almarklein/pyelastix
pyelastix.py
https://github.com/almarklein/pyelastix/blob/971a677ce9a3ef8eb0b95ae393db8e2506d2f8a4/pyelastix.py#L189-L222
def get_tempdir(): """ Get the temporary directory where pyelastix stores its temporary files. The directory is specific to the current process and the calling thread. Generally, the user does not need this; directories are automatically cleaned up. Though Elastix log files are also written here. ...
[ "def", "get_tempdir", "(", ")", ":", "tempdir", "=", "os", ".", "path", ".", "join", "(", "tempfile", ".", "gettempdir", "(", ")", ",", "'pyelastix'", ")", "# Make sure it exists", "if", "not", "os", ".", "path", ".", "isdir", "(", "tempdir", ")", ":",...
Get the temporary directory where pyelastix stores its temporary files. The directory is specific to the current process and the calling thread. Generally, the user does not need this; directories are automatically cleaned up. Though Elastix log files are also written here.
[ "Get", "the", "temporary", "directory", "where", "pyelastix", "stores", "its", "temporary", "files", ".", "The", "directory", "is", "specific", "to", "the", "current", "process", "and", "the", "calling", "thread", ".", "Generally", "the", "user", "does", "not"...
python
train
Robpol86/sphinxcontrib-imgur
sphinxcontrib/imgur/sphinx_api.py
https://github.com/Robpol86/sphinxcontrib-imgur/blob/5c178481d645147d10acb096793eda41c12c57af/sphinxcontrib/imgur/sphinx_api.py#L114-L140
def event_doctree_resolved(app, doctree, _): """Called by Sphinx after phase 3 (resolving). * Replace Imgur text nodes with data from the Sphinx cache. * Call finalizer for ImgurImageNode nodes. :param sphinx.application.Sphinx app: Sphinx application object. :param docutils.nodes.document doctree...
[ "def", "event_doctree_resolved", "(", "app", ",", "doctree", ",", "_", ")", ":", "album_cache", "=", "app", ".", "builder", ".", "env", ".", "imgur_album_cache", "image_cache", "=", "app", ".", "builder", ".", "env", ".", "imgur_image_cache", "for", "node", ...
Called by Sphinx after phase 3 (resolving). * Replace Imgur text nodes with data from the Sphinx cache. * Call finalizer for ImgurImageNode nodes. :param sphinx.application.Sphinx app: Sphinx application object. :param docutils.nodes.document doctree: Tree of docutils nodes. :param _: Not used.
[ "Called", "by", "Sphinx", "after", "phase", "3", "(", "resolving", ")", "." ]
python
train
jpscaletti/pyceo
pyceo/params.py
https://github.com/jpscaletti/pyceo/blob/7f37eaf8e557d25f8e54634176139e0aad84b8df/pyceo/params.py#L20-L30
def param(name, help=""): """Decorator that add a parameter to the wrapped command or function.""" def decorator(func): params = getattr(func, "params", []) _param = Param(name, help) # Insert at the beginning so the apparent order is preserved params.insert(0, _param) fu...
[ "def", "param", "(", "name", ",", "help", "=", "\"\"", ")", ":", "def", "decorator", "(", "func", ")", ":", "params", "=", "getattr", "(", "func", ",", "\"params\"", ",", "[", "]", ")", "_param", "=", "Param", "(", "name", ",", "help", ")", "# In...
Decorator that add a parameter to the wrapped command or function.
[ "Decorator", "that", "add", "a", "parameter", "to", "the", "wrapped", "command", "or", "function", "." ]
python
train
theno/fabsetup
fabsetup/fabfile/setup/__init__.py
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/__init__.py#L378-L423
def powerline_shell(): '''Install and set up powerline-shell prompt. More infos: * https://github.com/banga/powerline-shell * https://github.com/ohnonot/powerline-shell * https://askubuntu.com/questions/283908/how-can-i-install-and-use-powerline-plugin ''' assert env.host == 'localhost',...
[ "def", "powerline_shell", "(", ")", ":", "assert", "env", ".", "host", "==", "'localhost'", ",", "'This task cannot run on a remote host'", "# set up fonts for powerline", "checkup_git_repo_legacy", "(", "'https://github.com/powerline/fonts.git'", ",", "name", "=", "'powerlin...
Install and set up powerline-shell prompt. More infos: * https://github.com/banga/powerline-shell * https://github.com/ohnonot/powerline-shell * https://askubuntu.com/questions/283908/how-can-i-install-and-use-powerline-plugin
[ "Install", "and", "set", "up", "powerline", "-", "shell", "prompt", "." ]
python
train
twilio/twilio-python
twilio/rest/autopilot/v1/assistant/query.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/autopilot/v1/assistant/query.py#L70-L96
def list(self, language=values.unset, model_build=values.unset, status=values.unset, limit=None, page_size=None): """ Lists QueryInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. ...
[ "def", "list", "(", "self", ",", "language", "=", "values", ".", "unset", ",", "model_build", "=", "values", ".", "unset", ",", "status", "=", "values", ".", "unset", ",", "limit", "=", "None", ",", "page_size", "=", "None", ")", ":", "return", "list...
Lists QueryInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. :param unicode language: The ISO language-country string that specifies the language used by the Query resources to read :param unicod...
[ "Lists", "QueryInstance", "records", "from", "the", "API", "as", "a", "list", ".", "Unlike", "stream", "()", "this", "operation", "is", "eager", "and", "will", "load", "limit", "records", "into", "memory", "before", "returning", "." ]
python
train
DLR-RM/RAFCON
source/rafcon/gui/controllers/state_editor/scoped_variable_list.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/scoped_variable_list.py#L150-L157
def remove_core_element(self, model): """Remove respective core element of handed scoped variable model :param ScopedVariableModel model: Scoped variable model which core element should be removed :return: """ assert model.scoped_variable.parent is self.model.state gui_h...
[ "def", "remove_core_element", "(", "self", ",", "model", ")", ":", "assert", "model", ".", "scoped_variable", ".", "parent", "is", "self", ".", "model", ".", "state", "gui_helper_state_machine", ".", "delete_core_element_of_model", "(", "model", ")" ]
Remove respective core element of handed scoped variable model :param ScopedVariableModel model: Scoped variable model which core element should be removed :return:
[ "Remove", "respective", "core", "element", "of", "handed", "scoped", "variable", "model" ]
python
train
chdzq/ARPAbetAndIPAConvertor
arpabetandipaconvertor/model/syllable.py
https://github.com/chdzq/ARPAbetAndIPAConvertor/blob/e8b2fdbb5b7134c4f779f4d6dcd5dc30979a0a26/arpabetandipaconvertor/model/syllable.py#L86-L98
def translate_to_international_phonetic_alphabet(self, hide_stress_mark=False): ''' 转换成国际音标。只要一个元音的时候需要隐藏重音标识 :param hide_stress_mark: :return: ''' translations = self.stress.mark_ipa() if (not hide_stress_mark) and self.have_vowel else "" for phoneme in self._p...
[ "def", "translate_to_international_phonetic_alphabet", "(", "self", ",", "hide_stress_mark", "=", "False", ")", ":", "translations", "=", "self", ".", "stress", ".", "mark_ipa", "(", ")", "if", "(", "not", "hide_stress_mark", ")", "and", "self", ".", "have_vowel...
转换成国际音标。只要一个元音的时候需要隐藏重音标识 :param hide_stress_mark: :return:
[ "转换成国际音标。只要一个元音的时候需要隐藏重音标识", ":", "param", "hide_stress_mark", ":", ":", "return", ":" ]
python
train
bear/parsedatetime
parsedatetime/__init__.py
https://github.com/bear/parsedatetime/blob/830775dc5e36395622b41f12317f5e10c303d3a2/parsedatetime/__init__.py#L685-L736
def _CalculateDOWDelta(self, wd, wkdy, offset, style, currentDayStyle): """ Based on the C{style} and C{currentDayStyle} determine what day-of-week value is to be returned. @type wd: integer @param wd: day-of-week value for the current day @typ...
[ "def", "_CalculateDOWDelta", "(", "self", ",", "wd", ",", "wkdy", ",", "offset", ",", "style", ",", "currentDayStyle", ")", ":", "diffBase", "=", "wkdy", "-", "wd", "origOffset", "=", "offset", "if", "offset", "==", "2", ":", "# no modifier is present.", "...
Based on the C{style} and C{currentDayStyle} determine what day-of-week value is to be returned. @type wd: integer @param wd: day-of-week value for the current day @type wkdy: integer @param wkdy: day-of-week value for the parsed...
[ "Based", "on", "the", "C", "{", "style", "}", "and", "C", "{", "currentDayStyle", "}", "determine", "what", "day", "-", "of", "-", "week", "value", "is", "to", "be", "returned", "." ]
python
train
booktype/python-ooxml
ooxml/serialize.py
https://github.com/booktype/python-ooxml/blob/b56990a5bee2e1bc46839cec5161ff3726dc4d87/ooxml/serialize.py#L342-L355
def has_style(node): """Tells us if node element has defined styling. :Args: - node (:class:`ooxml.doc.Element`): Element :Returns: True or False """ elements = ['b', 'i', 'u', 'strike', 'color', 'jc', 'sz', 'ind', 'superscript', 'subscript', 'small_caps'] return any([True f...
[ "def", "has_style", "(", "node", ")", ":", "elements", "=", "[", "'b'", ",", "'i'", ",", "'u'", ",", "'strike'", ",", "'color'", ",", "'jc'", ",", "'sz'", ",", "'ind'", ",", "'superscript'", ",", "'subscript'", ",", "'small_caps'", "]", "return", "any"...
Tells us if node element has defined styling. :Args: - node (:class:`ooxml.doc.Element`): Element :Returns: True or False
[ "Tells", "us", "if", "node", "element", "has", "defined", "styling", "." ]
python
train
swistakm/graceful
src/graceful/errors.py
https://github.com/swistakm/graceful/blob/d4678cb6349a5c843a5e58002fc80140821609e4/src/graceful/errors.py#L23-L43
def _get_description(self): """Return human readable description error description. This description should explain everything that went wrong during deserialization. """ return ", ".join([ part for part in [ "missing: {}".format(self.missing) if sel...
[ "def", "_get_description", "(", "self", ")", ":", "return", "\", \"", ".", "join", "(", "[", "part", "for", "part", "in", "[", "\"missing: {}\"", ".", "format", "(", "self", ".", "missing", ")", "if", "self", ".", "missing", "else", "\"\"", ",", "(", ...
Return human readable description error description. This description should explain everything that went wrong during deserialization.
[ "Return", "human", "readable", "description", "error", "description", "." ]
python
train
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/memory_profiler.py
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/memory_profiler.py#L140-L156
def _find_script(script_name): """ Find the script. If the input is not a file, then $PATH will be searched. """ if os.path.isfile(script_name): return script_name path = os.getenv('PATH', os.defpath).split(os.pathsep) for dir in path: if dir == '': continue ...
[ "def", "_find_script", "(", "script_name", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "script_name", ")", ":", "return", "script_name", "path", "=", "os", ".", "getenv", "(", "'PATH'", ",", "os", ".", "defpath", ")", ".", "split", "(", "o...
Find the script. If the input is not a file, then $PATH will be searched.
[ "Find", "the", "script", "." ]
python
train
jborean93/smbprotocol
smbprotocol/connection.py
https://github.com/jborean93/smbprotocol/blob/d8eb00fbc824f97d0f4946e3f768c5e6c723499a/smbprotocol/connection.py#L909-L946
def send(self, message, sid=None, tid=None, credit_request=None): """ Will send a message to the server that is passed in. The final unencrypted header is returned to the function that called this. :param message: An SMB message structure to send :param sid: A session_id that th...
[ "def", "send", "(", "self", ",", "message", ",", "sid", "=", "None", ",", "tid", "=", "None", ",", "credit_request", "=", "None", ")", ":", "header", "=", "self", ".", "_generate_packet_header", "(", "message", ",", "sid", ",", "tid", ",", "credit_requ...
Will send a message to the server that is passed in. The final unencrypted header is returned to the function that called this. :param message: An SMB message structure to send :param sid: A session_id that the message is sent for :param tid: A tree_id object that the message is sent fo...
[ "Will", "send", "a", "message", "to", "the", "server", "that", "is", "passed", "in", ".", "The", "final", "unencrypted", "header", "is", "returned", "to", "the", "function", "that", "called", "this", "." ]
python
train
wharris/dougrain
dougrain/builder.py
https://github.com/wharris/dougrain/blob/45062a1562fc34793e40c6253a93aa91eb4cf855/dougrain/builder.py#L74-L84
def add_curie(self, name, href): """Adds a CURIE definition. A CURIE link with the given ``name`` and ``href`` is added to the document. This method returns self, allowing it to be chained with additional method calls. """ self.draft.set_curie(self, name, href) ...
[ "def", "add_curie", "(", "self", ",", "name", ",", "href", ")", ":", "self", ".", "draft", ".", "set_curie", "(", "self", ",", "name", ",", "href", ")", "return", "self" ]
Adds a CURIE definition. A CURIE link with the given ``name`` and ``href`` is added to the document. This method returns self, allowing it to be chained with additional method calls.
[ "Adds", "a", "CURIE", "definition", "." ]
python
train
gaqzi/gocd-cli
gocd_cli/utils.py
https://github.com/gaqzi/gocd-cli/blob/ca8df8ec2274fdc69bce0619aa3794463c4f5a6f/gocd_cli/utils.py#L154-L172
def get_go_server(settings=None): """Returns a `gocd.Server` configured by the `settings` object. Args: settings: a `gocd_cli.settings.Settings` object. Default: if falsey calls `get_settings`. Returns: gocd.Server: a configured gocd.Server instance """ if not settings: ...
[ "def", "get_go_server", "(", "settings", "=", "None", ")", ":", "if", "not", "settings", ":", "settings", "=", "get_settings", "(", ")", "return", "gocd", ".", "Server", "(", "settings", ".", "get", "(", "'server'", ")", ",", "user", "=", "settings", "...
Returns a `gocd.Server` configured by the `settings` object. Args: settings: a `gocd_cli.settings.Settings` object. Default: if falsey calls `get_settings`. Returns: gocd.Server: a configured gocd.Server instance
[ "Returns", "a", "gocd", ".", "Server", "configured", "by", "the", "settings", "object", "." ]
python
train
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L806-L826
def MapEncoder(field_descriptor): """Encoder for extensions of MessageSet. Maps always have a wire format like this: message MapEntry { key_type key = 1; value_type value = 2; } repeated MapEntry map = N; """ # Can't look at field_descriptor.message_type._concrete_class because it may ...
[ "def", "MapEncoder", "(", "field_descriptor", ")", ":", "# Can't look at field_descriptor.message_type._concrete_class because it may", "# not have been initialized yet.", "message_type", "=", "field_descriptor", ".", "message_type", "encode_message", "=", "MessageEncoder", "(", "f...
Encoder for extensions of MessageSet. Maps always have a wire format like this: message MapEntry { key_type key = 1; value_type value = 2; } repeated MapEntry map = N;
[ "Encoder", "for", "extensions", "of", "MessageSet", "." ]
python
train
cloudsmith-io/cloudsmith-cli
cloudsmith_cli/cli/types.py
https://github.com/cloudsmith-io/cloudsmith-cli/blob/5bc245ca5d0bfa85380be48e7c206b4c86cc6c8e/cloudsmith_cli/cli/types.py#L13-L16
def convert(self, value, *args, **kwargs): # pylint: disable=arguments-differ """Take a path with $HOME variables and resolve it to full path.""" value = os.path.expanduser(value) return super(ExpandPath, self).convert(value, *args, **kwargs)
[ "def", "convert", "(", "self", ",", "value", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=arguments-differ", "value", "=", "os", ".", "path", ".", "expanduser", "(", "value", ")", "return", "super", "(", "ExpandPath", ",", "sel...
Take a path with $HOME variables and resolve it to full path.
[ "Take", "a", "path", "with", "$HOME", "variables", "and", "resolve", "it", "to", "full", "path", "." ]
python
train
log2timeline/plaso
plaso/storage/interface.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/storage/interface.py#L1653-L1681
def PrepareMergeTaskStorage(self, task): """Prepares a task storage for merging. Moves the task storage file from the processed directory to the merge directory. Args: task (Task): task. Raises: IOError: if the storage type is not supported or if the storage file cannot be r...
[ "def", "PrepareMergeTaskStorage", "(", "self", ",", "task", ")", ":", "if", "self", ".", "_storage_type", "!=", "definitions", ".", "STORAGE_TYPE_SESSION", ":", "raise", "IOError", "(", "'Unsupported storage type.'", ")", "merge_storage_file_path", "=", "self", ".",...
Prepares a task storage for merging. Moves the task storage file from the processed directory to the merge directory. Args: task (Task): task. Raises: IOError: if the storage type is not supported or if the storage file cannot be renamed. OSError: if the storage type is no...
[ "Prepares", "a", "task", "storage", "for", "merging", "." ]
python
train
swift-nav/libsbp
generator/sbpg/targets/protobuf.py
https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/protobuf.py#L39-L48
def to_comment(value): """ Builds a comment. """ if value is None: return if len(value.split('\n')) == 1: return "* " + value else: return '\n'.join([' * ' + l for l in value.split('\n')[:-1]])
[ "def", "to_comment", "(", "value", ")", ":", "if", "value", "is", "None", ":", "return", "if", "len", "(", "value", ".", "split", "(", "'\\n'", ")", ")", "==", "1", ":", "return", "\"* \"", "+", "value", "else", ":", "return", "'\\n'", ".", "join",...
Builds a comment.
[ "Builds", "a", "comment", "." ]
python
train
rackerlabs/timid
timid/context.py
https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/context.py#L90-L109
def template(self, string): """ Interpret a template string. This returns a callable taking one argument--this context--and returning a string rendered from the template. :param string: The template string. :returns: A callable of one argument that will return the ...
[ "def", "template", "(", "self", ",", "string", ")", ":", "# Short-circuit if the template \"string\" isn't actually a", "# string", "if", "not", "isinstance", "(", "string", ",", "six", ".", "string_types", ")", ":", "return", "lambda", "ctxt", ":", "string", "# C...
Interpret a template string. This returns a callable taking one argument--this context--and returning a string rendered from the template. :param string: The template string. :returns: A callable of one argument that will return the desired string.
[ "Interpret", "a", "template", "string", ".", "This", "returns", "a", "callable", "taking", "one", "argument", "--", "this", "context", "--", "and", "returning", "a", "string", "rendered", "from", "the", "template", "." ]
python
test
fermiPy/fermipy
fermipy/jobs/file_archive.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L766-L775
def write_table_file(self, table_file=None): """Write the table to self._table_file""" if self._table is None: raise RuntimeError("No table to write") if table_file is not None: self._table_file = table_file if self._table_file is None: raise RuntimeEr...
[ "def", "write_table_file", "(", "self", ",", "table_file", "=", "None", ")", ":", "if", "self", ".", "_table", "is", "None", ":", "raise", "RuntimeError", "(", "\"No table to write\"", ")", "if", "table_file", "is", "not", "None", ":", "self", ".", "_table...
Write the table to self._table_file
[ "Write", "the", "table", "to", "self", ".", "_table_file" ]
python
train
noxdafox/clipspy
clips/classes.py
https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L267-L269
def name(self): """Class name.""" return ffi.string(lib.EnvGetDefclassName(self._env, self._cls)).decode()
[ "def", "name", "(", "self", ")", ":", "return", "ffi", ".", "string", "(", "lib", ".", "EnvGetDefclassName", "(", "self", ".", "_env", ",", "self", ".", "_cls", ")", ")", ".", "decode", "(", ")" ]
Class name.
[ "Class", "name", "." ]
python
train
todddeluca/python-vagrant
vagrant/__init__.py
https://github.com/todddeluca/python-vagrant/blob/83b26f9337b1f2cb6314210923bbd189e7c9199e/vagrant/__init__.py#L420-L494
def status(self, vm_name=None): ''' Return the results of a `vagrant status` call as a list of one or more Status objects. A Status contains the following attributes: - name: The VM name in a multi-vm environment. 'default' otherwise. - state: The state of the underlying guest...
[ "def", "status", "(", "self", ",", "vm_name", "=", "None", ")", ":", "# machine-readable output are CSV lines", "output", "=", "self", ".", "_run_vagrant_command", "(", "[", "'status'", ",", "'--machine-readable'", ",", "vm_name", "]", ")", "return", "self", "."...
Return the results of a `vagrant status` call as a list of one or more Status objects. A Status contains the following attributes: - name: The VM name in a multi-vm environment. 'default' otherwise. - state: The state of the underlying guest machine (i.e. VM). - provider: the name of ...
[ "Return", "the", "results", "of", "a", "vagrant", "status", "call", "as", "a", "list", "of", "one", "or", "more", "Status", "objects", ".", "A", "Status", "contains", "the", "following", "attributes", ":" ]
python
train
fboender/ansible-cmdb
lib/mako/ast.py
https://github.com/fboender/ansible-cmdb/blob/ebd960ac10684e8c9ec2b12751bba2c4c9504ab7/lib/mako/ast.py#L116-L167
def get_argument_expressions(self, as_call=False): """Return the argument declarations of this FunctionDecl as a printable list. By default the return value is appropriate for writing in a ``def``; set `as_call` to true to build arguments to be passed to the function instead (as...
[ "def", "get_argument_expressions", "(", "self", ",", "as_call", "=", "False", ")", ":", "namedecls", "=", "[", "]", "# Build in reverse order, since defaults and slurpy args come last", "argnames", "=", "self", ".", "argnames", "[", ":", ":", "-", "1", "]", "kwarg...
Return the argument declarations of this FunctionDecl as a printable list. By default the return value is appropriate for writing in a ``def``; set `as_call` to true to build arguments to be passed to the function instead (assuming locals with the same names as the arguments exist).
[ "Return", "the", "argument", "declarations", "of", "this", "FunctionDecl", "as", "a", "printable", "list", "." ]
python
train
inasafe/inasafe
safe/utilities/qgis_utilities.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/qgis_utilities.py#L132-L174
def display_warning_message_bar( title=None, message=None, more_details=None, button_text=tr('Show details ...'), duration=8, iface_object=iface): """ Display a warning message bar. :param title: The title of the message bar. :type title: basestring ...
[ "def", "display_warning_message_bar", "(", "title", "=", "None", ",", "message", "=", "None", ",", "more_details", "=", "None", ",", "button_text", "=", "tr", "(", "'Show details ...'", ")", ",", "duration", "=", "8", ",", "iface_object", "=", "iface", ")", ...
Display a warning message bar. :param title: The title of the message bar. :type title: basestring :param message: The message inside the message bar. :type message: basestring :param more_details: The message inside the 'Show details' button. :type more_details: basestring :param button...
[ "Display", "a", "warning", "message", "bar", "." ]
python
train
BlueHack-Core/blueforge
blueforge/apis/s3.py
https://github.com/BlueHack-Core/blueforge/blob/ac40a888ee9c388638a8f312c51f7500b8891b6c/blueforge/apis/s3.py#L25-L29
def download_file_from_bucket(self, bucket, file_path, key): """ Download file from S3 Bucket """ with open(file_path, 'wb') as data: self.__s3.download_fileobj(bucket, key, data) return file_path
[ "def", "download_file_from_bucket", "(", "self", ",", "bucket", ",", "file_path", ",", "key", ")", ":", "with", "open", "(", "file_path", ",", "'wb'", ")", "as", "data", ":", "self", ".", "__s3", ".", "download_fileobj", "(", "bucket", ",", "key", ",", ...
Download file from S3 Bucket
[ "Download", "file", "from", "S3", "Bucket" ]
python
train
sdispater/pendulum
pendulum/date.py
https://github.com/sdispater/pendulum/blob/94d28b0d3cb524ae02361bd1ed7ea03e2e655e4e/pendulum/date.py#L753-L764
def _last_of_quarter(self, day_of_week=None): """ Modify to the last occurrence of a given day of the week in the current quarter. If no day_of_week is provided, modify to the last day of the quarter. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MONDA...
[ "def", "_last_of_quarter", "(", "self", ",", "day_of_week", "=", "None", ")", ":", "return", "self", ".", "set", "(", "self", ".", "year", ",", "self", ".", "quarter", "*", "3", ",", "1", ")", ".", "last_of", "(", "\"month\"", ",", "day_of_week", ")"...
Modify to the last occurrence of a given day of the week in the current quarter. If no day_of_week is provided, modify to the last day of the quarter. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MONDAY. :type day_of_week: int or None :rtype: Date
[ "Modify", "to", "the", "last", "occurrence", "of", "a", "given", "day", "of", "the", "week", "in", "the", "current", "quarter", ".", "If", "no", "day_of_week", "is", "provided", "modify", "to", "the", "last", "day", "of", "the", "quarter", ".", "Use", ...
python
train
django-danceschool/django-danceschool
danceschool/guestlist/models.py
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/guestlist/models.py#L152-L191
def getListForEvent(self, event=None): ''' Get the list of names associated with a particular event. ''' names = list(self.guestlistname_set.annotate( guestType=Case( When(notes__isnull=False, then=F('notes')), default=Value(ugettext('Manually Added')), ...
[ "def", "getListForEvent", "(", "self", ",", "event", "=", "None", ")", ":", "names", "=", "list", "(", "self", ".", "guestlistname_set", ".", "annotate", "(", "guestType", "=", "Case", "(", "When", "(", "notes__isnull", "=", "False", ",", "then", "=", ...
Get the list of names associated with a particular event.
[ "Get", "the", "list", "of", "names", "associated", "with", "a", "particular", "event", "." ]
python
train
rougeth/bottery
bottery/telegram/engine.py
https://github.com/rougeth/bottery/blob/1c724b867fa16708d59a3dbba5dd2c3de85147a9/bottery/telegram/engine.py#L147-L156
def get_chat_id(self, message): ''' Telegram chat type can be either "private", "group", "supergroup" or "channel". Return user ID if it is of type "private", chat ID otherwise. ''' if message.chat.type == 'private': return message.user.id return mess...
[ "def", "get_chat_id", "(", "self", ",", "message", ")", ":", "if", "message", ".", "chat", ".", "type", "==", "'private'", ":", "return", "message", ".", "user", ".", "id", "return", "message", ".", "chat", ".", "id" ]
Telegram chat type can be either "private", "group", "supergroup" or "channel". Return user ID if it is of type "private", chat ID otherwise.
[ "Telegram", "chat", "type", "can", "be", "either", "private", "group", "supergroup", "or", "channel", ".", "Return", "user", "ID", "if", "it", "is", "of", "type", "private", "chat", "ID", "otherwise", "." ]
python
valid
mlperf/training
object_detection/pytorch/tools/cityscapes/convert_cityscapes_to_coco.py
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/object_detection/pytorch/tools/cityscapes/convert_cityscapes_to_coco.py#L53-L90
def convert_coco_stuff_mat(data_dir, out_dir): """Convert to png and save json with path. This currently only contains the segmentation labels for objects+stuff in cocostuff - if we need to combine with other labels from original COCO that will be a TODO.""" sets = ['train', 'val'] categories = [] ...
[ "def", "convert_coco_stuff_mat", "(", "data_dir", ",", "out_dir", ")", ":", "sets", "=", "[", "'train'", ",", "'val'", "]", "categories", "=", "[", "]", "json_name", "=", "'coco_stuff_%s.json'", "ann_dict", "=", "{", "}", "for", "data_set", "in", "sets", "...
Convert to png and save json with path. This currently only contains the segmentation labels for objects+stuff in cocostuff - if we need to combine with other labels from original COCO that will be a TODO.
[ "Convert", "to", "png", "and", "save", "json", "with", "path", ".", "This", "currently", "only", "contains", "the", "segmentation", "labels", "for", "objects", "+", "stuff", "in", "cocostuff", "-", "if", "we", "need", "to", "combine", "with", "other", "lab...
python
train
BerkeleyAutomation/perception
perception/detector.py
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/detector.py#L604-L612
def detector(detector_type): """ Returns a detector of the specified type. """ if detector_type == 'point_cloud_box': return PointCloudBoxDetector() elif detector_type == 'rgbd_foreground_mask_query': return RgbdForegroundMaskQueryImageDetector() elif detector_typ...
[ "def", "detector", "(", "detector_type", ")", ":", "if", "detector_type", "==", "'point_cloud_box'", ":", "return", "PointCloudBoxDetector", "(", ")", "elif", "detector_type", "==", "'rgbd_foreground_mask_query'", ":", "return", "RgbdForegroundMaskQueryImageDetector", "("...
Returns a detector of the specified type.
[ "Returns", "a", "detector", "of", "the", "specified", "type", "." ]
python
train