repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
aewallin/allantools
allantools/ci.py
https://github.com/aewallin/allantools/blob/b5c695a5af4379fcea4d4ce93a066cb902e7ee0a/allantools/ci.py#L249-L261
def b1_boundary(b_hi, N): """ B1 ratio boundary for selecting between [b_hi-1, b_hi] alpha = b + 2 """ b_lo = b_hi-1 b1_lo = b1_theory(N, b_to_mu(b_lo)) b1_hi = b1_theory(N, b_to_mu(b_hi)) if b1_lo >= -4: return np.sqrt(b1_lo*b1_hi) # geometric mean else: return ...
[ "def", "b1_boundary", "(", "b_hi", ",", "N", ")", ":", "b_lo", "=", "b_hi", "-", "1", "b1_lo", "=", "b1_theory", "(", "N", ",", "b_to_mu", "(", "b_lo", ")", ")", "b1_hi", "=", "b1_theory", "(", "N", ",", "b_to_mu", "(", "b_hi", ")", ")", "if", ...
B1 ratio boundary for selecting between [b_hi-1, b_hi] alpha = b + 2
[ "B1", "ratio", "boundary", "for", "selecting", "between", "[", "b_hi", "-", "1", "b_hi", "]", "alpha", "=", "b", "+", "2" ]
python
train
tensorflow/cleverhans
cleverhans/attacks/max_confidence.py
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/cleverhans/attacks/max_confidence.py#L41-L53
def generate(self, x, **kwargs): """ Generate symbolic graph for adversarial examples and return. :param x: The model's symbolic inputs. :param kwargs: Keyword arguments for the base attacker """ assert self.parse_params(**kwargs) labels, _nb_classes = self.get_or_guess_labels(x, kwargs) ...
[ "def", "generate", "(", "self", ",", "x", ",", "*", "*", "kwargs", ")", ":", "assert", "self", ".", "parse_params", "(", "*", "*", "kwargs", ")", "labels", ",", "_nb_classes", "=", "self", ".", "get_or_guess_labels", "(", "x", ",", "kwargs", ")", "ad...
Generate symbolic graph for adversarial examples and return. :param x: The model's symbolic inputs. :param kwargs: Keyword arguments for the base attacker
[ "Generate", "symbolic", "graph", "for", "adversarial", "examples", "and", "return", "." ]
python
train
napalm-automation/napalm-eos
napalm_eos/eos.py
https://github.com/napalm-automation/napalm-eos/blob/a3b37d6ee353e326ab9ea1a09ecc14045b12928b/napalm_eos/eos.py#L190-L199
def commit_config(self): """Implementation of NAPALM method commit_config.""" commands = [] commands.append('copy startup-config flash:rollback-0') commands.append('configure session {}'.format(self.config_session)) commands.append('commit') commands.append('write memory'...
[ "def", "commit_config", "(", "self", ")", ":", "commands", "=", "[", "]", "commands", ".", "append", "(", "'copy startup-config flash:rollback-0'", ")", "commands", ".", "append", "(", "'configure session {}'", ".", "format", "(", "self", ".", "config_session", ...
Implementation of NAPALM method commit_config.
[ "Implementation", "of", "NAPALM", "method", "commit_config", "." ]
python
train
WZBSocialScienceCenter/tmtoolkit
tmtoolkit/topicmod/visualize.py
https://github.com/WZBSocialScienceCenter/tmtoolkit/blob/ca8b9d072e37ccc82b533f47d48bd9755722305b/tmtoolkit/topicmod/visualize.py#L182-L232
def plot_topic_word_heatmap(fig, ax, topic_word_distrib, vocab, which_topics=None, which_topic_indices=None, which_words=None, which_word_indices=None, xaxislabel=None, yaxislabel=None, **kwargs): """ ...
[ "def", "plot_topic_word_heatmap", "(", "fig", ",", "ax", ",", "topic_word_distrib", ",", "vocab", ",", "which_topics", "=", "None", ",", "which_topic_indices", "=", "None", ",", "which_words", "=", "None", ",", "which_word_indices", "=", "None", ",", "xaxislabel...
Plot a heatmap for a topic-word distribution `topic_word_distrib` to a matplotlib Figure `fig` and Axes `ax` using `vocab` as vocabulary on the x-axis and topics from 1 to `n_topics=doc_topic_distrib.shape[1]` on the y-axis. A subset of words from `vocab` can be specified either directly with a sequence `wh...
[ "Plot", "a", "heatmap", "for", "a", "topic", "-", "word", "distribution", "topic_word_distrib", "to", "a", "matplotlib", "Figure", "fig", "and", "Axes", "ax", "using", "vocab", "as", "vocabulary", "on", "the", "x", "-", "axis", "and", "topics", "from", "1"...
python
train
pygobject/pgi
pgi/codegen/utils.py
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/codegen/utils.py#L118-L122
def write_lines(self, lines, level=0): """Append multiple new lines""" for line in lines: self.write_line(line, level)
[ "def", "write_lines", "(", "self", ",", "lines", ",", "level", "=", "0", ")", ":", "for", "line", "in", "lines", ":", "self", ".", "write_line", "(", "line", ",", "level", ")" ]
Append multiple new lines
[ "Append", "multiple", "new", "lines" ]
python
train
tcalmant/ipopo
pelix/ipopo/core.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L250-L299
def __remove_handler_factory(self, svc_ref): # type: (ServiceReference) -> None """ Removes an handler factory :param svc_ref: ServiceReference of the handler factory to remove """ with self.__handlers_lock: # Get the handler ID handler_id = svc_r...
[ "def", "__remove_handler_factory", "(", "self", ",", "svc_ref", ")", ":", "# type: (ServiceReference) -> None", "with", "self", ".", "__handlers_lock", ":", "# Get the handler ID", "handler_id", "=", "svc_ref", ".", "get_property", "(", "handlers_const", ".", "PROP_HAND...
Removes an handler factory :param svc_ref: ServiceReference of the handler factory to remove
[ "Removes", "an", "handler", "factory" ]
python
train
geophysics-ubonn/reda
lib/reda/configs/configManager.py
https://github.com/geophysics-ubonn/reda/blob/46a939729e40c7c4723315c03679c40761152e9e/lib/reda/configs/configManager.py#L459-L498
def gen_schlumberger(self, M, N, a=None): """generate one Schlumberger sounding configuration, that is, one set of configurations for one potential dipole MN. Parameters ---------- M: int electrode number for the first potential electrode N: int e...
[ "def", "gen_schlumberger", "(", "self", ",", "M", ",", "N", ",", "a", "=", "None", ")", ":", "if", "a", "is", "None", ":", "a", "=", "np", ".", "abs", "(", "M", "-", "N", ")", "nr_of_steps_left", "=", "int", "(", "min", "(", "M", ",", "N", ...
generate one Schlumberger sounding configuration, that is, one set of configurations for one potential dipole MN. Parameters ---------- M: int electrode number for the first potential electrode N: int electrode number for the second potential electrode ...
[ "generate", "one", "Schlumberger", "sounding", "configuration", "that", "is", "one", "set", "of", "configurations", "for", "one", "potential", "dipole", "MN", "." ]
python
train
JukeboxPipeline/jukeboxmaya
src/jukeboxmaya/menu.py
https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/menu.py#L208-L219
def delete_menu(self, menu): """ Delete the specified menu :param menu: :type menu: :returns: :rtype: :raises: """ if menu.parent is None: del self.menus[menu.name()] menu._delete()
[ "def", "delete_menu", "(", "self", ",", "menu", ")", ":", "if", "menu", ".", "parent", "is", "None", ":", "del", "self", ".", "menus", "[", "menu", ".", "name", "(", ")", "]", "menu", ".", "_delete", "(", ")" ]
Delete the specified menu :param menu: :type menu: :returns: :rtype: :raises:
[ "Delete", "the", "specified", "menu" ]
python
train
rstoneback/pysat
pysat/utils.py
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/utils.py#L42-L76
def set_data_dir(path=None, store=None): """ Set the top level directory pysat uses to look for data and reload. Parameters ---------- path : string valid path to directory pysat uses to look for data store : bool if True, store data directory for future runs """ import ...
[ "def", "set_data_dir", "(", "path", "=", "None", ",", "store", "=", "None", ")", ":", "import", "sys", "import", "os", "import", "pysat", "if", "sys", ".", "version_info", "[", "0", "]", ">=", "3", ":", "if", "sys", ".", "version_info", "[", "1", "...
Set the top level directory pysat uses to look for data and reload. Parameters ---------- path : string valid path to directory pysat uses to look for data store : bool if True, store data directory for future runs
[ "Set", "the", "top", "level", "directory", "pysat", "uses", "to", "look", "for", "data", "and", "reload", "." ]
python
train
pycontribs/pyrax
pyrax/cloudloadbalancers.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudloadbalancers.py#L635-L643
def get_health_monitor(self, loadbalancer): """ Returns a dict representing the health monitor for the load balancer. If no monitor has been configured, returns an empty dict. """ uri = "/loadbalancers/%s/healthmonitor" % utils.get_id(loadbalancer) resp, body = se...
[ "def", "get_health_monitor", "(", "self", ",", "loadbalancer", ")", ":", "uri", "=", "\"/loadbalancers/%s/healthmonitor\"", "%", "utils", ".", "get_id", "(", "loadbalancer", ")", "resp", ",", "body", "=", "self", ".", "api", ".", "method_get", "(", "uri", ")...
Returns a dict representing the health monitor for the load balancer. If no monitor has been configured, returns an empty dict.
[ "Returns", "a", "dict", "representing", "the", "health", "monitor", "for", "the", "load", "balancer", ".", "If", "no", "monitor", "has", "been", "configured", "returns", "an", "empty", "dict", "." ]
python
train
brandon-rhodes/python-jplephem
jplephem/daf.py
https://github.com/brandon-rhodes/python-jplephem/blob/48c99ce40c627e24c95479d8845e312ea168f567/jplephem/daf.py#L92-L117
def map_words(self, start, end): """Return a memory-map of the elements `start` through `end`. The memory map will offer the 8-byte double-precision floats ("elements") in the file from index `start` through to the index `end`, inclusive, both counting the first float as element 1. ...
[ "def", "map_words", "(", "self", ",", "start", ",", "end", ")", ":", "i", ",", "j", "=", "8", "*", "start", "-", "8", ",", "8", "*", "end", "try", ":", "fileno", "=", "self", ".", "file", ".", "fileno", "(", ")", "except", "(", "AttributeError"...
Return a memory-map of the elements `start` through `end`. The memory map will offer the 8-byte double-precision floats ("elements") in the file from index `start` through to the index `end`, inclusive, both counting the first float as element 1. Memory maps must begin on a page boundar...
[ "Return", "a", "memory", "-", "map", "of", "the", "elements", "start", "through", "end", "." ]
python
test
fananimi/pyzk
zk/base.py
https://github.com/fananimi/pyzk/blob/1a765d616526efdcb4c9adfcc9b1d10f6ed8b938/zk/base.py#L1541-L1605
def get_attendance(self): """ return attendance record :return: List of Attendance object """ self.read_sizes() if self.records == 0: return [] users = self.get_users() if self.verbose: print (users) attendances = [] attendance...
[ "def", "get_attendance", "(", "self", ")", ":", "self", ".", "read_sizes", "(", ")", "if", "self", ".", "records", "==", "0", ":", "return", "[", "]", "users", "=", "self", ".", "get_users", "(", ")", "if", "self", ".", "verbose", ":", "print", "("...
return attendance record :return: List of Attendance object
[ "return", "attendance", "record" ]
python
train
Equitable/trump
trump/orm.py
https://github.com/Equitable/trump/blob/a2802692bc642fa32096374159eea7ceca2947b4/trump/orm.py#L1918-L1945
def update_handle(self, chkpnt_settings): """ Update a feeds's handle checkpoint settings :param chkpnt_settings, dict: a dictionary where the keys are stings representing individual handle checkpoint names, for a Feed (eg. api_failure, feed_type, mono...
[ "def", "update_handle", "(", "self", ",", "chkpnt_settings", ")", ":", "# Note, for now, this function is nearly identical\r", "# to the Symbol version. Careful when augmenting,\r", "# to get the right one.\r", "objs", "=", "object_session", "(", "self", ")", "# override with anyt...
Update a feeds's handle checkpoint settings :param chkpnt_settings, dict: a dictionary where the keys are stings representing individual handle checkpoint names, for a Feed (eg. api_failure, feed_type, monounique...) See FeedHandle.__table__.columns for the...
[ "Update", "a", "feeds", "s", "handle", "checkpoint", "settings", ":", "param", "chkpnt_settings", "dict", ":", "a", "dictionary", "where", "the", "keys", "are", "stings", "representing", "individual", "handle", "checkpoint", "names", "for", "a", "Feed", "(", "...
python
train
david-caro/python-autosemver
autosemver/packaging.py
https://github.com/david-caro/python-autosemver/blob/3bc0adb70c33e4bd3623ae4c1944d5ee37f4303d/autosemver/packaging.py#L180-L199
def create_authors(project_dir=os.curdir): """ Creates the authors file, if not in a package. Returns: None Raises: RuntimeError: If the authors could not be retrieved """ pkg_info_file = os.path.join(project_dir, 'PKG-INFO') authors_file = os.path.join(project_dir, 'AUTHOR...
[ "def", "create_authors", "(", "project_dir", "=", "os", ".", "curdir", ")", ":", "pkg_info_file", "=", "os", ".", "path", ".", "join", "(", "project_dir", ",", "'PKG-INFO'", ")", "authors_file", "=", "os", ".", "path", ".", "join", "(", "project_dir", ",...
Creates the authors file, if not in a package. Returns: None Raises: RuntimeError: If the authors could not be retrieved
[ "Creates", "the", "authors", "file", "if", "not", "in", "a", "package", "." ]
python
train
stevearc/dynamo3
dynamo3/result.py
https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/result.py#L331-L345
def build_kwargs(self): """ Construct the kwargs to pass to batch_get_item """ keys, self.keys = self.keys[:MAX_GET_BATCH], self.keys[MAX_GET_BATCH:] query = {'ConsistentRead': self.consistent} if self.attributes is not None: query['ProjectionExpression'] = self.attributes ...
[ "def", "build_kwargs", "(", "self", ")", ":", "keys", ",", "self", ".", "keys", "=", "self", ".", "keys", "[", ":", "MAX_GET_BATCH", "]", ",", "self", ".", "keys", "[", "MAX_GET_BATCH", ":", "]", "query", "=", "{", "'ConsistentRead'", ":", "self", "....
Construct the kwargs to pass to batch_get_item
[ "Construct", "the", "kwargs", "to", "pass", "to", "batch_get_item" ]
python
train
delph-in/pydelphin
delphin/interfaces/base.py
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/interfaces/base.py#L282-L305
def cleanup(self): """ Return aggregated (table, rowdata) tuples and clear the state. """ inserts = [] last_run = self._runs[self._last_run_id] if 'end' not in last_run: last_run['end'] = datetime.now() for run_id in sorted(self._runs): r...
[ "def", "cleanup", "(", "self", ")", ":", "inserts", "=", "[", "]", "last_run", "=", "self", ".", "_runs", "[", "self", ".", "_last_run_id", "]", "if", "'end'", "not", "in", "last_run", ":", "last_run", "[", "'end'", "]", "=", "datetime", ".", "now", ...
Return aggregated (table, rowdata) tuples and clear the state.
[ "Return", "aggregated", "(", "table", "rowdata", ")", "tuples", "and", "clear", "the", "state", "." ]
python
train
gplepage/lsqfit
src/lsqfit/__init__.py
https://github.com/gplepage/lsqfit/blob/6a57fd687632c175fccb47d8e8e943cda5e9ce9d/src/lsqfit/__init__.py#L903-L1225
def format(self, maxline=0, pstyle='v', nline=None, extend=True): """ Formats fit output details into a string for printing. The output tabulates the ``chi**2`` per degree of freedom of the fit (``chi2/dof``), the number of degrees of freedom, the ``Q`` value of the fit (ie, p-value), ...
[ "def", "format", "(", "self", ",", "maxline", "=", "0", ",", "pstyle", "=", "'v'", ",", "nline", "=", "None", ",", "extend", "=", "True", ")", ":", "# unpack arguments", "if", "nline", "is", "not", "None", "and", "maxline", "==", "0", ":", "maxline",...
Formats fit output details into a string for printing. The output tabulates the ``chi**2`` per degree of freedom of the fit (``chi2/dof``), the number of degrees of freedom, the ``Q`` value of the fit (ie, p-value), and the logarithm of the Gaussian Bayes Factor for the fit (``logGBF``...
[ "Formats", "fit", "output", "details", "into", "a", "string", "for", "printing", "." ]
python
train
pywbem/pywbem
pywbem/tupleparse.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/tupleparse.py#L1821-L1837
def parse_methodresponse(self, tup_tree): """ Parse expected METHODRESPONSE ELEMENT. I.e. :: <!ELEMENT METHODRESPONSE (ERROR | (RETURNVALUE?, PARAMVALUE*))> <!ATTLIST METHODRESPONSE %CIMName;> """ self.check_node(tup_tree, 'METHODRESPO...
[ "def", "parse_methodresponse", "(", "self", ",", "tup_tree", ")", ":", "self", ".", "check_node", "(", "tup_tree", ",", "'METHODRESPONSE'", ",", "(", "'NAME'", ",", ")", ")", "return", "(", "name", "(", "tup_tree", ")", ",", "attrs", "(", "tup_tree", ")"...
Parse expected METHODRESPONSE ELEMENT. I.e. :: <!ELEMENT METHODRESPONSE (ERROR | (RETURNVALUE?, PARAMVALUE*))> <!ATTLIST METHODRESPONSE %CIMName;>
[ "Parse", "expected", "METHODRESPONSE", "ELEMENT", ".", "I", ".", "e", "." ]
python
train
facelessuser/wcmatch
wcmatch/glob.py
https://github.com/facelessuser/wcmatch/blob/d153e7007cc73b994ae1ba553dc4584039f5c212/wcmatch/glob.py#L428-L439
def globmatch(filename, patterns, *, flags=0): """ Check if filename matches pattern. By default case sensitivity is determined by the file system, but if `case_sensitive` is set, respect that instead. """ flags = _flag_transform(flags) if not _wcparse.is_unix_style(flags): filenam...
[ "def", "globmatch", "(", "filename", ",", "patterns", ",", "*", ",", "flags", "=", "0", ")", ":", "flags", "=", "_flag_transform", "(", "flags", ")", "if", "not", "_wcparse", ".", "is_unix_style", "(", "flags", ")", ":", "filename", "=", "util", ".", ...
Check if filename matches pattern. By default case sensitivity is determined by the file system, but if `case_sensitive` is set, respect that instead.
[ "Check", "if", "filename", "matches", "pattern", "." ]
python
train
chaoss/grimoirelab-sortinghat
sortinghat/parsing/stackalytics.py
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/parsing/stackalytics.py#L130-L207
def __parse_identities(self, json): """Parse identities using Stackalytics format. The Stackalytics identities format is a JSON document under the "users" key. The document should follow the next schema: { "users": [ { "launchpad_id": "0-...
[ "def", "__parse_identities", "(", "self", ",", "json", ")", ":", "try", ":", "for", "user", "in", "json", "[", "'users'", "]", ":", "name", "=", "self", ".", "__encode", "(", "user", "[", "'user_name'", "]", ")", "uuid", "=", "name", "uid", "=", "U...
Parse identities using Stackalytics format. The Stackalytics identities format is a JSON document under the "users" key. The document should follow the next schema: { "users": [ { "launchpad_id": "0-jsmith", "gerrit_id": "jsmi...
[ "Parse", "identities", "using", "Stackalytics", "format", "." ]
python
train
amicks/Speculator
speculator/features/SO.py
https://github.com/amicks/Speculator/blob/f7d6590aded20b1e1b5df16a4b27228ee821c4ab/speculator/features/SO.py#L33-L45
def eval_from_json(json): """ Evaluates SO from JSON (typically Poloniex API response) Args: json: List of dates where each entry is a dict of raw market data. Returns: Float SO between 0 and 100. """ close = json[-1]['close'] # Latest closing price ...
[ "def", "eval_from_json", "(", "json", ")", ":", "close", "=", "json", "[", "-", "1", "]", "[", "'close'", "]", "# Latest closing price", "low", "=", "min", "(", "poloniex", ".", "get_attribute", "(", "json", ",", "'low'", ")", ")", "# Lowest low", "high"...
Evaluates SO from JSON (typically Poloniex API response) Args: json: List of dates where each entry is a dict of raw market data. Returns: Float SO between 0 and 100.
[ "Evaluates", "SO", "from", "JSON", "(", "typically", "Poloniex", "API", "response", ")" ]
python
train
prompt-toolkit/pyvim
pyvim/editor.py
https://github.com/prompt-toolkit/pyvim/blob/5928b53b9d700863c1a06d2181a034a955f94594/pyvim/editor.py#L247-L260
def run(self): """ Run the event loop for the interface. This starts the interaction. """ # Make sure everything is in sync, before starting. self.sync_with_prompt_toolkit() def pre_run(): # Start in navigation mode. self.application.vi_st...
[ "def", "run", "(", "self", ")", ":", "# Make sure everything is in sync, before starting.", "self", ".", "sync_with_prompt_toolkit", "(", ")", "def", "pre_run", "(", ")", ":", "# Start in navigation mode.", "self", ".", "application", ".", "vi_state", ".", "input_mode...
Run the event loop for the interface. This starts the interaction.
[ "Run", "the", "event", "loop", "for", "the", "interface", ".", "This", "starts", "the", "interaction", "." ]
python
train
uber/tchannel-python
tchannel/peer_heap.py
https://github.com/uber/tchannel-python/blob/ee08cce6234f24fd2373774988186dd374306c43/tchannel/peer_heap.py#L63-L78
def lt(self, i, j): """Compare the priority of two peers. Primary comparator will be the rank of each peer. If the ``rank`` is same then compare the ``order``. The ``order`` attribute of the peer tracks the heap push order of the peer. This help solve the imbalance problem cause...
[ "def", "lt", "(", "self", ",", "i", ",", "j", ")", ":", "if", "self", ".", "peers", "[", "i", "]", ".", "rank", "==", "self", ".", "peers", "[", "j", "]", ".", "rank", ":", "return", "self", ".", "peers", "[", "i", "]", ".", "order", "<", ...
Compare the priority of two peers. Primary comparator will be the rank of each peer. If the ``rank`` is same then compare the ``order``. The ``order`` attribute of the peer tracks the heap push order of the peer. This help solve the imbalance problem caused by randomization when deal wi...
[ "Compare", "the", "priority", "of", "two", "peers", "." ]
python
train
apache/incubator-heron
heron/tools/admin/src/python/standalone.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L278-L288
def template_statemgr_yaml(cl_args, zookeepers): ''' Template statemgr.yaml ''' statemgr_config_file_template = "%s/standalone/templates/statemgr.template.yaml" \ % cl_args["config_path"] statemgr_config_file_actual = "%s/standalone/statemgr.yaml" % cl_args["config_path"] ...
[ "def", "template_statemgr_yaml", "(", "cl_args", ",", "zookeepers", ")", ":", "statemgr_config_file_template", "=", "\"%s/standalone/templates/statemgr.template.yaml\"", "%", "cl_args", "[", "\"config_path\"", "]", "statemgr_config_file_actual", "=", "\"%s/standalone/statemgr.yam...
Template statemgr.yaml
[ "Template", "statemgr", ".", "yaml" ]
python
valid
softvar/simplegist
simplegist/mygist.py
https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/mygist.py#L13-L34
def listall(self): ''' will display all the filenames. Result can be stored in an array for easy fetching of gistNames for future purposes. eg. a = Gist().mygists().listall() print a[0] #to fetch first gistName ''' file_name = [] r = requests.get( '%s/users/%s/gists' % (BASE_URL, self.user), ...
[ "def", "listall", "(", "self", ")", ":", "file_name", "=", "[", "]", "r", "=", "requests", ".", "get", "(", "'%s/users/%s/gists'", "%", "(", "BASE_URL", ",", "self", ".", "user", ")", ",", "headers", "=", "self", ".", "gist", ".", "header", ")", "r...
will display all the filenames. Result can be stored in an array for easy fetching of gistNames for future purposes. eg. a = Gist().mygists().listall() print a[0] #to fetch first gistName
[ "will", "display", "all", "the", "filenames", ".", "Result", "can", "be", "stored", "in", "an", "array", "for", "easy", "fetching", "of", "gistNames", "for", "future", "purposes", ".", "eg", ".", "a", "=", "Gist", "()", ".", "mygists", "()", ".", "list...
python
train
lambdamusic/Ontospy
ontospy/core/ontospy.py
https://github.com/lambdamusic/Ontospy/blob/eb46cb13792b2b87f21babdf976996318eec7571/ontospy/core/ontospy.py#L230-L286
def build_ontologies(self, exclude_BNodes=False, return_string=False): """ Extract ontology instances info from the graph, then creates python objects for them. Note: often ontology info is nested in structures like this: [ a owl:Ontology ; vann:preferredNamespacePrefix "bs...
[ "def", "build_ontologies", "(", "self", ",", "exclude_BNodes", "=", "False", ",", "return_string", "=", "False", ")", ":", "out", "=", "[", "]", "qres", "=", "self", ".", "sparqlHelper", ".", "getOntology", "(", ")", "if", "qres", ":", "# NOTE: SPARQL retu...
Extract ontology instances info from the graph, then creates python objects for them. Note: often ontology info is nested in structures like this: [ a owl:Ontology ; vann:preferredNamespacePrefix "bsym" ; vann:preferredNamespaceUri "http://bsym.bloomberg.com/sym/" ] He...
[ "Extract", "ontology", "instances", "info", "from", "the", "graph", "then", "creates", "python", "objects", "for", "them", "." ]
python
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/filters.py#L292-L307
def do_filesizeformat(value, binary=False): """Format the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB, 102 bytes, etc). Per default decimal prefixes are used (mega, giga, etc.), if the second parameter is set to `True` the binary prefixes are used (mebi, gibi). """ bytes = float...
[ "def", "do_filesizeformat", "(", "value", ",", "binary", "=", "False", ")", ":", "bytes", "=", "float", "(", "value", ")", "base", "=", "binary", "and", "1024", "or", "1000", "middle", "=", "binary", "and", "'i'", "or", "''", "if", "bytes", "<", "bas...
Format the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB, 102 bytes, etc). Per default decimal prefixes are used (mega, giga, etc.), if the second parameter is set to `True` the binary prefixes are used (mebi, gibi).
[ "Format", "the", "value", "like", "a", "human", "-", "readable", "file", "size", "(", "i", ".", "e", ".", "13", "KB", "4", ".", "1", "MB", "102", "bytes", "etc", ")", ".", "Per", "default", "decimal", "prefixes", "are", "used", "(", "mega", "giga",...
python
train
Hackerfleet/hfos
hfos/debugger.py
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/debugger.py#L223-L264
def debugrequest(self, event): """Handler for client-side debug requests""" try: self.log("Event: ", event.__dict__, lvl=critical) if event.data == "storejson": self.log("Storing received object to /tmp", lvl=critical) fp = open('/tmp/hfosdebugger...
[ "def", "debugrequest", "(", "self", ",", "event", ")", ":", "try", ":", "self", ".", "log", "(", "\"Event: \"", ",", "event", ".", "__dict__", ",", "lvl", "=", "critical", ")", "if", "event", ".", "data", "==", "\"storejson\"", ":", "self", ".", "log...
Handler for client-side debug requests
[ "Handler", "for", "client", "-", "side", "debug", "requests" ]
python
train
geertj/gruvi
lib/gruvi/ssl.py
https://github.com/geertj/gruvi/blob/1d77ca439600b6ea7a19aa1ee85dca0f3be3f3f8/lib/gruvi/ssl.py#L494-L500
def close(self): """Cleanly shut down the SSL protocol and close the transport.""" if self._closing or self._handle.closed: return self._closing = True self._write_backlog.append([b'', False]) self._process_write_backlog()
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_closing", "or", "self", ".", "_handle", ".", "closed", ":", "return", "self", ".", "_closing", "=", "True", "self", ".", "_write_backlog", ".", "append", "(", "[", "b''", ",", "False", "]", ...
Cleanly shut down the SSL protocol and close the transport.
[ "Cleanly", "shut", "down", "the", "SSL", "protocol", "and", "close", "the", "transport", "." ]
python
train
django-extensions/django-extensions
django_extensions/management/commands/export_emails.py
https://github.com/django-extensions/django-extensions/blob/7e0bef97ea6cb7f9eea5e2528e3a985a83a7b9b8/django_extensions/management/commands/export_emails.py#L72-L78
def address(self, qs): """ Single entry per line in the format of: "full name" <my@address.com>; """ self.stdout.write("\n".join('"%s" <%s>;' % (full_name(**ent), ent['email']) for ent in qs)) self.stdout.write("\n")
[ "def", "address", "(", "self", ",", "qs", ")", ":", "self", ".", "stdout", ".", "write", "(", "\"\\n\"", ".", "join", "(", "'\"%s\" <%s>;'", "%", "(", "full_name", "(", "*", "*", "ent", ")", ",", "ent", "[", "'email'", "]", ")", "for", "ent", "in...
Single entry per line in the format of: "full name" <my@address.com>;
[ "Single", "entry", "per", "line", "in", "the", "format", "of", ":", "full", "name", "<my" ]
python
train
svenevs/exhale
exhale/graph.py
https://github.com/svenevs/exhale/blob/fe7644829057af622e467bb529db6c03a830da99/exhale/graph.py#L3747-L3830
def toConsole(self): ''' Convenience function for printing out the entire API being generated to the console. Unused in the release, but is helpful for debugging ;) ''' fmt_spec = { "class": utils.AnsiColors.BOLD_MAGENTA, "struct": utils.AnsiColors...
[ "def", "toConsole", "(", "self", ")", ":", "fmt_spec", "=", "{", "\"class\"", ":", "utils", ".", "AnsiColors", ".", "BOLD_MAGENTA", ",", "\"struct\"", ":", "utils", ".", "AnsiColors", ".", "BOLD_CYAN", ",", "\"define\"", ":", "utils", ".", "AnsiColors", "....
Convenience function for printing out the entire API being generated to the console. Unused in the release, but is helpful for debugging ;)
[ "Convenience", "function", "for", "printing", "out", "the", "entire", "API", "being", "generated", "to", "the", "console", ".", "Unused", "in", "the", "release", "but", "is", "helpful", "for", "debugging", ";", ")" ]
python
train
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/streamed.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/streamed.py#L96-L109
def _merge_values(self, values): """Merge values into rows. :type values: list of :class:`~google.protobuf.struct_pb2.Value` :param values: non-chunked values from partial result set. """ width = len(self.fields) for value in values: index = len(self._current...
[ "def", "_merge_values", "(", "self", ",", "values", ")", ":", "width", "=", "len", "(", "self", ".", "fields", ")", "for", "value", "in", "values", ":", "index", "=", "len", "(", "self", ".", "_current_row", ")", "field", "=", "self", ".", "fields", ...
Merge values into rows. :type values: list of :class:`~google.protobuf.struct_pb2.Value` :param values: non-chunked values from partial result set.
[ "Merge", "values", "into", "rows", "." ]
python
train
rwl/pylon
pylon/io/psat.py
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/io/psat.py#L369-L381
def push_bus(self, tokens): """ Adds a Bus object to the case. """ logger.debug("Pushing bus data: %s" % tokens) bus = Bus() bus.name = tokens["bus_no"] bus.v_magnitude = tokens["v_magnitude"] bus.v_angle = tokens["v_angle"] bus.v_magnitude = tokens["v_ma...
[ "def", "push_bus", "(", "self", ",", "tokens", ")", ":", "logger", ".", "debug", "(", "\"Pushing bus data: %s\"", "%", "tokens", ")", "bus", "=", "Bus", "(", ")", "bus", ".", "name", "=", "tokens", "[", "\"bus_no\"", "]", "bus", ".", "v_magnitude", "="...
Adds a Bus object to the case.
[ "Adds", "a", "Bus", "object", "to", "the", "case", "." ]
python
train
data61/clkhash
clkhash/bloomfilter.py
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/bloomfilter.py#L258-L286
def fold_xor(bloomfilter, # type: bitarray folds # type: int ): # type: (...) -> bitarray """ Performs XOR folding on a Bloom filter. If the length of the original Bloom filter is n and we perform r folds, then the length of the resulting filter is n / 2 ** r....
[ "def", "fold_xor", "(", "bloomfilter", ",", "# type: bitarray", "folds", "# type: int", ")", ":", "# type: (...) -> bitarray", "if", "len", "(", "bloomfilter", ")", "%", "2", "**", "folds", "!=", "0", ":", "msg", "=", "(", "'The length of the bloom filter is {leng...
Performs XOR folding on a Bloom filter. If the length of the original Bloom filter is n and we perform r folds, then the length of the resulting filter is n / 2 ** r. :param bloomfilter: Bloom filter to fold :param folds: number of folds :return: folded bloom filter
[ "Performs", "XOR", "folding", "on", "a", "Bloom", "filter", "." ]
python
train
Nixiware/viper
nx/viper/application.py
https://github.com/Nixiware/viper/blob/fbe6057facd8d46103e9955880dfd99e63b7acb3/nx/viper/application.py#L173-L186
def getModel(self, modelIdentifier): """ Return the requested model. :param modelIdentifier: <str> model identifier :return: <object> model instance """ if modelIdentifier in self._models: return self._models[modelIdentifier] else: message...
[ "def", "getModel", "(", "self", ",", "modelIdentifier", ")", ":", "if", "modelIdentifier", "in", "self", ".", "_models", ":", "return", "self", ".", "_models", "[", "modelIdentifier", "]", "else", ":", "message", "=", "\"Application - getModel() - \"", "\"Model ...
Return the requested model. :param modelIdentifier: <str> model identifier :return: <object> model instance
[ "Return", "the", "requested", "model", "." ]
python
train
pip-services3-python/pip-services3-commons-python
pip_services3_commons/data/AnyValueMap.py
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/data/AnyValueMap.py#L365-L377
def get_as_type(self, key, value_type): """ Converts map element into a value defined by specied typecode. If conversion is not possible it returns default value for the specified type. :param key: an index of element to get. :param value_type: the TypeCode that defined the typ...
[ "def", "get_as_type", "(", "self", ",", "key", ",", "value_type", ")", ":", "value", "=", "self", ".", "get", "(", "key", ")", "return", "TypeConverter", ".", "to_type", "(", "value_type", ",", "value", ")" ]
Converts map element into a value defined by specied typecode. If conversion is not possible it returns default value for the specified type. :param key: an index of element to get. :param value_type: the TypeCode that defined the type of the result :return: element value defined by t...
[ "Converts", "map", "element", "into", "a", "value", "defined", "by", "specied", "typecode", ".", "If", "conversion", "is", "not", "possible", "it", "returns", "default", "value", "for", "the", "specified", "type", "." ]
python
train
fossasia/knittingpattern
knittingpattern/convert/KnittingPatternToSVG.py
https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/convert/KnittingPatternToSVG.py#L118-L131
def _compute_scale(self, instruction_id, svg_dict): """Compute the scale of an instruction svg. Compute the scale using the bounding box stored in the :paramref:`svg_dict`. The scale is saved in a dictionary using :paramref:`instruction_id` as key. :param str instruction_id: id...
[ "def", "_compute_scale", "(", "self", ",", "instruction_id", ",", "svg_dict", ")", ":", "bbox", "=", "list", "(", "map", "(", "float", ",", "svg_dict", "[", "\"svg\"", "]", "[", "\"@viewBox\"", "]", ".", "split", "(", ")", ")", ")", "scale", "=", "se...
Compute the scale of an instruction svg. Compute the scale using the bounding box stored in the :paramref:`svg_dict`. The scale is saved in a dictionary using :paramref:`instruction_id` as key. :param str instruction_id: id identifying a symbol in the defs :param dict svg_dict:...
[ "Compute", "the", "scale", "of", "an", "instruction", "svg", "." ]
python
valid
tanghaibao/jcvi
jcvi/assembly/opticalmap.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/assembly/opticalmap.py#L247-L304
def chimera(args): """ %prog chimera bedfile Scan the bed file to break scaffolds that multi-maps. """ p = OptionParser(chimera.__doc__) opts, args = p.parse_args(args) if len(args) != 1: sys.exit(not p.print_help()) bedfile, = args bed = Bed(bedfile) selected = select...
[ "def", "chimera", "(", "args", ")", ":", "p", "=", "OptionParser", "(", "chimera", ".", "__doc__", ")", "opts", ",", "args", "=", "p", ".", "parse_args", "(", "args", ")", "if", "len", "(", "args", ")", "!=", "1", ":", "sys", ".", "exit", "(", ...
%prog chimera bedfile Scan the bed file to break scaffolds that multi-maps.
[ "%prog", "chimera", "bedfile" ]
python
train
5monkeys/django-bananas
bananas/environment.py
https://github.com/5monkeys/django-bananas/blob/cfd318c737f6c4580036c13d2acf32bca96654bf/bananas/environment.py#L40-L54
def parse_bool(value): """ Parse string to bool. :param str value: String value to parse as bool :return bool: """ boolean = parse_str(value).capitalize() if boolean in ("True", "Yes", "On", "1"): return True elif boolean in ("False", "No", "Off", "0"): return False ...
[ "def", "parse_bool", "(", "value", ")", ":", "boolean", "=", "parse_str", "(", "value", ")", ".", "capitalize", "(", ")", "if", "boolean", "in", "(", "\"True\"", ",", "\"Yes\"", ",", "\"On\"", ",", "\"1\"", ")", ":", "return", "True", "elif", "boolean"...
Parse string to bool. :param str value: String value to parse as bool :return bool:
[ "Parse", "string", "to", "bool", "." ]
python
test
Gandi/gandi.cli
gandi/cli/modules/webacc.py
https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/modules/webacc.py#L84-L101
def update(cls, resource, new_name, algorithm, ssl_enable, ssl_disable): """ Update a webaccelerator""" params = {} if new_name: params['name'] = new_name if algorithm: params['lb'] = {'algorithm': algorithm} if ssl_enable: params['ssl_enable']...
[ "def", "update", "(", "cls", ",", "resource", ",", "new_name", ",", "algorithm", ",", "ssl_enable", ",", "ssl_disable", ")", ":", "params", "=", "{", "}", "if", "new_name", ":", "params", "[", "'name'", "]", "=", "new_name", "if", "algorithm", ":", "pa...
Update a webaccelerator
[ "Update", "a", "webaccelerator" ]
python
train
sibirrer/lenstronomy
lenstronomy/LensModel/Profiles/nfw_ellipse.py
https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LensModel/Profiles/nfw_ellipse.py#L25-L42
def function(self, x, y, Rs, theta_Rs, e1, e2, center_x=0, center_y=0): """ returns double integral of NFW profile """ phi_G, q = param_util.ellipticity2phi_q(e1, e2) x_shift = x - center_x y_shift = y - center_y cos_phi = np.cos(phi_G) sin_phi = np.sin(ph...
[ "def", "function", "(", "self", ",", "x", ",", "y", ",", "Rs", ",", "theta_Rs", ",", "e1", ",", "e2", ",", "center_x", "=", "0", ",", "center_y", "=", "0", ")", ":", "phi_G", ",", "q", "=", "param_util", ".", "ellipticity2phi_q", "(", "e1", ",", ...
returns double integral of NFW profile
[ "returns", "double", "integral", "of", "NFW", "profile" ]
python
train
insightindustry/validator-collection
validator_collection/checkers.py
https://github.com/insightindustry/validator-collection/blob/8c8047a0fa36cc88a021771279898278c4cc98e3/validator_collection/checkers.py#L89-L148
def are_equivalent(*args, **kwargs): """Indicate if arguments passed to this function are equivalent. .. hint:: This checker operates recursively on the members contained within iterables and :class:`dict <python:dict>` objects. .. caution:: If you only pass one argument to this checke...
[ "def", "are_equivalent", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "args", ")", "==", "1", ":", "return", "True", "first_item", "=", "args", "[", "0", "]", "for", "item", "in", "args", "[", "1", ":", "]", ":", "if",...
Indicate if arguments passed to this function are equivalent. .. hint:: This checker operates recursively on the members contained within iterables and :class:`dict <python:dict>` objects. .. caution:: If you only pass one argument to this checker - even if it is an iterable - the ch...
[ "Indicate", "if", "arguments", "passed", "to", "this", "function", "are", "equivalent", "." ]
python
train
sptonkin/fuzzyhashlib
fuzzyhashlib/__init__.py
https://github.com/sptonkin/fuzzyhashlib/blob/61999dcfb0893358a330f51d88e4fa494a91bce2/fuzzyhashlib/__init__.py#L291-L297
def update(self, buf): """Update this hash object's state with the provided string.""" if self._final: raise InvalidOperation("Cannot update finalised tlsh") else: self._buf_len += len(buf) return self._tlsh.update(buf)
[ "def", "update", "(", "self", ",", "buf", ")", ":", "if", "self", ".", "_final", ":", "raise", "InvalidOperation", "(", "\"Cannot update finalised tlsh\"", ")", "else", ":", "self", ".", "_buf_len", "+=", "len", "(", "buf", ")", "return", "self", ".", "_...
Update this hash object's state with the provided string.
[ "Update", "this", "hash", "object", "s", "state", "with", "the", "provided", "string", "." ]
python
train
sibson/vncdotool
vncdotool/rfb.py
https://github.com/sibson/vncdotool/blob/e133a8916efaa0f5ed421e0aa737196624635b0c/vncdotool/rfb.py#L667-L680
def setKey(self, key): """RFB protocol for authentication requires client to encrypt challenge sent by server with password using DES method. However, bits in each byte of the password are put in reverse order before using it as encryption key.""" newkey = [] for...
[ "def", "setKey", "(", "self", ",", "key", ")", ":", "newkey", "=", "[", "]", "for", "ki", "in", "range", "(", "len", "(", "key", ")", ")", ":", "bsrc", "=", "ord", "(", "key", "[", "ki", "]", ")", "btgt", "=", "0", "for", "i", "in", "range"...
RFB protocol for authentication requires client to encrypt challenge sent by server with password using DES method. However, bits in each byte of the password are put in reverse order before using it as encryption key.
[ "RFB", "protocol", "for", "authentication", "requires", "client", "to", "encrypt", "challenge", "sent", "by", "server", "with", "password", "using", "DES", "method", ".", "However", "bits", "in", "each", "byte", "of", "the", "password", "are", "put", "in", "...
python
train
westurner/pyrpo
pyrpo/pyrpo.py
https://github.com/westurner/pyrpo/blob/2a910af055dc405b761571a52ef87842397ddadf/pyrpo/pyrpo.py#L283-L292
def relpath(self): """ Determine the relative path to this repository Returns: str: relative path to this repository """ here = os.path.abspath(os.path.curdir) relpath = os.path.relpath(self.fpath, here) return relpath
[ "def", "relpath", "(", "self", ")", ":", "here", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "curdir", ")", "relpath", "=", "os", ".", "path", ".", "relpath", "(", "self", ".", "fpath", ",", "here", ")", "return", "relpat...
Determine the relative path to this repository Returns: str: relative path to this repository
[ "Determine", "the", "relative", "path", "to", "this", "repository" ]
python
train
chaoss/grimoirelab-sirmordred
sirmordred/task_enrich.py
https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/task_enrich.py#L349-L368
def retain_identities(self, retention_time): """Retain the identities in SortingHat based on the `retention_time` value declared in the setup.cfg. :param retention_time: maximum number of minutes wrt the current date to retain the SortingHat data """ enrich_es = self.conf['es_en...
[ "def", "retain_identities", "(", "self", ",", "retention_time", ")", ":", "enrich_es", "=", "self", ".", "conf", "[", "'es_enrichment'", "]", "[", "'url'", "]", "sortinghat_db", "=", "self", ".", "db", "current_data_source", "=", "self", ".", "get_backend", ...
Retain the identities in SortingHat based on the `retention_time` value declared in the setup.cfg. :param retention_time: maximum number of minutes wrt the current date to retain the SortingHat data
[ "Retain", "the", "identities", "in", "SortingHat", "based", "on", "the", "retention_time", "value", "declared", "in", "the", "setup", ".", "cfg", "." ]
python
valid
SuperCowPowers/workbench
workbench/server/data_store.py
https://github.com/SuperCowPowers/workbench/blob/710232756dd717f734253315e3d0b33c9628dafb/workbench/server/data_store.py#L265-L278
def has_sample(self, md5): """Checks if data store has this sample. Args: md5: The md5 digest of the required sample. Returns: True if sample with this md5 is present, else False. """ # The easiest thing is to simply get the sample and if that #...
[ "def", "has_sample", "(", "self", ",", "md5", ")", ":", "# The easiest thing is to simply get the sample and if that", "# succeeds than return True, else return False", "sample", "=", "self", ".", "get_sample", "(", "md5", ")", "return", "True", "if", "sample", "else", ...
Checks if data store has this sample. Args: md5: The md5 digest of the required sample. Returns: True if sample with this md5 is present, else False.
[ "Checks", "if", "data", "store", "has", "this", "sample", "." ]
python
train
uw-it-aca/uw-restclients-uwnetid
uw_uwnetid/subscription.py
https://github.com/uw-it-aca/uw-restclients-uwnetid/blob/58c78b564f9c920a8f8fd408eec959ddd5605b0b/uw_uwnetid/subscription.py#L46-L54
def select_subscription(subs_code, subscriptions): """ Return the uwnetid.subscription object with the subs_code. """ if subs_code and subscriptions: for subs in subscriptions: if (subs.subscription_code == subs_code): return subs return None
[ "def", "select_subscription", "(", "subs_code", ",", "subscriptions", ")", ":", "if", "subs_code", "and", "subscriptions", ":", "for", "subs", "in", "subscriptions", ":", "if", "(", "subs", ".", "subscription_code", "==", "subs_code", ")", ":", "return", "subs...
Return the uwnetid.subscription object with the subs_code.
[ "Return", "the", "uwnetid", ".", "subscription", "object", "with", "the", "subs_code", "." ]
python
train
night-crawler/django-docker-helpers
django_docker_helpers/cli/django/management/commands/run_configured_uwsgi.py
https://github.com/night-crawler/django-docker-helpers/blob/b64f8009101a8eb61d3841124ba19e3ab881aa2f/django_docker_helpers/cli/django/management/commands/run_configured_uwsgi.py#L9-L40
def write_uwsgi_ini_cfg(fp: t.IO, cfg: dict): """ Writes into IO stream the uwsgi.ini file content (actually it does smth strange, just look below). uWSGI configs are likely to break INI (YAML, etc) specification (double key definition) so it writes `cfg` object (dict) in "uWSGI Style". >>> import...
[ "def", "write_uwsgi_ini_cfg", "(", "fp", ":", "t", ".", "IO", ",", "cfg", ":", "dict", ")", ":", "fp", ".", "write", "(", "f'[uwsgi]\\n'", ")", "for", "key", ",", "val", "in", "cfg", ".", "items", "(", ")", ":", "if", "isinstance", "(", "val", ",...
Writes into IO stream the uwsgi.ini file content (actually it does smth strange, just look below). uWSGI configs are likely to break INI (YAML, etc) specification (double key definition) so it writes `cfg` object (dict) in "uWSGI Style". >>> import sys >>> cfg = { ... 'static-map': [ ... '/sta...
[ "Writes", "into", "IO", "stream", "the", "uwsgi", ".", "ini", "file", "content", "(", "actually", "it", "does", "smth", "strange", "just", "look", "below", ")", "." ]
python
train
nugget/python-insteonplm
insteonplm/address.py
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/address.py#L124-L129
def bytes(self): """Emit the address in bytes format.""" addrbyte = b'\x00\x00\x00' if self.addr is not None: addrbyte = self.addr return addrbyte
[ "def", "bytes", "(", "self", ")", ":", "addrbyte", "=", "b'\\x00\\x00\\x00'", "if", "self", ".", "addr", "is", "not", "None", ":", "addrbyte", "=", "self", ".", "addr", "return", "addrbyte" ]
Emit the address in bytes format.
[ "Emit", "the", "address", "in", "bytes", "format", "." ]
python
train
brean/python-pathfinding
pathfinding/finder/finder.py
https://github.com/brean/python-pathfinding/blob/b857bf85e514a1712b40e29ccb5a473cd7fd5c80/pathfinding/finder/finder.py#L142-L166
def find_path(self, start, end, grid): """ find a path from start to end node on grid by iterating over all neighbors of a node (see check_neighbors) :param start: start node :param end: end node :param grid: grid that stores all possible steps/tiles as 2D-list :r...
[ "def", "find_path", "(", "self", ",", "start", ",", "end", ",", "grid", ")", ":", "self", ".", "start_time", "=", "time", ".", "time", "(", ")", "# execution time limitation", "self", ".", "runs", "=", "0", "# count number of iterations", "start", ".", "op...
find a path from start to end node on grid by iterating over all neighbors of a node (see check_neighbors) :param start: start node :param end: end node :param grid: grid that stores all possible steps/tiles as 2D-list :return:
[ "find", "a", "path", "from", "start", "to", "end", "node", "on", "grid", "by", "iterating", "over", "all", "neighbors", "of", "a", "node", "(", "see", "check_neighbors", ")", ":", "param", "start", ":", "start", "node", ":", "param", "end", ":", "end",...
python
train
ktbyers/netmiko
netmiko/base_connection.py
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/base_connection.py#L1369-L1377
def normalize_cmd(self, command): """Normalize CLI commands to have a single trailing newline. :param command: Command that may require line feed to be normalized :type command: str """ command = command.rstrip() command += self.RETURN return command
[ "def", "normalize_cmd", "(", "self", ",", "command", ")", ":", "command", "=", "command", ".", "rstrip", "(", ")", "command", "+=", "self", ".", "RETURN", "return", "command" ]
Normalize CLI commands to have a single trailing newline. :param command: Command that may require line feed to be normalized :type command: str
[ "Normalize", "CLI", "commands", "to", "have", "a", "single", "trailing", "newline", "." ]
python
train
ga4gh/ga4gh-server
ga4gh/server/datarepo.py
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/datarepo.py#L191-L197
def getReferenceSetByName(self, name): """ Returns the reference set with the specified name. """ if name not in self._referenceSetNameMap: raise exceptions.ReferenceSetNameNotFoundException(name) return self._referenceSetNameMap[name]
[ "def", "getReferenceSetByName", "(", "self", ",", "name", ")", ":", "if", "name", "not", "in", "self", ".", "_referenceSetNameMap", ":", "raise", "exceptions", ".", "ReferenceSetNameNotFoundException", "(", "name", ")", "return", "self", ".", "_referenceSetNameMap...
Returns the reference set with the specified name.
[ "Returns", "the", "reference", "set", "with", "the", "specified", "name", "." ]
python
train
jorbas/GADDAG
gaddag/gaddag.py
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/gaddag.py#L162-L184
def ends_with(self, suffix): """ Find all words ending with a suffix. Args: suffix: A suffix to be searched for. Returns: A list of all words found. """ suffix = suffix.lower() found_words = [] res = cgaddag.gdg_ends_with(self.gd...
[ "def", "ends_with", "(", "self", ",", "suffix", ")", ":", "suffix", "=", "suffix", ".", "lower", "(", ")", "found_words", "=", "[", "]", "res", "=", "cgaddag", ".", "gdg_ends_with", "(", "self", ".", "gdg", ",", "suffix", ".", "encode", "(", "encodin...
Find all words ending with a suffix. Args: suffix: A suffix to be searched for. Returns: A list of all words found.
[ "Find", "all", "words", "ending", "with", "a", "suffix", "." ]
python
train
Capitains/flask-capitains-nemo
flask_nemo/plugins/default.py
https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/plugins/default.py#L17-L63
def render(self, **kwargs): """ Make breadcrumbs for a route :param kwargs: dictionary of named arguments used to construct the view :type kwargs: dict :return: List of dict items the view can use to construct the link. :rtype: {str: list({ "link": str, "title", str, "args", dic...
[ "def", "render", "(", "self", ",", "*", "*", "kwargs", ")", ":", "breadcrumbs", "=", "[", "]", "# this is the list of items we want to accumulate in the breadcrumb trail.", "# item[0] is the key into the kwargs[\"url\"] object and item[1] is the name of the route", "# setting a rout...
Make breadcrumbs for a route :param kwargs: dictionary of named arguments used to construct the view :type kwargs: dict :return: List of dict items the view can use to construct the link. :rtype: {str: list({ "link": str, "title", str, "args", dict})}
[ "Make", "breadcrumbs", "for", "a", "route" ]
python
valid
jason-weirather/py-seq-tools
seqtools/format/sam/bam/bamindex.py
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/format/sam/bam/bamindex.py#L89-L95
def get_coords_by_name(self,name): """ .. warning:: not implemented """ sys.stderr.write("error unimplemented get_coords_by_name\n") sys.exit() return [[self._lines[x]['filestart'],self._lines[x]['innerstart']] for x in self._queries[self._name_to_num[name]]]
[ "def", "get_coords_by_name", "(", "self", ",", "name", ")", ":", "sys", ".", "stderr", ".", "write", "(", "\"error unimplemented get_coords_by_name\\n\"", ")", "sys", ".", "exit", "(", ")", "return", "[", "[", "self", ".", "_lines", "[", "x", "]", "[", "...
.. warning:: not implemented
[ "..", "warning", "::", "not", "implemented" ]
python
train
AguaClara/aguaclara
aguaclara/core/utility.py
https://github.com/AguaClara/aguaclara/blob/8dd4e734768b166a7fc2b60388a24df2f93783fc/aguaclara/core/utility.py#L64-L132
def list_handler(HandlerResult="nparray"): """Wraps a function to handle list inputs.""" def decorate(func): def wrapper(*args, **kwargs): """Run through the wrapped function once for each array element. :param HandlerResult: output type. Defaults to numpy arrays. ""...
[ "def", "list_handler", "(", "HandlerResult", "=", "\"nparray\"", ")", ":", "def", "decorate", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"Run through the wrapped function once for each array element.\n\n ...
Wraps a function to handle list inputs.
[ "Wraps", "a", "function", "to", "handle", "list", "inputs", "." ]
python
train
42cc/bets-api
bets/__init__.py
https://github.com/42cc/bets-api/blob/63a8227c7d8c65eef9974374607bc34effff5c7c/bets/__init__.py#L103-L139
def get_bets(self, type=None, order_by=None, state=None, project_id=None, page=None, page_size=None): """Return bets with given filters and ordering. :param type: return bets only with this type. Use None to include all (default). :param order_by: '-last_st...
[ "def", "get_bets", "(", "self", ",", "type", "=", "None", ",", "order_by", "=", "None", ",", "state", "=", "None", ",", "project_id", "=", "None", ",", "page", "=", "None", ",", "page_size", "=", "None", ")", ":", "if", "page", "is", "None", ":", ...
Return bets with given filters and ordering. :param type: return bets only with this type. Use None to include all (default). :param order_by: '-last_stake' or 'last_stake' to sort by stake's created date or None for default ordering. :param state: ...
[ "Return", "bets", "with", "given", "filters", "and", "ordering", "." ]
python
valid
requests/requests-ntlm
requests_ntlm/requests_ntlm.py
https://github.com/requests/requests-ntlm/blob/f71fee60aa64c17941114d4eae40aed670a77afd/requests_ntlm/requests_ntlm.py#L138-L168
def response_hook(self, r, **kwargs): """The actual hook handler.""" if r.status_code == 401: # Handle server auth. www_authenticate = r.headers.get('www-authenticate', '').lower() auth_type = _auth_type_from_header(www_authenticate) if auth_type is not N...
[ "def", "response_hook", "(", "self", ",", "r", ",", "*", "*", "kwargs", ")", ":", "if", "r", ".", "status_code", "==", "401", ":", "# Handle server auth.", "www_authenticate", "=", "r", ".", "headers", ".", "get", "(", "'www-authenticate'", ",", "''", ")...
The actual hook handler.
[ "The", "actual", "hook", "handler", "." ]
python
train
rq/rq-scheduler
rq_scheduler/scheduler.py
https://github.com/rq/rq-scheduler/blob/ee60c19e42a46ba787f762733a0036aa0cf2f7b7/rq_scheduler/scheduler.py#L290-L325
def get_jobs(self, until=None, with_times=False, offset=None, length=None): """ Returns a iterator of job instances that will be queued until the given time. If no 'until' argument is given all jobs are returned. If with_times is True, a list of tuples consisting of the job instance ...
[ "def", "get_jobs", "(", "self", ",", "until", "=", "None", ",", "with_times", "=", "False", ",", "offset", "=", "None", ",", "length", "=", "None", ")", ":", "def", "epoch_to_datetime", "(", "epoch", ")", ":", "return", "from_unix", "(", "float", "(", ...
Returns a iterator of job instances that will be queued until the given time. If no 'until' argument is given all jobs are returned. If with_times is True, a list of tuples consisting of the job instance and it's scheduled execution time is returned. If offset and length are specified,...
[ "Returns", "a", "iterator", "of", "job", "instances", "that", "will", "be", "queued", "until", "the", "given", "time", ".", "If", "no", "until", "argument", "is", "given", "all", "jobs", "are", "returned", "." ]
python
train
Erotemic/utool
utool/util_str.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_str.py#L1582-L1694
def list_str(list_, **listkw): r""" Makes a pretty list string Args: list_ (list): input list **listkw: nl, newlines, packed, truncate, nobr, nobraces, itemsep, trailing_sep, truncatekw, strvals, recursive, indent_, precision, use_numpy, with_dtype, force...
[ "def", "list_str", "(", "list_", ",", "*", "*", "listkw", ")", ":", "import", "utool", "as", "ut", "newlines", "=", "listkw", ".", "pop", "(", "'nl'", ",", "listkw", ".", "pop", "(", "'newlines'", ",", "1", ")", ")", "packed", "=", "listkw", ".", ...
r""" Makes a pretty list string Args: list_ (list): input list **listkw: nl, newlines, packed, truncate, nobr, nobraces, itemsep, trailing_sep, truncatekw, strvals, recursive, indent_, precision, use_numpy, with_dtype, force_dtype, stritems,...
[ "r", "Makes", "a", "pretty", "list", "string" ]
python
train
rchatterjee/pwmodels
src/pwmodel/fast_fuzzysearch.py
https://github.com/rchatterjee/pwmodels/blob/e277411f8ebaf4ad1c208d2b035b4b68f7471517/src/pwmodel/fast_fuzzysearch.py#L107-L123
def query(self, w, ed=1): # Can only handle ed=1 """ Finds the fuzzy matches (within edit distance 1) of w from words """ assert ed <= self._ed if ed == 0: return [w] if w in self._L else [''] w = str(w) n = len(w) prefix, suffix = w[:n // 2]...
[ "def", "query", "(", "self", ",", "w", ",", "ed", "=", "1", ")", ":", "# Can only handle ed=1", "assert", "ed", "<=", "self", ".", "_ed", "if", "ed", "==", "0", ":", "return", "[", "w", "]", "if", "w", "in", "self", ".", "_L", "else", "[", "''"...
Finds the fuzzy matches (within edit distance 1) of w from words
[ "Finds", "the", "fuzzy", "matches", "(", "within", "edit", "distance", "1", ")", "of", "w", "from", "words" ]
python
train
jic-dtool/dtoolcore
dtoolcore/utils.py
https://github.com/jic-dtool/dtoolcore/blob/eeb9a924dc8fcf543340653748a7877be1f98e0f/dtoolcore/utils.py#L191-L204
def mkdir_parents(path): """Create the given directory path. This includes all necessary parent directories. Does not raise an error if the directory already exists. :param path: path to create """ try: os.makedirs(path) except OSError as exc: if exc.errno == errno.EEXIST: ...
[ "def", "mkdir_parents", "(", "path", ")", ":", "try", ":", "os", ".", "makedirs", "(", "path", ")", "except", "OSError", "as", "exc", ":", "if", "exc", ".", "errno", "==", "errno", ".", "EEXIST", ":", "pass", "else", ":", "raise" ]
Create the given directory path. This includes all necessary parent directories. Does not raise an error if the directory already exists. :param path: path to create
[ "Create", "the", "given", "directory", "path", ".", "This", "includes", "all", "necessary", "parent", "directories", ".", "Does", "not", "raise", "an", "error", "if", "the", "directory", "already", "exists", ".", ":", "param", "path", ":", "path", "to", "c...
python
train
pantsbuild/pex
pex/pex_builder.py
https://github.com/pantsbuild/pex/blob/87b2129d860250d3b9edce75b9cb62f9789ee521/pex/pex_builder.py#L146-L155
def add_source(self, filename, env_filename): """Add a source to the PEX environment. :param filename: The source filename to add to the PEX; None to create an empty file at `env_filename`. :param env_filename: The destination filename in the PEX. This path must be a relative path. """ ...
[ "def", "add_source", "(", "self", ",", "filename", ",", "env_filename", ")", ":", "self", ".", "_ensure_unfrozen", "(", "'Adding source'", ")", "self", ".", "_copy_or_link", "(", "filename", ",", "env_filename", ",", "\"source\"", ")" ]
Add a source to the PEX environment. :param filename: The source filename to add to the PEX; None to create an empty file at `env_filename`. :param env_filename: The destination filename in the PEX. This path must be a relative path.
[ "Add", "a", "source", "to", "the", "PEX", "environment", "." ]
python
train
shi-cong/PYSTUDY
PYSTUDY/image/pillib.py
https://github.com/shi-cong/PYSTUDY/blob/c8da7128ea18ecaa5849f2066d321e70d6f97f70/PYSTUDY/image/pillib.py#L236-L253
def get_exif_data(self, image): """Returns a dictionary from the exif data of an PIL Image item. Also converts the GPS Tags""" exif_data = {} info = image._getexif() if info: for tag, value in info.items(): decoded = TAGS.get(tag, tag) if decod...
[ "def", "get_exif_data", "(", "self", ",", "image", ")", ":", "exif_data", "=", "{", "}", "info", "=", "image", ".", "_getexif", "(", ")", "if", "info", ":", "for", "tag", ",", "value", "in", "info", ".", "items", "(", ")", ":", "decoded", "=", "T...
Returns a dictionary from the exif data of an PIL Image item. Also converts the GPS Tags
[ "Returns", "a", "dictionary", "from", "the", "exif", "data", "of", "an", "PIL", "Image", "item", ".", "Also", "converts", "the", "GPS", "Tags" ]
python
train
mikekatz04/BOWIE
bowie/plotutils/plottypes.py
https://github.com/mikekatz04/BOWIE/blob/a941342a3536cb57c817a1643896d99a3f354a86/bowie/plotutils/plottypes.py#L71-L123
def make_plot(self): """Creates the ratio plot. """ # sets colormap for ratio comparison plot cmap = getattr(cm, self.colormap) # set values of ratio comparison contour normval = 2.0 num_contours = 40 # must be even levels = np.linspace(-normval, normva...
[ "def", "make_plot", "(", "self", ")", ":", "# sets colormap for ratio comparison plot", "cmap", "=", "getattr", "(", "cm", ",", "self", ".", "colormap", ")", "# set values of ratio comparison contour", "normval", "=", "2.0", "num_contours", "=", "40", "# must be even"...
Creates the ratio plot.
[ "Creates", "the", "ratio", "plot", "." ]
python
train
fermiPy/fermipy
fermipy/ltcube.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/ltcube.py#L20-L108
def fill_livetime_hist(skydir, tab_sc, tab_gti, zmax, costh_edges): """Generate a sequence of livetime distributions at the sky positions given by ``skydir``. The output of the method are two NxM arrays containing a sequence of histograms for N sky positions and M incidence angle bins where the bin edg...
[ "def", "fill_livetime_hist", "(", "skydir", ",", "tab_sc", ",", "tab_gti", ",", "zmax", ",", "costh_edges", ")", ":", "if", "len", "(", "tab_gti", ")", "==", "0", ":", "shape", "=", "(", "len", "(", "costh_edges", ")", "-", "1", ",", "len", "(", "s...
Generate a sequence of livetime distributions at the sky positions given by ``skydir``. The output of the method are two NxM arrays containing a sequence of histograms for N sky positions and M incidence angle bins where the bin edges are defined by ``costh_edges``. This method uses the same algorithm...
[ "Generate", "a", "sequence", "of", "livetime", "distributions", "at", "the", "sky", "positions", "given", "by", "skydir", ".", "The", "output", "of", "the", "method", "are", "two", "NxM", "arrays", "containing", "a", "sequence", "of", "histograms", "for", "N...
python
train
chemlab/chemlab
chemlab/core/random.py
https://github.com/chemlab/chemlab/blob/c8730966316d101e24f39ac3b96b51282aba0abe/chemlab/core/random.py#L40-L104
def random_lattice_box(mol_list, mol_number, size, spacing=np.array([0.3, 0.3, 0.3])): '''Make a box by placing the molecules specified in *mol_list* on random points of an evenly spaced lattice. Using a lattice automatically ensures that no two molecules are overlapping. **...
[ "def", "random_lattice_box", "(", "mol_list", ",", "mol_number", ",", "size", ",", "spacing", "=", "np", ".", "array", "(", "[", "0.3", ",", "0.3", ",", "0.3", "]", ")", ")", ":", "# Generate the coordinates", "positions", "=", "spaced_lattice", "(", "size...
Make a box by placing the molecules specified in *mol_list* on random points of an evenly spaced lattice. Using a lattice automatically ensures that no two molecules are overlapping. **Parameters** mol_list: list of Molecule instances A list of each kind of molecules to add to the system. ...
[ "Make", "a", "box", "by", "placing", "the", "molecules", "specified", "in", "*", "mol_list", "*", "on", "random", "points", "of", "an", "evenly", "spaced", "lattice", "." ]
python
train
bachya/pyairvisual
pyairvisual/supported.py
https://github.com/bachya/pyairvisual/blob/1d4809998d87f85d53bb281e1eb54d43acee06fa/pyairvisual/supported.py#L12-L19
async def cities(self, country: str, state: str) -> list: """Return a list of supported cities in a country/state.""" data = await self._request( 'get', 'cities', params={ 'state': state, 'country': country }) return [d['city'] for d in dat...
[ "async", "def", "cities", "(", "self", ",", "country", ":", "str", ",", "state", ":", "str", ")", "->", "list", ":", "data", "=", "await", "self", ".", "_request", "(", "'get'", ",", "'cities'", ",", "params", "=", "{", "'state'", ":", "state", ","...
Return a list of supported cities in a country/state.
[ "Return", "a", "list", "of", "supported", "cities", "in", "a", "country", "/", "state", "." ]
python
train
jwkvam/plotlywrapper
plotlywrapper.py
https://github.com/jwkvam/plotlywrapper/blob/762b42912e824fecb1212c186900f2ebdd0ab12b/plotlywrapper.py#L891-L940
def fill_between( x=None, ylow=None, yhigh=None, label=None, color=None, width=None, dash=None, opacity=None, mode='lines+markers', **kargs ): """Fill between `ylow` and `yhigh`. Parameters ---------- x : array-like, optional ylow : TODO, optional yhigh :...
[ "def", "fill_between", "(", "x", "=", "None", ",", "ylow", "=", "None", ",", "yhigh", "=", "None", ",", "label", "=", "None", ",", "color", "=", "None", ",", "width", "=", "None", ",", "dash", "=", "None", ",", "opacity", "=", "None", ",", "mode"...
Fill between `ylow` and `yhigh`. Parameters ---------- x : array-like, optional ylow : TODO, optional yhigh : TODO, optional Returns ------- Chart
[ "Fill", "between", "ylow", "and", "yhigh", "." ]
python
train
allenai/allennlp
allennlp/models/model.py
https://github.com/allenai/allennlp/blob/648a36f77db7e45784c047176074f98534c76636/allennlp/models/model.py#L126-L172
def forward_on_instances(self, instances: List[Instance]) -> List[Dict[str, numpy.ndarray]]: """ Takes a list of :class:`~allennlp.data.instance.Instance`s, converts that text into arrays using this model's :class:`Vocabulary`, passes those arrays through :f...
[ "def", "forward_on_instances", "(", "self", ",", "instances", ":", "List", "[", "Instance", "]", ")", "->", "List", "[", "Dict", "[", "str", ",", "numpy", ".", "ndarray", "]", "]", ":", "batch_size", "=", "len", "(", "instances", ")", "with", "torch", ...
Takes a list of :class:`~allennlp.data.instance.Instance`s, converts that text into arrays using this model's :class:`Vocabulary`, passes those arrays through :func:`self.forward()` and :func:`self.decode()` (which by default does nothing) and returns the result. Before returning the result, w...
[ "Takes", "a", "list", "of", ":", "class", ":", "~allennlp", ".", "data", ".", "instance", ".", "Instance", "s", "converts", "that", "text", "into", "arrays", "using", "this", "model", "s", ":", "class", ":", "Vocabulary", "passes", "those", "arrays", "th...
python
train
deepmind/pysc2
pysc2/bin/valid_actions.py
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/bin/valid_actions.py#L34-L56
def main(unused_argv): """Print the valid actions.""" feats = features.Features( # Actually irrelevant whether it's feature or rgb size. features.AgentInterfaceFormat( feature_dimensions=features.Dimensions( screen=FLAGS.screen_size, minimap=FLAGS.minimap_size))) ...
[ "def", "main", "(", "unused_argv", ")", ":", "feats", "=", "features", ".", "Features", "(", "# Actually irrelevant whether it's feature or rgb size.", "features", ".", "AgentInterfaceFormat", "(", "feature_dimensions", "=", "features", ".", "Dimensions", "(", "screen",...
Print the valid actions.
[ "Print", "the", "valid", "actions", "." ]
python
train
saltstack/salt
salt/modules/git.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/git.py#L4192-L4289
def reset(cwd, opts='', git_opts='', user=None, password=None, identity=None, ignore_retcode=False, output_encoding=None): ''' Interface to `git-reset(1)`_, returns the stdout from the git command cwd The path to the git checkout...
[ "def", "reset", "(", "cwd", ",", "opts", "=", "''", ",", "git_opts", "=", "''", ",", "user", "=", "None", ",", "password", "=", "None", ",", "identity", "=", "None", ",", "ignore_retcode", "=", "False", ",", "output_encoding", "=", "None", ")", ":", ...
Interface to `git-reset(1)`_, returns the stdout from the git command cwd The path to the git checkout opts Any additional options to add to the command line, in a single string .. note:: On the Salt CLI, if the opts are preceded with a dash, it is necessary to...
[ "Interface", "to", "git", "-", "reset", "(", "1", ")", "_", "returns", "the", "stdout", "from", "the", "git", "command" ]
python
train
brechtm/rinohtype
src/rinoh/layout.py
https://github.com/brechtm/rinohtype/blob/40a63c4e5ad7550f62b6860f1812cb67cafb9dc7/src/rinoh/layout.py#L196-L200
def place(self): """Place this container's canvas onto the parent container's canvas.""" self.place_children() self.canvas.append(self.parent.canvas, float(self.left), float(self.top))
[ "def", "place", "(", "self", ")", ":", "self", ".", "place_children", "(", ")", "self", ".", "canvas", ".", "append", "(", "self", ".", "parent", ".", "canvas", ",", "float", "(", "self", ".", "left", ")", ",", "float", "(", "self", ".", "top", "...
Place this container's canvas onto the parent container's canvas.
[ "Place", "this", "container", "s", "canvas", "onto", "the", "parent", "container", "s", "canvas", "." ]
python
train
datacats/datacats
datacats/docker.py
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/docker.py#L394-L398
def pull_stream(image): """ Return generator of pull status objects """ return (json.loads(s) for s in _get_docker().pull(image, stream=True))
[ "def", "pull_stream", "(", "image", ")", ":", "return", "(", "json", ".", "loads", "(", "s", ")", "for", "s", "in", "_get_docker", "(", ")", ".", "pull", "(", "image", ",", "stream", "=", "True", ")", ")" ]
Return generator of pull status objects
[ "Return", "generator", "of", "pull", "status", "objects" ]
python
train
draios/python-sdc-client
sdcclient/_common.py
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L521-L563
def create_sysdig_capture(self, hostname, capture_name, duration, capture_filter='', folder='/'): '''**Description** Create a new sysdig capture. The capture will be immediately started. **Arguments** - **hostname**: the hostname of the instrumented host where the capture will b...
[ "def", "create_sysdig_capture", "(", "self", ",", "hostname", ",", "capture_name", ",", "duration", ",", "capture_filter", "=", "''", ",", "folder", "=", "'/'", ")", ":", "res", "=", "self", ".", "get_connected_agents", "(", ")", "if", "not", "res", "[", ...
**Description** Create a new sysdig capture. The capture will be immediately started. **Arguments** - **hostname**: the hostname of the instrumented host where the capture will be taken. - **capture_name**: the name of the capture. - **duration**: the duration of...
[ "**", "Description", "**", "Create", "a", "new", "sysdig", "capture", ".", "The", "capture", "will", "be", "immediately", "started", "." ]
python
test
zhanglab/psamm
psamm/massconsistency.py
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/massconsistency.py#L74-L138
def check_reaction_consistency(database, solver, exchange=set(), checked=set(), zeromass=set(), weights={}): """Check inconsistent reactions by minimizing mass residuals Return a reaction iterable, and compound iterable. The reaction iterable yields reaction ids and mass resi...
[ "def", "check_reaction_consistency", "(", "database", ",", "solver", ",", "exchange", "=", "set", "(", ")", ",", "checked", "=", "set", "(", ")", ",", "zeromass", "=", "set", "(", ")", ",", "weights", "=", "{", "}", ")", ":", "# Create Flux balance probl...
Check inconsistent reactions by minimizing mass residuals Return a reaction iterable, and compound iterable. The reaction iterable yields reaction ids and mass residuals. The compound iterable yields compound ids and mass assignments. Each compound is assigned a mass of at least one, and the masses ar...
[ "Check", "inconsistent", "reactions", "by", "minimizing", "mass", "residuals" ]
python
train
mcieslik-mctp/papy
src/papy/core.py
https://github.com/mcieslik-mctp/papy/blob/708e50827b5db46bbea081982cb74b9b0e464064/src/papy/core.py#L444-L457
def add_pipers(self, pipers, *args, **kwargs): """ Adds a sequence of ``Pipers`` instances to the ``Dagger`` in the specified order. Takes optional arguments for ``Dagger.add_piper``. Arguments: - pipers(sequence of valid ``add_piper`` arguments) Sequence of ...
[ "def", "add_pipers", "(", "self", ",", "pipers", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "piper", "in", "pipers", ":", "self", ".", "add_piper", "(", "piper", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Adds a sequence of ``Pipers`` instances to the ``Dagger`` in the specified order. Takes optional arguments for ``Dagger.add_piper``. Arguments: - pipers(sequence of valid ``add_piper`` arguments) Sequence of ``Pipers`` or valid ``Dagger.add_piper`` arguments to ...
[ "Adds", "a", "sequence", "of", "Pipers", "instances", "to", "the", "Dagger", "in", "the", "specified", "order", ".", "Takes", "optional", "arguments", "for", "Dagger", ".", "add_piper", ".", "Arguments", ":", "-", "pipers", "(", "sequence", "of", "valid", ...
python
train
ThreatConnect-Inc/tcex
tcex/tcex_bin_run.py
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/tcex/tcex_bin_run.py#L1264-L1284
def staging_data(self): """Read data files and return all staging data for current profile.""" if self._staging_data is None: staging_data = [] for staging_file in self.profile.get('data_files') or []: if os.path.isfile(staging_file): print( ...
[ "def", "staging_data", "(", "self", ")", ":", "if", "self", ".", "_staging_data", "is", "None", ":", "staging_data", "=", "[", "]", "for", "staging_file", "in", "self", ".", "profile", ".", "get", "(", "'data_files'", ")", "or", "[", "]", ":", "if", ...
Read data files and return all staging data for current profile.
[ "Read", "data", "files", "and", "return", "all", "staging", "data", "for", "current", "profile", "." ]
python
train
Xion/taipan
taipan/functional/constructs.py
https://github.com/Xion/taipan/blob/f333f0287c8bd0915182c7d5308e5f05ef0cca78/taipan/functional/constructs.py#L37-L54
def raise_(exception=ABSENT, *args, **kwargs): """Raise (or re-raises) an exception. :param exception: Exception object to raise, or an exception class. In the latter case, remaining arguments are passed to the exception's constructor. If omitte...
[ "def", "raise_", "(", "exception", "=", "ABSENT", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "exception", "is", "ABSENT", ":", "raise", "else", ":", "if", "inspect", ".", "isclass", "(", "exception", ")", ":", "raise", "exception", "(...
Raise (or re-raises) an exception. :param exception: Exception object to raise, or an exception class. In the latter case, remaining arguments are passed to the exception's constructor. If omitted, the currently handled exception is re-raised.
[ "Raise", "(", "or", "re", "-", "raises", ")", "an", "exception", "." ]
python
train
naphatkrit/easyci
easyci/vcs/git.py
https://github.com/naphatkrit/easyci/blob/7aee8d7694fe4e2da42ce35b0f700bc840c8b95f/easyci/vcs/git.py#L123-L143
def get_ignored_files(self): """Returns the list of files being ignored in this repository. Note that file names, not directories, are returned. So, we will get the following: a/b.txt a/c.txt instead of just: a/ Returns: List[str] - list ...
[ "def", "get_ignored_files", "(", "self", ")", ":", "return", "[", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "p", ")", "for", "p", "in", "self", ".", "run", "(", "'ls-files'", ",", "'--ignored'", ",", "'--exclude-standard'", ",", ...
Returns the list of files being ignored in this repository. Note that file names, not directories, are returned. So, we will get the following: a/b.txt a/c.txt instead of just: a/ Returns: List[str] - list of ignored files. The paths are absolute...
[ "Returns", "the", "list", "of", "files", "being", "ignored", "in", "this", "repository", "." ]
python
train
ianepperson/pyredminews
redmine/redmine.py
https://github.com/ianepperson/pyredminews/blob/b2b0581483632738a3acca3b4e093c181847b813/redmine/redmine.py#L282-L284
def close(self, notes=None): '''Save all changes and close this issue''' self.set_status(self._redmine.ISSUE_STATUS_ID_CLOSED, notes=notes)
[ "def", "close", "(", "self", ",", "notes", "=", "None", ")", ":", "self", ".", "set_status", "(", "self", ".", "_redmine", ".", "ISSUE_STATUS_ID_CLOSED", ",", "notes", "=", "notes", ")" ]
Save all changes and close this issue
[ "Save", "all", "changes", "and", "close", "this", "issue" ]
python
train
kivy/python-for-android
pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/debug.py
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstraps/pygame/build/buildlib/jinja2.egg/jinja2/debug.py#L62-L69
def chain_frames(self): """Chains the frames. Requires ctypes or the speedups extension.""" prev_tb = None for tb in self.frames: if prev_tb is not None: prev_tb.tb_next = tb prev_tb = tb prev_tb.tb_next = None
[ "def", "chain_frames", "(", "self", ")", ":", "prev_tb", "=", "None", "for", "tb", "in", "self", ".", "frames", ":", "if", "prev_tb", "is", "not", "None", ":", "prev_tb", ".", "tb_next", "=", "tb", "prev_tb", "=", "tb", "prev_tb", ".", "tb_next", "="...
Chains the frames. Requires ctypes or the speedups extension.
[ "Chains", "the", "frames", ".", "Requires", "ctypes", "or", "the", "speedups", "extension", "." ]
python
train
pycontribs/pyrax
pyrax/object_storage.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/object_storage.py#L1319-L1333
def list_subdirs(self, container, marker=None, limit=None, prefix=None, delimiter=None, full_listing=False): """ Returns a list of StorageObjects representing the pseudo-subdirectories in the specified container. You can use the marker and limit params to handle pagination, a...
[ "def", "list_subdirs", "(", "self", ",", "container", ",", "marker", "=", "None", ",", "limit", "=", "None", ",", "prefix", "=", "None", ",", "delimiter", "=", "None", ",", "full_listing", "=", "False", ")", ":", "mthd", "=", "container", ".", "list_al...
Returns a list of StorageObjects representing the pseudo-subdirectories in the specified container. You can use the marker and limit params to handle pagination, and the prefix param to filter the objects returned. The 'delimiter' parameter is ignored, as the only meaningful value is '/'...
[ "Returns", "a", "list", "of", "StorageObjects", "representing", "the", "pseudo", "-", "subdirectories", "in", "the", "specified", "container", ".", "You", "can", "use", "the", "marker", "and", "limit", "params", "to", "handle", "pagination", "and", "the", "pre...
python
train
Alignak-monitoring/alignak
alignak/objects/config.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/config.py#L976-L998
def clean_params(self, params): """Convert a list of parameters (key=value) into a dict This function is used to transform Nagios (or ini) like formated parameters (key=value) to a dictionary. :param params: parameters list :type params: list :return: dict with key and ...
[ "def", "clean_params", "(", "self", ",", "params", ")", ":", "clean_p", "=", "{", "}", "for", "elt", "in", "params", ":", "elts", "=", "elt", ".", "split", "(", "'='", ",", "1", ")", "if", "len", "(", "elts", ")", "==", "1", ":", "# error, there ...
Convert a list of parameters (key=value) into a dict This function is used to transform Nagios (or ini) like formated parameters (key=value) to a dictionary. :param params: parameters list :type params: list :return: dict with key and value. Log error if malformed :rtyp...
[ "Convert", "a", "list", "of", "parameters", "(", "key", "=", "value", ")", "into", "a", "dict" ]
python
train
twosigma/beakerx
beakerx/setupbase.py
https://github.com/twosigma/beakerx/blob/404de61ed627d9daaf6b77eb4859e7cb6f37413f/beakerx/setupbase.py#L155-L162
def is_stale(target, source): """Test whether the target file/directory is stale based on the source file/directory. """ if not os.path.exists(target): return True target_mtime = recursive_mtime(target) or 0 return compare_recursive_mtime(source, cutoff=target_mtime)
[ "def", "is_stale", "(", "target", ",", "source", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "target", ")", ":", "return", "True", "target_mtime", "=", "recursive_mtime", "(", "target", ")", "or", "0", "return", "compare_recursive_mtime",...
Test whether the target file/directory is stale based on the source file/directory.
[ "Test", "whether", "the", "target", "file", "/", "directory", "is", "stale", "based", "on", "the", "source", "file", "/", "directory", "." ]
python
train
stephenmcd/gnotty
gnotty/bots/commands.py
https://github.com/stephenmcd/gnotty/blob/bea3762dc9cbc3cb21a5ae7224091cf027273c40/gnotty/bots/commands.py#L45-L67
def timesince(self, when): """ Returns human friendly version of the timespan between now and the given datetime. """ units = ( ("year", 60 * 60 * 24 * 365), ("week", 60 * 60 * 24 * 7), ("day", 60 * 60 * 24), ("hour", 60 * ...
[ "def", "timesince", "(", "self", ",", "when", ")", ":", "units", "=", "(", "(", "\"year\"", ",", "60", "*", "60", "*", "24", "*", "365", ")", ",", "(", "\"week\"", ",", "60", "*", "60", "*", "24", "*", "7", ")", ",", "(", "\"day\"", ",", "6...
Returns human friendly version of the timespan between now and the given datetime.
[ "Returns", "human", "friendly", "version", "of", "the", "timespan", "between", "now", "and", "the", "given", "datetime", "." ]
python
train
cga-harvard/Hypermap-Registry
hypermap/search_api/utils.py
https://github.com/cga-harvard/Hypermap-Registry/blob/899a5385b15af7fba190ab4fae1d41e47d155a1b/hypermap/search_api/utils.py#L185-L195
def gap_to_sorl(time_gap): """ P1D to +1DAY :param time_gap: :return: solr's format duration. """ quantity, unit = parse_ISO8601(time_gap) if unit[0] == "WEEKS": return "+{0}DAYS".format(quantity * 7) else: return "+{0}{1}".format(quantity, unit[0])
[ "def", "gap_to_sorl", "(", "time_gap", ")", ":", "quantity", ",", "unit", "=", "parse_ISO8601", "(", "time_gap", ")", "if", "unit", "[", "0", "]", "==", "\"WEEKS\"", ":", "return", "\"+{0}DAYS\"", ".", "format", "(", "quantity", "*", "7", ")", "else", ...
P1D to +1DAY :param time_gap: :return: solr's format duration.
[ "P1D", "to", "+", "1DAY", ":", "param", "time_gap", ":", ":", "return", ":", "solr", "s", "format", "duration", "." ]
python
train
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_0/task/task_client.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_0/task/task_client.py#L353-L374
def create_timeline(self, timeline, scope_identifier, hub_name, plan_id): """CreateTimeline. :param :class:`<Timeline> <azure.devops.v5_0.task.models.Timeline>` timeline: :param str scope_identifier: The project GUID to scope the request :param str hub_name: The name of the server hub: "...
[ "def", "create_timeline", "(", "self", ",", "timeline", ",", "scope_identifier", ",", "hub_name", ",", "plan_id", ")", ":", "route_values", "=", "{", "}", "if", "scope_identifier", "is", "not", "None", ":", "route_values", "[", "'scopeIdentifier'", "]", "=", ...
CreateTimeline. :param :class:`<Timeline> <azure.devops.v5_0.task.models.Timeline>` timeline: :param str scope_identifier: The project GUID to scope the request :param str hub_name: The name of the server hub: "build" for the Build server or "rm" for the Release Management server :param ...
[ "CreateTimeline", ".", ":", "param", ":", "class", ":", "<Timeline", ">", "<azure", ".", "devops", ".", "v5_0", ".", "task", ".", "models", ".", "Timeline", ">", "timeline", ":", ":", "param", "str", "scope_identifier", ":", "The", "project", "GUID", "to...
python
train
mbedmicro/pyOCD
pyocd/utility/conversion.py
https://github.com/mbedmicro/pyOCD/blob/41a174718a9739f3cbe785c2ba21cb7fd1310c6f/pyocd/utility/conversion.py#L92-L103
def u64_to_hex16le(val): """! @brief Create 16-digit hexadecimal string from 64-bit register value""" return ''.join("%02x" % (x & 0xFF) for x in ( val, val >> 8, val >> 16, val >> 24, val >> 32, val >> 40, val >> 48, val >> 56, ))
[ "def", "u64_to_hex16le", "(", "val", ")", ":", "return", "''", ".", "join", "(", "\"%02x\"", "%", "(", "x", "&", "0xFF", ")", "for", "x", "in", "(", "val", ",", "val", ">>", "8", ",", "val", ">>", "16", ",", "val", ">>", "24", ",", "val", ">>...
! @brief Create 16-digit hexadecimal string from 64-bit register value
[ "!" ]
python
train
inveniosoftware/invenio-oauth2server
invenio_oauth2server/ext.py
https://github.com/inveniosoftware/invenio-oauth2server/blob/7033d3495c1a2b830e101e43918e92a37bbb49f2/invenio_oauth2server/ext.py#L123-L136
def init_app(self, app, entry_point_group='invenio_oauth2server.scopes', **kwargs): """Flask application initialization. :param app: An instance of :class:`flask.Flask`. :param entry_point_group: The entrypoint group name to load plugins. (Default: ``'invenio_oauth2...
[ "def", "init_app", "(", "self", ",", "app", ",", "entry_point_group", "=", "'invenio_oauth2server.scopes'", ",", "*", "*", "kwargs", ")", ":", "self", ".", "init_config", "(", "app", ")", "state", "=", "_OAuth2ServerState", "(", "app", ",", "entry_point_group"...
Flask application initialization. :param app: An instance of :class:`flask.Flask`. :param entry_point_group: The entrypoint group name to load plugins. (Default: ``'invenio_oauth2server.scopes'``)
[ "Flask", "application", "initialization", "." ]
python
train
acutesoftware/AIKIF
aikif/dataTools/cls_sql_code_generator.py
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/dataTools/cls_sql_code_generator.py#L244-L309
def extract_dimension(self, dim_name, dim_cols, dim_key, dim_stag_table, src_table, src_cols, grain_cols, where_clause): """ selects the src_cols from src_table and groups by dim_grain then inserts into newly created table dim_name the columns as 'dim_cols """ self.ddl_t...
[ "def", "extract_dimension", "(", "self", ",", "dim_name", ",", "dim_cols", ",", "dim_key", ",", "dim_stag_table", ",", "src_table", ",", "src_cols", ",", "grain_cols", ",", "where_clause", ")", ":", "self", ".", "ddl_text", "+=", "'--------------------------------...
selects the src_cols from src_table and groups by dim_grain then inserts into newly created table dim_name the columns as 'dim_cols
[ "selects", "the", "src_cols", "from", "src_table", "and", "groups", "by", "dim_grain", "then", "inserts", "into", "newly", "created", "table", "dim_name", "the", "columns", "as", "dim_cols" ]
python
train
bloomreach/s4cmd
s4cmd.py
https://github.com/bloomreach/s4cmd/blob/bb51075bf43703e7cd95aa39288cf7732ec13a6d/s4cmd.py#L1386-L1442
def download(self, source, target, mpi=None, pos=0, chunk=0, part=0): '''Thread worker for download operation.''' s3url = S3URL(source) obj = self.lookup(s3url) if obj is None: raise Failure('The obj "%s" does not exists.' % (s3url.path,)) # Initialization: Set up multithreaded downloads. ...
[ "def", "download", "(", "self", ",", "source", ",", "target", ",", "mpi", "=", "None", ",", "pos", "=", "0", ",", "chunk", "=", "0", ",", "part", "=", "0", ")", ":", "s3url", "=", "S3URL", "(", "source", ")", "obj", "=", "self", ".", "lookup", ...
Thread worker for download operation.
[ "Thread", "worker", "for", "download", "operation", "." ]
python
test
quantopian/pgcontents
pgcontents/api_utils.py
https://github.com/quantopian/pgcontents/blob/ed36268b7917332d16868208e1e565742a8753e1/pgcontents/api_utils.py#L137-L148
def _decode_unknown_from_base64(path, bcontent): """ Decode base64 data of unknown format. Attempts to interpret data as utf-8, falling back to ascii on failure. """ content = b64decode(bcontent) try: return (content.decode('utf-8'), 'text') except UnicodeError: pass ret...
[ "def", "_decode_unknown_from_base64", "(", "path", ",", "bcontent", ")", ":", "content", "=", "b64decode", "(", "bcontent", ")", "try", ":", "return", "(", "content", ".", "decode", "(", "'utf-8'", ")", ",", "'text'", ")", "except", "UnicodeError", ":", "p...
Decode base64 data of unknown format. Attempts to interpret data as utf-8, falling back to ascii on failure.
[ "Decode", "base64", "data", "of", "unknown", "format", "." ]
python
test
sporteasy/python-poeditor
poeditor/client.py
https://github.com/sporteasy/python-poeditor/blob/e9c0a8ab08816903122f730b73ffaab46601076c/poeditor/client.py#L652-L679
def update_terms_translations(self, project_id, file_path=None, language_code=None, overwrite=False, sync_terms=False, tags=None, fuzzy_trigger=None): """ Updates terms translations overwrite: set it to True if you want to overwr...
[ "def", "update_terms_translations", "(", "self", ",", "project_id", ",", "file_path", "=", "None", ",", "language_code", "=", "None", ",", "overwrite", "=", "False", ",", "sync_terms", "=", "False", ",", "tags", "=", "None", ",", "fuzzy_trigger", "=", "None"...
Updates terms translations overwrite: set it to True if you want to overwrite translations sync_terms: set it to True if you want to sync your terms (terms that are not found in the uploaded file will be deleted from project and the new ones added). Ignored if updating = transla...
[ "Updates", "terms", "translations" ]
python
train
tomplus/kubernetes_asyncio
kubernetes_asyncio/client/api/custom_objects_api.py
https://github.com/tomplus/kubernetes_asyncio/blob/f9ab15317ec921409714c7afef11aeb0f579985d/kubernetes_asyncio/client/api/custom_objects_api.py#L1727-L1751
def patch_cluster_custom_object_scale(self, group, version, plural, name, body, **kwargs): # noqa: E501 """patch_cluster_custom_object_scale # noqa: E501 partially update scale of the specified cluster scoped custom object # noqa: E501 This method makes a synchronous HTTP request by default....
[ "def", "patch_cluster_custom_object_scale", "(", "self", ",", "group", ",", "version", ",", "plural", ",", "name", ",", "body", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", "....
patch_cluster_custom_object_scale # noqa: E501 partially update scale of the specified cluster scoped custom object # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.patch_cluster_cus...
[ "patch_cluster_custom_object_scale", "#", "noqa", ":", "E501" ]
python
train
googleapis/google-cloud-python
firestore/google/cloud/firestore_v1beta1/document.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/document.py#L615-L677
def get(self, field_path): """Get a value from the snapshot data. If the data is nested, for example: .. code-block:: python >>> snapshot.to_dict() { 'top1': { 'middle2': { 'bottom3': 20, 'bo...
[ "def", "get", "(", "self", ",", "field_path", ")", ":", "if", "not", "self", ".", "_exists", ":", "return", "None", "nested_data", "=", "field_path_module", ".", "get_nested_value", "(", "field_path", ",", "self", ".", "_data", ")", "return", "copy", ".", ...
Get a value from the snapshot data. If the data is nested, for example: .. code-block:: python >>> snapshot.to_dict() { 'top1': { 'middle2': { 'bottom3': 20, 'bottom4': 22, }, ...
[ "Get", "a", "value", "from", "the", "snapshot", "data", "." ]
python
train
hobson/pug-ann
pug/ann/util.py
https://github.com/hobson/pug-ann/blob/8a4d7103a744d15b4a737fc0f9a84c823973e0ec/pug/ann/util.py#L372-L374
def build_trainer(nn, ds, verbosity=1): """Configure neural net trainer from a pybrain dataset""" return pb.supervised.trainers.rprop.RPropMinusTrainer(nn, dataset=ds, batchlearning=True, verbose=bool(verbosity))
[ "def", "build_trainer", "(", "nn", ",", "ds", ",", "verbosity", "=", "1", ")", ":", "return", "pb", ".", "supervised", ".", "trainers", ".", "rprop", ".", "RPropMinusTrainer", "(", "nn", ",", "dataset", "=", "ds", ",", "batchlearning", "=", "True", ","...
Configure neural net trainer from a pybrain dataset
[ "Configure", "neural", "net", "trainer", "from", "a", "pybrain", "dataset" ]
python
train
SKA-ScienceDataProcessor/integration-prototype
sip/tango_control/flask_master/app/app.py
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/tango_control/flask_master/app/app.py#L167-L174
def allowed_transitions(): """Get target states allowed for the current state.""" try: sdp_state = SDPState() return sdp_state.allowed_target_states[sdp_state.current_state] except KeyError: LOG.error("Key Error") return dict(state="KeyError", reason="KeyError")
[ "def", "allowed_transitions", "(", ")", ":", "try", ":", "sdp_state", "=", "SDPState", "(", ")", "return", "sdp_state", ".", "allowed_target_states", "[", "sdp_state", ".", "current_state", "]", "except", "KeyError", ":", "LOG", ".", "error", "(", "\"Key Error...
Get target states allowed for the current state.
[ "Get", "target", "states", "allowed", "for", "the", "current", "state", "." ]
python
train
ContinuumIO/menuinst
menuinst/freedesktop.py
https://github.com/ContinuumIO/menuinst/blob/dae53065e9e82a3352b817cca5895a9b271ddfdb/menuinst/freedesktop.py#L50-L77
def make_directory_entry(d): """ Create a directory entry that conforms to the format of the Desktop Entry Specification by freedesktop.org. See: http://freedesktop.org/Standards/desktop-entry-spec These should work for both KDE and Gnome2 An entry is a .directory file that includes th...
[ "def", "make_directory_entry", "(", "d", ")", ":", "assert", "d", "[", "'path'", "]", ".", "endswith", "(", "'.directory'", ")", "# default values", "d", ".", "setdefault", "(", "'comment'", ",", "''", ")", "d", ".", "setdefault", "(", "'icon'", ",", "''...
Create a directory entry that conforms to the format of the Desktop Entry Specification by freedesktop.org. See: http://freedesktop.org/Standards/desktop-entry-spec These should work for both KDE and Gnome2 An entry is a .directory file that includes the display name, icon, etc. It will be...
[ "Create", "a", "directory", "entry", "that", "conforms", "to", "the", "format", "of", "the", "Desktop", "Entry", "Specification", "by", "freedesktop", ".", "org", ".", "See", ":", "http", ":", "//", "freedesktop", ".", "org", "/", "Standards", "/", "deskto...
python
train