repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
gbowerman/azurerm
azurerm/amsrp.py
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/amsrp.py#L520-L545
def create_contentkey_authorization_policy_options(access_token, key_delivery_type="2", \ name="HLS Open Authorization Policy", key_restriction_type="0"): '''Create Media Service Content Key Authorization Policy Options. Args: access_token (str): A valid Azure authentication token. key_delivery...
[ "def", "create_contentkey_authorization_policy_options", "(", "access_token", ",", "key_delivery_type", "=", "\"2\"", ",", "name", "=", "\"HLS Open Authorization Policy\"", ",", "key_restriction_type", "=", "\"0\"", ")", ":", "path", "=", "'/ContentKeyAuthorizationPolicyOptio...
Create Media Service Content Key Authorization Policy Options. Args: access_token (str): A valid Azure authentication token. key_delivery_type (str): A Media Service Content Key Authorization Policy Delivery Type. name (str): A Media Service Contenty Key Authorization Policy Name. k...
[ "Create", "Media", "Service", "Content", "Key", "Authorization", "Policy", "Options", "." ]
python
train
39.423077
suds-community/suds
suds/sax/document.py
https://github.com/suds-community/suds/blob/6fb0a829337b5037a66c20aae6f89b41acd77e40/suds/sax/document.py#L62-L85
def getChild(self, name, ns=None, default=None): """ Get a child by (optional) name and/or (optional) namespace. @param name: The name of a child element (may contain prefix). @type name: basestring @param ns: An optional namespace used to match the child. @type ns: (I{pr...
[ "def", "getChild", "(", "self", ",", "name", ",", "ns", "=", "None", ",", "default", "=", "None", ")", ":", "if", "self", ".", "__root", "is", "None", ":", "return", "default", "if", "ns", "is", "None", ":", "prefix", ",", "name", "=", "splitPrefix...
Get a child by (optional) name and/or (optional) namespace. @param name: The name of a child element (may contain prefix). @type name: basestring @param ns: An optional namespace used to match the child. @type ns: (I{prefix}, I{name}) @param default: Returned when child not-found...
[ "Get", "a", "child", "by", "(", "optional", ")", "name", "and", "/", "or", "(", "optional", ")", "namespace", "." ]
python
train
36.541667
fastai/fastai
fastai/torch_core.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/torch_core.py#L161-L167
def children_and_parameters(m:nn.Module): "Return the children of `m` and its direct parameters not registered in modules." children = list(m.children()) children_p = sum([[id(p) for p in c.parameters()] for c in m.children()],[]) for p in m.parameters(): if id(p) not in children_p: children.app...
[ "def", "children_and_parameters", "(", "m", ":", "nn", ".", "Module", ")", ":", "children", "=", "list", "(", "m", ".", "children", "(", ")", ")", "children_p", "=", "sum", "(", "[", "[", "id", "(", "p", ")", "for", "p", "in", "c", ".", "paramete...
Return the children of `m` and its direct parameters not registered in modules.
[ "Return", "the", "children", "of", "m", "and", "its", "direct", "parameters", "not", "registered", "in", "modules", "." ]
python
train
51
c-w/gutenberg
gutenberg/query/api.py
https://github.com/c-w/gutenberg/blob/d1ef3da6fba6c3636d452479ed6bcb17c7d4d246/gutenberg/query/api.py#L20-L38
def get_metadata(feature_name, etextno): """Looks up the value of a meta-data feature for a given text. Arguments: feature_name (str): The name of the meta-data to look up. etextno (int): The identifier of the Gutenberg text for which to look up the meta-data. Returns: ...
[ "def", "get_metadata", "(", "feature_name", ",", "etextno", ")", ":", "metadata_values", "=", "MetadataExtractor", ".", "get", "(", "feature_name", ")", ".", "get_metadata", "(", "etextno", ")", "return", "frozenset", "(", "metadata_values", ")" ]
Looks up the value of a meta-data feature for a given text. Arguments: feature_name (str): The name of the meta-data to look up. etextno (int): The identifier of the Gutenberg text for which to look up the meta-data. Returns: frozenset: The values of the meta-data for the t...
[ "Looks", "up", "the", "value", "of", "a", "meta", "-", "data", "feature", "for", "a", "given", "text", "." ]
python
train
38.157895
wheerd/multiset
multiset.py
https://github.com/wheerd/multiset/blob/1f002397096edae3da32d004e3159345a476999c/multiset.py#L316-L354
def intersection(self, *others): r"""Return a new multiset with elements common to the multiset and all others. >>> ms = Multiset('aab') >>> sorted(ms.intersection('abc')) ['a', 'b'] You can also use the ``&`` operator for the same effect. However, the operator version ...
[ "def", "intersection", "(", "self", ",", "*", "others", ")", ":", "result", "=", "self", ".", "__copy__", "(", ")", "_elements", "=", "result", ".", "_elements", "_total", "=", "result", ".", "_total", "for", "other", "in", "map", "(", "self", ".", "...
r"""Return a new multiset with elements common to the multiset and all others. >>> ms = Multiset('aab') >>> sorted(ms.intersection('abc')) ['a', 'b'] You can also use the ``&`` operator for the same effect. However, the operator version will only accept a set as other operator,...
[ "r", "Return", "a", "new", "multiset", "with", "elements", "common", "to", "the", "multiset", "and", "all", "others", "." ]
python
train
40.666667
Parquery/sphinx-icontract
sphinx_icontract/__init__.py
https://github.com/Parquery/sphinx-icontract/blob/92918f23a8ea1873112e9b7446c64cd6f12ee04b/sphinx_icontract/__init__.py#L87-L125
def _condition_as_text(lambda_inspection: icontract._represent.ConditionLambdaInspection) -> str: """Format condition lambda function as reST.""" lambda_ast_node = lambda_inspection.node assert isinstance(lambda_ast_node, ast.Lambda) body_node = lambda_ast_node.body text = None # type: Optional[s...
[ "def", "_condition_as_text", "(", "lambda_inspection", ":", "icontract", ".", "_represent", ".", "ConditionLambdaInspection", ")", "->", "str", ":", "lambda_ast_node", "=", "lambda_inspection", ".", "node", "assert", "isinstance", "(", "lambda_ast_node", ",", "ast", ...
Format condition lambda function as reST.
[ "Format", "condition", "lambda", "function", "as", "reST", "." ]
python
train
53.871795
NoneGG/aredis
aredis/pipeline.py
https://github.com/NoneGG/aredis/blob/204caad740ac13e5760d46444a2ba7632982a046/aredis/pipeline.py#L481-L577
async def send_cluster_commands(self, stack, raise_on_error=True, allow_redirections=True): """ Send a bunch of cluster commands to the redis cluster. `allow_redirections` If the pipeline should follow `ASK` & `MOVED` responses automatically. If set to false it will raise RedisClusterEx...
[ "async", "def", "send_cluster_commands", "(", "self", ",", "stack", ",", "raise_on_error", "=", "True", ",", "allow_redirections", "=", "True", ")", ":", "# the first time sending the commands we send all of the commands that were queued up.", "# if we have to run through it agai...
Send a bunch of cluster commands to the redis cluster. `allow_redirections` If the pipeline should follow `ASK` & `MOVED` responses automatically. If set to false it will raise RedisClusterException.
[ "Send", "a", "bunch", "of", "cluster", "commands", "to", "the", "redis", "cluster", "." ]
python
train
55.43299
raphaelgyory/django-rest-messaging-centrifugo
rest_messaging_centrifugo/utils.py
https://github.com/raphaelgyory/django-rest-messaging-centrifugo/blob/f44022cd9fc83e84ab573fe8a8385c85f6e77380/rest_messaging_centrifugo/utils.py#L8-L11
def build_channel(namespace, name, user_ids): """ Creates complete channel information as described here https://fzambia.gitbooks.io/centrifugal/content/server/channels.html. """ ids = ','.join(map(str, user_ids)) return "{0}:{1}#{2}".format(namespace, name, ids)
[ "def", "build_channel", "(", "namespace", ",", "name", ",", "user_ids", ")", ":", "ids", "=", "','", ".", "join", "(", "map", "(", "str", ",", "user_ids", ")", ")", "return", "\"{0}:{1}#{2}\"", ".", "format", "(", "namespace", ",", "name", ",", "ids", ...
Creates complete channel information as described here https://fzambia.gitbooks.io/centrifugal/content/server/channels.html.
[ "Creates", "complete", "channel", "information", "as", "described", "here", "https", ":", "//", "fzambia", ".", "gitbooks", ".", "io", "/", "centrifugal", "/", "content", "/", "server", "/", "channels", ".", "html", "." ]
python
train
68
tensorpack/tensorpack
tensorpack/graph_builder/utils.py
https://github.com/tensorpack/tensorpack/blob/d7a13cb74c9066bc791d7aafc3b744b60ee79a9f/tensorpack/graph_builder/utils.py#L366-L381
def pack(self, grads): """ Args: grads (list): list of gradient tensors Returns: packed list of gradient tensors to be aggregated. """ for i, g in enumerate(grads): assert g.shape == self._shapes[i] with cached_name_scope("GradientPac...
[ "def", "pack", "(", "self", ",", "grads", ")", ":", "for", "i", ",", "g", "in", "enumerate", "(", "grads", ")", ":", "assert", "g", ".", "shape", "==", "self", ".", "_shapes", "[", "i", "]", "with", "cached_name_scope", "(", "\"GradientPacker\"", ","...
Args: grads (list): list of gradient tensors Returns: packed list of gradient tensors to be aggregated.
[ "Args", ":", "grads", "(", "list", ")", ":", "list", "of", "gradient", "tensors" ]
python
train
37.0625
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/usage.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/usage.py#L561-L564
def page_guiref(arg_s=None): """Show a basic reference about the GUI Console.""" from IPython.core import page page.page(gui_reference, auto_html=True)
[ "def", "page_guiref", "(", "arg_s", "=", "None", ")", ":", "from", "IPython", ".", "core", "import", "page", "page", ".", "page", "(", "gui_reference", ",", "auto_html", "=", "True", ")" ]
Show a basic reference about the GUI Console.
[ "Show", "a", "basic", "reference", "about", "the", "GUI", "Console", "." ]
python
test
40
pyca/pynacl
src/nacl/bindings/crypto_hash.py
https://github.com/pyca/pynacl/blob/0df0c2c7693fa5d316846111ce510702756f5feb/src/nacl/bindings/crypto_hash.py#L43-L55
def crypto_hash_sha256(message): """ Hashes and returns the message ``message``. :param message: bytes :rtype: bytes """ digest = ffi.new("unsigned char[]", crypto_hash_sha256_BYTES) rc = lib.crypto_hash_sha256(digest, message, len(message)) ensure(rc == 0, 'Unexpected librar...
[ "def", "crypto_hash_sha256", "(", "message", ")", ":", "digest", "=", "ffi", ".", "new", "(", "\"unsigned char[]\"", ",", "crypto_hash_sha256_BYTES", ")", "rc", "=", "lib", ".", "crypto_hash_sha256", "(", "digest", ",", "message", ",", "len", "(", "message", ...
Hashes and returns the message ``message``. :param message: bytes :rtype: bytes
[ "Hashes", "and", "returns", "the", "message", "message", "." ]
python
train
31.769231
johnnoone/facts
facts/targeting.py
https://github.com/johnnoone/facts/blob/82d38a46c15d9c01200445526f4c0d1825fc1e51/facts/targeting.py#L50-L74
def read(self, obj): """ Returns object: fragment """ path, frag = [], obj for part in self.parts: path.append(part) if isinstance(frag, dict): try: frag = frag[part] except KeyError as error:...
[ "def", "read", "(", "self", ",", "obj", ")", ":", "path", ",", "frag", "=", "[", "]", ",", "obj", "for", "part", "in", "self", ".", "parts", ":", "path", ".", "append", "(", "part", ")", "if", "isinstance", "(", "frag", ",", "dict", ")", ":", ...
Returns object: fragment
[ "Returns", "object", ":", "fragment" ]
python
train
34.6
agsimeonov/cbexchange
cbexchange/orderbook.py
https://github.com/agsimeonov/cbexchange/blob/e3762f77583f89cf7b4f501ab3c7675fc7d30ab3/cbexchange/orderbook.py#L120-L153
def _real_time_thread(self): """Handles real-time updates to the order book.""" while self.ws_client.connected(): if self.die: break if self.pause: sleep(5) continue message = self.ws_client.receive() if message is None: break message_type ...
[ "def", "_real_time_thread", "(", "self", ")", ":", "while", "self", ".", "ws_client", ".", "connected", "(", ")", ":", "if", "self", ".", "die", ":", "break", "if", "self", ".", "pause", ":", "sleep", "(", "5", ")", "continue", "message", "=", "self"...
Handles real-time updates to the order book.
[ "Handles", "real", "-", "time", "updates", "to", "the", "order", "book", "." ]
python
valid
22.588235
stratis-storage/into-dbus-python
src/into_dbus_python/_xformer.py
https://github.com/stratis-storage/into-dbus-python/blob/81366049671f79116bbb81c97bf621800a2f6315/src/into_dbus_python/_xformer.py#L106-L173
def _handle_array(toks): """ Generate the correct function for an array signature. :param toks: the list of parsed tokens :returns: function that returns an Array or Dictionary value :rtype: ((or list dict) -> ((or Array Dictionary) * int)) * str """ if len(toks...
[ "def", "_handle_array", "(", "toks", ")", ":", "if", "len", "(", "toks", ")", "==", "5", "and", "toks", "[", "1", "]", "==", "'{'", "and", "toks", "[", "4", "]", "==", "'}'", ":", "subtree", "=", "toks", "[", "2", ":", "4", "]", "signature", ...
Generate the correct function for an array signature. :param toks: the list of parsed tokens :returns: function that returns an Array or Dictionary value :rtype: ((or list dict) -> ((or Array Dictionary) * int)) * str
[ "Generate", "the", "correct", "function", "for", "an", "array", "signature", "." ]
python
valid
40.132353
geertj/gruvi
lib/gruvi/transports.py
https://github.com/geertj/gruvi/blob/1d77ca439600b6ea7a19aa1ee85dca0f3be3f3f8/lib/gruvi/transports.py#L96-L105
def set_write_buffer_limits(self, high=None, low=None): """Set the low and high watermark for the write buffer.""" if high is None: high = self.write_buffer_size if low is None: low = high // 2 if low > high: low = high self._write_buffer_high ...
[ "def", "set_write_buffer_limits", "(", "self", ",", "high", "=", "None", ",", "low", "=", "None", ")", ":", "if", "high", "is", "None", ":", "high", "=", "self", ".", "write_buffer_size", "if", "low", "is", "None", ":", "low", "=", "high", "//", "2",...
Set the low and high watermark for the write buffer.
[ "Set", "the", "low", "and", "high", "watermark", "for", "the", "write", "buffer", "." ]
python
train
35.4
PSPC-SPAC-buyandsell/von_anchor
von_anchor/anchor/verifier.py
https://github.com/PSPC-SPAC-buyandsell/von_anchor/blob/78ac1de67be42a676274f4bf71fe12f66e72f309/von_anchor/anchor/verifier.py#L414-L457
def check_encoding(proof_req: dict, proof: dict) -> bool: """ Return whether the proof's raw values correspond to their encodings as cross-referenced against proof request. :param proof request: proof request :param proof: corresponding proof to check :return: True if OK...
[ "def", "check_encoding", "(", "proof_req", ":", "dict", ",", "proof", ":", "dict", ")", "->", "bool", ":", "LOGGER", ".", "debug", "(", "'Verifier.check_encoding <<< proof_req: %s, proof: %s'", ",", "proof_req", ",", "proof", ")", "cd_id2proof_id", "=", "{", "}"...
Return whether the proof's raw values correspond to their encodings as cross-referenced against proof request. :param proof request: proof request :param proof: corresponding proof to check :return: True if OK, False for encoding mismatch
[ "Return", "whether", "the", "proof", "s", "raw", "values", "correspond", "to", "their", "encodings", "as", "cross", "-", "referenced", "against", "proof", "request", "." ]
python
train
52.113636
log2timeline/plaso
plaso/parsers/esedb_plugins/interface.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/parsers/esedb_plugins/interface.py#L170-L221
def _GetRecordValue(self, record, value_entry): """Retrieves a specific value from the record. Args: record (pyesedb.record): ESE record. value_entry (int): value entry. Returns: object: value. Raises: ValueError: if the value is not supported. """ column_type = record...
[ "def", "_GetRecordValue", "(", "self", ",", "record", ",", "value_entry", ")", ":", "column_type", "=", "record", ".", "get_column_type", "(", "value_entry", ")", "long_value", "=", "None", "if", "record", ".", "is_long_value", "(", "value_entry", ")", ":", ...
Retrieves a specific value from the record. Args: record (pyesedb.record): ESE record. value_entry (int): value entry. Returns: object: value. Raises: ValueError: if the value is not supported.
[ "Retrieves", "a", "specific", "value", "from", "the", "record", "." ]
python
train
30.788462
saltstack/salt
salt/cloud/clouds/ec2.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1296-L1329
def securitygroupid(vm_): ''' Returns the SecurityGroupId ''' securitygroupid_set = set() securitygroupid_list = config.get_cloud_config_value( 'securitygroupid', vm_, __opts__, search_global=False ) # If the list is None, then the set will remain empty # ...
[ "def", "securitygroupid", "(", "vm_", ")", ":", "securitygroupid_set", "=", "set", "(", ")", "securitygroupid_list", "=", "config", ".", "get_cloud_config_value", "(", "'securitygroupid'", ",", "vm_", ",", "__opts__", ",", "search_global", "=", "False", ")", "# ...
Returns the SecurityGroupId
[ "Returns", "the", "SecurityGroupId" ]
python
train
40.205882
pymc-devs/pymc
pymc/gp/GPutils.py
https://github.com/pymc-devs/pymc/blob/c6e530210bff4c0d7189b35b2c971bc53f93f7cd/pymc/gp/GPutils.py#L264-L313
def observe(M, C, obs_mesh, obs_vals, obs_V=0, lintrans=None, cross_validate=True): """ (M, C, obs_mesh, obs_vals[, obs_V = 0, lintrans = None, cross_validate = True]) Imposes observation of the value of obs_vals on M and C, where obs_vals ~ N(lintrans * f(obs_mesh), V) f ~ GP(M,C) ...
[ "def", "observe", "(", "M", ",", "C", ",", "obs_mesh", ",", "obs_vals", ",", "obs_V", "=", "0", ",", "lintrans", "=", "None", ",", "cross_validate", "=", "True", ")", ":", "obs_mesh", "=", "regularize_array", "(", "obs_mesh", ")", "# print_(obs_mesh)", "...
(M, C, obs_mesh, obs_vals[, obs_V = 0, lintrans = None, cross_validate = True]) Imposes observation of the value of obs_vals on M and C, where obs_vals ~ N(lintrans * f(obs_mesh), V) f ~ GP(M,C) :Arguments: - `M`: The mean function - `C`: The covariance function - `...
[ "(", "M", "C", "obs_mesh", "obs_vals", "[", "obs_V", "=", "0", "lintrans", "=", "None", "cross_validate", "=", "True", "]", ")" ]
python
train
35.44
tradenity/python-sdk
tradenity/resources/geo_zone.py
https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/geo_zone.py#L259-L281
def list_all_geo_zones(cls, **kwargs): """List GeoZones Return a list of GeoZones This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.list_all_geo_zones(async=True) >>> result = thread.get...
[ "def", "list_all_geo_zones", "(", "cls", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async'", ")", ":", "return", "cls", ".", "_list_all_geo_zones_with_http_info", "(", "*...
List GeoZones Return a list of GeoZones This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.list_all_geo_zones(async=True) >>> result = thread.get() :param async bool :param int p...
[ "List", "GeoZones" ]
python
train
36.347826
yuce/pyswip
pyswip/easy.py
https://github.com/yuce/pyswip/blob/f7c1f1e8c3a13b90bd775861d374788a8b5677d8/pyswip/easy.py#L349-L356
def getBool(t): """If t is of type bool, return it, otherwise raise InvalidTypeError. """ b = c_int() if PL_get_long(t, byref(b)): return bool(b.value) else: raise InvalidTypeError("bool")
[ "def", "getBool", "(", "t", ")", ":", "b", "=", "c_int", "(", ")", "if", "PL_get_long", "(", "t", ",", "byref", "(", "b", ")", ")", ":", "return", "bool", "(", "b", ".", "value", ")", "else", ":", "raise", "InvalidTypeError", "(", "\"bool\"", ")"...
If t is of type bool, return it, otherwise raise InvalidTypeError.
[ "If", "t", "is", "of", "type", "bool", "return", "it", "otherwise", "raise", "InvalidTypeError", "." ]
python
train
27.125
tensorflow/probability
tensorflow_probability/examples/latent_dirichlet_allocation_distributions.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/examples/latent_dirichlet_allocation_distributions.py#L197-L222
def make_decoder(num_topics, num_words): """Create the decoder function. Args: num_topics: The number of topics. num_words: The number of words. Returns: decoder: A `callable` mapping a `Tensor` of encodings to a `tfd.Distribution` instance over words. """ topics_words_logits = tf.compat.v...
[ "def", "make_decoder", "(", "num_topics", ",", "num_words", ")", ":", "topics_words_logits", "=", "tf", ".", "compat", ".", "v1", ".", "get_variable", "(", "\"topics_words_logits\"", ",", "shape", "=", "[", "num_topics", ",", "num_words", "]", ",", "initialize...
Create the decoder function. Args: num_topics: The number of topics. num_words: The number of words. Returns: decoder: A `callable` mapping a `Tensor` of encodings to a `tfd.Distribution` instance over words.
[ "Create", "the", "decoder", "function", "." ]
python
test
33.615385
JarryShaw/PyPCAPKit
src/protocols/link/link.py
https://github.com/JarryShaw/PyPCAPKit/blob/c7f0da9aebc2cf210bf8f8b912f7d3cbb98ca10e/src/protocols/link/link.py#L79-L121
def _import_next_layer(self, proto, length): """Import next layer extractor. Positional arguments: * proto -- str, next layer protocol name * length -- int, valid (not padding) length Returns: * bool -- flag if extraction of next layer succeeded ...
[ "def", "_import_next_layer", "(", "self", ",", "proto", ",", "length", ")", ":", "if", "length", "==", "0", ":", "from", "pcapkit", ".", "protocols", ".", "null", "import", "NoPayload", "as", "Protocol", "elif", "self", ".", "_sigterm", ":", "from", "pca...
Import next layer extractor. Positional arguments: * proto -- str, next layer protocol name * length -- int, valid (not padding) length Returns: * bool -- flag if extraction of next layer succeeded * Info -- info of next layer * ProtoChain --...
[ "Import", "next", "layer", "extractor", "." ]
python
train
39.023256
pantsbuild/pex
pex/pex.py
https://github.com/pantsbuild/pex/blob/87b2129d860250d3b9edce75b9cb62f9789ee521/pex/pex.py#L235-L252
def minimum_sys(cls, inherit_path): """Return the minimum sys necessary to run this interpreter, a la python -S. :returns: (sys.path, sys.path_importer_cache, sys.modules) tuple of a bare python installation. """ site_libs = set(cls.site_libs()) for site_lib in site_libs: TRACER.log('Fo...
[ "def", "minimum_sys", "(", "cls", ",", "inherit_path", ")", ":", "site_libs", "=", "set", "(", "cls", ".", "site_libs", "(", ")", ")", "for", "site_lib", "in", "site_libs", ":", "TRACER", ".", "log", "(", "'Found site-library: %s'", "%", "site_lib", ")", ...
Return the minimum sys necessary to run this interpreter, a la python -S. :returns: (sys.path, sys.path_importer_cache, sys.modules) tuple of a bare python installation.
[ "Return", "the", "minimum", "sys", "necessary", "to", "run", "this", "interpreter", "a", "la", "python", "-", "S", "." ]
python
train
40.722222
quantumlib/Cirq
cirq/circuits/text_diagram_drawer.py
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/circuits/text_diagram_drawer.py#L179-L182
def force_horizontal_padding_after( self, index: int, padding: Union[int, float]) -> None: """Change the padding after the given column.""" self.horizontal_padding[index] = padding
[ "def", "force_horizontal_padding_after", "(", "self", ",", "index", ":", "int", ",", "padding", ":", "Union", "[", "int", ",", "float", "]", ")", "->", "None", ":", "self", ".", "horizontal_padding", "[", "index", "]", "=", "padding" ]
Change the padding after the given column.
[ "Change", "the", "padding", "after", "the", "given", "column", "." ]
python
train
51.25
chaoss/grimoirelab-manuscripts
manuscripts2/metrics/git.py
https://github.com/chaoss/grimoirelab-manuscripts/blob/94a3ad4f11bfbcd6c5190e01cb5d3e47a5187cd9/manuscripts2/metrics/git.py#L107-L114
def timeseries(self, dataframe=False): """Get the date histogram aggregations. :param dataframe: if true, return a pandas.DataFrame object """ self.query.get_cardinality("author_uuid").by_period() return super().timeseries(dataframe)
[ "def", "timeseries", "(", "self", ",", "dataframe", "=", "False", ")", ":", "self", ".", "query", ".", "get_cardinality", "(", "\"author_uuid\"", ")", ".", "by_period", "(", ")", "return", "super", "(", ")", ".", "timeseries", "(", "dataframe", ")" ]
Get the date histogram aggregations. :param dataframe: if true, return a pandas.DataFrame object
[ "Get", "the", "date", "histogram", "aggregations", "." ]
python
train
33.5
HazyResearch/metal
metal/logging/logger.py
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/logging/logger.py#L37-L40
def check(self, batch_size): """Returns True if the logging frequency has been met.""" self.increment(batch_size) return self.unit_count >= self.config["log_train_every"]
[ "def", "check", "(", "self", ",", "batch_size", ")", ":", "self", ".", "increment", "(", "batch_size", ")", "return", "self", ".", "unit_count", ">=", "self", ".", "config", "[", "\"log_train_every\"", "]" ]
Returns True if the logging frequency has been met.
[ "Returns", "True", "if", "the", "logging", "frequency", "has", "been", "met", "." ]
python
train
47.75
b3j0f/annotation
b3j0f/annotation/async.py
https://github.com/b3j0f/annotation/blob/738035a974e4092696d9dc1bbd149faa21c8c51f/b3j0f/annotation/async.py#L97-L102
def _threaded(self, *args, **kwargs): """Call the target and put the result in the Queue.""" for target in self.targets: result = target(*args, **kwargs) self.queue.put(result)
[ "def", "_threaded", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "target", "in", "self", ".", "targets", ":", "result", "=", "target", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "queue", ".", "put", ...
Call the target and put the result in the Queue.
[ "Call", "the", "target", "and", "put", "the", "result", "in", "the", "Queue", "." ]
python
train
35.333333
DLR-RM/RAFCON
source/rafcon/gui/controllers/top_tool_bar.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/top_tool_bar.py#L51-L55
def register_view(self, view): """Called when the View was registered""" super(TopToolBarController, self).register_view(view) view['maximize_button'].connect('clicked', self.on_maximize_button_clicked) self.update_maximize_button()
[ "def", "register_view", "(", "self", ",", "view", ")", ":", "super", "(", "TopToolBarController", ",", "self", ")", ".", "register_view", "(", "view", ")", "view", "[", "'maximize_button'", "]", ".", "connect", "(", "'clicked'", ",", "self", ".", "on_maxim...
Called when the View was registered
[ "Called", "when", "the", "View", "was", "registered" ]
python
train
52
cs50/check50
check50/runner.py
https://github.com/cs50/check50/blob/42c1f0c36baa6a24f69742d74551a9ea7a5ceb33/check50/runner.py#L76-L153
def check(dependency=None, timeout=60): """Mark function as a check. :param dependency: the check that this check depends on :type dependency: function :param timeout: maximum number of seconds the check can run :type timeout: int When a check depends on another, the former will only run if th...
[ "def", "check", "(", "dependency", "=", "None", ",", "timeout", "=", "60", ")", ":", "def", "decorator", "(", "check", ")", ":", "# Modules are evaluated from the top of the file down, so _check_names will", "# contain the names of the checks in the order in which they are decl...
Mark function as a check. :param dependency: the check that this check depends on :type dependency: function :param timeout: maximum number of seconds the check can run :type timeout: int When a check depends on another, the former will only run if the latter passes. Additionally, the dependen...
[ "Mark", "function", "as", "a", "check", "." ]
python
train
42.089744
dbcli/cli_helpers
cli_helpers/config.py
https://github.com/dbcli/cli_helpers/blob/3ebd891ac0c02bad061182dbcb54a47fb21980ae/cli_helpers/config.py#L103-L111
def read(self): """Read the default, additional, system, and user config files. :raises DefaultConfigValidationError: There was a validation error with the *default* file. """ if self.default_file: self.read_default_config() ...
[ "def", "read", "(", "self", ")", ":", "if", "self", ".", "default_file", ":", "self", ".", "read_default_config", "(", ")", "return", "self", ".", "read_config_files", "(", "self", ".", "all_config_files", "(", ")", ")" ]
Read the default, additional, system, and user config files. :raises DefaultConfigValidationError: There was a validation error with the *default* file.
[ "Read", "the", "default", "additional", "system", "and", "user", "config", "files", "." ]
python
test
41.111111
p3trus/slave
slave/misc.py
https://github.com/p3trus/slave/blob/bdc74e73bd0f47b74a090c43aa2283c469cde3be/slave/misc.py#L78-L95
def index(index, length): """Generates an index. :param index: The index, can be positive or negative. :param length: The length of the sequence to index. :raises: IndexError Negative indices are typically used to index a sequence in reverse order. But to use them, the indexed object must con...
[ "def", "index", "(", "index", ",", "length", ")", ":", "if", "index", "<", "0", ":", "index", "+=", "length", "if", "0", "<=", "index", "<", "length", ":", "return", "index", "raise", "IndexError", "(", ")" ]
Generates an index. :param index: The index, can be positive or negative. :param length: The length of the sequence to index. :raises: IndexError Negative indices are typically used to index a sequence in reverse order. But to use them, the indexed object must convert them to the correct, pos...
[ "Generates", "an", "index", "." ]
python
train
28.277778
greenape/mktheapidocs
mktheapidocs/mkapi.py
https://github.com/greenape/mktheapidocs/blob/a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7/mktheapidocs/mkapi.py#L552-L612
def type_list(signature, doc, header): """ Construct a list of types, preferring type annotations to docstrings if they are available. Parameters ---------- signature : Signature Signature of thing doc : list of tuple Numpydoc's type list section Returns ------- ...
[ "def", "type_list", "(", "signature", ",", "doc", ",", "header", ")", ":", "lines", "=", "[", "]", "docced", "=", "set", "(", ")", "lines", ".", "append", "(", "header", ")", "try", ":", "for", "names", ",", "types", ",", "description", "in", "doc"...
Construct a list of types, preferring type annotations to docstrings if they are available. Parameters ---------- signature : Signature Signature of thing doc : list of tuple Numpydoc's type list section Returns ------- list of str Markdown formatted type list
[ "Construct", "a", "list", "of", "types", "preferring", "type", "annotations", "to", "docstrings", "if", "they", "are", "available", "." ]
python
train
36.295082
readbeyond/aeneas
aeneas/executetask.py
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/executetask.py#L185-L225
def _execute_single_level_task(self): """ Execute a single-level task """ self.log(u"Executing single level task...") try: # load audio file, extract MFCCs from real wave, clear audio file self._step_begin(u"extract MFCC real wave") real_wave_mfcc = self._extr...
[ "def", "_execute_single_level_task", "(", "self", ")", ":", "self", ".", "log", "(", "u\"Executing single level task...\"", ")", "try", ":", "# load audio file, extract MFCCs from real wave, clear audio file", "self", ".", "_step_begin", "(", "u\"extract MFCC real wave\"", ")...
Execute a single-level task
[ "Execute", "a", "single", "-", "level", "task" ]
python
train
37.853659
saltstack/salt
salt/modules/boto_lambda.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_lambda.py#L788-L819
def update_alias(FunctionName, Name, FunctionVersion=None, Description=None, region=None, key=None, keyid=None, profile=None): ''' Update the named alias to the configuration. Returns {updated: true} if the alias was updated and returns {updated: False} if the alias was not updated. ...
[ "def", "update_alias", "(", "FunctionName", ",", "Name", ",", "FunctionVersion", "=", "None", ",", "Description", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "try",...
Update the named alias to the configuration. Returns {updated: true} if the alias was updated and returns {updated: False} if the alias was not updated. CLI Example: .. code-block:: bash salt myminion boto_lamba.update_alias my_lambda my_alias $LATEST
[ "Update", "the", "named", "alias", "to", "the", "configuration", "." ]
python
train
34.78125
cloudtools/troposphere
troposphere/utils.py
https://github.com/cloudtools/troposphere/blob/f7ea5591a7c287a843adc9c184d2f56064cfc632/troposphere/utils.py#L8-L19
def get_events(conn, stackname): """Get the events in batches and return in chronological order""" next = None event_list = [] while 1: events = conn.describe_stack_events(stackname, next) event_list.append(events) if events.next_token is None: break next = ev...
[ "def", "get_events", "(", "conn", ",", "stackname", ")", ":", "next", "=", "None", "event_list", "=", "[", "]", "while", "1", ":", "events", "=", "conn", ".", "describe_stack_events", "(", "stackname", ",", "next", ")", "event_list", ".", "append", "(", ...
Get the events in batches and return in chronological order
[ "Get", "the", "events", "in", "batches", "and", "return", "in", "chronological", "order" ]
python
train
32.25
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_tunnels.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_tunnels.py#L51-L63
def nsx_controller_connection_addr_method(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") nsx_controller = ET.SubElement(config, "nsx-controller", xmlns="urn:brocade.com:mgmt:brocade-tunnels") name_key = ET.SubElement(nsx_controller, "name") name...
[ "def", "nsx_controller_connection_addr_method", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "nsx_controller", "=", "ET", ".", "SubElement", "(", "config", ",", "\"nsx-controller\"", ",", "xmlns",...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
46.538462
oleiade/durations
durations/parser.py
https://github.com/oleiade/durations/blob/62c176dfa7d36d5c59bf93bdebfdc80ab53757bd/durations/parser.py#L10-L31
def valid_token(token): """Asserts a provided string is a valid duration token representation :param token: duration representation token :type token: string """ is_scale = False # Check if the token represents a scale # If it doesn't set a flag accordingly try: Scale(token)...
[ "def", "valid_token", "(", "token", ")", ":", "is_scale", "=", "False", "# Check if the token represents a scale", "# If it doesn't set a flag accordingly", "try", ":", "Scale", "(", "token", ")", "is_scale", "=", "True", "except", "ScaleFormatError", ":", "pass", "# ...
Asserts a provided string is a valid duration token representation :param token: duration representation token :type token: string
[ "Asserts", "a", "provided", "string", "is", "a", "valid", "duration", "token", "representation" ]
python
train
26.545455
what-studio/profiling
profiling/viewer.py
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/viewer.py#L563-L574
def find_node(self, node, path): """Finds a node by the given path from the given node.""" for hash_value in path: if isinstance(node, LeafStatisticsNode): break for stats in node.get_child_keys(): if hash(stats) == hash_value: ...
[ "def", "find_node", "(", "self", ",", "node", ",", "path", ")", ":", "for", "hash_value", "in", "path", ":", "if", "isinstance", "(", "node", ",", "LeafStatisticsNode", ")", ":", "break", "for", "stats", "in", "node", ".", "get_child_keys", "(", ")", "...
Finds a node by the given path from the given node.
[ "Finds", "a", "node", "by", "the", "given", "path", "from", "the", "given", "node", "." ]
python
train
35.666667
CameronLonsdale/lantern
lantern/modules/shift.py
https://github.com/CameronLonsdale/lantern/blob/235e163e96bf0719d49c54204ee576b2ca93abb6/lantern/modules/shift.py#L9-L43
def make_shift_function(alphabet): """Construct a shift function from an alphabet. Examples: Shift cases independently >>> make_shift_function([string.ascii_uppercase, string.ascii_lowercase]) <function make_shift_function.<locals>.shift_case_sensitive> Additionally shift punc...
[ "def", "make_shift_function", "(", "alphabet", ")", ":", "def", "shift_case_sensitive", "(", "shift", ",", "symbol", ")", ":", "case", "=", "[", "case", "for", "case", "in", "alphabet", "if", "symbol", "in", "case", "]", "if", "not", "case", ":", "return...
Construct a shift function from an alphabet. Examples: Shift cases independently >>> make_shift_function([string.ascii_uppercase, string.ascii_lowercase]) <function make_shift_function.<locals>.shift_case_sensitive> Additionally shift punctuation characters >>> make_shift...
[ "Construct", "a", "shift", "function", "from", "an", "alphabet", "." ]
python
train
32.4
QualiSystems/vCenterShell
package/cloudshell/cp/vcenter/common/wrappers/command_wrapper.py
https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/common/wrappers/command_wrapper.py#L54-L135
def execute_command_with_connection(self, context, command, *args): """ Note: session & vcenter_data_model & reservation id objects will be injected dynamically to the command :param command: :param context: instance of ResourceCommandContext or AutoLoadCommandContext :type conte...
[ "def", "execute_command_with_connection", "(", "self", ",", "context", ",", "command", ",", "*", "args", ")", ":", "logger", "=", "self", ".", "context_based_logger_factory", ".", "create_logger_for_context", "(", "logger_name", "=", "'vCenterShell'", ",", "context"...
Note: session & vcenter_data_model & reservation id objects will be injected dynamically to the command :param command: :param context: instance of ResourceCommandContext or AutoLoadCommandContext :type context: cloudshell.shell.core.context.ResourceCommandContext :param args:
[ "Note", ":", "session", "&", "vcenter_data_model", "&", "reservation", "id", "objects", "will", "be", "injected", "dynamically", "to", "the", "command", ":", "param", "command", ":", ":", "param", "context", ":", "instance", "of", "ResourceCommandContext", "or",...
python
train
45.804878
BeyondTheClouds/enoslib
enoslib/infra/enos_openstack/provider.py
https://github.com/BeyondTheClouds/enoslib/blob/fb00be58e56a7848cfe482187d659744919fe2f7/enoslib/infra/enos_openstack/provider.py#L208-L230
def wait_for_servers(session, servers): """Wait for the servers to be ready. Note(msimonin): we don't garantee the SSH connection to be ready. """ nclient = nova.Client(NOVA_VERSION, session=session, region_name=os.environ['OS_REGION_NAME']) while True: deployed = ...
[ "def", "wait_for_servers", "(", "session", ",", "servers", ")", ":", "nclient", "=", "nova", ".", "Client", "(", "NOVA_VERSION", ",", "session", "=", "session", ",", "region_name", "=", "os", ".", "environ", "[", "'OS_REGION_NAME'", "]", ")", "while", "Tru...
Wait for the servers to be ready. Note(msimonin): we don't garantee the SSH connection to be ready.
[ "Wait", "for", "the", "servers", "to", "be", "ready", "." ]
python
train
39.26087
saltstack/salt
salt/utils/user.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/user.py#L329-L341
def get_group_dict(user=None, include_default=True): ''' Returns a dict of all of the system groups as keys, and group ids as values, of which the user is a member. E.g.: {'staff': 501, 'sudo': 27} ''' if HAS_GRP is False or HAS_PWD is False: return {} group_dict = {} group_names...
[ "def", "get_group_dict", "(", "user", "=", "None", ",", "include_default", "=", "True", ")", ":", "if", "HAS_GRP", "is", "False", "or", "HAS_PWD", "is", "False", ":", "return", "{", "}", "group_dict", "=", "{", "}", "group_names", "=", "get_group_list", ...
Returns a dict of all of the system groups as keys, and group ids as values, of which the user is a member. E.g.: {'staff': 501, 'sudo': 27}
[ "Returns", "a", "dict", "of", "all", "of", "the", "system", "groups", "as", "keys", "and", "group", "ids", "as", "values", "of", "which", "the", "user", "is", "a", "member", ".", "E", ".", "g", ".", ":", "{", "staff", ":", "501", "sudo", ":", "27...
python
train
36.846154
jilljenn/tryalgo
tryalgo/pq_tree.py
https://github.com/jilljenn/tryalgo/blob/89a4dd9655e7b6b0a176f72b4c60d0196420dfe1/tryalgo/pq_tree.py#L73-L77
def add(self, node): """Add one node as descendant """ self.sons.append(node) node.parent = self
[ "def", "add", "(", "self", ",", "node", ")", ":", "self", ".", "sons", ".", "append", "(", "node", ")", "node", ".", "parent", "=", "self" ]
Add one node as descendant
[ "Add", "one", "node", "as", "descendant" ]
python
train
24.8
synw/dataswim
dataswim/data/clean.py
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L37-L50
def nan_empty(self, col: str): """ Fill empty values with NaN values :param col: name of the colum :type col: str :example: ``ds.nan_empty("mycol")`` """ try: self.df[col] = self.df[col].replace('', nan) self.ok("Filled empty values with ...
[ "def", "nan_empty", "(", "self", ",", "col", ":", "str", ")", ":", "try", ":", "self", ".", "df", "[", "col", "]", "=", "self", ".", "df", "[", "col", "]", ".", "replace", "(", "''", ",", "nan", ")", "self", ".", "ok", "(", "\"Filled empty valu...
Fill empty values with NaN values :param col: name of the colum :type col: str :example: ``ds.nan_empty("mycol")``
[ "Fill", "empty", "values", "with", "NaN", "values" ]
python
train
30.142857
jupyter-widgets/ipywidgets
ipywidgets/widgets/interaction.py
https://github.com/jupyter-widgets/ipywidgets/blob/36fe37594cd5a268def228709ca27e37b99ac606/ipywidgets/widgets/interaction.py#L341-L354
def widget_from_single_value(o): """Make widgets from single values, which can be used as parameter defaults.""" if isinstance(o, string_types): return Text(value=unicode_type(o)) elif isinstance(o, bool): return Checkbox(value=o) elif isinstance(o, Integral): ...
[ "def", "widget_from_single_value", "(", "o", ")", ":", "if", "isinstance", "(", "o", ",", "string_types", ")", ":", "return", "Text", "(", "value", "=", "unicode_type", "(", "o", ")", ")", "elif", "isinstance", "(", "o", ",", "bool", ")", ":", "return"...
Make widgets from single values, which can be used as parameter defaults.
[ "Make", "widgets", "from", "single", "values", "which", "can", "be", "used", "as", "parameter", "defaults", "." ]
python
train
44.071429
Oneiroe/PySimpleAutomata
PySimpleAutomata/NFA.py
https://github.com/Oneiroe/PySimpleAutomata/blob/0f9f2705fd8ddd5d8118bc31552a640f5d00c359/PySimpleAutomata/NFA.py#L102-L142
def nfa_union(nfa_1: dict, nfa_2: dict) -> dict: """ Returns a NFA that reads the union of the NFAs in input. Let :math:`A_1 = (Σ,S_1,S_1^0,ρ_1,F_1)` and :math:`A_2 =(Σ, S_2,S_2^0,ρ_2,F_2)` be two NFAs. here is a NFA :math:`A_∨` that nondeterministically chooses :math:`A_1` or :math:`A_2` and runs ...
[ "def", "nfa_union", "(", "nfa_1", ":", "dict", ",", "nfa_2", ":", "dict", ")", "->", "dict", ":", "union", "=", "{", "'alphabet'", ":", "nfa_1", "[", "'alphabet'", "]", ".", "union", "(", "nfa_2", "[", "'alphabet'", "]", ")", ",", "'states'", ":", ...
Returns a NFA that reads the union of the NFAs in input. Let :math:`A_1 = (Σ,S_1,S_1^0,ρ_1,F_1)` and :math:`A_2 =(Σ, S_2,S_2^0,ρ_2,F_2)` be two NFAs. here is a NFA :math:`A_∨` that nondeterministically chooses :math:`A_1` or :math:`A_2` and runs it on the input word. It is defined as: :math:`A...
[ "Returns", "a", "NFA", "that", "reads", "the", "union", "of", "the", "NFAs", "in", "input", "." ]
python
train
35.97561
GPflow/GPflow
gpflow/actions.py
https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/actions.py#L335-L345
def with_run_kwargs(self, **kwargs: Dict[str, Any]) -> 'Optimization': """ Replace Tensorflow session run kwargs. Check Tensorflow session run [documentation](https://www.tensorflow.org/api_docs/python/tf/Session). :param kwargs: Dictionary of tensors as keys and numpy arrays or ...
[ "def", "with_run_kwargs", "(", "self", ",", "*", "*", "kwargs", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "'Optimization'", ":", "self", ".", "_run_kwargs", "=", "kwargs", "return", "self" ]
Replace Tensorflow session run kwargs. Check Tensorflow session run [documentation](https://www.tensorflow.org/api_docs/python/tf/Session). :param kwargs: Dictionary of tensors as keys and numpy arrays or primitive python types as values. :return: Optimization instance s...
[ "Replace", "Tensorflow", "session", "run", "kwargs", ".", "Check", "Tensorflow", "session", "run", "[", "documentation", "]", "(", "https", ":", "//", "www", ".", "tensorflow", ".", "org", "/", "api_docs", "/", "python", "/", "tf", "/", "Session", ")", "...
python
train
43.727273
cdeboever3/cdpybio
cdpybio/analysis.py
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/analysis.py#L755-L909
def plot_pc_scatter(self, pc1, pc2, v=True, subset=None, ax=None, color=None, s=None, marker=None, color_name=None, s_name=None, marker_name=None): """ Make a scatter plot of two principal components. You can create differently colored, sized, or m...
[ "def", "plot_pc_scatter", "(", "self", ",", "pc1", ",", "pc2", ",", "v", "=", "True", ",", "subset", "=", "None", ",", "ax", "=", "None", ",", "color", "=", "None", ",", "s", "=", "None", ",", "marker", "=", "None", ",", "color_name", "=", "None"...
Make a scatter plot of two principal components. You can create differently colored, sized, or marked scatter points. Parameters ---------- pc1 : str String of form PCX where X is the number of the principal component you want to plot on the x-axis. ...
[ "Make", "a", "scatter", "plot", "of", "two", "principal", "components", ".", "You", "can", "create", "differently", "colored", "sized", "or", "marked", "scatter", "points", "." ]
python
train
37.780645
apache/spark
python/pyspark/heapq3.py
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/heapq3.py#L411-L414
def heappush(heap, item): """Push item onto heap, maintaining the heap invariant.""" heap.append(item) _siftdown(heap, 0, len(heap)-1)
[ "def", "heappush", "(", "heap", ",", "item", ")", ":", "heap", ".", "append", "(", "item", ")", "_siftdown", "(", "heap", ",", "0", ",", "len", "(", "heap", ")", "-", "1", ")" ]
Push item onto heap, maintaining the heap invariant.
[ "Push", "item", "onto", "heap", "maintaining", "the", "heap", "invariant", "." ]
python
train
35.75
bitcraze/crazyflie-lib-python
cflib/crazyflie/param.py
https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/crazyflie/param.py#L215-L230
def add_update_callback(self, group=None, name=None, cb=None): """ Add a callback for a specific parameter name. This callback will be executed when a new value is read from the Crazyflie. """ if not group and not name: self.all_update_callback.add_callback(cb) ...
[ "def", "add_update_callback", "(", "self", ",", "group", "=", "None", ",", "name", "=", "None", ",", "cb", "=", "None", ")", ":", "if", "not", "group", "and", "not", "name", ":", "self", ".", "all_update_callback", ".", "add_callback", "(", "cb", ")", ...
Add a callback for a specific parameter name. This callback will be executed when a new value is read from the Crazyflie.
[ "Add", "a", "callback", "for", "a", "specific", "parameter", "name", ".", "This", "callback", "will", "be", "executed", "when", "a", "new", "value", "is", "read", "from", "the", "Crazyflie", "." ]
python
train
47.8125
jsvine/markovify
markovify/text.py
https://github.com/jsvine/markovify/blob/6968649a4c5d80f8a1b2279734417348013789e5/markovify/text.py#L150-L193
def make_sentence(self, init_state=None, **kwargs): """ Attempts `tries` (default: 10) times to generate a valid sentence, based on the model and `test_sentence_output`. Passes `max_overlap_ratio` and `max_overlap_total` to `test_sentence_output`. If successful, returns the sent...
[ "def", "make_sentence", "(", "self", ",", "init_state", "=", "None", ",", "*", "*", "kwargs", ")", ":", "tries", "=", "kwargs", ".", "get", "(", "'tries'", ",", "DEFAULT_TRIES", ")", "mor", "=", "kwargs", ".", "get", "(", "'max_overlap_ratio'", ",", "D...
Attempts `tries` (default: 10) times to generate a valid sentence, based on the model and `test_sentence_output`. Passes `max_overlap_ratio` and `max_overlap_total` to `test_sentence_output`. If successful, returns the sentence as a string. If not, returns None. If `init_state` (a tupl...
[ "Attempts", "tries", "(", "default", ":", "10", ")", "times", "to", "generate", "a", "valid", "sentence", "based", "on", "the", "model", "and", "test_sentence_output", ".", "Passes", "max_overlap_ratio", "and", "max_overlap_total", "to", "test_sentence_output", "....
python
train
39.386364
jtwhite79/pyemu
pyemu/la.py
https://github.com/jtwhite79/pyemu/blob/c504d8e7a4097cec07655a6318d275739bd8148a/pyemu/la.py#L260-L316
def __load_parcov(self): """private method to set the parcov attribute from: a pest control file (parameter bounds) a pst object a matrix object an uncert file an ascii matrix file """ # if the parcov arg was not pas...
[ "def", "__load_parcov", "(", "self", ")", ":", "# if the parcov arg was not passed but the pst arg was,", "# reset and use parbounds to build parcov", "if", "not", "self", ".", "parcov_arg", ":", "if", "self", ".", "pst_arg", ":", "self", ".", "parcov_arg", "=", "self",...
private method to set the parcov attribute from: a pest control file (parameter bounds) a pst object a matrix object an uncert file an ascii matrix file
[ "private", "method", "to", "set", "the", "parcov", "attribute", "from", ":", "a", "pest", "control", "file", "(", "parameter", "bounds", ")", "a", "pst", "object", "a", "matrix", "object", "an", "uncert", "file", "an", "ascii", "matrix", "file" ]
python
train
49.842105
mandiant/ioc_writer
ioc_writer/ioc_api.py
https://github.com/mandiant/ioc_writer/blob/712247f3a10bdc2584fa18ac909fc763f71df21a/ioc_writer/ioc_api.py#L575-L583
def write_ioc_to_file(self, output_dir=None, force=False): """ Serialize the IOC to a .ioc file. :param output_dir: Directory to write the ioc out to. default is the current working directory. :param force: If specified, will not validate the root node of the IOC is 'OpenIOC'. ...
[ "def", "write_ioc_to_file", "(", "self", ",", "output_dir", "=", "None", ",", "force", "=", "False", ")", ":", "return", "write_ioc", "(", "self", ".", "root", ",", "output_dir", ",", "force", "=", "force", ")" ]
Serialize the IOC to a .ioc file. :param output_dir: Directory to write the ioc out to. default is the current working directory. :param force: If specified, will not validate the root node of the IOC is 'OpenIOC'. :return:
[ "Serialize", "the", "IOC", "to", "a", ".", "ioc", "file", "." ]
python
train
43.666667
jmbhughes/suvi-trainer
suvitrainer/fileio.py
https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/fileio.py#L36-L41
def get_dates_file(path): """ parse dates file of dates and probability of choosing""" with open(path) as f: dates = f.readlines() return [(convert_time_string(date_string.split(" ")[0]), float(date_string.split(" ")[1])) for date_string in dates]
[ "def", "get_dates_file", "(", "path", ")", ":", "with", "open", "(", "path", ")", "as", "f", ":", "dates", "=", "f", ".", "readlines", "(", ")", "return", "[", "(", "convert_time_string", "(", "date_string", ".", "split", "(", "\" \"", ")", "[", "0",...
parse dates file of dates and probability of choosing
[ "parse", "dates", "file", "of", "dates", "and", "probability", "of", "choosing" ]
python
train
45.666667
timothyhahn/rui
rui/rui.py
https://github.com/timothyhahn/rui/blob/ac9f587fb486760d77332866c6e876f78a810f74/rui/rui.py#L215-L223
def set_tag(self, tag): ''' Sets the tag. If the Entity belongs to the world it will check for tag conflicts. ''' if self._world: if self._world.get_entity_by_tag(tag): raise NonUniqueTagError(tag) self._tag = tag
[ "def", "set_tag", "(", "self", ",", "tag", ")", ":", "if", "self", ".", "_world", ":", "if", "self", ".", "_world", ".", "get_entity_by_tag", "(", "tag", ")", ":", "raise", "NonUniqueTagError", "(", "tag", ")", "self", ".", "_tag", "=", "tag" ]
Sets the tag. If the Entity belongs to the world it will check for tag conflicts.
[ "Sets", "the", "tag", ".", "If", "the", "Entity", "belongs", "to", "the", "world", "it", "will", "check", "for", "tag", "conflicts", "." ]
python
train
31.222222
quantopian/zipline
zipline/finance/asset_restrictions.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/finance/asset_restrictions.py#L143-L152
def is_restricted(self, assets, dt): """ An asset is restricted for all dts if it is in the static list. """ if isinstance(assets, Asset): return assets in self._restricted_set return pd.Series( index=pd.Index(assets), data=vectorized_is_elemen...
[ "def", "is_restricted", "(", "self", ",", "assets", ",", "dt", ")", ":", "if", "isinstance", "(", "assets", ",", "Asset", ")", ":", "return", "assets", "in", "self", ".", "_restricted_set", "return", "pd", ".", "Series", "(", "index", "=", "pd", ".", ...
An asset is restricted for all dts if it is in the static list.
[ "An", "asset", "is", "restricted", "for", "all", "dts", "if", "it", "is", "in", "the", "static", "list", "." ]
python
train
35.2
pysal/spglm
spglm/links.py
https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/links.py#L149-L169
def inverse(self, z): """ Inverse of the logit transform Parameters ---------- z : array-like The value of the logit transform at `p` Returns ------- p : array Probabilities Notes ----- g^(-1)(z) = exp(z)/...
[ "def", "inverse", "(", "self", ",", "z", ")", ":", "z", "=", "np", ".", "asarray", "(", "z", ")", "t", "=", "np", ".", "exp", "(", "-", "z", ")", "return", "1.", "/", "(", "1.", "+", "t", ")" ]
Inverse of the logit transform Parameters ---------- z : array-like The value of the logit transform at `p` Returns ------- p : array Probabilities Notes ----- g^(-1)(z) = exp(z)/(1+exp(z))
[ "Inverse", "of", "the", "logit", "transform" ]
python
train
19.047619
apache/spark
python/pyspark/shuffle.py
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/shuffle.py#L709-L766
def _spill(self): """ dump already partitioned data into disks. """ global MemoryBytesSpilled, DiskBytesSpilled path = self._get_spill_dir(self.spills) if not os.path.exists(path): os.makedirs(path) used_memory = get_used_memory() if not self....
[ "def", "_spill", "(", "self", ")", ":", "global", "MemoryBytesSpilled", ",", "DiskBytesSpilled", "path", "=", "self", ".", "_get_spill_dir", "(", "self", ".", "spills", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "os", "....
dump already partitioned data into disks.
[ "dump", "already", "partitioned", "data", "into", "disks", "." ]
python
train
41.431034
dcaune/perseus-lib-python-common
majormode/perseus/utils/key_util.py
https://github.com/dcaune/perseus-lib-python-common/blob/ba48fe0fd9bb4a75b53e7d10c41ada36a72d4496/majormode/perseus/utils/key_util.py#L115-L134
def key_to_int(key, base=BASE62): """ Convert the following key to an integer. @param key: a key. @param base: a sequence of characters that was used to encode the integer value. @return: the integer value corresponding to the given key. @raise ValueError: if one character of the s...
[ "def", "key_to_int", "(", "key", ",", "base", "=", "BASE62", ")", ":", "base_length", "=", "len", "(", "base", ")", "value", "=", "0", "for", "c", "in", "reversed", "(", "key", ")", ":", "value", "=", "(", "value", "*", "base_length", ")", "+", "...
Convert the following key to an integer. @param key: a key. @param base: a sequence of characters that was used to encode the integer value. @return: the integer value corresponding to the given key. @raise ValueError: if one character of the specified key doesn't match any char...
[ "Convert", "the", "following", "key", "to", "an", "integer", "." ]
python
train
26.3
lukaskubis/crayon
crayon.py
https://github.com/lukaskubis/crayon/blob/7b6926000e08ad029049419b564e34bc735d0e6c/crayon.py#L84-L88
def indent(txt, spacing=4): """ Indent given text using custom spacing, default is set to 4. """ return prefix(str(txt), ''.join([' ' for _ in range(spacing)]))
[ "def", "indent", "(", "txt", ",", "spacing", "=", "4", ")", ":", "return", "prefix", "(", "str", "(", "txt", ")", ",", "''", ".", "join", "(", "[", "' '", "for", "_", "in", "range", "(", "spacing", ")", "]", ")", ")" ]
Indent given text using custom spacing, default is set to 4.
[ "Indent", "given", "text", "using", "custom", "spacing", "default", "is", "set", "to", "4", "." ]
python
train
34.4
Autodesk/pyccc
pyccc/docker_utils.py
https://github.com/Autodesk/pyccc/blob/011698e78d49a83ac332e0578a4a2a865b75ef8d/pyccc/docker_utils.py#L45-L68
def create_build_context(image, inputs, wdir): """ Creates a tar archive with a dockerfile and a directory called "inputs" The Dockerfile will copy the "inputs" directory to the chosen working directory """ assert os.path.isabs(wdir) dockerlines = ["FROM %s" % image, "RUN mk...
[ "def", "create_build_context", "(", "image", ",", "inputs", ",", "wdir", ")", ":", "assert", "os", ".", "path", ".", "isabs", "(", "wdir", ")", "dockerlines", "=", "[", "\"FROM %s\"", "%", "image", ",", "\"RUN mkdir -p %s\"", "%", "wdir", "]", "build_conte...
Creates a tar archive with a dockerfile and a directory called "inputs" The Dockerfile will copy the "inputs" directory to the chosen working directory
[ "Creates", "a", "tar", "archive", "with", "a", "dockerfile", "and", "a", "directory", "called", "inputs", "The", "Dockerfile", "will", "copy", "the", "inputs", "directory", "to", "the", "chosen", "working", "directory" ]
python
train
38.833333
mk-fg/feedjack
feedjack/filters.py
https://github.com/mk-fg/feedjack/blob/3fe65c0f66dc2cfdf45834aaa7235ec9f81b3ca3/feedjack/filters.py#L83-L92
def pick_enclosure_link(post, parameter=''): '''Override URL of the Post to point to url of the first enclosure with href attribute non-empty and type matching specified regexp parameter (empty=any). Missing "type" attribute for enclosure will be matched as an empty string. If none of the enclosures match, link...
[ "def", "pick_enclosure_link", "(", "post", ",", "parameter", "=", "''", ")", ":", "for", "e", "in", "(", "post", ".", "enclosures", "or", "list", "(", ")", ")", ":", "href", "=", "e", ".", "get", "(", "'href'", ")", "if", "not", "href", ":", "con...
Override URL of the Post to point to url of the first enclosure with href attribute non-empty and type matching specified regexp parameter (empty=any). Missing "type" attribute for enclosure will be matched as an empty string. If none of the enclosures match, link won't be updated.
[ "Override", "URL", "of", "the", "Post", "to", "point", "to", "url", "of", "the", "first", "enclosure", "with", "href", "attribute", "non", "-", "empty", "and", "type", "matching", "specified", "regexp", "parameter", "(", "empty", "=", "any", ")", ".", "M...
python
train
51.6
sensu-plugins/sensu-plugin-python
sensu_plugin/utils.py
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/utils.py#L37-L46
def get_settings(): ''' Get all currently loaded settings. ''' settings = {} for config_file in config_files(): config_contents = load_config(config_file) if config_contents is not None: settings = deep_merge(settings, config_contents) return settings
[ "def", "get_settings", "(", ")", ":", "settings", "=", "{", "}", "for", "config_file", "in", "config_files", "(", ")", ":", "config_contents", "=", "load_config", "(", "config_file", ")", "if", "config_contents", "is", "not", "None", ":", "settings", "=", ...
Get all currently loaded settings.
[ "Get", "all", "currently", "loaded", "settings", "." ]
python
train
29.4
aio-libs/yarl
yarl/__init__.py
https://github.com/aio-libs/yarl/blob/e47da02c00ad764e030ca7647a9565548c97d362/yarl/__init__.py#L332-L345
def is_default_port(self): """A check for default port. Return True if port is default for specified scheme, e.g. 'http://python.org' or 'http://python.org:80', False otherwise. """ if self.port is None: return False default = DEFAULT_PORTS.get(self....
[ "def", "is_default_port", "(", "self", ")", ":", "if", "self", ".", "port", "is", "None", ":", "return", "False", "default", "=", "DEFAULT_PORTS", ".", "get", "(", "self", ".", "scheme", ")", "if", "default", "is", "None", ":", "return", "False", "retu...
A check for default port. Return True if port is default for specified scheme, e.g. 'http://python.org' or 'http://python.org:80', False otherwise.
[ "A", "check", "for", "default", "port", "." ]
python
train
28.785714
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
30.833333
saltstack/salt
salt/fileclient.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L1371-L1377
def envs(self): ''' Return a list of available environments ''' load = {'cmd': '_file_envs'} return salt.utils.data.decode(self.channel.send(load)) if six.PY2 \ else self.channel.send(load)
[ "def", "envs", "(", "self", ")", ":", "load", "=", "{", "'cmd'", ":", "'_file_envs'", "}", "return", "salt", ".", "utils", ".", "data", ".", "decode", "(", "self", ".", "channel", ".", "send", "(", "load", ")", ")", "if", "six", ".", "PY2", "else...
Return a list of available environments
[ "Return", "a", "list", "of", "available", "environments" ]
python
train
33.571429
ausaki/subfinder
subfinder/utils.py
https://github.com/ausaki/subfinder/blob/b74b79214f618c603a551b9334ebb110ccf9684c/subfinder/utils.py#L11-L25
def rm_subtitles(path): """ delete all subtitles in path recursively """ sub_exts = ['ass', 'srt', 'sub'] count = 0 for root, dirs, files in os.walk(path): for f in files: _, ext = os.path.splitext(f) ext = ext[1:] if ext in sub_exts: p = o...
[ "def", "rm_subtitles", "(", "path", ")", ":", "sub_exts", "=", "[", "'ass'", ",", "'srt'", ",", "'sub'", "]", "count", "=", "0", "for", "root", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "path", ")", ":", "for", "f", "in", "files", ...
delete all subtitles in path recursively
[ "delete", "all", "subtitles", "in", "path", "recursively" ]
python
train
29.6
neurosynth/neurosynth
neurosynth/base/transformations.py
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/transformations.py#L59-L70
def apply(self, name, foci): """ Apply a named transformation to a set of foci. If the named transformation doesn't exist, return foci untransformed. """ if name in self.transformations: return transform(foci, self.transformations[name]) else: logger.info...
[ "def", "apply", "(", "self", ",", "name", ",", "foci", ")", ":", "if", "name", "in", "self", ".", "transformations", ":", "return", "transform", "(", "foci", ",", "self", ".", "transformations", "[", "name", "]", ")", "else", ":", "logger", ".", "inf...
Apply a named transformation to a set of foci. If the named transformation doesn't exist, return foci untransformed.
[ "Apply", "a", "named", "transformation", "to", "a", "set", "of", "foci", "." ]
python
test
37.25
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v10/matrixpilot.py#L11763-L11773
def gps_inject_data_send(self, target_system, target_component, len, data, force_mavlink1=False): ''' data for injecting into the onboard GPS (used for DGPS) target_system : System ID (uint8_t) target_component : Component ID (uint8_t...
[ "def", "gps_inject_data_send", "(", "self", ",", "target_system", ",", "target_component", ",", "len", ",", "data", ",", "force_mavlink1", "=", "False", ")", ":", "return", "self", ".", "send", "(", "self", ".", "gps_inject_data_encode", "(", "target_system", ...
data for injecting into the onboard GPS (used for DGPS) target_system : System ID (uint8_t) target_component : Component ID (uint8_t) len : data length (uint8_t) data : raw data (110 is enoug...
[ "data", "for", "injecting", "into", "the", "onboard", "GPS", "(", "used", "for", "DGPS", ")" ]
python
train
58.363636
mar10/wsgidav
wsgidav/dc/simple_dc.py
https://github.com/mar10/wsgidav/blob/cec0d84222fc24bea01be1cea91729001963f172/wsgidav/dc/simple_dc.py#L119-L127
def basic_auth_user(self, realm, user_name, password, environ): """Returns True if this user_name/password pair is valid for the realm, False otherwise. Used for basic authentication.""" user = self._get_realm_entry(realm, user_name) if user is not None and password == user.get("passwor...
[ "def", "basic_auth_user", "(", "self", ",", "realm", ",", "user_name", ",", "password", ",", "environ", ")", ":", "user", "=", "self", ".", "_get_realm_entry", "(", "realm", ",", "user_name", ")", "if", "user", "is", "not", "None", "and", "password", "==...
Returns True if this user_name/password pair is valid for the realm, False otherwise. Used for basic authentication.
[ "Returns", "True", "if", "this", "user_name", "/", "password", "pair", "is", "valid", "for", "the", "realm", "False", "otherwise", ".", "Used", "for", "basic", "authentication", "." ]
python
valid
47.444444
oscarbranson/latools
Supplement/comparison_tools/plots.py
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/Supplement/comparison_tools/plots.py#L19-L27
def rangecalc(x, y=None, pad=0.05): """ Calculate padded range limits for axes. """ mn = np.nanmin([np.nanmin(x), np.nanmin(y)]) mx = np.nanmax([np.nanmax(x), np.nanmax(y)]) rn = mx - mn return (mn - pad * rn, mx + pad * rn)
[ "def", "rangecalc", "(", "x", ",", "y", "=", "None", ",", "pad", "=", "0.05", ")", ":", "mn", "=", "np", ".", "nanmin", "(", "[", "np", ".", "nanmin", "(", "x", ")", ",", "np", ".", "nanmin", "(", "y", ")", "]", ")", "mx", "=", "np", ".",...
Calculate padded range limits for axes.
[ "Calculate", "padded", "range", "limits", "for", "axes", "." ]
python
test
28.555556
kyuupichan/aiorpcX
aiorpcx/util.py
https://github.com/kyuupichan/aiorpcX/blob/707c989ed1c67ac9a40cd20b0161b1ce1f4d7db0/aiorpcx/util.py#L93-L97
def validate_protocol(protocol): '''Validate a protocol, a string, and return it.''' if not re.match(PROTOCOL_REGEX, protocol): raise ValueError(f'invalid protocol: {protocol}') return protocol.lower()
[ "def", "validate_protocol", "(", "protocol", ")", ":", "if", "not", "re", ".", "match", "(", "PROTOCOL_REGEX", ",", "protocol", ")", ":", "raise", "ValueError", "(", "f'invalid protocol: {protocol}'", ")", "return", "protocol", ".", "lower", "(", ")" ]
Validate a protocol, a string, and return it.
[ "Validate", "a", "protocol", "a", "string", "and", "return", "it", "." ]
python
train
43.4
minio/minio-py
minio/api.py
https://github.com/minio/minio-py/blob/7107c84183cf5fb4deff68c0a16ab9f1c0b4c37e/minio/api.py#L239-L304
def make_bucket(self, bucket_name, location='us-east-1'): """ Make a new bucket on the server. Optionally include Location. ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'eu-west-1', 'eu-west-2', 'ca-central-1', 'eu-central-1', 'sa-east-1', 'cn-north-1'...
[ "def", "make_bucket", "(", "self", ",", "bucket_name", ",", "location", "=", "'us-east-1'", ")", ":", "is_valid_bucket_name", "(", "bucket_name", ")", "# Default region for all requests.", "region", "=", "'us-east-1'", "if", "self", ".", "_region", ":", "region", ...
Make a new bucket on the server. Optionally include Location. ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'eu-west-1', 'eu-west-2', 'ca-central-1', 'eu-central-1', 'sa-east-1', 'cn-north-1', 'ap-southeast-1', 'ap-southeast-2', 'ap-northeast-1', 'ap-northe...
[ "Make", "a", "new", "bucket", "on", "the", "server", "." ]
python
train
39.878788
lorien/grab
grab/script/crawl.py
https://github.com/lorien/grab/blob/8b301db2a08c830245b61c589e58af6234f4db79/grab/script/crawl.py#L57-L69
def save_list(lst, path): """ Save items from list to the file. """ with open(path, 'wb') as out: lines = [] for item in lst: if isinstance(item, (six.text_type, six.binary_type)): lines.append(make_str(item)) else: lines.append(ma...
[ "def", "save_list", "(", "lst", ",", "path", ")", ":", "with", "open", "(", "path", ",", "'wb'", ")", "as", "out", ":", "lines", "=", "[", "]", "for", "item", "in", "lst", ":", "if", "isinstance", "(", "item", ",", "(", "six", ".", "text_type", ...
Save items from list to the file.
[ "Save", "items", "from", "list", "to", "the", "file", "." ]
python
train
29.076923
DataONEorg/d1_python
lib_common/src/d1_common/multipart.py
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/lib_common/src/d1_common/multipart.py#L90-L103
def is_multipart(header_dict): """ Args: header_dict : CaseInsensitiveDict Returns: bool: ``True`` if ``header_dict`` has a Content-Type key (case insensitive) with value that begins with 'multipart'. """ return ( {k.lower(): v for k, v in header_dict.items()} .get('content-ty...
[ "def", "is_multipart", "(", "header_dict", ")", ":", "return", "(", "{", "k", ".", "lower", "(", ")", ":", "v", "for", "k", ",", "v", "in", "header_dict", ".", "items", "(", ")", "}", ".", "get", "(", "'content-type'", ",", "''", ")", ".", "start...
Args: header_dict : CaseInsensitiveDict Returns: bool: ``True`` if ``header_dict`` has a Content-Type key (case insensitive) with value that begins with 'multipart'.
[ "Args", ":", "header_dict", ":", "CaseInsensitiveDict" ]
python
train
25.285714
dfm/george
george/utils.py
https://github.com/dfm/george/blob/44819680036387625ee89f81c55104f3c1600759/george/utils.py#L36-L56
def nd_sort_samples(samples): """ Sort an N-dimensional list of samples using a KDTree. :param samples: ``(nsamples, ndim)`` The list of samples. This must be a two-dimensional array. :returns i: ``(nsamples,)`` The list of indices into the original array that return the correctly ...
[ "def", "nd_sort_samples", "(", "samples", ")", ":", "# Check the shape of the sample list.", "assert", "len", "(", "samples", ".", "shape", ")", "==", "2", "# Build a KD-tree on the samples.", "tree", "=", "cKDTree", "(", "samples", ")", "# Compute the distances.", "d...
Sort an N-dimensional list of samples using a KDTree. :param samples: ``(nsamples, ndim)`` The list of samples. This must be a two-dimensional array. :returns i: ``(nsamples,)`` The list of indices into the original array that return the correctly sorted version.
[ "Sort", "an", "N", "-", "dimensional", "list", "of", "samples", "using", "a", "KDTree", "." ]
python
train
26.904762
bwohlberg/sporco
sporco/dictlrn/prlcnscdl.py
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/dictlrn/prlcnscdl.py#L704-L711
def cbpdnmd_ustep(k): """Do the U step of the cbpdn stage. The only parameter is the slice index `k` and there are no return values; all inputs and outputs are from and to global variables. """ mp_Z_U0[k] += mp_DX[k] - mp_Z_Y0[k] - mp_S[k] mp_Z_U1[k] += mp_Z_X[k] - mp_Z_Y1[k]
[ "def", "cbpdnmd_ustep", "(", "k", ")", ":", "mp_Z_U0", "[", "k", "]", "+=", "mp_DX", "[", "k", "]", "-", "mp_Z_Y0", "[", "k", "]", "-", "mp_S", "[", "k", "]", "mp_Z_U1", "[", "k", "]", "+=", "mp_Z_X", "[", "k", "]", "-", "mp_Z_Y1", "[", "k", ...
Do the U step of the cbpdn stage. The only parameter is the slice index `k` and there are no return values; all inputs and outputs are from and to global variables.
[ "Do", "the", "U", "step", "of", "the", "cbpdn", "stage", ".", "The", "only", "parameter", "is", "the", "slice", "index", "k", "and", "there", "are", "no", "return", "values", ";", "all", "inputs", "and", "outputs", "are", "from", "and", "to", "global",...
python
train
36.75
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_map/mp_slipmap_ui.py#L387-L391
def set_ground_width(self, ground_width): '''set ground width of view''' state = self.state state.ground_width = ground_width state.panel.re_center(state.width/2, state.height/2, state.lat, state.lon)
[ "def", "set_ground_width", "(", "self", ",", "ground_width", ")", ":", "state", "=", "self", ".", "state", "state", ".", "ground_width", "=", "ground_width", "state", ".", "panel", ".", "re_center", "(", "state", ".", "width", "/", "2", ",", "state", "."...
set ground width of view
[ "set", "ground", "width", "of", "view" ]
python
train
45.6
EntilZha/PyFunctional
functional/execution.py
https://github.com/EntilZha/PyFunctional/blob/ac04e4a8552b0c464a7f492f7c9862424867b63e/functional/execution.py#L48-L72
def evaluate(self, sequence, transformations): """ Execute the sequence of transformations in parallel :param sequence: Sequence to evaluation :param transformations: Transformations to apply :return: Resulting sequence or value """ result = sequence paral...
[ "def", "evaluate", "(", "self", ",", "sequence", ",", "transformations", ")", ":", "result", "=", "sequence", "parallel", "=", "partial", "(", "parallelize", ",", "processes", "=", "self", ".", "processes", ",", "partition_size", "=", "self", ".", "partition...
Execute the sequence of transformations in parallel :param sequence: Sequence to evaluation :param transformations: Transformations to apply :return: Resulting sequence or value
[ "Execute", "the", "sequence", "of", "transformations", "in", "parallel", ":", "param", "sequence", ":", "Sequence", "to", "evaluation", ":", "param", "transformations", ":", "Transformations", "to", "apply", ":", "return", ":", "Resulting", "sequence", "or", "va...
python
train
41.48
glomex/gcdt
gcdt/kumo_start_stop.py
https://github.com/glomex/gcdt/blob/cd67cf416371337b83cb9ca3f696277125703339/gcdt/kumo_start_stop.py#L287-L307
def _get_autoscaling_min_max(template, parameters, asg_name): """Helper to extract the configured MinSize, MaxSize attributes from the template. :param template: cloudformation template (json) :param parameters: list of {'ParameterKey': 'x1', 'ParameterValue': 'y1'} :param asg_name: logical resourc...
[ "def", "_get_autoscaling_min_max", "(", "template", ",", "parameters", ",", "asg_name", ")", ":", "params", "=", "{", "e", "[", "'ParameterKey'", "]", ":", "e", "[", "'ParameterValue'", "]", "for", "e", "in", "parameters", "}", "asg", "=", "template", ".",...
Helper to extract the configured MinSize, MaxSize attributes from the template. :param template: cloudformation template (json) :param parameters: list of {'ParameterKey': 'x1', 'ParameterValue': 'y1'} :param asg_name: logical resource name of the autoscaling group :return: MinSize, MaxSize
[ "Helper", "to", "extract", "the", "configured", "MinSize", "MaxSize", "attributes", "from", "the", "template", "." ]
python
train
43.333333
miguelgrinberg/python-socketio
socketio/packet.py
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/packet.py#L76-L114
def decode(self, encoded_packet): """Decode a transmitted package. The return value indicates how many binary attachment packets are necessary to fully decode the packet. """ ep = encoded_packet try: self.packet_type = int(ep[0:1]) except TypeError: ...
[ "def", "decode", "(", "self", ",", "encoded_packet", ")", ":", "ep", "=", "encoded_packet", "try", ":", "self", ".", "packet_type", "=", "int", "(", "ep", "[", "0", ":", "1", "]", ")", "except", "TypeError", ":", "self", ".", "packet_type", "=", "ep"...
Decode a transmitted package. The return value indicates how many binary attachment packets are necessary to fully decode the packet.
[ "Decode", "a", "transmitted", "package", "." ]
python
train
31.435897
sebp/scikit-survival
sksurv/svm/survival_svm.py
https://github.com/sebp/scikit-survival/blob/cfc99fd20454cdd6f4f20fe331b39f2191ccaabc/sksurv/svm/survival_svm.py#L1000-L1028
def predict(self, X): """Rank samples according to survival times Lower ranks indicate shorter survival, higher ranks longer survival. Parameters ---------- X : array-like, shape = (n_samples, n_features) The input samples. Returns ------- y...
[ "def", "predict", "(", "self", ",", "X", ")", ":", "kernel_mat", "=", "self", ".", "_get_kernel", "(", "X", ",", "self", ".", "fit_X_", ")", "val", "=", "numpy", ".", "dot", "(", "kernel_mat", ",", "self", ".", "coef_", ")", "if", "hasattr", "(", ...
Rank samples according to survival times Lower ranks indicate shorter survival, higher ranks longer survival. Parameters ---------- X : array-like, shape = (n_samples, n_features) The input samples. Returns ------- y : ndarray, shape = (n_samples,) ...
[ "Rank", "samples", "according", "to", "survival", "times" ]
python
train
28
kennell/schiene
schiene/schiene.py
https://github.com/kennell/schiene/blob/a8f1ba2bd30f9f4a373c7b0ced589bd60121aa1f/schiene/schiene.py#L40-L46
def parse_stations(html): """ Strips JS code, loads JSON """ html = html.replace('SLs.sls=', '').replace(';SLs.showSuggestion();', '') html = json.loads(html) return html['suggestions']
[ "def", "parse_stations", "(", "html", ")", ":", "html", "=", "html", ".", "replace", "(", "'SLs.sls='", ",", "''", ")", ".", "replace", "(", "';SLs.showSuggestion();'", ",", "''", ")", "html", "=", "json", ".", "loads", "(", "html", ")", "return", "htm...
Strips JS code, loads JSON
[ "Strips", "JS", "code", "loads", "JSON" ]
python
train
29.571429
csparpa/pyowm
pyowm/stationsapi30/stations_manager.py
https://github.com/csparpa/pyowm/blob/cdd59eb72f32f7238624ceef9b2e2329a5ebd472/pyowm/stationsapi30/stations_manager.py#L39-L51
def get_stations(self): """ Retrieves all of the user's stations registered on the Stations API. :returns: list of *pyowm.stationsapi30.station.Station* objects """ status, data = self.http_client.get_json( STATIONS_URI, params={'appid': self.API_key}, ...
[ "def", "get_stations", "(", "self", ")", ":", "status", ",", "data", "=", "self", ".", "http_client", ".", "get_json", "(", "STATIONS_URI", ",", "params", "=", "{", "'appid'", ":", "self", ".", "API_key", "}", ",", "headers", "=", "{", "'Content-Type'", ...
Retrieves all of the user's stations registered on the Stations API. :returns: list of *pyowm.stationsapi30.station.Station* objects
[ "Retrieves", "all", "of", "the", "user", "s", "stations", "registered", "on", "the", "Stations", "API", "." ]
python
train
33.615385
monarch-initiative/dipper
dipper/sources/KEGG.py
https://github.com/monarch-initiative/dipper/blob/24cc80db355bbe15776edc5c7b41e0886959ba41/dipper/sources/KEGG.py#L137-L173
def parse(self, limit=None): """ :param limit: :return: """ if limit is not None: LOG.info("Only parsing first %s rows fo each file", str(limit)) LOG.info("Parsing files...") if self.test_only: self.test_mode = True self._proces...
[ "def", "parse", "(", "self", ",", "limit", "=", "None", ")", ":", "if", "limit", "is", "not", "None", ":", "LOG", ".", "info", "(", "\"Only parsing first %s rows fo each file\"", ",", "str", "(", "limit", ")", ")", "LOG", ".", "info", "(", "\"Parsing fil...
:param limit: :return:
[ ":", "param", "limit", ":", ":", "return", ":" ]
python
train
30.891892
google/transitfeed
transitfeed/problems.py
https://github.com/google/transitfeed/blob/eb2991a3747ba541b2cb66502b305b6304a1f85f/transitfeed/problems.py#L268-L272
def InvalidLineEnd(self, bad_line_end, context=None, type=TYPE_WARNING): """bad_line_end is a human readable string.""" e = InvalidLineEnd(bad_line_end=bad_line_end, context=context, context2=self._context, type=type) self.AddToAccumulator(e)
[ "def", "InvalidLineEnd", "(", "self", ",", "bad_line_end", ",", "context", "=", "None", ",", "type", "=", "TYPE_WARNING", ")", ":", "e", "=", "InvalidLineEnd", "(", "bad_line_end", "=", "bad_line_end", ",", "context", "=", "context", ",", "context2", "=", ...
bad_line_end is a human readable string.
[ "bad_line_end", "is", "a", "human", "readable", "string", "." ]
python
train
54.6
pypa/pipenv
pipenv/environment.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/environment.py#L278-L290
def find_egg(self, egg_dist): """Find an egg by name in the given environment""" site_packages = self.libdir[1] search_filename = "{0}.egg-link".format(egg_dist.project_name) try: user_site = site.getusersitepackages() except AttributeError: user_site = si...
[ "def", "find_egg", "(", "self", ",", "egg_dist", ")", ":", "site_packages", "=", "self", ".", "libdir", "[", "1", "]", "search_filename", "=", "\"{0}.egg-link\"", ".", "format", "(", "egg_dist", ".", "project_name", ")", "try", ":", "user_site", "=", "site...
Find an egg by name in the given environment
[ "Find", "an", "egg", "by", "name", "in", "the", "given", "environment" ]
python
train
42.230769
dmlc/gluon-nlp
src/gluonnlp/model/transformer.py
https://github.com/dmlc/gluon-nlp/blob/4b83eb6bcc8881e5f1081a3675adaa19fac5c0ba/src/gluonnlp/model/transformer.py#L905-L932
def init_state_from_encoder(self, encoder_outputs, encoder_valid_length=None): """Initialize the state from the encoder outputs. Parameters ---------- encoder_outputs : list encoder_valid_length : NDArray or None Returns ------- decoder_states : list ...
[ "def", "init_state_from_encoder", "(", "self", ",", "encoder_outputs", ",", "encoder_valid_length", "=", "None", ")", ":", "mem_value", "=", "encoder_outputs", "decoder_states", "=", "[", "mem_value", "]", "mem_length", "=", "mem_value", ".", "shape", "[", "1", ...
Initialize the state from the encoder outputs. Parameters ---------- encoder_outputs : list encoder_valid_length : NDArray or None Returns ------- decoder_states : list The decoder states, includes: - mem_value : NDArray - me...
[ "Initialize", "the", "state", "from", "the", "encoder", "outputs", "." ]
python
train
35.392857
log2timeline/dfvfs
dfvfs/path/encrypted_stream_path_spec.py
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/path/encrypted_stream_path_spec.py#L52-L74
def comparable(self): """str: comparable representation of the path specification.""" string_parts = [] if self.cipher_mode: string_parts.append('cipher_mode: {0:s}'.format(self.cipher_mode)) if self.encryption_method: string_parts.append('encryption_method: {0:s}'.format( self.e...
[ "def", "comparable", "(", "self", ")", ":", "string_parts", "=", "[", "]", "if", "self", ".", "cipher_mode", ":", "string_parts", ".", "append", "(", "'cipher_mode: {0:s}'", ".", "format", "(", "self", ".", "cipher_mode", ")", ")", "if", "self", ".", "en...
str: comparable representation of the path specification.
[ "str", ":", "comparable", "representation", "of", "the", "path", "specification", "." ]
python
train
35.73913
crccheck/cloudwatch-to-graphite
leadbutt.py
https://github.com/crccheck/cloudwatch-to-graphite/blob/28a11ee56f7231cef6b6f8af142a8aab3d2eb5a6/leadbutt.py#L51-L67
def get_config(config_file): """Get configuration from a file.""" def load(fp): try: return yaml.safe_load(fp) except yaml.YAMLError as e: sys.stderr.write(text_type(e)) sys.exit(1) # TODO document exit codes if config_file == '-': return load(sy...
[ "def", "get_config", "(", "config_file", ")", ":", "def", "load", "(", "fp", ")", ":", "try", ":", "return", "yaml", ".", "safe_load", "(", "fp", ")", "except", "yaml", ".", "YAMLError", "as", "e", ":", "sys", ".", "stderr", ".", "write", "(", "tex...
Get configuration from a file.
[ "Get", "configuration", "from", "a", "file", "." ]
python
train
32.588235
apache/incubator-heron
heron/tools/explorer/src/python/logicalplan.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/explorer/src/python/logicalplan.py#L62-L89
def to_table(components, topo_info): """ normalize raw logical plan info to table """ inputs, outputs = defaultdict(list), defaultdict(list) for ctype, component in components.items(): if ctype == 'bolts': for component_name, component_info in component.items(): for input_stream in component_inf...
[ "def", "to_table", "(", "components", ",", "topo_info", ")", ":", "inputs", ",", "outputs", "=", "defaultdict", "(", "list", ")", ",", "defaultdict", "(", "list", ")", "for", "ctype", ",", "component", "in", "components", ".", "items", "(", ")", ":", "...
normalize raw logical plan info to table
[ "normalize", "raw", "logical", "plan", "info", "to", "table" ]
python
valid
42.821429
SheffieldML/GPy
GPy/likelihoods/poisson.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/poisson.py#L52-L68
def logpdf_link(self, link_f, y, Y_metadata=None): """ Log Likelihood Function given link(f) .. math:: \\ln p(y_{i}|\lambda(f_{i})) = -\\lambda(f_{i}) + y_{i}\\log \\lambda(f_{i}) - \\log y_{i}! :param link_f: latent variables (link(f)) :type link_f: Nx1 array ...
[ "def", "logpdf_link", "(", "self", ",", "link_f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "return", "-", "link_f", "+", "y", "*", "np", ".", "log", "(", "link_f", ")", "-", "special", ".", "gammaln", "(", "y", "+", "1", ")" ]
Log Likelihood Function given link(f) .. math:: \\ln p(y_{i}|\lambda(f_{i})) = -\\lambda(f_{i}) + y_{i}\\log \\lambda(f_{i}) - \\log y_{i}! :param link_f: latent variables (link(f)) :type link_f: Nx1 array :param y: data :type y: Nx1 array :param Y_metadata:...
[ "Log", "Likelihood", "Function", "given", "link", "(", "f", ")" ]
python
train
34.235294
jupyterhub/kubespawner
kubespawner/spawner.py
https://github.com/jupyterhub/kubespawner/blob/46a4b109c5e657a4c3d5bfa8ea4731ec6564ea13/kubespawner/spawner.py#L1876-L1909
def _load_profile(self, profile_name): """Load a profile by name Called by load_user_options """ # find the profile default_profile = self._profile_list[0] for profile in self._profile_list: if profile.get('default', False): # explicit defaul...
[ "def", "_load_profile", "(", "self", ",", "profile_name", ")", ":", "# find the profile", "default_profile", "=", "self", ".", "_profile_list", "[", "0", "]", "for", "profile", "in", "self", ".", "_profile_list", ":", "if", "profile", ".", "get", "(", "'defa...
Load a profile by name Called by load_user_options
[ "Load", "a", "profile", "by", "name" ]
python
train
38.764706
nilp0inter/cpe
cpe/cpelang2_3.py
https://github.com/nilp0inter/cpe/blob/670d947472a7652af5149324977b50f9a7af9bcf/cpe/cpelang2_3.py#L172-L277
def language_match(self, cpeset, cpel_dom=None): """ Accepts a set of known CPE Names and an expression in the CPE language, and delivers the answer True if the expression matches with the set. Otherwise, it returns False. :param CPELanguage self: An expression in the CPE Applic...
[ "def", "language_match", "(", "self", ",", "cpeset", ",", "cpel_dom", "=", "None", ")", ":", "# Root element tag", "TAG_ROOT", "=", "'#document'", "# A container for child platform definitions", "TAG_PLATSPEC", "=", "'cpe:platform-specification'", "# Information about a platf...
Accepts a set of known CPE Names and an expression in the CPE language, and delivers the answer True if the expression matches with the set. Otherwise, it returns False. :param CPELanguage self: An expression in the CPE Applicability Language, represented as the XML infoset for the ...
[ "Accepts", "a", "set", "of", "known", "CPE", "Names", "and", "an", "expression", "in", "the", "CPE", "language", "and", "delivers", "the", "answer", "True", "if", "the", "expression", "matches", "with", "the", "set", ".", "Otherwise", "it", "returns", "Fal...
python
train
36.103774
emirozer/fake2db
fake2db/helpers.py
https://github.com/emirozer/fake2db/blob/568cf42afb3ac10fc15c4faaa1cdb84fc1f4946c/fake2db/helpers.py#L8-L19
def fake2db_logger(): '''creates a logger obj''' # Pull the local ip and username for meaningful logging username = getpass.getuser() # Set the logger FORMAT = '%(asctime)-15s %(user)-8s %(message)s' logging.basicConfig(format=FORMAT) extra_information = {'user': username} logger = ...
[ "def", "fake2db_logger", "(", ")", ":", "# Pull the local ip and username for meaningful logging", "username", "=", "getpass", ".", "getuser", "(", ")", "# Set the logger", "FORMAT", "=", "'%(asctime)-15s %(user)-8s %(message)s'", "logging", ".", "basicConfig", "(", "format...
creates a logger obj
[ "creates", "a", "logger", "obj" ]
python
train
34
equinor/segyviewer
src/segyviewlib/layoutfigure.py
https://github.com/equinor/segyviewer/blob/994d402a8326f30608d98103f8831dee9e3c5850/src/segyviewlib/layoutfigure.py#L36-L42
def index(self, axes): """ :param axes: The Axes instance to find the index of. :type axes: Axes :rtype: int """ return None if axes is self._colormap_axes else self._axes.index(axes)
[ "def", "index", "(", "self", ",", "axes", ")", ":", "return", "None", "if", "axes", "is", "self", ".", "_colormap_axes", "else", "self", ".", "_axes", ".", "index", "(", "axes", ")" ]
:param axes: The Axes instance to find the index of. :type axes: Axes :rtype: int
[ ":", "param", "axes", ":", "The", "Axes", "instance", "to", "find", "the", "index", "of", ".", ":", "type", "axes", ":", "Axes", ":", "rtype", ":", "int" ]
python
train
32.142857
shinux/PyTime
pytime/pytime.py
https://github.com/shinux/PyTime/blob/f2b9f877507e2a1dddf5dd255fdff243a5dbed48/pytime/pytime.py#L64-L70
def yesterday(date=None): """yesterday once more""" if not date: return _date - datetime.timedelta(days=1) else: current_date = parse(date) return current_date - datetime.timedelta(days=1)
[ "def", "yesterday", "(", "date", "=", "None", ")", ":", "if", "not", "date", ":", "return", "_date", "-", "datetime", ".", "timedelta", "(", "days", "=", "1", ")", "else", ":", "current_date", "=", "parse", "(", "date", ")", "return", "current_date", ...
yesterday once more
[ "yesterday", "once", "more" ]
python
train
31.142857
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L719-L727
def RootNode(self): """Return our current root node and appropriate adapter for it""" tree = self.loader.get_root( self.viewType ) adapter = self.loader.get_adapter( self.viewType ) rows = self.loader.get_rows( self.viewType ) adapter.SetPercentage(self.percentageView, a...
[ "def", "RootNode", "(", "self", ")", ":", "tree", "=", "self", ".", "loader", ".", "get_root", "(", "self", ".", "viewType", ")", "adapter", "=", "self", ".", "loader", ".", "get_adapter", "(", "self", ".", "viewType", ")", "rows", "=", "self", ".", ...
Return our current root node and appropriate adapter for it
[ "Return", "our", "current", "root", "node", "and", "appropriate", "adapter", "for", "it" ]
python
train
41.888889
mushkevych/scheduler
synergy/system/repeat_timer.py
https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/system/repeat_timer.py#L66-L77
def next_run_in(self, utc_now=None): """ :param utc_now: optional parameter to be used by Unit Tests as a definition of "now" :return: timedelta instance presenting amount of time before the trigger is triggered next time or None if the RepeatTimer instance is not running """ if utc...
[ "def", "next_run_in", "(", "self", ",", "utc_now", "=", "None", ")", ":", "if", "utc_now", "is", "None", ":", "utc_now", "=", "datetime", ".", "utcnow", "(", ")", "if", "self", ".", "is_alive", "(", ")", ":", "next_run", "=", "timedelta", "(", "secon...
:param utc_now: optional parameter to be used by Unit Tests as a definition of "now" :return: timedelta instance presenting amount of time before the trigger is triggered next time or None if the RepeatTimer instance is not running
[ ":", "param", "utc_now", ":", "optional", "parameter", "to", "be", "used", "by", "Unit", "Tests", "as", "a", "definition", "of", "now", ":", "return", ":", "timedelta", "instance", "presenting", "amount", "of", "time", "before", "the", "trigger", "is", "tr...
python
train
46