repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
mitsei/dlkit
dlkit/records/repository/basic/media_accessibility.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/repository/basic/media_accessibility.py#L200-L212
def add_media_description(self, media_description): """Adds a media_description. arg: media_description (displayText): the new media_description raise: InvalidArgument - ``media_description`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArg...
[ "def", "add_media_description", "(", "self", ",", "media_description", ")", ":", "if", "self", ".", "get_media_descriptions_metadata", "(", ")", ".", "is_read_only", "(", ")", ":", "raise", "NoAccess", "(", ")", "self", ".", "add_or_replace_value", "(", "'mediaD...
Adds a media_description. arg: media_description (displayText): the new media_description raise: InvalidArgument - ``media_description`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``media_description`` is ``null`` *compliance: ...
[ "Adds", "a", "media_description", "." ]
python
train
46.076923
numenta/htmresearch
projects/location_layer/location_module_experiment/grid_2d_location_experiment.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/projects/location_layer/location_module_experiment/grid_2d_location_experiment.py#L275-L324
def inferObjectsWithRandomMovements(self): """ Infer each object without any location input. """ for objectName, objectFeatures in self.objects.iteritems(): self.reset() inferred = False prevTouchSequence = None for _ in xrange(4): while True: touchSequence =...
[ "def", "inferObjectsWithRandomMovements", "(", "self", ")", ":", "for", "objectName", ",", "objectFeatures", "in", "self", ".", "objects", ".", "iteritems", "(", ")", ":", "self", ".", "reset", "(", ")", "inferred", "=", "False", "prevTouchSequence", "=", "N...
Infer each object without any location input.
[ "Infer", "each", "object", "without", "any", "location", "input", "." ]
python
train
29.48
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/bson/__init__.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L731-L743
def _element_to_bson(key, value, check_keys, opts): """Encode a single key, value pair.""" if not isinstance(key, string_type): raise InvalidDocument("documents must have only string keys, " "key was %r" % (key,)) if check_keys: if key.startswith("$"): ...
[ "def", "_element_to_bson", "(", "key", ",", "value", ",", "check_keys", ",", "opts", ")", ":", "if", "not", "isinstance", "(", "key", ",", "string_type", ")", ":", "raise", "InvalidDocument", "(", "\"documents must have only string keys, \"", "\"key was %r\"", "%"...
Encode a single key, value pair.
[ "Encode", "a", "single", "key", "value", "pair", "." ]
python
train
43.230769
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/help.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/help.py#L88-L101
def get_doc(self, objtxt): """Get object documentation dictionary""" if self._reading: return wait_loop = QEventLoop() self.sig_got_reply.connect(wait_loop.quit) self.silent_exec_method("get_ipython().kernel.get_doc('%s')" % objtxt) wait_loop.exec_() ...
[ "def", "get_doc", "(", "self", ",", "objtxt", ")", ":", "if", "self", ".", "_reading", ":", "return", "wait_loop", "=", "QEventLoop", "(", ")", "self", ".", "sig_got_reply", ".", "connect", "(", "wait_loop", ".", "quit", ")", "self", ".", "silent_exec_me...
Get object documentation dictionary
[ "Get", "object", "documentation", "dictionary" ]
python
train
32.428571
saltstack/salt
salt/states/pkg.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pkg.py#L3329-L3349
def mod_watch(name, **kwargs): ''' Install/reinstall a package based on a watch requisite .. note:: This state exists to support special handling of the ``watch`` :ref:`requisite <requisites>`. It should not be called directly. Parameters for this function should be set by the stat...
[ "def", "mod_watch", "(", "name", ",", "*", "*", "kwargs", ")", ":", "sfun", "=", "kwargs", ".", "pop", "(", "'sfun'", ",", "None", ")", "mapfun", "=", "{", "'purged'", ":", "purged", ",", "'latest'", ":", "latest", ",", "'removed'", ":", "removed", ...
Install/reinstall a package based on a watch requisite .. note:: This state exists to support special handling of the ``watch`` :ref:`requisite <requisites>`. It should not be called directly. Parameters for this function should be set by the state being triggered.
[ "Install", "/", "reinstall", "a", "package", "based", "on", "a", "watch", "requisite" ]
python
train
34.904762
ns1/ns1-python
ns1/__init__.py
https://github.com/ns1/ns1-python/blob/f3e1d90a3b76a1bd18f855f2c622a8a49d4b585e/ns1/__init__.py#L240-L248
def loadNetworkbyName(self, name, callback=None, errback=None): """ Load an existing Network by name into a high level Network object :param str name: Name of an existing Network """ import ns1.ipam network = ns1.ipam.Network(self.config, name=name) return networ...
[ "def", "loadNetworkbyName", "(", "self", ",", "name", ",", "callback", "=", "None", ",", "errback", "=", "None", ")", ":", "import", "ns1", ".", "ipam", "network", "=", "ns1", ".", "ipam", ".", "Network", "(", "self", ".", "config", ",", "name", "=",...
Load an existing Network by name into a high level Network object :param str name: Name of an existing Network
[ "Load", "an", "existing", "Network", "by", "name", "into", "a", "high", "level", "Network", "object" ]
python
train
39.333333
StackStorm/pybind
pybind/slxos/v17r_2_00/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_2_00/__init__.py#L6613-L6636
def _set_hw_state(self, v, load=False): """ Setter method for hw_state, mapped from YANG variable /hw_state (container) If this variable is read-only (config: false) in the source YANG file, then _set_hw_state is considered as a private method. Backends looking to populate this variable should d...
[ "def", "_set_hw_state", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "base"...
Setter method for hw_state, mapped from YANG variable /hw_state (container) If this variable is read-only (config: false) in the source YANG file, then _set_hw_state is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_hw_state() directly. ...
[ "Setter", "method", "for", "hw_state", "mapped", "from", "YANG", "variable", "/", "hw_state", "(", "container", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "in", "the", "source", "YANG", "file", "then", "_s...
python
train
70.291667
numenta/nupic
src/nupic/algorithms/spatial_pooler.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/spatial_pooler.py#L792-L799
def getPotential(self, columnIndex, potential): """ :param columnIndex: (int) column index to get potential for. :param potential: (list) will be overwritten with column potentials. Must match the number of inputs. """ assert(columnIndex < self._numColumns) potential[:] = self._poten...
[ "def", "getPotential", "(", "self", ",", "columnIndex", ",", "potential", ")", ":", "assert", "(", "columnIndex", "<", "self", ".", "_numColumns", ")", "potential", "[", ":", "]", "=", "self", ".", "_potentialPools", "[", "columnIndex", "]" ]
:param columnIndex: (int) column index to get potential for. :param potential: (list) will be overwritten with column potentials. Must match the number of inputs.
[ ":", "param", "columnIndex", ":", "(", "int", ")", "column", "index", "to", "get", "potential", "for", ".", ":", "param", "potential", ":", "(", "list", ")", "will", "be", "overwritten", "with", "column", "potentials", ".", "Must", "match", "the", "numbe...
python
valid
41.875
GNS3/gns3-server
gns3server/compute/vpcs/vpcs_vm.py
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vpcs/vpcs_vm.py#L152-L166
def name(self, new_name): """ Sets the name of this VPCS VM. :param new_name: name """ if self.script_file: content = self.startup_script content = content.replace(self._name, new_name) escaped_name = new_name.replace('\\', '') co...
[ "def", "name", "(", "self", ",", "new_name", ")", ":", "if", "self", ".", "script_file", ":", "content", "=", "self", ".", "startup_script", "content", "=", "content", ".", "replace", "(", "self", ".", "_name", ",", "new_name", ")", "escaped_name", "=", ...
Sets the name of this VPCS VM. :param new_name: name
[ "Sets", "the", "name", "of", "this", "VPCS", "VM", "." ]
python
train
33.4
the01/python-floscraper
floscraper/cache.py
https://github.com/the01/python-floscraper/blob/d578cd3d6381070d9a07dade1e10387ae33e9a65/floscraper/cache.py#L170-L189
def put(self, url, html, cache_info=None): """ Put response into cache :param url: Url to cache :type url: str | unicode :param html: HTML content of url :type html: str | unicode :param cache_info: Cache Info (default: None) :type cache_info: floscraper....
[ "def", "put", "(", "self", ",", "url", ",", "html", ",", "cache_info", "=", "None", ")", ":", "key", "=", "hashlib", ".", "md5", "(", "url", ")", ".", "hexdigest", "(", ")", "try", ":", "self", ".", "_cache_set", "(", "key", ",", "html", ")", "...
Put response into cache :param url: Url to cache :type url: str | unicode :param html: HTML content of url :type html: str | unicode :param cache_info: Cache Info (default: None) :type cache_info: floscraper.models.CacheInfo :rtype: None
[ "Put", "response", "into", "cache" ]
python
train
28.5
CS207-Final-Project-Group-10/cs207-FinalProject
solar_system/solar_system.py
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/solar_system/solar_system.py#L143-L193
def simulate_leapfrog(config_func: Callable, accel_func: Callable, t0: date, t1: date, steps_per_day: int): """ Simulate the earth-sun system from t0 to t1 using Leapfrog Integration. INPUTS: config_func: function taking a date or date range and returning position and velocity of ...
[ "def", "simulate_leapfrog", "(", "config_func", ":", "Callable", ",", "accel_func", ":", "Callable", ",", "t0", ":", "date", ",", "t1", ":", "date", ",", "steps_per_day", ":", "int", ")", ":", "# Length of the simulation (number of steps)", "N", ":", "int", "=...
Simulate the earth-sun system from t0 to t1 using Leapfrog Integration. INPUTS: config_func: function taking a date or date range and returning position and velocity of bodies accel_func: function taking positions of the bodies and returning their accelerations t0: start date of the simulation; a pytho...
[ "Simulate", "the", "earth", "-", "sun", "system", "from", "t0", "to", "t1", "using", "Leapfrog", "Integration", ".", "INPUTS", ":", "config_func", ":", "function", "taking", "a", "date", "or", "date", "range", "and", "returning", "position", "and", "velocity...
python
train
38.764706
nerdvegas/rez
src/rez/wrapper.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/wrapper.py#L202-L219
def print_about(self): """Print an info message about the tool.""" filepath = os.path.join(self.suite_path, "bin", self.tool_name) print "Tool: %s" % self.tool_name print "Path: %s" % filepath print "Suite: %s" % self.suite_path msg = "%s (%r)" % (self.context...
[ "def", "print_about", "(", "self", ")", ":", "filepath", "=", "os", ".", "path", ".", "join", "(", "self", ".", "suite_path", ",", "\"bin\"", ",", "self", ".", "tool_name", ")", "print", "\"Tool: %s\"", "%", "self", ".", "tool_name", "print", "\"Path...
Print an info message about the tool.
[ "Print", "an", "info", "message", "about", "the", "tool", "." ]
python
train
38.5
quiltdata/quilt
compiler/quilt/tools/command.py
https://github.com/quiltdata/quilt/blob/651853e7e89a8af86e0ff26167e752efa5878c12/compiler/quilt/tools/command.py#L1118-L1142
def search(query, team=None): """ Search for packages """ if team is None: team = _find_logged_in_team() if team is not None: session = _get_session(team) response = session.get("%s/api/search/" % get_registry_url(team), params=dict(q=query)) print("* Packages in tea...
[ "def", "search", "(", "query", ",", "team", "=", "None", ")", ":", "if", "team", "is", "None", ":", "team", "=", "_find_logged_in_team", "(", ")", "if", "team", "is", "not", "None", ":", "session", "=", "_get_session", "(", "team", ")", "response", "...
Search for packages
[ "Search", "for", "packages" ]
python
train
34.64
twilio/twilio-python
twilio/rest/messaging/v1/session/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/messaging/v1/session/__init__.py#L324-L333
def messages(self): """ Access the messages :returns: twilio.rest.messaging.v1.session.message.MessageList :rtype: twilio.rest.messaging.v1.session.message.MessageList """ if self._messages is None: self._messages = MessageList(self._version, session_sid=self...
[ "def", "messages", "(", "self", ")", ":", "if", "self", ".", "_messages", "is", "None", ":", "self", ".", "_messages", "=", "MessageList", "(", "self", ".", "_version", ",", "session_sid", "=", "self", ".", "_solution", "[", "'sid'", "]", ",", ")", "...
Access the messages :returns: twilio.rest.messaging.v1.session.message.MessageList :rtype: twilio.rest.messaging.v1.session.message.MessageList
[ "Access", "the", "messages" ]
python
train
36.1
tonyseek/python-base36
base36.py
https://github.com/tonyseek/python-base36/blob/4650988d9730e5cf9ca4a8fd634556f03c6d1c58/base36.py#L17-L35
def dumps(number): """Dumps an integer into a base36 string. :param number: the 10-based integer. :returns: the base36 string. """ if not isinstance(number, integer_types): raise TypeError('number must be an integer') if number < 0: return '-' + dumps(-number) value = '' ...
[ "def", "dumps", "(", "number", ")", ":", "if", "not", "isinstance", "(", "number", ",", "integer_types", ")", ":", "raise", "TypeError", "(", "'number must be an integer'", ")", "if", "number", "<", "0", ":", "return", "'-'", "+", "dumps", "(", "-", "num...
Dumps an integer into a base36 string. :param number: the 10-based integer. :returns: the base36 string.
[ "Dumps", "an", "integer", "into", "a", "base36", "string", "." ]
python
train
23.315789
tensorpack/tensorpack
examples/DeepQNetwork/expreplay.py
https://github.com/tensorpack/tensorpack/blob/d7a13cb74c9066bc791d7aafc3b744b60ee79a9f/examples/DeepQNetwork/expreplay.py#L242-L255
def reset_stats(self): """ Returns: mean, max: two stats of the runners, to be added to backend """ scores = list(itertools.chain.from_iterable([v.total_scores for v in self._runners])) for v in self._runners: v.total_scores.clear() try: ...
[ "def", "reset_stats", "(", "self", ")", ":", "scores", "=", "list", "(", "itertools", ".", "chain", ".", "from_iterable", "(", "[", "v", ".", "total_scores", "for", "v", "in", "self", ".", "_runners", "]", ")", ")", "for", "v", "in", "self", ".", "...
Returns: mean, max: two stats of the runners, to be added to backend
[ "Returns", ":", "mean", "max", ":", "two", "stats", "of", "the", "runners", "to", "be", "added", "to", "backend" ]
python
train
34.142857
ph4r05/monero-serialize
monero_serialize/xmrrpc.py
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrrpc.py#L1209-L1244
async def dump_variant(self, elem, elem_type=None, params=None, obj=None): """ Dumps variant type to the writer. Supports both wrapped and raw variant. :param elem: :param elem_type: :param params: :param obj: :return: """ fvalue = None ...
[ "async", "def", "dump_variant", "(", "self", ",", "elem", ",", "elem_type", "=", "None", ",", "params", "=", "None", ",", "obj", "=", "None", ")", ":", "fvalue", "=", "None", "if", "isinstance", "(", "elem", ",", "x", ".", "VariantType", ")", "or", ...
Dumps variant type to the writer. Supports both wrapped and raw variant. :param elem: :param elem_type: :param params: :param obj: :return:
[ "Dumps", "variant", "type", "to", "the", "writer", ".", "Supports", "both", "wrapped", "and", "raw", "variant", "." ]
python
train
33.472222
log2timeline/plaso
plaso/parsers/pls_recall.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/parsers/pls_recall.py#L98-L142
def ParseFileObject(self, parser_mediator, file_object): """Parses a PLSRecall.dat file-like object. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. file_object (dfvfs.FileIO): a file-like object. Raises: ...
[ "def", "ParseFileObject", "(", "self", ",", "parser_mediator", ",", "file_object", ")", ":", "file_offset", "=", "0", "file_size", "=", "file_object", ".", "get_size", "(", ")", "record_map", "=", "self", ".", "_GetDataTypeMap", "(", "'pls_recall_record'", ")", ...
Parses a PLSRecall.dat file-like object. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. file_object (dfvfs.FileIO): a file-like object. Raises: UnableToParseFile: when the file cannot be parsed.
[ "Parses", "a", "PLSRecall", ".", "dat", "file", "-", "like", "object", "." ]
python
train
39.688889
mgagne/wafflehaus.iweb
wafflehaus/iweb/glance/image_filter/visible.py
https://github.com/mgagne/wafflehaus.iweb/blob/8ac625582c1180391fe022d1db19f70a2dfb376a/wafflehaus/iweb/glance/image_filter/visible.py#L94-L101
def filter_factory(global_conf, **local_conf): """Returns a WSGI filter app for use with paste.deploy.""" conf = global_conf.copy() conf.update(local_conf) def visible(app): return VisibleFilter(app, conf) return visible
[ "def", "filter_factory", "(", "global_conf", ",", "*", "*", "local_conf", ")", ":", "conf", "=", "global_conf", ".", "copy", "(", ")", "conf", ".", "update", "(", "local_conf", ")", "def", "visible", "(", "app", ")", ":", "return", "VisibleFilter", "(", ...
Returns a WSGI filter app for use with paste.deploy.
[ "Returns", "a", "WSGI", "filter", "app", "for", "use", "with", "paste", ".", "deploy", "." ]
python
train
30.25
jcrist/skein
examples/echo_server/client.py
https://github.com/jcrist/skein/blob/16f8b1d3b3d9f79f36e2f152e45893339a1793e8/examples/echo_server/client.py#L20-L29
async def echo_all(app, message): """Send and recieve a message from all running echo servers""" # Loop through all registered server addresses for address in app.kv.get_prefix('address.').values(): # Parse the host and port from the stored address host, port = address.decode().split(':') ...
[ "async", "def", "echo_all", "(", "app", ",", "message", ")", ":", "# Loop through all registered server addresses", "for", "address", "in", "app", ".", "kv", ".", "get_prefix", "(", "'address.'", ")", ".", "values", "(", ")", ":", "# Parse the host and port from t...
Send and recieve a message from all running echo servers
[ "Send", "and", "recieve", "a", "message", "from", "all", "running", "echo", "servers" ]
python
train
43.7
mozilla/FoxPuppet
foxpuppet/windows/browser/notifications/base.py
https://github.com/mozilla/FoxPuppet/blob/6575eb4c72fd024c986b254e198c8b4e6f68cddd/foxpuppet/windows/browser/notifications/base.py#L42-L50
def label(self): """Provide access to the notification label. Returns: str: The notification label """ with self.selenium.context(self.selenium.CONTEXT_CHROME): return self.root.get_attribute("label")
[ "def", "label", "(", "self", ")", ":", "with", "self", ".", "selenium", ".", "context", "(", "self", ".", "selenium", ".", "CONTEXT_CHROME", ")", ":", "return", "self", ".", "root", ".", "get_attribute", "(", "\"label\"", ")" ]
Provide access to the notification label. Returns: str: The notification label
[ "Provide", "access", "to", "the", "notification", "label", "." ]
python
train
27.777778
pyviz/param
setup.py
https://github.com/pyviz/param/blob/8f0dafa78defa883247b40635f96cc6d5c1b3481/setup.py#L8-L13
def get_setup_version(reponame): """Use autover to get up to date version.""" # importing self into setup.py is unorthodox, but param has no # required dependencies outside of python from param.version import Version return Version.setup_version(os.path.dirname(__file__),reponame,archive_commit="$Fo...
[ "def", "get_setup_version", "(", "reponame", ")", ":", "# importing self into setup.py is unorthodox, but param has no", "# required dependencies outside of python", "from", "param", ".", "version", "import", "Version", "return", "Version", ".", "setup_version", "(", "os", "....
Use autover to get up to date version.
[ "Use", "autover", "to", "get", "up", "to", "date", "version", "." ]
python
train
54.166667
EconForge/dolo
trash/dolo/algos/dtcscc/gssa.py
https://github.com/EconForge/dolo/blob/d91ddf148b009bf79852d9aec70f3a1877e0f79a/trash/dolo/algos/dtcscc/gssa.py#L14-L190
def gssa(model, maxit=100, tol=1e-8, initial_dr=None, verbose=False, n_sim=10000, deg=3, damp=0.1, seed=42): """ Sketch of algorithm: 0. Choose levels for the initial states and the simulation length (n_sim) 1. Obtain an initial decision rule -- here using first order perturbation 2. Draw ...
[ "def", "gssa", "(", "model", ",", "maxit", "=", "100", ",", "tol", "=", "1e-8", ",", "initial_dr", "=", "None", ",", "verbose", "=", "False", ",", "n_sim", "=", "10000", ",", "deg", "=", "3", ",", "damp", "=", "0.1", ",", "seed", "=", "42", ")"...
Sketch of algorithm: 0. Choose levels for the initial states and the simulation length (n_sim) 1. Obtain an initial decision rule -- here using first order perturbation 2. Draw a sequence of innovations epsilon 3. Iterate on the following steps: - Use the epsilons, initial states, and proposed ...
[ "Sketch", "of", "algorithm", ":" ]
python
train
35.107345
inasafe/inasafe
safe/gui/tools/batch/batch_dialog.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/batch/batch_dialog.py#L779-L788
def on_scenario_directory_radio_toggled(self, flag): """Autoconnect slot activated when scenario_directory_radio is checked. :param flag: Flag indicating whether the checkbox was toggled on or off. :type flag: bool """ if flag: self.output_directory.setTe...
[ "def", "on_scenario_directory_radio_toggled", "(", "self", ",", "flag", ")", ":", "if", "flag", ":", "self", ".", "output_directory", ".", "setText", "(", "self", ".", "source_directory", ".", "text", "(", ")", ")", "self", ".", "output_directory_chooser", "."...
Autoconnect slot activated when scenario_directory_radio is checked. :param flag: Flag indicating whether the checkbox was toggled on or off. :type flag: bool
[ "Autoconnect", "slot", "activated", "when", "scenario_directory_radio", "is", "checked", "." ]
python
train
40.2
smarie/python-parsyfiles
parsyfiles/parsing_registries.py
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/parsing_registries.py#L772-L816
def __build_parser_for_fileobject_and_desiredtype(self, obj_on_filesystem: PersistedObject, object_typ: Type[T], logger: Logger = None) -> Parser: """ Builds from the registry, a parser to parse object obj_on_filesystem as an object of type object_ty...
[ "def", "__build_parser_for_fileobject_and_desiredtype", "(", "self", ",", "obj_on_filesystem", ":", "PersistedObject", ",", "object_typ", ":", "Type", "[", "T", "]", ",", "logger", ":", "Logger", "=", "None", ")", "->", "Parser", ":", "# first remove any non-generic...
Builds from the registry, a parser to parse object obj_on_filesystem as an object of type object_type. To do that, it iterates through all registered parsers in the list in reverse order (last inserted first), and checks if they support the provided object format (single or multifile) and type. ...
[ "Builds", "from", "the", "registry", "a", "parser", "to", "parse", "object", "obj_on_filesystem", "as", "an", "object", "of", "type", "object_type", "." ]
python
train
56.888889
mikekatz04/BOWIE
snr_calculator_folder/gwsnrcalc/utils/waveforms.py
https://github.com/mikekatz04/BOWIE/blob/a941342a3536cb57c817a1643896d99a3f354a86/snr_calculator_folder/gwsnrcalc/utils/waveforms.py#L463-L493
def _t_of_e(self, a0=None, t_start=None, f0=None, ef=None, t_obs=5.0): """Rearranged versions of Peters equations This function calculates the semi-major axis and eccentricity over time. """ if ef is None: ef = np.ones_like(self.e0)*0.0000001 beta = 64.0/5.0*self.m...
[ "def", "_t_of_e", "(", "self", ",", "a0", "=", "None", ",", "t_start", "=", "None", ",", "f0", "=", "None", ",", "ef", "=", "None", ",", "t_obs", "=", "5.0", ")", ":", "if", "ef", "is", "None", ":", "ef", "=", "np", ".", "ones_like", "(", "se...
Rearranged versions of Peters equations This function calculates the semi-major axis and eccentricity over time.
[ "Rearranged", "versions", "of", "Peters", "equations" ]
python
train
34.612903
PMEAL/OpenPNM
openpnm/algorithms/AdvectionDiffusion.py
https://github.com/PMEAL/OpenPNM/blob/0547b5724ffedc0a593aae48639d36fe10e0baed/openpnm/algorithms/AdvectionDiffusion.py#L101-L127
def set_outflow_BC(self, pores, mode='merge'): r""" Adds outflow boundary condition to the selected pores. Outflow condition simply means that the gradient of the solved quantity does not change, i.e. is 0. """ # Hijack the parse_mode function to verify mode/pores argum...
[ "def", "set_outflow_BC", "(", "self", ",", "pores", ",", "mode", "=", "'merge'", ")", ":", "# Hijack the parse_mode function to verify mode/pores argument", "mode", "=", "self", ".", "_parse_mode", "(", "mode", ",", "allowed", "=", "[", "'merge'", ",", "'overwrite...
r""" Adds outflow boundary condition to the selected pores. Outflow condition simply means that the gradient of the solved quantity does not change, i.e. is 0.
[ "r", "Adds", "outflow", "boundary", "condition", "to", "the", "selected", "pores", "." ]
python
train
45.37037
tensorflow/probability
tensorflow_probability/python/internal/tensorshape_util.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/internal/tensorshape_util.py#L144-L160
def dims(x): """Returns a list of dimension sizes, or `None` if `rank` is unknown. For more details, see `help(tf.TensorShape.dims)`. Args: x: object representing a shape; convertible to `tf.TensorShape`. Returns: shape_as_list: list of sizes or `None` values representing each dimensions size i...
[ "def", "dims", "(", "x", ")", ":", "if", "isinstance", "(", "x", ",", "tf", ".", "TensorShape", ")", ":", "return", "x", ".", "dims", "r", "=", "tf", ".", "TensorShape", "(", "x", ")", ".", "dims", "return", "None", "if", "r", "is", "None", "el...
Returns a list of dimension sizes, or `None` if `rank` is unknown. For more details, see `help(tf.TensorShape.dims)`. Args: x: object representing a shape; convertible to `tf.TensorShape`. Returns: shape_as_list: list of sizes or `None` values representing each dimensions size if known. A size is...
[ "Returns", "a", "list", "of", "dimension", "sizes", "or", "None", "if", "rank", "is", "unknown", "." ]
python
test
32.882353
specialunderwear/django-easymode
easymode/i18n/gettext.py
https://github.com/specialunderwear/django-easymode/blob/92f674b91fb8c54d6e379e2664e2000872d9c95e/easymode/i18n/gettext.py#L191-L205
def msgmerge(self, locale_file, po_string): """ Runs msgmerge on a locale_file and po_string """ cmd = "msgmerge -q %s -" % locale_file p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (msg, err) = p...
[ "def", "msgmerge", "(", "self", ",", "locale_file", ",", "po_string", ")", ":", "cmd", "=", "\"msgmerge -q %s -\"", "%", "locale_file", "p", "=", "subprocess", ".", "Popen", "(", "cmd", ",", "shell", "=", "True", ",", "stdin", "=", "subprocess", ".", "PI...
Runs msgmerge on a locale_file and po_string
[ "Runs", "msgmerge", "on", "a", "locale_file", "and", "po_string" ]
python
train
35.866667
acutesoftware/AIKIF
aikif/toolbox/game_board_utils.py
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/toolbox/game_board_utils.py#L25-L45
def build_board_checkers(): """ builds a checkers starting board Printing Grid 0 B 0 B 0 B 0 B B 0 B 0 B 0 B 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
[ "def", "build_board_checkers", "(", ")", ":", "grd", "=", "Grid", "(", "8", ",", "8", ",", "[", "\"B\"", ",", "\"W\"", "]", ")", "for", "c", "in", "range", "(", "4", ")", ":", "grd", ".", "set_tile", "(", "0", ",", "(", "c", "*", "2", ")", ...
builds a checkers starting board Printing Grid 0 B 0 B 0 B 0 B B 0 B 0 B 0 B 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
[ "builds", "a", "checkers", "starting", "board", "Printing", "Grid", "0", "B", "0", "B", "0", "B", "0", "B", "B", "0", "B", "0", "B", "0", "B", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"...
python
train
33.714286
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/tensor_shape.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/tensor_shape.py#L649-L676
def merge_with(self, other): """Returns a `TensorShape` combining the information in `self` and `other`. The dimensions in `self` and `other` are merged elementwise, according to the rules defined for `Dimension.merge_with()`. Args: other: Another `TensorShape`. Retu...
[ "def", "merge_with", "(", "self", ",", "other", ")", ":", "other", "=", "as_shape", "(", "other", ")", "if", "self", ".", "_dims", "is", "None", ":", "return", "other", "else", ":", "try", ":", "self", ".", "assert_same_rank", "(", "other", ")", "new...
Returns a `TensorShape` combining the information in `self` and `other`. The dimensions in `self` and `other` are merged elementwise, according to the rules defined for `Dimension.merge_with()`. Args: other: Another `TensorShape`. Returns: A `TensorShape` containin...
[ "Returns", "a", "TensorShape", "combining", "the", "information", "in", "self", "and", "other", "." ]
python
train
34.285714
mLewisLogic/foursquare
foursquare/__init__.py
https://github.com/mLewisLogic/foursquare/blob/420f3b588b9af154688ec82649f24a70f96c1665/foursquare/__init__.py#L768-L774
def _post(url, headers={}, data=None, files=None): """Tries to POST data to an endpoint""" try: response = requests.post(url, headers=headers, data=data, files=files, verify=VERIFY_SSL) return _process_response(response) except requests.exceptions.RequestException as e: _log_and_rais...
[ "def", "_post", "(", "url", ",", "headers", "=", "{", "}", ",", "data", "=", "None", ",", "files", "=", "None", ")", ":", "try", ":", "response", "=", "requests", ".", "post", "(", "url", ",", "headers", "=", "headers", ",", "data", "=", "data", ...
Tries to POST data to an endpoint
[ "Tries", "to", "POST", "data", "to", "an", "endpoint" ]
python
train
52.571429
EventTeam/beliefs
src/beliefs/beliefstate.py
https://github.com/EventTeam/beliefs/blob/c07d22b61bebeede74a72800030dde770bf64208/src/beliefs/beliefstate.py#L351-L370
def is_entailed_by(self, other): """ Given two beliefstates, returns True iff the calling instance implies the other beliefstate, meaning it contains at least the same structure (for all structures) and all values (for all defined values). Inverse of `entails`. ...
[ "def", "is_entailed_by", "(", "self", ",", "other", ")", ":", "for", "(", "s_key", ",", "s_val", ")", "in", "self", ":", "if", "s_key", "in", "other", ":", "if", "not", "hasattr", "(", "other", "[", "s_key", "]", ",", "'implies'", ")", ":", "raise"...
Given two beliefstates, returns True iff the calling instance implies the other beliefstate, meaning it contains at least the same structure (for all structures) and all values (for all defined values). Inverse of `entails`. Note: this only compares the items in the DictCell, n...
[ "Given", "two", "beliefstates", "returns", "True", "iff", "the", "calling", "instance", "implies", "the", "other", "beliefstate", "meaning", "it", "contains", "at", "least", "the", "same", "structure", "(", "for", "all", "structures", ")", "and", "all", "value...
python
train
39.3
arcturial/clickatell-python
clickatell/rest/__init__.py
https://github.com/arcturial/clickatell-python/blob/4a554c28edaf2e5d0d9e81b4c9415241bfd61d00/clickatell/rest/__init__.py#L18-L29
def request(self, action, data={}, headers={}, method='GET'): """ Append the REST headers to every request """ headers = { "Authorization": "Bearer " + self.token, "Content-Type": "application/json", "X-Version": "1", "Accept": "application...
[ "def", "request", "(", "self", ",", "action", ",", "data", "=", "{", "}", ",", "headers", "=", "{", "}", ",", "method", "=", "'GET'", ")", ":", "headers", "=", "{", "\"Authorization\"", ":", "\"Bearer \"", "+", "self", ".", "token", ",", "\"Content-T...
Append the REST headers to every request
[ "Append", "the", "REST", "headers", "to", "every", "request" ]
python
train
33
mintchaos/django_inlines
django_inlines/templatetags/inlines.py
https://github.com/mintchaos/django_inlines/blob/1912e508d04884713a6c44a068c21fbd217d478a/django_inlines/templatetags/inlines.py#L40-L80
def process_inlines(parser, token): """ Searches through the provided content and applies inlines where ever they are found. Syntax:: {% process_inlines entry.body [in template_dir] [as varname] } Examples:: {% process_inlines entry.body %} {% process_inlines entry.body ...
[ "def", "process_inlines", "(", "parser", ",", "token", ")", ":", "args", "=", "token", ".", "split_contents", "(", ")", "if", "not", "len", "(", "args", ")", "in", "(", "2", ",", "4", ",", "6", ")", ":", "raise", "template", ".", "TemplateSyntaxError...
Searches through the provided content and applies inlines where ever they are found. Syntax:: {% process_inlines entry.body [in template_dir] [as varname] } Examples:: {% process_inlines entry.body %} {% process_inlines entry.body as body %} {% process_inlines entry.bod...
[ "Searches", "through", "the", "provided", "content", "and", "applies", "inlines", "where", "ever", "they", "are", "found", "." ]
python
train
28.439024
Ex-Mente/auxi.0
auxi/modelling/process/materials/thermo.py
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/process/materials/thermo.py#L924-L931
def amount(self): """ Determine the sum of mole amounts of all the compounds. :returns: Amount. [kmol] """ return sum(self.get_compound_amount(c) for c in self.material.compounds)
[ "def", "amount", "(", "self", ")", ":", "return", "sum", "(", "self", ".", "get_compound_amount", "(", "c", ")", "for", "c", "in", "self", ".", "material", ".", "compounds", ")" ]
Determine the sum of mole amounts of all the compounds. :returns: Amount. [kmol]
[ "Determine", "the", "sum", "of", "mole", "amounts", "of", "all", "the", "compounds", "." ]
python
valid
26.75
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_tunnels.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_tunnels.py#L630-L644
def overlay_gateway_sflow_sflow_vlan_action(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") overlay_gateway = ET.SubElement(config, "overlay-gateway", xmlns="urn:brocade.com:mgmt:brocade-tunnels") name_key = ET.SubElement(overlay_gateway, "name") ...
[ "def", "overlay_gateway_sflow_sflow_vlan_action", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "overlay_gateway", "=", "ET", ".", "SubElement", "(", "config", ",", "\"overlay-gateway\"", ",", "xml...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
51.333333
za-creature/gulpless
gulpless/__init__.py
https://github.com/za-creature/gulpless/blob/fd73907dbe86880086719816bb042233f85121f6/gulpless/__init__.py#L11-L70
def main(): """Entry point for command line usage.""" import colorama import argparse import logging import sys import os parser = argparse.ArgumentParser(prog="gulpless", description="Simple build system.") parser.add_argument("-v", "--version", ...
[ "def", "main", "(", ")", ":", "import", "colorama", "import", "argparse", "import", "logging", "import", "sys", "import", "os", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "\"gulpless\"", ",", "description", "=", "\"Simple build system.\"...
Entry point for command line usage.
[ "Entry", "point", "for", "command", "line", "usage", "." ]
python
train
35.383333
saltstack/salt
salt/modules/aix_group.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aix_group.py#L186-L200
def members(name, members_list, root=None): ''' Replaces members of the group with a provided list. CLI Example: salt '*' group.members foo 'user1,user2,user3,...' Replaces a membership list for a local group 'foo'. foo:x:1234:user1,user2,user3,... ''' cmd = 'chgrpmem -m = {0}...
[ "def", "members", "(", "name", ",", "members_list", ",", "root", "=", "None", ")", ":", "cmd", "=", "'chgrpmem -m = {0} {1}'", ".", "format", "(", "members_list", ",", "name", ")", "retcode", "=", "__salt__", "[", "'cmd.retcode'", "]", "(", "cmd", ",", "...
Replaces members of the group with a provided list. CLI Example: salt '*' group.members foo 'user1,user2,user3,...' Replaces a membership list for a local group 'foo'. foo:x:1234:user1,user2,user3,...
[ "Replaces", "members", "of", "the", "group", "with", "a", "provided", "list", "." ]
python
train
28.333333
SheffieldML/GPy
GPy/core/sparse_gp.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/core/sparse_gp.py#L121-L131
def to_dict(self, save_data=True): """ Convert the object into a json serializable dictionary. :param boolean save_data: if true, it adds the training data self.X and self.Y to the dictionary :return dict: json serializable dictionary containing the needed information to instantiate the...
[ "def", "to_dict", "(", "self", ",", "save_data", "=", "True", ")", ":", "input_dict", "=", "super", "(", "SparseGP", ",", "self", ")", ".", "to_dict", "(", "save_data", ")", "input_dict", "[", "\"class\"", "]", "=", "\"GPy.core.SparseGP\"", "input_dict", "...
Convert the object into a json serializable dictionary. :param boolean save_data: if true, it adds the training data self.X and self.Y to the dictionary :return dict: json serializable dictionary containing the needed information to instantiate the object
[ "Convert", "the", "object", "into", "a", "json", "serializable", "dictionary", "." ]
python
train
46.272727
arcticfoxnv/slackminion
slackminion/plugins/core/acl.py
https://github.com/arcticfoxnv/slackminion/blob/62ea77aba5ac5ba582793e578a379a76f7d26cdb/slackminion/plugins/core/acl.py#L112-L125
def acl_show(self, msg, args): """Show current allow and deny blocks for the given acl.""" name = args[0] if len(args) > 0 else None if name is None: return "%s: The following ACLs are defined: %s" % (msg.user, ', '.join(self._acl.keys())) if name not in self._acl: ...
[ "def", "acl_show", "(", "self", ",", "msg", ",", "args", ")", ":", "name", "=", "args", "[", "0", "]", "if", "len", "(", "args", ")", ">", "0", "else", "None", "if", "name", "is", "None", ":", "return", "\"%s: The following ACLs are defined: %s\"", "%"...
Show current allow and deny blocks for the given acl.
[ "Show", "current", "allow", "and", "deny", "blocks", "for", "the", "given", "acl", "." ]
python
valid
42.571429
saltstack/salt
salt/roster/cloud.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/roster/cloud.py#L97-L113
def extract_ipv4(roster_order, ipv4): ''' Extract the preferred IP address from the ipv4 grain ''' for ip_type in roster_order: for ip_ in ipv4: if ':' in ip_: continue if not salt.utils.validate.net.ipv4_addr(ip_): continue if ...
[ "def", "extract_ipv4", "(", "roster_order", ",", "ipv4", ")", ":", "for", "ip_type", "in", "roster_order", ":", "for", "ip_", "in", "ipv4", ":", "if", "':'", "in", "ip_", ":", "continue", "if", "not", "salt", ".", "utils", ".", "validate", ".", "net", ...
Extract the preferred IP address from the ipv4 grain
[ "Extract", "the", "preferred", "IP", "address", "from", "the", "ipv4", "grain" ]
python
train
35.647059
eaton-lab/toytree
toytree/Drawing.py
https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/Drawing.py#L314-L349
def assign_tip_labels_and_colors(self): "assign tip labels based on user provided kwargs" # COLOR # tip color overrides tipstyle.fill if self.style.tip_labels_colors: #if self.style.tip_labels_style.fill: # self.style.tip_labels_style.fill = None if...
[ "def", "assign_tip_labels_and_colors", "(", "self", ")", ":", "# COLOR", "# tip color overrides tipstyle.fill", "if", "self", ".", "style", ".", "tip_labels_colors", ":", "#if self.style.tip_labels_style.fill:", "# self.style.tip_labels_style.fill = None", "if", "self", ".",...
assign tip labels based on user provided kwargs
[ "assign", "tip", "labels", "based", "on", "user", "provided", "kwargs" ]
python
train
44.25
saltstack/salt
salt/log/handlers/sentry_mod.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/log/handlers/sentry_mod.py#L120-L235
def setup_handlers(): ''' sets up the sentry handler ''' __grains__ = salt.loader.grains(__opts__) __salt__ = salt.loader.minion_mods(__opts__) if 'sentry_handler' not in __opts__: log.debug('No \'sentry_handler\' key was found in the configuration') return False options = {}...
[ "def", "setup_handlers", "(", ")", ":", "__grains__", "=", "salt", ".", "loader", ".", "grains", "(", "__opts__", ")", "__salt__", "=", "salt", ".", "loader", ".", "minion_mods", "(", "__opts__", ")", "if", "'sentry_handler'", "not", "in", "__opts__", ":",...
sets up the sentry handler
[ "sets", "up", "the", "sentry", "handler" ]
python
train
39.491379
pyrogram/pyrogram
pyrogram/client/methods/contacts/delete_contacts.py
https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/client/methods/contacts/delete_contacts.py#L27-L59
def delete_contacts( self, ids: List[int] ): """Use this method to delete contacts from your Telegram address book. Args: ids (List of ``int``): A list of unique identifiers for the target users. Can be an ID (int), a username (string) or ...
[ "def", "delete_contacts", "(", "self", ",", "ids", ":", "List", "[", "int", "]", ")", ":", "contacts", "=", "[", "]", "for", "i", "in", "ids", ":", "try", ":", "input_user", "=", "self", ".", "resolve_peer", "(", "i", ")", "except", "PeerIdInvalid", ...
Use this method to delete contacts from your Telegram address book. Args: ids (List of ``int``): A list of unique identifiers for the target users. Can be an ID (int), a username (string) or phone number (string). Returns: True on success. ...
[ "Use", "this", "method", "to", "delete", "contacts", "from", "your", "Telegram", "address", "book", "." ]
python
train
27.151515
pazz/alot
alot/crypto.py
https://github.com/pazz/alot/blob/d0297605c0ec1c6b65f541d0fd5b69ac5a0f4ded/alot/crypto.py#L138-L155
def detached_signature_for(plaintext_str, keys): """ Signs the given plaintext string and returns the detached signature. A detached signature in GPG speak is a separate blob of data containing a signature for the specified plaintext. :param bytes plaintext_str: bytestring to sign :param keys:...
[ "def", "detached_signature_for", "(", "plaintext_str", ",", "keys", ")", ":", "ctx", "=", "gpg", ".", "core", ".", "Context", "(", "armor", "=", "True", ")", "ctx", ".", "signers", "=", "keys", "(", "sigblob", ",", "sign_result", ")", "=", "ctx", ".", ...
Signs the given plaintext string and returns the detached signature. A detached signature in GPG speak is a separate blob of data containing a signature for the specified plaintext. :param bytes plaintext_str: bytestring to sign :param keys: list of one or more key to sign with. :type keys: list[g...
[ "Signs", "the", "given", "plaintext", "string", "and", "returns", "the", "detached", "signature", "." ]
python
train
41.166667
HPAC/matchpy
matchpy/expressions/functions.py
https://github.com/HPAC/matchpy/blob/06b2ec50ee0efdf3dd183768c0ffdb51b7efc393/matchpy/expressions/functions.py#L115-L139
def rename_variables(expression: Expression, renaming: Dict[str, str]) -> Expression: """Rename the variables in the expression according to the given dictionary. Args: expression: The expression in which the variables are renamed. renaming: The renaming dictionary. Maps...
[ "def", "rename_variables", "(", "expression", ":", "Expression", ",", "renaming", ":", "Dict", "[", "str", ",", "str", "]", ")", "->", "Expression", ":", "if", "isinstance", "(", "expression", ",", "Operation", ")", ":", "if", "hasattr", "(", "expression",...
Rename the variables in the expression according to the given dictionary. Args: expression: The expression in which the variables are renamed. renaming: The renaming dictionary. Maps old variable names to new ones. Variable names not occuring in the dictionary ar...
[ "Rename", "the", "variables", "in", "the", "expression", "according", "to", "the", "given", "dictionary", "." ]
python
train
47.76
wbond/asn1crypto
asn1crypto/keys.py
https://github.com/wbond/asn1crypto/blob/ecda20176f55d37021cbca1f6da9083a8e491197/asn1crypto/keys.py#L1042-L1063
def unwrap(self): """ Unwraps an RSA public key into an RSAPublicKey object. Does not support DSA or EC public keys since they do not have an unwrapped form. :return: An RSAPublicKey object """ if self.algorithm == 'rsa': return self['public_key'...
[ "def", "unwrap", "(", "self", ")", ":", "if", "self", ".", "algorithm", "==", "'rsa'", ":", "return", "self", "[", "'public_key'", "]", ".", "parsed", "key_type", "=", "self", ".", "algorithm", ".", "upper", "(", ")", "a_an", "=", "'an'", "if", "key_...
Unwraps an RSA public key into an RSAPublicKey object. Does not support DSA or EC public keys since they do not have an unwrapped form. :return: An RSAPublicKey object
[ "Unwraps", "an", "RSA", "public", "key", "into", "an", "RSAPublicKey", "object", ".", "Does", "not", "support", "DSA", "or", "EC", "public", "keys", "since", "they", "do", "not", "have", "an", "unwrapped", "form", "." ]
python
train
27.636364
tkf/rash
rash/indexer.py
https://github.com/tkf/rash/blob/585da418ec37dd138f1a4277718b6f507e9536a2/rash/indexer.py#L117-L125
def index_all(self): """ Index all records under :attr:`record_path`. """ self.logger.debug('Start indexing all records under: %s', self.record_path) with self.db.connection(): for json_path in sorted(self.find_record_files()): ...
[ "def", "index_all", "(", "self", ")", ":", "self", ".", "logger", ".", "debug", "(", "'Start indexing all records under: %s'", ",", "self", ".", "record_path", ")", "with", "self", ".", "db", ".", "connection", "(", ")", ":", "for", "json_path", "in", "sor...
Index all records under :attr:`record_path`.
[ "Index", "all", "records", "under", ":", "attr", ":", "record_path", "." ]
python
train
38
Erotemic/utool
utool/util_class.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_class.py#L413-L426
def decorate_class_method(func, classkey=None, skipmain=False): """ Will inject all decorated function as methods of classkey classkey is some identifying string, tuple, or object func can also be a tuple """ #import utool as ut global __CLASSTYPE_ATTRIBUTES__ assert classkey is not No...
[ "def", "decorate_class_method", "(", "func", ",", "classkey", "=", "None", ",", "skipmain", "=", "False", ")", ":", "#import utool as ut", "global", "__CLASSTYPE_ATTRIBUTES__", "assert", "classkey", "is", "not", "None", ",", "'must specify classkey'", "#if not (skipma...
Will inject all decorated function as methods of classkey classkey is some identifying string, tuple, or object func can also be a tuple
[ "Will", "inject", "all", "decorated", "function", "as", "methods", "of", "classkey" ]
python
train
33.428571
Overboard/httpfind
httpfind/httpfind.py
https://github.com/Overboard/httpfind/blob/2c372daa66dcc7158e8bb179b29d8001d473bc4a/httpfind/httpfind.py#L157-L181
def cli(): """ Command line interface """ ch = logging.StreamHandler() ch.setFormatter(logging.Formatter( '%(asctime)s.%(msecs)03d %(levelname)s: %(message)s', datefmt="%Y-%m-%d %H:%M:%S" )) logger.addHandler(ch) import argparse parser = argparse.ArgumentParser(description="...
[ "def", "cli", "(", ")", ":", "ch", "=", "logging", ".", "StreamHandler", "(", ")", "ch", ".", "setFormatter", "(", "logging", ".", "Formatter", "(", "'%(asctime)s.%(msecs)03d %(levelname)s: %(message)s'", ",", "datefmt", "=", "\"%Y-%m-%d %H:%M:%S\"", ")", ")", "...
Command line interface
[ "Command", "line", "interface" ]
python
train
43.72
calmjs/calmjs.parse
src/calmjs/parse/parsers/es5.py
https://github.com/calmjs/calmjs.parse/blob/369f0ee346c5a84c4d5c35a7733a0e63b02eac59/src/calmjs/parse/parsers/es5.py#L342-L351
def p_element_list(self, p): """element_list : elision_opt assignment_expr | element_list COMMA elision_opt assignment_expr """ if len(p) == 3: p[0] = p[1] + [p[2]] else: p[1].extend(p[3]) p[1].append(p[4]) p[0] = p[...
[ "def", "p_element_list", "(", "self", ",", "p", ")", ":", "if", "len", "(", "p", ")", "==", "3", ":", "p", "[", "0", "]", "=", "p", "[", "1", "]", "+", "[", "p", "[", "2", "]", "]", "else", ":", "p", "[", "1", "]", ".", "extend", "(", ...
element_list : elision_opt assignment_expr | element_list COMMA elision_opt assignment_expr
[ "element_list", ":", "elision_opt", "assignment_expr", "|", "element_list", "COMMA", "elision_opt", "assignment_expr" ]
python
train
31.3
fedora-infra/fmn.rules
fmn/rules/pagure.py
https://github.com/fedora-infra/fmn.rules/blob/f9ec790619fcc8b41803077c4dec094e5127fc24/fmn/rules/pagure.py#L45-L68
def pagure_specific_project_tag_filter(config, message, tags=None, *args, **kw): """ Particular pagure project tags Adding this rule allows you to get notifications for one or more `pagure.io <https://pagure.io>`_ projects having the specified tags. Specify multiple tags by separating them with a co...
[ "def", "pagure_specific_project_tag_filter", "(", "config", ",", "message", ",", "tags", "=", "None", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "if", "not", "pagure_catchall", "(", "config", ",", "message", ")", ":", "return", "False", "tags", "="...
Particular pagure project tags Adding this rule allows you to get notifications for one or more `pagure.io <https://pagure.io>`_ projects having the specified tags. Specify multiple tags by separating them with a comma ','.
[ "Particular", "pagure", "project", "tags" ]
python
train
35.5
numenta/nupic
examples/network/network_api_demo.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/network/network_api_demo.py#L84-L94
def createEncoder(): """Create the encoder instance for our test and return it.""" consumption_encoder = ScalarEncoder(21, 0.0, 100.0, n=50, name="consumption", clipInput=True) time_encoder = DateEncoder(timeOfDay=(21, 9.5), name="timestamp_timeOfDay") encoder = MultiEncoder() encoder.addEncoder("consu...
[ "def", "createEncoder", "(", ")", ":", "consumption_encoder", "=", "ScalarEncoder", "(", "21", ",", "0.0", ",", "100.0", ",", "n", "=", "50", ",", "name", "=", "\"consumption\"", ",", "clipInput", "=", "True", ")", "time_encoder", "=", "DateEncoder", "(", ...
Create the encoder instance for our test and return it.
[ "Create", "the", "encoder", "instance", "for", "our", "test", "and", "return", "it", "." ]
python
valid
36.818182
CityOfZion/neo-python
neo/Implementations/Wallets/peewee/UserWallet.py
https://github.com/CityOfZion/neo-python/blob/fe90f62e123d720d4281c79af0598d9df9e776fb/neo/Implementations/Wallets/peewee/UserWallet.py#L83-L97
def Create(path, password, generate_default_key=True): """ Create a new user wallet. Args: path (str): A path indicating where to create or open the wallet e.g. "/Wallets/mywallet". password (str): a 10 characters minimum password to secure the wallet with. Retu...
[ "def", "Create", "(", "path", ",", "password", ",", "generate_default_key", "=", "True", ")", ":", "wallet", "=", "UserWallet", "(", "path", "=", "path", ",", "passwordKey", "=", "password", ",", "create", "=", "True", ")", "if", "generate_default_key", ":...
Create a new user wallet. Args: path (str): A path indicating where to create or open the wallet e.g. "/Wallets/mywallet". password (str): a 10 characters minimum password to secure the wallet with. Returns: UserWallet: a UserWallet instance.
[ "Create", "a", "new", "user", "wallet", "." ]
python
train
35.333333
SheffieldML/GPy
GPy/kern/src/add.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/add.py#L46-L57
def to_dict(self): """ Convert the object into a json serializable dictionary. Note: It uses the private method _save_to_input_dict of the parent. :return dict: json serializable dictionary containing the needed information to instantiate the object """ input_dict = su...
[ "def", "to_dict", "(", "self", ")", ":", "input_dict", "=", "super", "(", "Add", ",", "self", ")", ".", "_save_to_input_dict", "(", ")", "input_dict", "[", "\"class\"", "]", "=", "str", "(", "\"GPy.kern.Add\"", ")", "return", "input_dict" ]
Convert the object into a json serializable dictionary. Note: It uses the private method _save_to_input_dict of the parent. :return dict: json serializable dictionary containing the needed information to instantiate the object
[ "Convert", "the", "object", "into", "a", "json", "serializable", "dictionary", "." ]
python
train
35.083333
Rediker-Software/doac
doac/utils.py
https://github.com/Rediker-Software/doac/blob/398fdd64452e4ff8662297b0381926addd77505a/doac/utils.py#L1-L9
def prune_old_authorization_codes(): """ Removes all unused and expired authorization codes from the database. """ from .compat import now from .models import AuthorizationCode AuthorizationCode.objects.with_expiration_before(now()).delete()
[ "def", "prune_old_authorization_codes", "(", ")", ":", "from", ".", "compat", "import", "now", "from", ".", "models", "import", "AuthorizationCode", "AuthorizationCode", ".", "objects", ".", "with_expiration_before", "(", "now", "(", ")", ")", ".", "delete", "("...
Removes all unused and expired authorization codes from the database.
[ "Removes", "all", "unused", "and", "expired", "authorization", "codes", "from", "the", "database", "." ]
python
train
29.222222
vertexproject/synapse
synapse/cortex.py
https://github.com/vertexproject/synapse/blob/22e67c5a8f6d7caddbcf34b39ab1bd2d6c4a6e0b/synapse/cortex.py#L487-L494
async def storm(self, text, opts=None): ''' Evaluate a storm query and yield result messages. Yields: ((str,dict)): Storm messages. ''' async for mesg in self.cell.streamstorm(text, opts, user=self.user): yield mesg
[ "async", "def", "storm", "(", "self", ",", "text", ",", "opts", "=", "None", ")", ":", "async", "for", "mesg", "in", "self", ".", "cell", ".", "streamstorm", "(", "text", ",", "opts", ",", "user", "=", "self", ".", "user", ")", ":", "yield", "mes...
Evaluate a storm query and yield result messages. Yields: ((str,dict)): Storm messages.
[ "Evaluate", "a", "storm", "query", "and", "yield", "result", "messages", ".", "Yields", ":", "((", "str", "dict", "))", ":", "Storm", "messages", "." ]
python
train
34
alphagov/notifications-python-client
notifications_python_client/authentication.py
https://github.com/alphagov/notifications-python-client/blob/b397aed212acf15b1b1e049da2654d9a230f72d2/notifications_python_client/authentication.py#L59-L77
def get_token_issuer(token): """ Issuer of a token is the identifier used to recover the secret Need to extract this from token to ensure we can proceed to the signature validation stage Does not check validity of the token :param token: signed JWT token :return issuer: iss field of the JWT toke...
[ "def", "get_token_issuer", "(", "token", ")", ":", "try", ":", "unverified", "=", "decode_token", "(", "token", ")", "if", "'iss'", "not", "in", "unverified", ":", "raise", "TokenIssuerError", "return", "unverified", ".", "get", "(", "'iss'", ")", "except", ...
Issuer of a token is the identifier used to recover the secret Need to extract this from token to ensure we can proceed to the signature validation stage Does not check validity of the token :param token: signed JWT token :return issuer: iss field of the JWT token :raises TokenIssuerError: if iss fi...
[ "Issuer", "of", "a", "token", "is", "the", "identifier", "used", "to", "recover", "the", "secret", "Need", "to", "extract", "this", "from", "token", "to", "ensure", "we", "can", "proceed", "to", "the", "signature", "validation", "stage", "Does", "not", "ch...
python
train
34.368421
empirical-org/Quill-NLP-Tools-and-Datasets
utils/qfragment/qfragment/sva_rb2.py
https://github.com/empirical-org/Quill-NLP-Tools-and-Datasets/blob/f2ff579ddf3a556d9cdc47c5f702422fa06863d9/utils/qfragment/qfragment/sva_rb2.py#L273-L308
def get_verb_phrases(sentence_doc): """ Returns an object like, [(1), (5,6,7)] where this means 2 verb phrases. a single verb at index 1, another verb phrase 5,6,7. - Adverbs are not included. - Infinitive phrases (and verb phrases that are subsets of infinitive phrase...
[ "def", "get_verb_phrases", "(", "sentence_doc", ")", ":", "pattern", "=", "r'<VERB>*<ADV>*<VERB>+'", "# r'<VERB>?<ADV>*<VERB>+' is suggested by textacy site", "verb_phrases", "=", "textacy", ".", "extract", ".", "pos_regex_matches", "(", "sentence_doc", ",", "pattern", ")"...
Returns an object like, [(1), (5,6,7)] where this means 2 verb phrases. a single verb at index 1, another verb phrase 5,6,7. - Adverbs are not included. - Infinitive phrases (and verb phrases that are subsets of infinitive phrases) are not included
[ "Returns", "an", "object", "like", "[", "(", "1", ")", "(", "5", "6", "7", ")", "]", "where", "this", "means", "2", "verb", "phrases", ".", "a", "single", "verb", "at", "index", "1", "another", "verb", "phrase", "5", "6", "7", ".", "-", "Adverbs"...
python
train
36.25
klen/pylama
pylama/lint/pylama_pydocstyle.py
https://github.com/klen/pylama/blob/f436ccc6b55b33381a295ded753e467953cf4379/pylama/lint/pylama_pydocstyle.py#L20-L37
def run(path, code=None, params=None, **meta): """pydocstyle code checking. :return list: List of errors. """ if 'ignore_decorators' in params: ignore_decorators = params['ignore_decorators'] else: ignore_decorators = None check_source_args = (cod...
[ "def", "run", "(", "path", ",", "code", "=", "None", ",", "params", "=", "None", ",", "*", "*", "meta", ")", ":", "if", "'ignore_decorators'", "in", "params", ":", "ignore_decorators", "=", "params", "[", "'ignore_decorators'", "]", "else", ":", "ignore_...
pydocstyle code checking. :return list: List of errors.
[ "pydocstyle", "code", "checking", "." ]
python
train
39.722222
inasafe/inasafe
safe/definitions/utilities.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/definitions/utilities.py#L63-L77
def hazards_for_layer(layer_geometry_key): """Get hazard categories form layer_geometry_key. :param layer_geometry_key: The geometry id :type layer_geometry_key: str :returns: List of hazard :rtype: list """ result = [] for hazard in hazard_all: if layer_geometry_key in hazard....
[ "def", "hazards_for_layer", "(", "layer_geometry_key", ")", ":", "result", "=", "[", "]", "for", "hazard", "in", "hazard_all", ":", "if", "layer_geometry_key", "in", "hazard", ".", "get", "(", "'allowed_geometries'", ")", ":", "result", ".", "append", "(", "...
Get hazard categories form layer_geometry_key. :param layer_geometry_key: The geometry id :type layer_geometry_key: str :returns: List of hazard :rtype: list
[ "Get", "hazard", "categories", "form", "layer_geometry_key", "." ]
python
train
27.8
theno/utlz
fabfile.py
https://github.com/theno/utlz/blob/bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389/fabfile.py#L10-L19
def flo(string): '''Return the string given by param formatted with the callers locals.''' callers_locals = {} frame = inspect.currentframe() try: outerframe = frame.f_back callers_locals = outerframe.f_locals finally: del frame return string.format(**callers_locals)
[ "def", "flo", "(", "string", ")", ":", "callers_locals", "=", "{", "}", "frame", "=", "inspect", ".", "currentframe", "(", ")", "try", ":", "outerframe", "=", "frame", ".", "f_back", "callers_locals", "=", "outerframe", ".", "f_locals", "finally", ":", "...
Return the string given by param formatted with the callers locals.
[ "Return", "the", "string", "given", "by", "param", "formatted", "with", "the", "callers", "locals", "." ]
python
train
30.6
openego/eTraGo
etrago/tools/utilities.py
https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/tools/utilities.py#L311-L395
def clip_foreign(network): """ Delete all components and timelines located outside of Germany. Add transborder flows divided by country of origin as network.foreign_trade. Parameters ---------- network : :class:`pypsa.Network Overall container of PyPSA Returns ------- n...
[ "def", "clip_foreign", "(", "network", ")", ":", "# get foreign buses by country", "foreign_buses", "=", "network", ".", "buses", "[", "network", ".", "buses", ".", "country_code", "!=", "'DE'", "]", "network", ".", "buses", "=", "network", ".", "buses", ".", ...
Delete all components and timelines located outside of Germany. Add transborder flows divided by country of origin as network.foreign_trade. Parameters ---------- network : :class:`pypsa.Network Overall container of PyPSA Returns ------- network : :class:`pypsa.Network ...
[ "Delete", "all", "components", "and", "timelines", "located", "outside", "of", "Germany", ".", "Add", "transborder", "flows", "divided", "by", "country", "of", "origin", "as", "network", ".", "foreign_trade", "." ]
python
train
41.929412
jilljenn/tryalgo
tryalgo/laser_mirrors.py
https://github.com/jilljenn/tryalgo/blob/89a4dd9655e7b6b0a176f72b4c60d0196420dfe1/tryalgo/laser_mirrors.py#L57-L80
def solve(succ, orien, i, direc): """Can a laser leaving mirror i in direction direc reach exit ? :param i: mirror index :param direc: direction leaving mirror i :param orient: orient[i]=orientation of mirror i :param succ: succ[i][direc]=succ mirror reached when leaving i in direc...
[ "def", "solve", "(", "succ", ",", "orien", ",", "i", ",", "direc", ")", ":", "assert", "orien", "[", "i", "]", "is", "not", "None", "j", "=", "succ", "[", "i", "]", "[", "direc", "]", "if", "j", "is", "None", ":", "# basic case", "return", "Fal...
Can a laser leaving mirror i in direction direc reach exit ? :param i: mirror index :param direc: direction leaving mirror i :param orient: orient[i]=orientation of mirror i :param succ: succ[i][direc]=succ mirror reached when leaving i in direction direc
[ "Can", "a", "laser", "leaving", "mirror", "i", "in", "direction", "direc", "reach", "exit", "?" ]
python
train
32.541667
Stewori/pytypes
pytypes/type_util.py
https://github.com/Stewori/pytypes/blob/b814d38709e84c0e0825caf8b721c20eb5a8ab3b/pytypes/type_util.py#L1965-L1991
def generator_checker_py2(gen, gen_type, bound_Generic, bound_typevars, bound_typevars_readonly, follow_fwd_refs, _recursion_check): """Builds a typechecking wrapper around a Python 2 style generator object. """ initialized = False sn = None while True: a = gen.send(sn) i...
[ "def", "generator_checker_py2", "(", "gen", ",", "gen_type", ",", "bound_Generic", ",", "bound_typevars", ",", "bound_typevars_readonly", ",", "follow_fwd_refs", ",", "_recursion_check", ")", ":", "initialized", "=", "False", "sn", "=", "None", "while", "True", ":...
Builds a typechecking wrapper around a Python 2 style generator object.
[ "Builds", "a", "typechecking", "wrapper", "around", "a", "Python", "2", "style", "generator", "object", "." ]
python
train
54.296296
pantsbuild/pants
src/python/pants/core_tasks/deferred_sources_mapper.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/core_tasks/deferred_sources_mapper.py#L53-L90
def process_remote_sources(self): """Create synthetic targets with populated sources from remote_sources targets.""" unpacked_sources = self.context.products.get_data(UnpackedArchives) remote_sources_targets = self.context.targets(predicate=lambda t: isinstance(t, RemoteSources)) if not remote_sources_t...
[ "def", "process_remote_sources", "(", "self", ")", ":", "unpacked_sources", "=", "self", ".", "context", ".", "products", ".", "get_data", "(", "UnpackedArchives", ")", "remote_sources_targets", "=", "self", ".", "context", ".", "targets", "(", "predicate", "=",...
Create synthetic targets with populated sources from remote_sources targets.
[ "Create", "synthetic", "targets", "with", "populated", "sources", "from", "remote_sources", "targets", "." ]
python
train
48.763158
saltstack/salt
salt/modules/glusterfs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/glusterfs.py#L545-L589
def add_volume_bricks(name, bricks): ''' Add brick(s) to an existing volume name Volume name bricks List of bricks to add to the volume CLI Example: .. code-block:: bash salt '*' glusterfs.add_volume_bricks <volume> <bricks> ''' volinfo = info() if name ...
[ "def", "add_volume_bricks", "(", "name", ",", "bricks", ")", ":", "volinfo", "=", "info", "(", ")", "if", "name", "not", "in", "volinfo", ":", "log", ".", "error", "(", "'Volume %s does not exist, cannot add bricks'", ",", "name", ")", "return", "False", "ne...
Add brick(s) to an existing volume name Volume name bricks List of bricks to add to the volume CLI Example: .. code-block:: bash salt '*' glusterfs.add_volume_bricks <volume> <bricks>
[ "Add", "brick", "(", "s", ")", "to", "an", "existing", "volume" ]
python
train
22
woolfson-group/isambard
isambard/ampal/protein.py
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/protein.py#L80-L116
def flat_list_to_polymer(atom_list, atom_group_s=4): """Takes a flat list of atomic coordinates and converts it to a `Polymer`. Parameters ---------- atom_list : [Atom] Flat list of coordinates. atom_group_s : int, optional Size of atom groups. Returns ------- polymer :...
[ "def", "flat_list_to_polymer", "(", "atom_list", ",", "atom_group_s", "=", "4", ")", ":", "atom_labels", "=", "[", "'N'", ",", "'CA'", ",", "'C'", ",", "'O'", ",", "'CB'", "]", "atom_elements", "=", "[", "'N'", ",", "'C'", ",", "'C'", ",", "'O'", ","...
Takes a flat list of atomic coordinates and converts it to a `Polymer`. Parameters ---------- atom_list : [Atom] Flat list of coordinates. atom_group_s : int, optional Size of atom groups. Returns ------- polymer : Polypeptide `Polymer` object containing atom coords...
[ "Takes", "a", "flat", "list", "of", "atomic", "coordinates", "and", "converts", "it", "to", "a", "Polymer", "." ]
python
train
32.891892
pydata/xarray
xarray/backends/zarr.py
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/backends/zarr.py#L356-L533
def open_zarr(store, group=None, synchronizer=None, chunks='auto', decode_cf=True, mask_and_scale=True, decode_times=True, concat_characters=True, decode_coords=True, drop_variables=None, consolidated=False, overwrite_encoded_chunks=False, **kwargs): """Load a...
[ "def", "open_zarr", "(", "store", ",", "group", "=", "None", ",", "synchronizer", "=", "None", ",", "chunks", "=", "'auto'", ",", "decode_cf", "=", "True", ",", "mask_and_scale", "=", "True", ",", "decode_times", "=", "True", ",", "concat_characters", "=",...
Load and decode a dataset from a Zarr store. .. note:: Experimental The Zarr backend is new and experimental. Please report any unexpected behavior via github issues. The `store` object should be a valid store for a Zarr group. `store` variables must contain dimension metadata ...
[ "Load", "and", "decode", "a", "dataset", "from", "a", "Zarr", "store", "." ]
python
train
41.224719
BenjaminSchubert/NitPycker
nitpycker/runner.py
https://github.com/BenjaminSchubert/NitPycker/blob/3ac2b3bf06f1d704b4853167a967311b0465a76f/nitpycker/runner.py#L113-L135
def module_can_run_parallel(test_module: unittest.TestSuite) -> bool: """ Checks if a given module of tests can be run in parallel or not :param test_module: the module to run :return: True if the module can be run on parallel, False otherwise """ for test_class in test_...
[ "def", "module_can_run_parallel", "(", "test_module", ":", "unittest", ".", "TestSuite", ")", "->", "bool", ":", "for", "test_class", "in", "test_module", ":", "# if the test is already failed, we just don't filter it", "# and let the test runner deal with it later.", "if", "...
Checks if a given module of tests can be run in parallel or not :param test_module: the module to run :return: True if the module can be run on parallel, False otherwise
[ "Checks", "if", "a", "given", "module", "of", "tests", "can", "be", "run", "in", "parallel", "or", "not" ]
python
train
53.391304
dropbox/stone
stone/backends/js_types.py
https://github.com/dropbox/stone/blob/2e95cbcd1c48e05cca68c919fd8d24adec6b0f58/stone/backends/js_types.py#L172-L249
def _generate_struct(self, struct_type, extra_parameters=None, nameOverride=None): """ Emits a JSDoc @typedef for a struct. """ extra_parameters = extra_parameters if extra_parameters is not None else [] self._emit_jsdoc_header(struct_type.doc) self.emit( ' * ...
[ "def", "_generate_struct", "(", "self", ",", "struct_type", ",", "extra_parameters", "=", "None", ",", "nameOverride", "=", "None", ")", ":", "extra_parameters", "=", "extra_parameters", "if", "extra_parameters", "is", "not", "None", "else", "[", "]", "self", ...
Emits a JSDoc @typedef for a struct.
[ "Emits", "a", "JSDoc" ]
python
train
46.551282
glormph/msstitch
src/app/actions/prottable/precursorarea.py
https://github.com/glormph/msstitch/blob/ded7e5cbd813d7797dc9d42805778266e59ff042/src/app/actions/prottable/precursorarea.py#L40-L52
def add_ms1_quant_from_top3_mzidtsv(proteins, psms, headerfields, protcol): """Collects PSMs with the highes precursor quant values, adds sum of the top 3 of these to a protein table""" if not protcol: protcol = mzidtsvdata.HEADER_MASTER_PROT top_ms1_psms = generate_top_psms(psms, protcol) f...
[ "def", "add_ms1_quant_from_top3_mzidtsv", "(", "proteins", ",", "psms", ",", "headerfields", ",", "protcol", ")", ":", "if", "not", "protcol", ":", "protcol", "=", "mzidtsvdata", ".", "HEADER_MASTER_PROT", "top_ms1_psms", "=", "generate_top_psms", "(", "psms", ","...
Collects PSMs with the highes precursor quant values, adds sum of the top 3 of these to a protein table
[ "Collects", "PSMs", "with", "the", "highes", "precursor", "quant", "values", "adds", "sum", "of", "the", "top", "3", "of", "these", "to", "a", "protein", "table" ]
python
train
50.846154
dslackw/slpkg
slpkg/checks.py
https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/checks.py#L119-L122
def print_status(self, repo): """Print status """ print(" {0}{1}{2}".format(repo, " " * (19 - len(repo)), self.st))
[ "def", "print_status", "(", "self", ",", "repo", ")", ":", "print", "(", "\" {0}{1}{2}\"", ".", "format", "(", "repo", ",", "\" \"", "*", "(", "19", "-", "len", "(", "repo", ")", ")", ",", "self", ".", "st", ")", ")" ]
Print status
[ "Print", "status" ]
python
train
34.25
undertheseanlp/languageflow
languageflow/reader/tagged_corpus.py
https://github.com/undertheseanlp/languageflow/blob/1436e0bf72803e02ccf727f41e8fc85ba167d9fe/languageflow/reader/tagged_corpus.py#L70-L94
def analyze(self, output_folder=".", auto_remove=False): """ :type auto_remove: boolean :param boolean auto_remove: auto remove previous files in analyze folder """ if auto_remove: try: shutil.rmtree(output_folder) except: p...
[ "def", "analyze", "(", "self", ",", "output_folder", "=", "\".\"", ",", "auto_remove", "=", "False", ")", ":", "if", "auto_remove", ":", "try", ":", "shutil", ".", "rmtree", "(", "output_folder", ")", "except", ":", "pass", "try", ":", "mkdir", "(", "o...
:type auto_remove: boolean :param boolean auto_remove: auto remove previous files in analyze folder
[ ":", "type", "auto_remove", ":", "boolean", ":", "param", "boolean", "auto_remove", ":", "auto", "remove", "previous", "files", "in", "analyze", "folder" ]
python
valid
34.08
fabioz/PyDev.Debugger
pydev_ipython/inputhook.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydev_ipython/inputhook.py#L396-L414
def enable_gtk3(self, app=None): """Enable event loop integration with Gtk3 (gir bindings). Parameters ---------- app : ignored Ignored, it's only a placeholder to keep the call signature of all gui activation methods consistent, which simplifies the logic of ...
[ "def", "enable_gtk3", "(", "self", ",", "app", "=", "None", ")", ":", "from", "pydev_ipython", ".", "inputhookgtk3", "import", "create_inputhook_gtk3", "self", ".", "set_inputhook", "(", "create_inputhook_gtk3", "(", "self", ".", "_stdin_file", ")", ")", "self",...
Enable event loop integration with Gtk3 (gir bindings). Parameters ---------- app : ignored Ignored, it's only a placeholder to keep the call signature of all gui activation methods consistent, which simplifies the logic of supporting magics. Notes ...
[ "Enable", "event", "loop", "integration", "with", "Gtk3", "(", "gir", "bindings", ")", "." ]
python
train
36.526316
honzajavorek/redis-collections
redis_collections/base.py
https://github.com/honzajavorek/redis-collections/blob/07ca8efe88fb128f7dc7319dfa6a26cd39b3776b/redis_collections/base.py#L116-L125
def _clear(self, pipe=None): """Helper for clear operations. :param pipe: Redis pipe in case update is performed as a part of transaction. :type pipe: :class:`redis.client.StrictPipeline` or :class:`redis.client.StrictRedis` """ redis = s...
[ "def", "_clear", "(", "self", ",", "pipe", "=", "None", ")", ":", "redis", "=", "self", ".", "redis", "if", "pipe", "is", "None", "else", "pipe", "redis", ".", "delete", "(", "self", ".", "key", ")" ]
Helper for clear operations. :param pipe: Redis pipe in case update is performed as a part of transaction. :type pipe: :class:`redis.client.StrictPipeline` or :class:`redis.client.StrictRedis`
[ "Helper", "for", "clear", "operations", "." ]
python
train
37.7
aequitas/python-rflink
rflink/protocol.py
https://github.com/aequitas/python-rflink/blob/46759ce8daf95cfc7cdb608ae17bc5501be9f6d8/rflink/protocol.py#L165-L188
def send_command_ack(self, device_id, action): """Send command, wait for gateway to repond with acknowledgment.""" # serialize commands yield from self._ready_to_send.acquire() acknowledgement = None try: self._command_ack.clear() self.send_command(device_...
[ "def", "send_command_ack", "(", "self", ",", "device_id", ",", "action", ")", ":", "# serialize commands", "yield", "from", "self", ".", "_ready_to_send", ".", "acquire", "(", ")", "acknowledgement", "=", "None", "try", ":", "self", ".", "_command_ack", ".", ...
Send command, wait for gateway to repond with acknowledgment.
[ "Send", "command", "wait", "for", "gateway", "to", "repond", "with", "acknowledgment", "." ]
python
train
40.083333
dj-stripe/dj-stripe
djstripe/models/base.py
https://github.com/dj-stripe/dj-stripe/blob/a5308a3808cd6e2baba49482f7a699f3a8992518/djstripe/models/base.py#L539-L560
def _stripe_object_to_refunds(cls, target_cls, data, charge): """ Retrieves Refunds for a charge :param target_cls: The target class to instantiate per invoice item. :type target_cls: ``Refund`` :param data: The data dictionary received from the Stripe API. :type data: dict :param charge: The charge objec...
[ "def", "_stripe_object_to_refunds", "(", "cls", ",", "target_cls", ",", "data", ",", "charge", ")", ":", "refunds", "=", "data", ".", "get", "(", "\"refunds\"", ")", "if", "not", "refunds", ":", "return", "[", "]", "refund_objs", "=", "[", "]", "for", ...
Retrieves Refunds for a charge :param target_cls: The target class to instantiate per invoice item. :type target_cls: ``Refund`` :param data: The data dictionary received from the Stripe API. :type data: dict :param charge: The charge object that refunds are for. :type invoice: ``djstripe.models.Refund`` ...
[ "Retrieves", "Refunds", "for", "a", "charge", ":", "param", "target_cls", ":", "The", "target", "class", "to", "instantiate", "per", "invoice", "item", ".", ":", "type", "target_cls", ":", "Refund", ":", "param", "data", ":", "The", "data", "dictionary", "...
python
train
29.5
datosgobar/pydatajson
pydatajson/validation.py
https://github.com/datosgobar/pydatajson/blob/3141082ffbaa295e2deaf6ffbbc5a59f5859960e/pydatajson/validation.py#L84-L107
def is_valid_catalog(catalog, validator=None): """Valida que un archivo `data.json` cumpla con el schema definido. Chequea que el data.json tiene todos los campos obligatorios y que tanto los campos obligatorios como los opcionales siguen la estructura definida en el schema. Args: catalog ...
[ "def", "is_valid_catalog", "(", "catalog", ",", "validator", "=", "None", ")", ":", "catalog", "=", "readers", ".", "read_catalog", "(", "catalog", ")", "if", "not", "validator", ":", "if", "hasattr", "(", "catalog", ",", "\"validator\"", ")", ":", "valida...
Valida que un archivo `data.json` cumpla con el schema definido. Chequea que el data.json tiene todos los campos obligatorios y que tanto los campos obligatorios como los opcionales siguen la estructura definida en el schema. Args: catalog (str o dict): Catálogo (dict, JSON o XLSX) a ser valid...
[ "Valida", "que", "un", "archivo", "data", ".", "json", "cumpla", "con", "el", "schema", "definido", "." ]
python
train
33.833333
jmcgeheeiv/pyfakefs
pyfakefs/fake_filesystem.py
https://github.com/jmcgeheeiv/pyfakefs/blob/6c36fb8987108107fc861fc3013620d46c7d2f9c/pyfakefs/fake_filesystem.py#L4903-L4917
def _write_wrapper(self, name): """Wrap write() to adapt return value for Python 2. Returns: Wrapper which is described below. """ io_attr = getattr(self._io, name) def write_wrapper(*args, **kwargs): """Wrap all write calls to the stream object.""" ...
[ "def", "_write_wrapper", "(", "self", ",", "name", ")", ":", "io_attr", "=", "getattr", "(", "self", ".", "_io", ",", "name", ")", "def", "write_wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"Wrap all write calls to the stream object.\...
Wrap write() to adapt return value for Python 2. Returns: Wrapper which is described below.
[ "Wrap", "write", "()", "to", "adapt", "return", "value", "for", "Python", "2", "." ]
python
train
29.333333
NicolasLM/spinach
spinach/job.py
https://github.com/NicolasLM/spinach/blob/0122f916643101eab5cdc1f3da662b9446e372aa/spinach/job.py#L152-L197
def advance_job_status(namespace: str, job: Job, duration: float, err: Optional[Exception]): """Advance the status of a job depending on its execution. This function is called after a job has been executed. It calculates its next status and calls the appropriate signals. """ ...
[ "def", "advance_job_status", "(", "namespace", ":", "str", ",", "job", ":", "Job", ",", "duration", ":", "float", ",", "err", ":", "Optional", "[", "Exception", "]", ")", ":", "duration", "=", "human_duration", "(", "duration", ")", "if", "not", "err", ...
Advance the status of a job depending on its execution. This function is called after a job has been executed. It calculates its next status and calls the appropriate signals.
[ "Advance", "the", "status", "of", "a", "job", "depending", "on", "its", "execution", "." ]
python
train
35.347826
pylp/pylp
pylp/utils/pipes.py
https://github.com/pylp/pylp/blob/7ebaa55fbaf61cb8175f211dd41ef2928c22d4d4/pylp/utils/pipes.py#L11-L15
def pipes(stream, *transformers): """Pipe several transformers end to end.""" for transformer in transformers: stream = stream.pipe(transformer) return stream
[ "def", "pipes", "(", "stream", ",", "*", "transformers", ")", ":", "for", "transformer", "in", "transformers", ":", "stream", "=", "stream", ".", "pipe", "(", "transformer", ")", "return", "stream" ]
Pipe several transformers end to end.
[ "Pipe", "several", "transformers", "end", "to", "end", "." ]
python
train
34.8
saltstack/salt
salt/queues/pgjsonb_queue.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/queues/pgjsonb_queue.py#L211-L228
def delete(queue, items): ''' Delete an item or items from a queue ''' with _conn(commit=True) as cur: if isinstance(items, dict): cmd = str("""DELETE FROM {0} WHERE data = '{1}'""").format( # future lint: disable=blacklisted-function queue, salt.util...
[ "def", "delete", "(", "queue", ",", "items", ")", ":", "with", "_conn", "(", "commit", "=", "True", ")", "as", "cur", ":", "if", "isinstance", "(", "items", ",", "dict", ")", ":", "cmd", "=", "str", "(", "\"\"\"DELETE FROM {0} WHERE data = '{1}'\"\"\"", ...
Delete an item or items from a queue
[ "Delete", "an", "item", "or", "items", "from", "a", "queue" ]
python
train
38.277778
openspending/babbage
babbage/cube.py
https://github.com/openspending/babbage/blob/9e03efe62e0be0cceabafd4de2a09cb8ec794b92/babbage/cube.py#L60-L117
def aggregate(self, aggregates=None, drilldowns=None, cuts=None, order=None, page=None, page_size=None, page_max=None): """Main aggregation function. This is used to compute a given set of aggregates, grouped by a given set of drilldown dimensions (i.e. dividers). The query can...
[ "def", "aggregate", "(", "self", ",", "aggregates", "=", "None", ",", "drilldowns", "=", "None", ",", "cuts", "=", "None", ",", "order", "=", "None", ",", "page", "=", "None", ",", "page_size", "=", "None", ",", "page_max", "=", "None", ")", ":", "...
Main aggregation function. This is used to compute a given set of aggregates, grouped by a given set of drilldown dimensions (i.e. dividers). The query can also be filtered and sorted.
[ "Main", "aggregation", "function", ".", "This", "is", "used", "to", "compute", "a", "given", "set", "of", "aggregates", "grouped", "by", "a", "given", "set", "of", "drilldown", "dimensions", "(", "i", ".", "e", ".", "dividers", ")", ".", "The", "query", ...
python
train
36.275862
wummel/linkchecker
linkcheck/checker/httpurl.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/checker/httpurl.py#L105-L116
def add_size_info (self): """Get size of URL content from HTTP header.""" if self.headers and "Content-Length" in self.headers and \ "Transfer-Encoding" not in self.headers: # Note that content-encoding causes size differences since # the content data is always decoded...
[ "def", "add_size_info", "(", "self", ")", ":", "if", "self", ".", "headers", "and", "\"Content-Length\"", "in", "self", ".", "headers", "and", "\"Transfer-Encoding\"", "not", "in", "self", ".", "headers", ":", "# Note that content-encoding causes size differences sinc...
Get size of URL content from HTTP header.
[ "Get", "size", "of", "URL", "content", "from", "HTTP", "header", "." ]
python
train
41.916667
dfm/george
george/modeling.py
https://github.com/dfm/george/blob/44819680036387625ee89f81c55104f3c1600759/george/modeling.py#L176-L188
def get_parameter_dict(self, include_frozen=False): """ Get an ordered dictionary of the parameters Args: include_frozen (Optional[bool]): Should the frozen parameters be included in the returned value? (default: ``False``) """ return OrderedDict(zip...
[ "def", "get_parameter_dict", "(", "self", ",", "include_frozen", "=", "False", ")", ":", "return", "OrderedDict", "(", "zip", "(", "self", ".", "get_parameter_names", "(", "include_frozen", "=", "include_frozen", ")", ",", "self", ".", "get_parameter_vector", "(...
Get an ordered dictionary of the parameters Args: include_frozen (Optional[bool]): Should the frozen parameters be included in the returned value? (default: ``False``)
[ "Get", "an", "ordered", "dictionary", "of", "the", "parameters" ]
python
train
35.307692
cokelaer/spectrum
src/spectrum/mtm.py
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/mtm.py#L359-L418
def _other_dpss_method(N, NW, Kmax): """Returns the Discrete Prolate Spheroidal Sequences of orders [0,Kmax-1] for a given frequency-spacing multiple NW and sequence length N. See dpss function that is the official version. This version is indepedant of the C code and relies on Scipy function. However,...
[ "def", "_other_dpss_method", "(", "N", ",", "NW", ",", "Kmax", ")", ":", "# here we want to set up an optimization problem to find a sequence", "# whose energy is maximally concentrated within band [-W,W].", "# Thus, the measure lambda(T,W) is the ratio between the energy within", "# that ...
Returns the Discrete Prolate Spheroidal Sequences of orders [0,Kmax-1] for a given frequency-spacing multiple NW and sequence length N. See dpss function that is the official version. This version is indepedant of the C code and relies on Scipy function. However, it is slower by a factor 3 Tridiagonal...
[ "Returns", "the", "Discrete", "Prolate", "Spheroidal", "Sequences", "of", "orders", "[", "0", "Kmax", "-", "1", "]", "for", "a", "given", "frequency", "-", "spacing", "multiple", "NW", "and", "sequence", "length", "N", "." ]
python
valid
43.366667
quikmile/trellio
trellio/host.py
https://github.com/quikmile/trellio/blob/e8b050077562acf32805fcbb9c0c162248a23c62/trellio/host.py#L130-L138
def attach_http_service(cls, http_service: HTTPService): """ Attaches a service for hosting :param http_service: A HTTPService instance """ if cls._http_service is None: cls._http_service = http_service cls._set_bus(http_service) else: warnings...
[ "def", "attach_http_service", "(", "cls", ",", "http_service", ":", "HTTPService", ")", ":", "if", "cls", ".", "_http_service", "is", "None", ":", "cls", ".", "_http_service", "=", "http_service", "cls", ".", "_set_bus", "(", "http_service", ")", "else", ":"...
Attaches a service for hosting :param http_service: A HTTPService instance
[ "Attaches", "a", "service", "for", "hosting", ":", "param", "http_service", ":", "A", "HTTPService", "instance" ]
python
train
39.222222
cackharot/suds-py3
suds/reader.py
https://github.com/cackharot/suds-py3/blob/7387ec7806e9be29aad0a711bea5cb3c9396469c/suds/reader.py#L134-L157
def open(self, url): """ Open a WSDL at the specified I{url}. First, the WSDL attempted to be retrieved from the I{object cache}. After unpickled from the cache, the I{options} attribute is restored. If not found, it is downloaded and instantiated using the I{fn}...
[ "def", "open", "(", "self", ",", "url", ")", ":", "cache", "=", "self", ".", "cache", "(", ")", "id", "=", "self", ".", "mangle", "(", "url", ",", "'wsdl'", ")", "d", "=", "cache", ".", "get", "(", "id", ")", "if", "d", "is", "None", ":", "...
Open a WSDL at the specified I{url}. First, the WSDL attempted to be retrieved from the I{object cache}. After unpickled from the cache, the I{options} attribute is restored. If not found, it is downloaded and instantiated using the I{fn} constructor and added to the cache for t...
[ "Open", "a", "WSDL", "at", "the", "specified", "I", "{", "url", "}", ".", "First", "the", "WSDL", "attempted", "to", "be", "retrieved", "from", "the", "I", "{", "object", "cache", "}", ".", "After", "unpickled", "from", "the", "cache", "the", "I", "{...
python
train
34.458333
bwhite/hadoopy
hadoopy/thirdparty/pyinstaller/PyInstaller/lib/pefile.py
https://github.com/bwhite/hadoopy/blob/ff39b4e6d4e6efaf1f571cf0f2c0e0d7ab28c2d6/hadoopy/thirdparty/pyinstaller/PyInstaller/lib/pefile.py#L2169-L2258
def parse_sections(self, offset): """Fetch the PE file sections. The sections will be readily available in the "sections" attribute. Its attributes will contain all the section information plus "data" a buffer containing the section's data. The "Characteristics"...
[ "def", "parse_sections", "(", "self", ",", "offset", ")", ":", "self", ".", "sections", "=", "[", "]", "for", "i", "in", "xrange", "(", "self", ".", "FILE_HEADER", ".", "NumberOfSections", ")", ":", "section", "=", "SectionStructure", "(", "self", ".", ...
Fetch the PE file sections. The sections will be readily available in the "sections" attribute. Its attributes will contain all the section information plus "data" a buffer containing the section's data. The "Characteristics" member will be processed and attributes ...
[ "Fetch", "the", "PE", "file", "sections", ".", "The", "sections", "will", "be", "readily", "available", "in", "the", "sections", "attribute", ".", "Its", "attributes", "will", "contain", "all", "the", "section", "information", "plus", "data", "a", "buffer", ...
python
train
48.422222
glottobank/python-newick
src/newick.py
https://github.com/glottobank/python-newick/blob/e8d4d1e4610f271d0f0e5cb86c0e0360b43bd702/src/newick.py#L209-L222
def visit(self, visitor, predicate=None, **kw): """ Apply a function to matching nodes in the (sub)tree rooted at self. :param visitor: A callable accepting a Node object as single argument.. :param predicate: A callable accepting a Node object as single argument and \ returning...
[ "def", "visit", "(", "self", ",", "visitor", ",", "predicate", "=", "None", ",", "*", "*", "kw", ")", ":", "predicate", "=", "predicate", "or", "bool", "for", "n", "in", "self", ".", "walk", "(", "*", "*", "kw", ")", ":", "if", "predicate", "(", ...
Apply a function to matching nodes in the (sub)tree rooted at self. :param visitor: A callable accepting a Node object as single argument.. :param predicate: A callable accepting a Node object as single argument and \ returning a boolean signaling whether Node matches; if `None` all nodes match...
[ "Apply", "a", "function", "to", "matching", "nodes", "in", "the", "(", "sub", ")", "tree", "rooted", "at", "self", "." ]
python
test
42.642857
apache/incubator-mxnet
example/reinforcement-learning/dqn/utils.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/example/reinforcement-learning/dqn/utils.py#L133-L154
def sample_categorical(prob, rng): """Sample from independent categorical distributions Each batch is an independent categorical distribution. Parameters ---------- prob : numpy.ndarray Probability of the categorical distribution. Shape --> (batch_num, category_num) rng : numpy.random.Ra...
[ "def", "sample_categorical", "(", "prob", ",", "rng", ")", ":", "ret", "=", "numpy", ".", "empty", "(", "prob", ".", "shape", "[", "0", "]", ",", "dtype", "=", "numpy", ".", "float32", ")", "for", "ind", "in", "range", "(", "prob", ".", "shape", ...
Sample from independent categorical distributions Each batch is an independent categorical distribution. Parameters ---------- prob : numpy.ndarray Probability of the categorical distribution. Shape --> (batch_num, category_num) rng : numpy.random.RandomState Returns ------- ret...
[ "Sample", "from", "independent", "categorical", "distributions" ]
python
train
36.545455
Erotemic/utool
utool/util_arg.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_arg.py#L48-L62
def get_module_verbosity_flags(*labels): """ checks for standard flags for enableing module specific verbosity """ verbose_prefix_list = ['--verbose-', '--verb', '--verb-'] veryverbose_prefix_list = ['--veryverbose-', '--veryverb', '--veryverb-'] verbose_flags = tuple( [prefix + lbl for prefix, ...
[ "def", "get_module_verbosity_flags", "(", "*", "labels", ")", ":", "verbose_prefix_list", "=", "[", "'--verbose-'", ",", "'--verb'", ",", "'--verb-'", "]", "veryverbose_prefix_list", "=", "[", "'--veryverbose-'", ",", "'--veryverb'", ",", "'--veryverb-'", "]", "verb...
checks for standard flags for enableing module specific verbosity
[ "checks", "for", "standard", "flags", "for", "enableing", "module", "specific", "verbosity" ]
python
train
50.533333
tcalmant/ipopo
pelix/remote/beans.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/beans.py#L655-L693
def from_export(cls, endpoint): # type: (ExportEndpoint) -> EndpointDescription """ Converts an ExportEndpoint bean to an EndpointDescription :param endpoint: An ExportEndpoint bean :return: An EndpointDescription bean """ assert isinstance(endpoint, ExportEndpoi...
[ "def", "from_export", "(", "cls", ",", "endpoint", ")", ":", "# type: (ExportEndpoint) -> EndpointDescription", "assert", "isinstance", "(", "endpoint", ",", "ExportEndpoint", ")", "# Service properties", "properties", "=", "endpoint", ".", "get_properties", "(", ")", ...
Converts an ExportEndpoint bean to an EndpointDescription :param endpoint: An ExportEndpoint bean :return: An EndpointDescription bean
[ "Converts", "an", "ExportEndpoint", "bean", "to", "an", "EndpointDescription" ]
python
train
32.384615
ubccr/pinky
pinky/perception/aromaticity.py
https://github.com/ubccr/pinky/blob/e9d6e8ff72aa7f670b591e3bd3629cb879db1a93/pinky/perception/aromaticity.py#L237-L264
def addHydrogens(molecule, usedPyroles=None): """(molecule) -> add implicit hydrogens to a molecule. If the atom has specified valences and the atom must be charged then a Valence Error is raised""" for atom in molecule.atoms: # if the atom has an explicit hcount, we can't set the # hcou...
[ "def", "addHydrogens", "(", "molecule", ",", "usedPyroles", "=", "None", ")", ":", "for", "atom", "in", "molecule", ".", "atoms", ":", "# if the atom has an explicit hcount, we can't set the", "# hcount", "if", "atom", ".", "has_explicit_hcount", ":", "atom", ".", ...
(molecule) -> add implicit hydrogens to a molecule. If the atom has specified valences and the atom must be charged then a Valence Error is raised
[ "(", "molecule", ")", "-", ">", "add", "implicit", "hydrogens", "to", "a", "molecule", ".", "If", "the", "atom", "has", "specified", "valences", "and", "the", "atom", "must", "be", "charged", "then", "a", "Valence", "Error", "is", "raised" ]
python
train
41.428571
StackStorm/pybind
pybind/slxos/v17r_1_01a/mpls_config/router/mpls/mpls_cmds_holder/policy/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_1_01a/mpls_config/router/mpls/mpls_cmds_holder/policy/__init__.py#L349-L370
def _set_load_interval(self, v, load=False): """ Setter method for load_interval, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/policy/load_interval (uint32) If this variable is read-only (config: false) in the source YANG file, then _set_load_interval is considered as a private ...
[ "def", "_set_load_interval", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "...
Setter method for load_interval, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/policy/load_interval (uint32) If this variable is read-only (config: false) in the source YANG file, then _set_load_interval is considered as a private method. Backends looking to populate this variable shou...
[ "Setter", "method", "for", "load_interval", "mapped", "from", "YANG", "variable", "/", "mpls_config", "/", "router", "/", "mpls", "/", "mpls_cmds_holder", "/", "policy", "/", "load_interval", "(", "uint32", ")", "If", "this", "variable", "is", "read", "-", "...
python
train
103.818182
SkyLothar/shcmd
shcmd/cmd.py
https://github.com/SkyLothar/shcmd/blob/d8cad6311a4da7ef09f3419c86b58e30388b7ee3/shcmd/cmd.py#L31-L50
def cd_to(path, mkdir=False): """make a generator like cd, but use it for function Usage:: >>> @cd_to("/") ... def say_where(): ... print(os.getcwd()) ... >>> say_where() / """ def cd_to_decorator(func): @functools.wraps(func) def _c...
[ "def", "cd_to", "(", "path", ",", "mkdir", "=", "False", ")", ":", "def", "cd_to_decorator", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "_cd_and_exec", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with"...
make a generator like cd, but use it for function Usage:: >>> @cd_to("/") ... def say_where(): ... print(os.getcwd()) ... >>> say_where() /
[ "make", "a", "generator", "like", "cd", "but", "use", "it", "for", "function" ]
python
train
23.15
emory-libraries/eulfedora
eulfedora/api.py
https://github.com/emory-libraries/eulfedora/blob/161826f3fdcdab4007f6fa7dfd9f1ecabc4bcbe4/eulfedora/api.py#L1067-L1075
def sparql_query(self, query, flush=None, limit=None): """ Run a Sparql query. :param query: sparql query string :rtype: list of dictionary """ return self.find_statements(query, language='sparql', type='tuples', flush=flush, limit=limit)
[ "def", "sparql_query", "(", "self", ",", "query", ",", "flush", "=", "None", ",", "limit", "=", "None", ")", ":", "return", "self", ".", "find_statements", "(", "query", ",", "language", "=", "'sparql'", ",", "type", "=", "'tuples'", ",", "flush", "=",...
Run a Sparql query. :param query: sparql query string :rtype: list of dictionary
[ "Run", "a", "Sparql", "query", "." ]
python
train
32.333333
materialsproject/pymatgen
pymatgen/analysis/structure_matcher.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_matcher.py#L614-L646
def _preprocess(self, struct1, struct2, niggli=True): """ Rescales, finds the reduced structures (primitive and niggli), and finds fu, the supercell size to make struct1 comparable to s2 """ struct1 = struct1.copy() struct2 = struct2.copy() if niggli: ...
[ "def", "_preprocess", "(", "self", ",", "struct1", ",", "struct2", ",", "niggli", "=", "True", ")", ":", "struct1", "=", "struct1", ".", "copy", "(", ")", "struct2", "=", "struct2", ".", "copy", "(", ")", "if", "niggli", ":", "struct1", "=", "struct1...
Rescales, finds the reduced structures (primitive and niggli), and finds fu, the supercell size to make struct1 comparable to s2
[ "Rescales", "finds", "the", "reduced", "structures", "(", "primitive", "and", "niggli", ")", "and", "finds", "fu", "the", "supercell", "size", "to", "make", "struct1", "comparable", "to", "s2" ]
python
train
36.333333