repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
frmdstryr/enamlx
enamlx/qt/qt_graphics_view.py
https://github.com/frmdstryr/enamlx/blob/9582e29c88dc0c0340f912b49168b7307a47ed4f/enamlx/qt/qt_graphics_view.py#L653-L658
def mouseReleaseEvent(self, event): """ Handle the mouse release event for the drag operation. """ self.declaration.mouse_release_event(event) super(QtGraphicsView, self).mouseReleaseEvent(event)
[ "def", "mouseReleaseEvent", "(", "self", ",", "event", ")", ":", "self", ".", "declaration", ".", "mouse_release_event", "(", "event", ")", "super", "(", "QtGraphicsView", ",", "self", ")", ".", "mouseReleaseEvent", "(", "event", ")" ]
Handle the mouse release event for the drag operation.
[ "Handle", "the", "mouse", "release", "event", "for", "the", "drag", "operation", "." ]
python
train
neo4j-drivers/neobolt
neobolt/impl/python/direct.py
https://github.com/neo4j-drivers/neobolt/blob/724569d76e85777c4f5e30e8d0a18116bda4d8cd/neobolt/impl/python/direct.py#L341-L381
def _fetch(self): """ Receive at least one message from the server, if available. :return: 2-tuple of number of detail messages and number of summary messages fetched """ if self.closed(): raise self.Error("Failed to read from closed connection {!r}".format(self.server.addre...
[ "def", "_fetch", "(", "self", ")", ":", "if", "self", ".", "closed", "(", ")", ":", "raise", "self", ".", "Error", "(", "\"Failed to read from closed connection {!r}\"", ".", "format", "(", "self", ".", "server", ".", "address", ")", ")", "if", "self", "...
Receive at least one message from the server, if available. :return: 2-tuple of number of detail messages and number of summary messages fetched
[ "Receive", "at", "least", "one", "message", "from", "the", "server", "if", "available", "." ]
python
train
mikedh/trimesh
trimesh/grouping.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/grouping.py#L529-L555
def boolean_rows(a, b, operation=np.intersect1d): """ Find the rows in two arrays which occur in both rows. Parameters --------- a: (n, d) int Array with row vectors b: (m, d) int Array with row vectors operation : function Numpy boolean set operation function: ...
[ "def", "boolean_rows", "(", "a", ",", "b", ",", "operation", "=", "np", ".", "intersect1d", ")", ":", "a", "=", "np", ".", "asanyarray", "(", "a", ",", "dtype", "=", "np", ".", "int64", ")", "b", "=", "np", ".", "asanyarray", "(", "b", ",", "dt...
Find the rows in two arrays which occur in both rows. Parameters --------- a: (n, d) int Array with row vectors b: (m, d) int Array with row vectors operation : function Numpy boolean set operation function: -np.intersect1d -np.setdiff1d Returns ...
[ "Find", "the", "rows", "in", "two", "arrays", "which", "occur", "in", "both", "rows", "." ]
python
train
luckydonald/pytgbot
code_generation/output/pytgbot/api_types/receivable/peer.py
https://github.com/luckydonald/pytgbot/blob/67f4b5a1510d4583d40b5477e876b1ef0eb8971b/code_generation/output/pytgbot/api_types/receivable/peer.py#L327-L369
def to_array(self): """ Serializes this Chat to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(Chat, self).to_array() array['id'] = int(self.id) # type int array['type'] = u(self.type) # py2: type unicode...
[ "def", "to_array", "(", "self", ")", ":", "array", "=", "super", "(", "Chat", ",", "self", ")", ".", "to_array", "(", ")", "array", "[", "'id'", "]", "=", "int", "(", "self", ".", "id", ")", "# type int", "array", "[", "'type'", "]", "=", "u", ...
Serializes this Chat to a dictionary. :return: dictionary representation of this object. :rtype: dict
[ "Serializes", "this", "Chat", "to", "a", "dictionary", "." ]
python
train
tgbugs/pyontutils
ilxutils/ilxutils/interlex_sql.py
https://github.com/tgbugs/pyontutils/blob/3d913db29c177db39151592909a4f56170ef8b35/ilxutils/ilxutils/interlex_sql.py#L218-L240
def get_terms_complete(self) -> pd.DataFrame: ''' Gets complete entity data like term/view ''' if not self.terms_complete.empty: return self.terms_complete if self.from_backup: self.terms_complete = open_pickle(TERMS_COMPLETE_BACKUP_PATH) return self.terms_com...
[ "def", "get_terms_complete", "(", "self", ")", "->", "pd", ".", "DataFrame", ":", "if", "not", "self", ".", "terms_complete", ".", "empty", ":", "return", "self", ".", "terms_complete", "if", "self", ".", "from_backup", ":", "self", ".", "terms_complete", ...
Gets complete entity data like term/view
[ "Gets", "complete", "entity", "data", "like", "term", "/", "view" ]
python
train
ASKIDA/Selenium2LibraryExtension
src/Selenium2LibraryExtension/keywords/__init__.py
https://github.com/ASKIDA/Selenium2LibraryExtension/blob/5ca3fa776063c6046dff317cb2575e4772d7541f/src/Selenium2LibraryExtension/keywords/__init__.py#L71-L81
def wait_until_element_value_contains(self, locator, expected, timeout=None): """Waits until the element identified by `locator` contains the expected value. You might want to use `Element Value Should Contain` instead. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_i...
[ "def", "wait_until_element_value_contains", "(", "self", ",", "locator", ",", "expected", ",", "timeout", "=", "None", ")", ":", "self", ".", "_info", "(", "\"Waiting for '%s' value to contain '%s'\"", "%", "(", "locator", ",", "expected", ")", ")", "self", ".",...
Waits until the element identified by `locator` contains the expected value. You might want to use `Element Value Should Contain` instead. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected value | Slim Shady | | timeout | maximum time to wait...
[ "Waits", "until", "the", "element", "identified", "by", "locator", "contains", "the", "expected", "value", ".", "You", "might", "want", "to", "use", "Element", "Value", "Should", "Contain", "instead", "." ]
python
train
MarcoFavorito/flloat
flloat/parser/ltlf.py
https://github.com/MarcoFavorito/flloat/blob/5e6de1bea444b68d46d288834031860a8b2f8c2d/flloat/parser/ltlf.py#L77-L127
def p_formula(self, p): """formula : formula EQUIVALENCE formula | formula IMPLIES formula | formula OR formula | formula AND formula | formula UNTIL formula | formula RELEASE formula | EVENTUALLY f...
[ "def", "p_formula", "(", "self", ",", "p", ")", ":", "if", "len", "(", "p", ")", "==", "2", ":", "if", "p", "[", "1", "]", "==", "Symbols", ".", "TRUE", ".", "value", ":", "p", "[", "0", "]", "=", "LTLfTrue", "(", ")", "elif", "p", "[", "...
formula : formula EQUIVALENCE formula | formula IMPLIES formula | formula OR formula | formula AND formula | formula UNTIL formula | formula RELEASE formula | EVENTUALLY formula | ALWAYS ...
[ "formula", ":", "formula", "EQUIVALENCE", "formula", "|", "formula", "IMPLIES", "formula", "|", "formula", "OR", "formula", "|", "formula", "AND", "formula", "|", "formula", "UNTIL", "formula", "|", "formula", "RELEASE", "formula", "|", "EVENTUALLY", "formula", ...
python
train
pantsbuild/pants
src/python/pants/backend/jvm/tasks/ivy_resolve.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/backend/jvm/tasks/ivy_resolve.py#L88-L117
def execute(self): """Resolves the specified confs for the configured targets and returns an iterator over tuples of (conf, jar path). """ if JvmResolveSubsystem.global_instance().get_options().resolver != 'ivy': return compile_classpath = self.context.products.get_data('compile_classpath', ...
[ "def", "execute", "(", "self", ")", ":", "if", "JvmResolveSubsystem", ".", "global_instance", "(", ")", ".", "get_options", "(", ")", ".", "resolver", "!=", "'ivy'", ":", "return", "compile_classpath", "=", "self", ".", "context", ".", "products", ".", "ge...
Resolves the specified confs for the configured targets and returns an iterator over tuples of (conf, jar path).
[ "Resolves", "the", "specified", "confs", "for", "the", "configured", "targets", "and", "returns", "an", "iterator", "over", "tuples", "of", "(", "conf", "jar", "path", ")", "." ]
python
train
lingpy/sinopy
src/sinopy/sinopy.py
https://github.com/lingpy/sinopy/blob/59a47fcdfae3e0000ac6d2b3d7919bf875ec2056/src/sinopy/sinopy.py#L276-L326
def fanqie2mch(fanqie, debug=False): """ Convert a Fǎnqiè reading to it's MCH counterpart. Important: we need to identify the medials in the xia-syllable. We also need to make additional background-checks, since in the current form, the approach is not error-prone and does not what it is suppos...
[ "def", "fanqie2mch", "(", "fanqie", ",", "debug", "=", "False", ")", ":", "# check for gbk", "fanqie", "=", "gbk2big5", "(", "fanqie", ")", "# get normal vals", "shangxia", "=", "chars2baxter", "(", "fanqie", ")", "# check for good fixed solutions in our dictionary", ...
Convert a Fǎnqiè reading to it's MCH counterpart. Important: we need to identify the medials in the xia-syllable. We also need to make additional background-checks, since in the current form, the approach is not error-prone and does not what it is supposed to do!
[ "Convert", "a", "Fǎnqiè", "reading", "to", "it", "s", "MCH", "counterpart", ".", "Important", ":", "we", "need", "to", "identify", "the", "medials", "in", "the", "xia", "-", "syllable", ".", "We", "also", "need", "to", "make", "additional", "background", ...
python
train
yamins81/tabular
tabular/io.py
https://github.com/yamins81/tabular/blob/1caf091c8c395960a9ad7078f95158b533cc52dd/tabular/io.py#L1177-L1354
def processmetadata(metadata, items=None, comments=None, delimiter_regex=None, ncols=None, verbosity=DEFAULT_VERBOSITY): """ Process Metadata from stored (or "packed") state to functional state. Metadata can come be read from a file "packed" in various ways, e.g. with a string repr...
[ "def", "processmetadata", "(", "metadata", ",", "items", "=", "None", ",", "comments", "=", "None", ",", "delimiter_regex", "=", "None", ",", "ncols", "=", "None", ",", "verbosity", "=", "DEFAULT_VERBOSITY", ")", ":", "items", "=", "items", ".", "split", ...
Process Metadata from stored (or "packed") state to functional state. Metadata can come be read from a file "packed" in various ways, e.g. with a string representation of a dialect or coloring dictionary. This function "unpacks" the stored metadata into useable Python objects. It consists of a list...
[ "Process", "Metadata", "from", "stored", "(", "or", "packed", ")", "state", "to", "functional", "state", "." ]
python
train
jsommers/switchyard
switchyard/lib/packet/udp.py
https://github.com/jsommers/switchyard/blob/fdcb3869c937dcedbd6ea7a7822ebd412bf1e2b0/switchyard/lib/packet/udp.py#L30-L35
def to_bytes(self): ''' Return packed byte representation of the UDP header. ''' return struct.pack(UDP._PACKFMT, self._src, self._dst, self._len, self._checksum)
[ "def", "to_bytes", "(", "self", ")", ":", "return", "struct", ".", "pack", "(", "UDP", ".", "_PACKFMT", ",", "self", ".", "_src", ",", "self", ".", "_dst", ",", "self", ".", "_len", ",", "self", ".", "_checksum", ")" ]
Return packed byte representation of the UDP header.
[ "Return", "packed", "byte", "representation", "of", "the", "UDP", "header", "." ]
python
train
kwikteam/phy
phy/cluster/clustering.py
https://github.com/kwikteam/phy/blob/7e9313dc364304b7d2bd03b92938347343703003/phy/cluster/clustering.py#L510-L537
def redo(self): """Redo the last cluster assignment operation. Returns ------- up : UpdateInfo instance of the changes done by this operation. """ # Go forward in the stack, and retrieve the new assignment. item = self._undo_stack.forward() if item is N...
[ "def", "redo", "(", "self", ")", ":", "# Go forward in the stack, and retrieve the new assignment.", "item", "=", "self", ".", "_undo_stack", ".", "forward", "(", ")", "if", "item", "is", "None", ":", "# No redo has been performed: abort.", "return", "# NOTE: the undo_s...
Redo the last cluster assignment operation. Returns ------- up : UpdateInfo instance of the changes done by this operation.
[ "Redo", "the", "last", "cluster", "assignment", "operation", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/layers/common_layers.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L2238-L2298
def sru_with_scan(x, num_layers=2, activation=None, initial_state=None, name=None, reuse=None): """SRU cell as in https://arxiv.org/abs/1709.02755. This implementation uses tf.scan and can incur overhead, see the full SRU f...
[ "def", "sru_with_scan", "(", "x", ",", "num_layers", "=", "2", ",", "activation", "=", "None", ",", "initial_state", "=", "None", ",", "name", "=", "None", ",", "reuse", "=", "None", ")", ":", "if", "num_layers", "<", "1", ":", "raise", "ValueError", ...
SRU cell as in https://arxiv.org/abs/1709.02755. This implementation uses tf.scan and can incur overhead, see the full SRU function doc for details and an implementation that is sometimes faster. Args: x: A tensor of shape [batch, ..., channels] ; ... is treated as time. num_layers: How many SRU layers;...
[ "SRU", "cell", "as", "in", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1709", ".", "02755", "." ]
python
train
google/grr
grr/core/grr_response_core/lib/utils.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/utils.py#L629-L649
def JoinPath(stem="", *parts): """A sane version of os.path.join. The intention here is to append the stem to the path. The standard module removes the path if the stem begins with a /. Args: stem: The stem to join to. *parts: parts of the path to join. The first arg is always the root and di...
[ "def", "JoinPath", "(", "stem", "=", "\"\"", ",", "*", "parts", ")", ":", "# Ensure all path components are unicode", "parts", "=", "[", "SmartUnicode", "(", "path", ")", "for", "path", "in", "parts", "]", "result", "=", "(", "stem", "+", "NormalizePath", ...
A sane version of os.path.join. The intention here is to append the stem to the path. The standard module removes the path if the stem begins with a /. Args: stem: The stem to join to. *parts: parts of the path to join. The first arg is always the root and directory traversal is not allowed. ...
[ "A", "sane", "version", "of", "os", ".", "path", ".", "join", "." ]
python
train
Azure/msrestazure-for-python
msrestazure/polling/arm_polling.py
https://github.com/Azure/msrestazure-for-python/blob/5f99262305692525d03ca87d2c5356b05c5aa874/msrestazure/polling/arm_polling.py#L87-L100
def get_header_url(response, header_name): """Get a URL from a header requests. :param requests.Response response: REST call response. :param str header_name: Header name. :returns: URL if not None AND valid, None otherwise """ url = response.headers.get(header_name) try: _validate(...
[ "def", "get_header_url", "(", "response", ",", "header_name", ")", ":", "url", "=", "response", ".", "headers", ".", "get", "(", "header_name", ")", "try", ":", "_validate", "(", "url", ")", "except", "ValueError", ":", "return", "None", "else", ":", "re...
Get a URL from a header requests. :param requests.Response response: REST call response. :param str header_name: Header name. :returns: URL if not None AND valid, None otherwise
[ "Get", "a", "URL", "from", "a", "header", "requests", "." ]
python
train
phrase/django-phrase
phrase/templatetags/phrase_i18n.py
https://github.com/phrase/django-phrase/blob/10dbd53513edd30da3fd6c020bcd7f0a1b7338b9/phrase/templatetags/phrase_i18n.py#L21-L98
def do_translate(parser, token): """ This will mark a string for translation and will translate the string for the current language. Usage:: {% trans "this is a test" %} This will mark the string for translation so it will be pulled out by mark-messages.py into the .po files and will...
[ "def", "do_translate", "(", "parser", ",", "token", ")", ":", "bits", "=", "token", ".", "split_contents", "(", ")", "if", "len", "(", "bits", ")", "<", "2", ":", "raise", "TemplateSyntaxError", "(", "\"'%s' takes at least one argument\"", "%", "bits", "[", ...
This will mark a string for translation and will translate the string for the current language. Usage:: {% trans "this is a test" %} This will mark the string for translation so it will be pulled out by mark-messages.py into the .po files and will run the string through the translation engin...
[ "This", "will", "mark", "a", "string", "for", "translation", "and", "will", "translate", "the", "string", "for", "the", "current", "language", ".", "Usage", "::", "{", "%", "trans", "this", "is", "a", "test", "%", "}", "This", "will", "mark", "the", "s...
python
train
wal-e/wal-e
wal_e/operator/backup.py
https://github.com/wal-e/wal-e/blob/027263860e72a403bc0e1497bb3e67523138e7a2/wal_e/operator/backup.py#L293-L363
def wal_restore(self, wal_name, wal_destination, prefetch_max): """ Downloads a WAL file from S3 or Windows Azure Blob Service This code is intended to typically be called from Postgres's restore_command feature. NB: Postgres doesn't guarantee that wal_name == basename(...
[ "def", "wal_restore", "(", "self", ",", "wal_name", ",", "wal_destination", ",", "prefetch_max", ")", ":", "url", "=", "'{0}://{1}/{2}'", ".", "format", "(", "self", ".", "layout", ".", "scheme", ",", "self", ".", "layout", ".", "store_name", "(", ")", "...
Downloads a WAL file from S3 or Windows Azure Blob Service This code is intended to typically be called from Postgres's restore_command feature. NB: Postgres doesn't guarantee that wal_name == basename(wal_path), so both are required.
[ "Downloads", "a", "WAL", "file", "from", "S3", "or", "Windows", "Azure", "Blob", "Service" ]
python
train
sorgerlab/indra
indra/tools/incremental_model.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/incremental_model.py#L149-L163
def get_model_agents(self): """Return a list of all Agents from all Statements. Returns ------- agents : list[indra.statements.Agent] A list of Agents that are in the model. """ model_stmts = self.get_statements() agents = [] for stmt in model_...
[ "def", "get_model_agents", "(", "self", ")", ":", "model_stmts", "=", "self", ".", "get_statements", "(", ")", "agents", "=", "[", "]", "for", "stmt", "in", "model_stmts", ":", "for", "a", "in", "stmt", ".", "agent_list", "(", ")", ":", "if", "a", "i...
Return a list of all Agents from all Statements. Returns ------- agents : list[indra.statements.Agent] A list of Agents that are in the model.
[ "Return", "a", "list", "of", "all", "Agents", "from", "all", "Statements", "." ]
python
train
gabstopper/smc-python
smc/elements/network.py
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/elements/network.py#L283-L305
def create(cls, name, ne_ref=None, operator='exclusion', sub_expression=None, comment=None): """ Create the expression :param str name: name of expression :param list ne_ref: network element references for expression :param str operator: 'exclusion' (negation), 'u...
[ "def", "create", "(", "cls", ",", "name", ",", "ne_ref", "=", "None", ",", "operator", "=", "'exclusion'", ",", "sub_expression", "=", "None", ",", "comment", "=", "None", ")", ":", "sub_expression", "=", "[", "]", "if", "sub_expression", "is", "None", ...
Create the expression :param str name: name of expression :param list ne_ref: network element references for expression :param str operator: 'exclusion' (negation), 'union', 'intersection' (default: exclusion) :param dict sub_expression: sub expression used :param...
[ "Create", "the", "expression" ]
python
train
fastai/fastai
fastai/basic_train.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/basic_train.py#L20-L38
def loss_batch(model:nn.Module, xb:Tensor, yb:Tensor, loss_func:OptLossFunc=None, opt:OptOptimizer=None, cb_handler:Optional[CallbackHandler]=None)->Tuple[Union[Tensor,int,float,str]]: "Calculate loss and metrics for a batch, call out to callbacks as necessary." cb_handler = ifnone(cb_handler, Ca...
[ "def", "loss_batch", "(", "model", ":", "nn", ".", "Module", ",", "xb", ":", "Tensor", ",", "yb", ":", "Tensor", ",", "loss_func", ":", "OptLossFunc", "=", "None", ",", "opt", ":", "OptOptimizer", "=", "None", ",", "cb_handler", ":", "Optional", "[", ...
Calculate loss and metrics for a batch, call out to callbacks as necessary.
[ "Calculate", "loss", "and", "metrics", "for", "a", "batch", "call", "out", "to", "callbacks", "as", "necessary", "." ]
python
train
QInfer/python-qinfer
src/qinfer/distributions.py
https://github.com/QInfer/python-qinfer/blob/8170c84a0be1723f8c6b09e0d3c7a40a886f1fe3/src/qinfer/distributions.py#L1321-L1347
def sample(self, n=1): """ Returns one or more samples from this probability distribution. :param int n: Number of samples to return. :return numpy.ndarray: An array containing samples from the distribution of shape ``(n, d)``, where ``d`` is the number of random...
[ "def", "sample", "(", "self", ",", "n", "=", "1", ")", ":", "samples", "=", "np", ".", "empty", "(", "(", "n", ",", "self", ".", "n_rvs", ")", ")", "idxs_to_sample", "=", "np", ".", "arange", "(", "n", ")", "iters", "=", "0", "while", "idxs_to_...
Returns one or more samples from this probability distribution. :param int n: Number of samples to return. :return numpy.ndarray: An array containing samples from the distribution of shape ``(n, d)``, where ``d`` is the number of random variables.
[ "Returns", "one", "or", "more", "samples", "from", "this", "probability", "distribution", "." ]
python
train
pyQode/pyqode.core
pyqode/core/panels/search_and_replace.py
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/panels/search_and_replace.py#L443-L487
def replace(self, text=None): """ Replaces the selected occurrence. :param text: The replacement text. If it is None, the lineEditReplace's text is used instead. :return True if the text could be replace properly, False if there is no more occurrenc...
[ "def", "replace", "(", "self", ",", "text", "=", "None", ")", ":", "if", "text", "is", "None", "or", "isinstance", "(", "text", ",", "bool", ")", ":", "text", "=", "self", ".", "lineEditReplace", ".", "text", "(", ")", "current_occurences", "=", "sel...
Replaces the selected occurrence. :param text: The replacement text. If it is None, the lineEditReplace's text is used instead. :return True if the text could be replace properly, False if there is no more occurrences to replace.
[ "Replaces", "the", "selected", "occurrence", "." ]
python
train
10gen/mongo-orchestration
mongo_orchestration/apps/links.py
https://github.com/10gen/mongo-orchestration/blob/81fd2224205922ea2178b08190b53a33aec47261/mongo_orchestration/apps/links.py#L181-L193
def all_sharded_cluster_links(cluster_id, shard_id=None, router_id=None, rel_to=None): """Get a list of all links to be included with ShardedClusters.""" return [ sharded_cluster_link(rel, cluster_id, shard_id, router_id, self_rel=(rel == rel_to...
[ "def", "all_sharded_cluster_links", "(", "cluster_id", ",", "shard_id", "=", "None", ",", "router_id", "=", "None", ",", "rel_to", "=", "None", ")", ":", "return", "[", "sharded_cluster_link", "(", "rel", ",", "cluster_id", ",", "shard_id", ",", "router_id", ...
Get a list of all links to be included with ShardedClusters.
[ "Get", "a", "list", "of", "all", "links", "to", "be", "included", "with", "ShardedClusters", "." ]
python
train
KrzyHonk/bpmn-python
bpmn_python/bpmn_diagram_import.py
https://github.com/KrzyHonk/bpmn-python/blob/6e5e28e3d656dbf5bd3d85d78fe8e3f2fb462629/bpmn_python/bpmn_diagram_import.py#L490-L505
def import_complex_gateway_to_graph(diagram_graph, process_id, process_attributes, element): """ Adds to graph the new element that represents BPMN complex gateway. In addition to attributes inherited from Gateway type, complex gateway has additional attribute default flow (default value...
[ "def", "import_complex_gateway_to_graph", "(", "diagram_graph", ",", "process_id", ",", "process_attributes", ",", "element", ")", ":", "element_id", "=", "element", ".", "getAttribute", "(", "consts", ".", "Consts", ".", "id", ")", "BpmnDiagramGraphImport", ".", ...
Adds to graph the new element that represents BPMN complex gateway. In addition to attributes inherited from Gateway type, complex gateway has additional attribute default flow (default value - none). :param diagram_graph: NetworkX graph representing a BPMN process diagram, :param proce...
[ "Adds", "to", "graph", "the", "new", "element", "that", "represents", "BPMN", "complex", "gateway", ".", "In", "addition", "to", "attributes", "inherited", "from", "Gateway", "type", "complex", "gateway", "has", "additional", "attribute", "default", "flow", "(",...
python
train
datamachine/twx
twx/twx.py
https://github.com/datamachine/twx/blob/d9633f12f3647b1e54ba87b70b39df3b7e02b4eb/twx/twx.py#L717-L725
def send_chat_action(self, peer: Peer, action: botapi.ChatAction, on_success: callable=None): """ Send status to peer. :param peer: Peer to send status to. :param action: Type of action to send to peer. :param on_success: Callback to call when call is complete. """ ...
[ "def", "send_chat_action", "(", "self", ",", "peer", ":", "Peer", ",", "action", ":", "botapi", ".", "ChatAction", ",", "on_success", ":", "callable", "=", "None", ")", ":", "botapi", ".", "send_chat_action", "(", "chat_id", "=", "peer", ".", "id", ",", ...
Send status to peer. :param peer: Peer to send status to. :param action: Type of action to send to peer. :param on_success: Callback to call when call is complete.
[ "Send", "status", "to", "peer", ".", ":", "param", "peer", ":", "Peer", "to", "send", "status", "to", ".", ":", "param", "action", ":", "Type", "of", "action", "to", "send", "to", "peer", ".", ":", "param", "on_success", ":", "Callback", "to", "call"...
python
train
Metatab/geoid
geoid/civick.py
https://github.com/Metatab/geoid/blob/4b7769406b00e59376fb6046b42a2f8ed706b33b/geoid/civick.py#L41-L46
def summarize(self): """Convert all of the values to their max values. This form is used to represent the summary level""" s = str(self.allval()) return self.parse(s[:2]+ ''.join(['Z']*len(s[2:])))
[ "def", "summarize", "(", "self", ")", ":", "s", "=", "str", "(", "self", ".", "allval", "(", ")", ")", "return", "self", ".", "parse", "(", "s", "[", ":", "2", "]", "+", "''", ".", "join", "(", "[", "'Z'", "]", "*", "len", "(", "s", "[", ...
Convert all of the values to their max values. This form is used to represent the summary level
[ "Convert", "all", "of", "the", "values", "to", "their", "max", "values", ".", "This", "form", "is", "used", "to", "represent", "the", "summary", "level" ]
python
train
tmux-python/libtmux
libtmux/session.py
https://github.com/tmux-python/libtmux/blob/8eb2f8bbea3a025c1567b1516653414dbc24e1fc/libtmux/session.py#L114-L120
def kill_session(self): """``$ tmux kill-session``.""" proc = self.cmd('kill-session', '-t%s' % self.id) if proc.stderr: raise exc.LibTmuxException(proc.stderr)
[ "def", "kill_session", "(", "self", ")", ":", "proc", "=", "self", ".", "cmd", "(", "'kill-session'", ",", "'-t%s'", "%", "self", ".", "id", ")", "if", "proc", ".", "stderr", ":", "raise", "exc", ".", "LibTmuxException", "(", "proc", ".", "stderr", "...
``$ tmux kill-session``.
[ "$", "tmux", "kill", "-", "session", "." ]
python
train
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L1028-L1038
def highlightByAlternate(self): """ Sets the palette highlighting for this tree widget to use a darker version of the alternate color vs. the standard highlighting. """ palette = QtGui.QApplication.palette() palette.setColor(palette.HighlightedText, palette.color(pa...
[ "def", "highlightByAlternate", "(", "self", ")", ":", "palette", "=", "QtGui", ".", "QApplication", ".", "palette", "(", ")", "palette", ".", "setColor", "(", "palette", ".", "HighlightedText", ",", "palette", ".", "color", "(", "palette", ".", "Text", ")"...
Sets the palette highlighting for this tree widget to use a darker version of the alternate color vs. the standard highlighting.
[ "Sets", "the", "palette", "highlighting", "for", "this", "tree", "widget", "to", "use", "a", "darker", "version", "of", "the", "alternate", "color", "vs", ".", "the", "standard", "highlighting", "." ]
python
train
mozilla/python_moztelemetry
moztelemetry/scalar.py
https://github.com/mozilla/python_moztelemetry/blob/09ddf1ec7d953a4308dfdcb0ed968f27bd5921bb/moztelemetry/scalar.py#L85-L106
def _parse_scalars(scalars): """Parse the scalars from the YAML file content to a dictionary of ScalarType(s). :return: A dictionary { 'full.scalar.label': ScalarType } """ scalar_dict = {} # Scalars are defined in a fixed two-level hierarchy within the definition file. ...
[ "def", "_parse_scalars", "(", "scalars", ")", ":", "scalar_dict", "=", "{", "}", "# Scalars are defined in a fixed two-level hierarchy within the definition file.", "# The first level contains the category name, while the second level contains the", "# probe name (e.g. \"category.name: probe...
Parse the scalars from the YAML file content to a dictionary of ScalarType(s). :return: A dictionary { 'full.scalar.label': ScalarType }
[ "Parse", "the", "scalars", "from", "the", "YAML", "file", "content", "to", "a", "dictionary", "of", "ScalarType", "(", "s", ")", ".", ":", "return", ":", "A", "dictionary", "{", "full", ".", "scalar", ".", "label", ":", "ScalarType", "}" ]
python
train
underworldcode/stripy
stripy-src/stripy/cartesian.py
https://github.com/underworldcode/stripy/blob/d4c3480c3e58c88489ded695eadbe7cd5bf94b48/stripy-src/stripy/cartesian.py#L871-L886
def areas(self): """ Compute the area of each triangle within the triangulation of points. Returns ------- area : array of floats, shape (nt,) area of each triangle in self.simplices where nt is the number of triangles. """ v1 = self.poi...
[ "def", "areas", "(", "self", ")", ":", "v1", "=", "self", ".", "points", "[", "self", ".", "simplices", "[", ":", ",", "1", "]", "]", "-", "self", ".", "points", "[", "self", ".", "simplices", "[", ":", ",", "0", "]", "]", "v2", "=", "self", ...
Compute the area of each triangle within the triangulation of points. Returns ------- area : array of floats, shape (nt,) area of each triangle in self.simplices where nt is the number of triangles.
[ "Compute", "the", "area", "of", "each", "triangle", "within", "the", "triangulation", "of", "points", "." ]
python
train
edeposit/edeposit.amqp.ftp
src/edeposit/amqp/ftp/passwd_reader.py
https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/src/edeposit/amqp/ftp/passwd_reader.py#L180-L187
def save_user_config(username, conf_dict, path=settings.LOGIN_FILE): """ Save user's configuration to otherwise unused field ``full_name`` in passwd file. """ users = load_users(path=path) users[username]["full_name"] = _encode_config(conf_dict) save_users(users, path=path)
[ "def", "save_user_config", "(", "username", ",", "conf_dict", ",", "path", "=", "settings", ".", "LOGIN_FILE", ")", ":", "users", "=", "load_users", "(", "path", "=", "path", ")", "users", "[", "username", "]", "[", "\"full_name\"", "]", "=", "_encode_conf...
Save user's configuration to otherwise unused field ``full_name`` in passwd file.
[ "Save", "user", "s", "configuration", "to", "otherwise", "unused", "field", "full_name", "in", "passwd", "file", "." ]
python
train
spacetelescope/drizzlepac
drizzlepac/imageObject.py
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imageObject.py#L604-L615
def getdarkimg(self,chip): """ Notes ===== Return an array representing the dark image for the detector. The method will return an array of the same shape as the image. :units: electrons """ sci_chip = self._image[self.scienceExt,chip] return np....
[ "def", "getdarkimg", "(", "self", ",", "chip", ")", ":", "sci_chip", "=", "self", ".", "_image", "[", "self", ".", "scienceExt", ",", "chip", "]", "return", "np", ".", "ones", "(", "sci_chip", ".", "image_shape", ",", "dtype", "=", "sci_chip", ".", "...
Notes ===== Return an array representing the dark image for the detector. The method will return an array of the same shape as the image. :units: electrons
[ "Notes", "=====", "Return", "an", "array", "representing", "the", "dark", "image", "for", "the", "detector", "." ]
python
train
bwohlberg/sporco
sporco/admm/parcbpdn.py
https://github.com/bwohlberg/sporco/blob/8946a04331106f4e39904fbdf2dc7351900baa04/sporco/admm/parcbpdn.py#L181-L188
def y0astep(): r"""The serial component of the step to minimise the augmented Lagrangian with respect to :math:`\mathbf{y}_0`. """ global mp_b mp_b[:] = mp_inv_off_diag * np.sum((mp_S + mp_rho*(mp_DX+mp_U0)), axis=mp_axisM, keepdims=True)
[ "def", "y0astep", "(", ")", ":", "global", "mp_b", "mp_b", "[", ":", "]", "=", "mp_inv_off_diag", "*", "np", ".", "sum", "(", "(", "mp_S", "+", "mp_rho", "*", "(", "mp_DX", "+", "mp_U0", ")", ")", ",", "axis", "=", "mp_axisM", ",", "keepdims", "=...
r"""The serial component of the step to minimise the augmented Lagrangian with respect to :math:`\mathbf{y}_0`.
[ "r", "The", "serial", "component", "of", "the", "step", "to", "minimise", "the", "augmented", "Lagrangian", "with", "respect", "to", ":", "math", ":", "\\", "mathbf", "{", "y", "}", "_0", "." ]
python
train
mikedh/trimesh
trimesh/exchange/dae.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/exchange/dae.py#L366-L400
def load_zae(file_obj, resolver=None, **kwargs): """ Load a ZAE file, which is just a zipped DAE file. Parameters ------------- file_obj : file object Contains ZAE data resolver : trimesh.visual.Resolver Resolver to load additional assets kwargs : dict Passed to load_colla...
[ "def", "load_zae", "(", "file_obj", ",", "resolver", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# a dict, {file name : file object}", "archive", "=", "util", ".", "decompress", "(", "file_obj", ",", "file_type", "=", "'zip'", ")", "# load the first file wi...
Load a ZAE file, which is just a zipped DAE file. Parameters ------------- file_obj : file object Contains ZAE data resolver : trimesh.visual.Resolver Resolver to load additional assets kwargs : dict Passed to load_collada Returns ------------ loaded : dict Resu...
[ "Load", "a", "ZAE", "file", "which", "is", "just", "a", "zipped", "DAE", "file", "." ]
python
train
tcalmant/ipopo
pelix/framework.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1371-L1381
def update(self): """ Stops and starts the framework, if the framework is active. :raise BundleException: Something wrong occurred while stopping or starting the framework. """ with self._lock: if self._state == Bundle.ACTIVE: ...
[ "def", "update", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "if", "self", ".", "_state", "==", "Bundle", ".", "ACTIVE", ":", "self", ".", "stop", "(", ")", "self", ".", "start", "(", ")" ]
Stops and starts the framework, if the framework is active. :raise BundleException: Something wrong occurred while stopping or starting the framework.
[ "Stops", "and", "starts", "the", "framework", "if", "the", "framework", "is", "active", "." ]
python
train
JasonKessler/scattertext
scattertext/TermDocMatrixWithoutCategories.py
https://github.com/JasonKessler/scattertext/blob/cacf1f687d218ee8cae3fc05cc901db824bb1b81/scattertext/TermDocMatrixWithoutCategories.py#L101-L120
def set_background_corpus(self, background): ''' Parameters ---------- background ''' if issubclass(type(background), TermDocMatrixWithoutCategories): self._background_corpus = pd.DataFrame(background .get_te...
[ "def", "set_background_corpus", "(", "self", ",", "background", ")", ":", "if", "issubclass", "(", "type", "(", "background", ")", ",", "TermDocMatrixWithoutCategories", ")", ":", "self", ".", "_background_corpus", "=", "pd", ".", "DataFrame", "(", "background",...
Parameters ---------- background
[ "Parameters", "----------", "background" ]
python
train
dmlc/gluon-nlp
scripts/bert/fp16_utils.py
https://github.com/dmlc/gluon-nlp/blob/4b83eb6bcc8881e5f1081a3675adaa19fac5c0ba/scripts/bert/fp16_utils.py#L26-L107
def grad_global_norm(parameters, max_norm): """Calculate the 2-norm of gradients of parameters, and how much they should be scaled down such that their 2-norm does not exceed `max_norm`. If gradients exist for more than one context for a parameter, user needs to explicitly call ``trainer.allreduce_grad...
[ "def", "grad_global_norm", "(", "parameters", ",", "max_norm", ")", ":", "# collect gradient arrays", "arrays", "=", "[", "]", "idx", "=", "0", "for", "p", "in", "parameters", ":", "if", "p", ".", "grad_req", "!=", "'null'", ":", "p_grads", "=", "p", "."...
Calculate the 2-norm of gradients of parameters, and how much they should be scaled down such that their 2-norm does not exceed `max_norm`. If gradients exist for more than one context for a parameter, user needs to explicitly call ``trainer.allreduce_grads`` so that the gradients are summed first before c...
[ "Calculate", "the", "2", "-", "norm", "of", "gradients", "of", "parameters", "and", "how", "much", "they", "should", "be", "scaled", "down", "such", "that", "their", "2", "-", "norm", "does", "not", "exceed", "max_norm", "." ]
python
train
hobson/aima
aima/games.py
https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/games.py#L10-L34
def minimax_decision(state, game): """Given a state in a game, calculate the best move by searching forward all the way to the terminal states. [Fig. 5.3]""" player = game.to_move(state) def max_value(state): if game.terminal_test(state): return game.utility(state, player) ...
[ "def", "minimax_decision", "(", "state", ",", "game", ")", ":", "player", "=", "game", ".", "to_move", "(", "state", ")", "def", "max_value", "(", "state", ")", ":", "if", "game", ".", "terminal_test", "(", "state", ")", ":", "return", "game", ".", "...
Given a state in a game, calculate the best move by searching forward all the way to the terminal states. [Fig. 5.3]
[ "Given", "a", "state", "in", "a", "game", "calculate", "the", "best", "move", "by", "searching", "forward", "all", "the", "way", "to", "the", "terminal", "states", ".", "[", "Fig", ".", "5", ".", "3", "]" ]
python
valid
sorgerlab/indra
indra/belief/wm_scorer.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/belief/wm_scorer.py#L38-L57
def get_eidos_scorer(): """Return a SimpleScorer based on Eidos curated precision estimates.""" table = load_eidos_curation_table() # Get the overall precision total_num = table['COUNT of RULE'].sum() weighted_sum = table['COUNT of RULE'].dot(table['% correct']) precision = weighted_sum / total...
[ "def", "get_eidos_scorer", "(", ")", ":", "table", "=", "load_eidos_curation_table", "(", ")", "# Get the overall precision", "total_num", "=", "table", "[", "'COUNT of RULE'", "]", ".", "sum", "(", ")", "weighted_sum", "=", "table", "[", "'COUNT of RULE'", "]", ...
Return a SimpleScorer based on Eidos curated precision estimates.
[ "Return", "a", "SimpleScorer", "based", "on", "Eidos", "curated", "precision", "estimates", "." ]
python
train
ehazlett/ignition
ignition/django.py
https://github.com/ehazlett/ignition/blob/618776fccd199c4613e105ee55955b40e52d3e68/ignition/django.py#L39-L59
def create_project(self): ''' Creates a base Django project ''' if os.path.exists(self._py): prj_dir = os.path.join(self._app_dir, self._project_name) if os.path.exists(prj_dir): if self._force: logging.warn('Removing existing p...
[ "def", "create_project", "(", "self", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "_py", ")", ":", "prj_dir", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_app_dir", ",", "self", ".", "_project_name", ")", "if", ...
Creates a base Django project
[ "Creates", "a", "base", "Django", "project" ]
python
valid
etal/biocma
biocma/cma.py
https://github.com/etal/biocma/blob/eac0c57eb83a9498e53ccdeb9cbc3fe21a5826a7/biocma/cma.py#L78-L141
def _parse_sequences(ilines, expect_qlen): """Parse the sequences in the current block. Sequence looks like: $3=227(209): >gi|15606894|ref|NP_214275.1| {|2(244)|<Aquificae(B)>}DNA polymerase III gamma subunit [Aquifex aeolicus VF5] >gi|2984127|gb|AAC07663.1| DNA polymerase III gamma subunit [Aquifex ...
[ "def", "_parse_sequences", "(", "ilines", ",", "expect_qlen", ")", ":", "while", "True", ":", "first", "=", "next", "(", "ilines", ")", "if", "first", ".", "startswith", "(", "'_'", ")", "and", "first", ".", "endswith", "(", "'].'", ")", ":", "# End of...
Parse the sequences in the current block. Sequence looks like: $3=227(209): >gi|15606894|ref|NP_214275.1| {|2(244)|<Aquificae(B)>}DNA polymerase III gamma subunit [Aquifex aeolicus VF5] >gi|2984127|gb|AAC07663.1| DNA polymerase III gamma subunit [Aquifex aeolicus VF5] >gi|75 {()YVPFARKYRPKFFREVIGQEAP...
[ "Parse", "the", "sequences", "in", "the", "current", "block", "." ]
python
train
data-8/datascience
datascience/tables.py
https://github.com/data-8/datascience/blob/4cee38266903ca169cea4a53b8cc39502d85c464/datascience/tables.py#L89-L92
def from_rows(cls, rows, labels): """Create a table from a sequence of rows (fixed-length sequences). [Deprecated]""" warnings.warn("Table.from_rows is deprecated. Use Table(labels).with_rows(...)", FutureWarning) return cls(labels).with_rows(rows)
[ "def", "from_rows", "(", "cls", ",", "rows", ",", "labels", ")", ":", "warnings", ".", "warn", "(", "\"Table.from_rows is deprecated. Use Table(labels).with_rows(...)\"", ",", "FutureWarning", ")", "return", "cls", "(", "labels", ")", ".", "with_rows", "(", "rows"...
Create a table from a sequence of rows (fixed-length sequences). [Deprecated]
[ "Create", "a", "table", "from", "a", "sequence", "of", "rows", "(", "fixed", "-", "length", "sequences", ")", ".", "[", "Deprecated", "]" ]
python
train
mongodb/mongo-python-driver
bson/__init__.py
https://github.com/mongodb/mongo-python-driver/blob/c29c21449e3aae74154207058cf85fd94018d4cd/bson/__init__.py#L969-L1003
def _decode_all_selective(data, codec_options, fields): """Decode BSON data to a single document while using user-provided custom decoding logic. `data` must be a string representing a valid, BSON-encoded document. :Parameters: - `data`: BSON data - `codec_options`: An instance of ...
[ "def", "_decode_all_selective", "(", "data", ",", "codec_options", ",", "fields", ")", ":", "if", "not", "codec_options", ".", "type_registry", ".", "_decoder_map", ":", "return", "decode_all", "(", "data", ",", "codec_options", ")", "if", "not", "fields", ":"...
Decode BSON data to a single document while using user-provided custom decoding logic. `data` must be a string representing a valid, BSON-encoded document. :Parameters: - `data`: BSON data - `codec_options`: An instance of :class:`~bson.codec_options.CodecOptions` with user-specified t...
[ "Decode", "BSON", "data", "to", "a", "single", "document", "while", "using", "user", "-", "provided", "custom", "decoding", "logic", "." ]
python
train
juju/python-libjuju
juju/client/_client1.py
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/client/_client1.py#L5086-L5099
async def ReportKeys(self, entity_keys): ''' entity_keys : typing.Sequence[~SSHHostKeys] Returns -> typing.Sequence[~ErrorResult] ''' # map input types to rpc msg _params = dict() msg = dict(type='HostKeyReporter', request='ReportKeys', ...
[ "async", "def", "ReportKeys", "(", "self", ",", "entity_keys", ")", ":", "# map input types to rpc msg", "_params", "=", "dict", "(", ")", "msg", "=", "dict", "(", "type", "=", "'HostKeyReporter'", ",", "request", "=", "'ReportKeys'", ",", "version", "=", "1...
entity_keys : typing.Sequence[~SSHHostKeys] Returns -> typing.Sequence[~ErrorResult]
[ "entity_keys", ":", "typing", ".", "Sequence", "[", "~SSHHostKeys", "]", "Returns", "-", ">", "typing", ".", "Sequence", "[", "~ErrorResult", "]" ]
python
train
jciskey/pygraph
pygraph/classes/directed_graph.py
https://github.com/jciskey/pygraph/blob/037bb2f32503fecb60d62921f9766d54109f15e2/pygraph/classes/directed_graph.py#L217-L223
def move_edge_target(self, edge_id, node_a): """Moves an edge so that it targets node_a.""" # Grab the edge edge = self.get_edge(edge_id) # Alter the vertices edge['vertices'] = (edge['vertices'][0], node_a)
[ "def", "move_edge_target", "(", "self", ",", "edge_id", ",", "node_a", ")", ":", "# Grab the edge", "edge", "=", "self", ".", "get_edge", "(", "edge_id", ")", "# Alter the vertices", "edge", "[", "'vertices'", "]", "=", "(", "edge", "[", "'vertices'", "]", ...
Moves an edge so that it targets node_a.
[ "Moves", "an", "edge", "so", "that", "it", "targets", "node_a", "." ]
python
train
stevepeak/debris
debris/tornado/__init__.py
https://github.com/stevepeak/debris/blob/62ffde573a880c022bd4876ec836b32953225eea/debris/tornado/__init__.py#L18-L47
def cached(namespace=None, service="memory", debug=False): """ Wrapper for tornado requests. Example ``` class MainHandler(tornado.web.RequestHandler): @debris.tornado.cached("home-page") def get(self): self.write("Hello, world") ``` """ _service = getattr(debr...
[ "def", "cached", "(", "namespace", "=", "None", ",", "service", "=", "\"memory\"", ",", "debug", "=", "False", ")", ":", "_service", "=", "getattr", "(", "debris", ".", "services", ",", "service", ")", "def", "wrapper", "(", "_f", ")", ":", "@", "fun...
Wrapper for tornado requests. Example ``` class MainHandler(tornado.web.RequestHandler): @debris.tornado.cached("home-page") def get(self): self.write("Hello, world") ```
[ "Wrapper", "for", "tornado", "requests", ".", "Example" ]
python
train
pygobject/pgi
pgi/overrides/GLib.py
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/GLib.py#L342-L394
def unpack(self): """Decompose a GVariant into a native Python object.""" LEAF_ACCESSORS = { 'b': self.get_boolean, 'y': self.get_byte, 'n': self.get_int16, 'q': self.get_uint16, 'i': self.get_int32, 'u': self.get_uint32, ...
[ "def", "unpack", "(", "self", ")", ":", "LEAF_ACCESSORS", "=", "{", "'b'", ":", "self", ".", "get_boolean", ",", "'y'", ":", "self", ".", "get_byte", ",", "'n'", ":", "self", ".", "get_int16", ",", "'q'", ":", "self", ".", "get_uint16", ",", "'i'", ...
Decompose a GVariant into a native Python object.
[ "Decompose", "a", "GVariant", "into", "a", "native", "Python", "object", "." ]
python
train
volafiled/python-volapi
volapi/file.py
https://github.com/volafiled/python-volapi/blob/5f0bc03dbde703264ac6ed494e2050761f688a3e/volapi/file.py#L156-L159
def timeout(self, duration=3600): """ Timeout the uploader of this file """ self.room.check_owner() self.conn.make_call("timeoutFile", self.fid, duration)
[ "def", "timeout", "(", "self", ",", "duration", "=", "3600", ")", ":", "self", ".", "room", ".", "check_owner", "(", ")", "self", ".", "conn", ".", "make_call", "(", "\"timeoutFile\"", ",", "self", ".", "fid", ",", "duration", ")" ]
Timeout the uploader of this file
[ "Timeout", "the", "uploader", "of", "this", "file" ]
python
train
ray-project/ray
python/ray/function_manager.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/function_manager.py#L560-L574
def _publish_actor_class_to_key(self, key, actor_class_info): """Push an actor class definition to Redis. The is factored out as a separate function because it is also called on cached actor class definitions when a worker connects for the first time. Args: key: The...
[ "def", "_publish_actor_class_to_key", "(", "self", ",", "key", ",", "actor_class_info", ")", ":", "# We set the driver ID here because it may not have been available when", "# the actor class was defined.", "self", ".", "_worker", ".", "redis_client", ".", "hmset", "(", "key"...
Push an actor class definition to Redis. The is factored out as a separate function because it is also called on cached actor class definitions when a worker connects for the first time. Args: key: The key to store the actor class info at. actor_class_info: Info...
[ "Push", "an", "actor", "class", "definition", "to", "Redis", "." ]
python
train
prompt-toolkit/pyvim
pyvim/commands/preview.py
https://github.com/prompt-toolkit/pyvim/blob/5928b53b9d700863c1a06d2181a034a955f94594/pyvim/commands/preview.py#L16-L29
def save(self): """ Back up current editor state. """ e = self.editor self._style = e.current_style self._show_line_numbers = e.show_line_numbers self._highlight_search = e.highlight_search self._show_ruler = e.show_ruler self._relative_number = e...
[ "def", "save", "(", "self", ")", ":", "e", "=", "self", ".", "editor", "self", ".", "_style", "=", "e", ".", "current_style", "self", ".", "_show_line_numbers", "=", "e", ".", "show_line_numbers", "self", ".", "_highlight_search", "=", "e", ".", "highlig...
Back up current editor state.
[ "Back", "up", "current", "editor", "state", "." ]
python
train
synw/dataswim
dataswim/data/transform/calculations.py
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/transform/calculations.py#L41-L72
def diffp(self, diffcol: str, name: str="Diff"): """ Add a diff column to the main dataframe: calculate the diff from the previous value :param diffcol: column to diff from :type diffcol: str :param name: diff column name, defaults to "Diff" :type name: str, opti...
[ "def", "diffp", "(", "self", ",", "diffcol", ":", "str", ",", "name", ":", "str", "=", "\"Diff\"", ")", ":", "try", ":", "df", "=", "self", ".", "df", ".", "copy", "(", ")", "previous", "=", "0", "i", "=", "0", "vals", "=", "[", "df", "[", ...
Add a diff column to the main dataframe: calculate the diff from the previous value :param diffcol: column to diff from :type diffcol: str :param name: diff column name, defaults to "Diff" :type name: str, optional :example: ``ds.diffp("Col 1", "New col")``
[ "Add", "a", "diff", "column", "to", "the", "main", "dataframe", ":", "calculate", "the", "diff", "from", "the", "previous", "value" ]
python
train
cakebread/yolk
yolk/yolklib.py
https://github.com/cakebread/yolk/blob/ee8c9f529a542d9c5eff4fe69b9c7906c802e4d8/yolk/yolklib.py#L154-L172
def get_highest_version(versions): """ Returns highest available version for a package in a list of versions Uses pkg_resources to parse the versions @param versions: List of PyPI package versions @type versions: List of strings @returns: string of a PyPI package version """ sorted_v...
[ "def", "get_highest_version", "(", "versions", ")", ":", "sorted_versions", "=", "[", "]", "for", "ver", "in", "versions", ":", "sorted_versions", ".", "append", "(", "(", "pkg_resources", ".", "parse_version", "(", "ver", ")", ",", "ver", ")", ")", "sorte...
Returns highest available version for a package in a list of versions Uses pkg_resources to parse the versions @param versions: List of PyPI package versions @type versions: List of strings @returns: string of a PyPI package version
[ "Returns", "highest", "available", "version", "for", "a", "package", "in", "a", "list", "of", "versions", "Uses", "pkg_resources", "to", "parse", "the", "versions" ]
python
train
splunk/splunk-sdk-python
splunklib/modularinput/scheme.py
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/splunklib/modularinput/scheme.py#L55-L85
def to_xml(self): """Creates an ``ET.Element`` representing self, then returns it. :returns root, an ``ET.Element`` representing this scheme. """ root = ET.Element("scheme") ET.SubElement(root, "title").text = self.title # add a description subelement if it's defined ...
[ "def", "to_xml", "(", "self", ")", ":", "root", "=", "ET", ".", "Element", "(", "\"scheme\"", ")", "ET", ".", "SubElement", "(", "root", ",", "\"title\"", ")", ".", "text", "=", "self", ".", "title", "# add a description subelement if it's defined", "if", ...
Creates an ``ET.Element`` representing self, then returns it. :returns root, an ``ET.Element`` representing this scheme.
[ "Creates", "an", "ET", ".", "Element", "representing", "self", "then", "returns", "it", "." ]
python
train
benhoff/pluginmanager
pluginmanager/file_manager.py
https://github.com/benhoff/pluginmanager/blob/a8a184f9ebfbb521703492cb88c1dbda4cd04c06/pluginmanager/file_manager.py#L53-L73
def collect_filepaths(self, directories): """ Collects and returns every filepath from each directory in `directories` that is filtered through the `file_filters`. If no `file_filters` are present, passes every file in directory as a result. Always returns a `set` object ...
[ "def", "collect_filepaths", "(", "self", ",", "directories", ")", ":", "plugin_filepaths", "=", "set", "(", ")", "directories", "=", "util", ".", "to_absolute_paths", "(", "directories", ")", "for", "directory", "in", "directories", ":", "filepaths", "=", "uti...
Collects and returns every filepath from each directory in `directories` that is filtered through the `file_filters`. If no `file_filters` are present, passes every file in directory as a result. Always returns a `set` object `directories` can be a object or an iterable. Recomme...
[ "Collects", "and", "returns", "every", "filepath", "from", "each", "directory", "in", "directories", "that", "is", "filtered", "through", "the", "file_filters", ".", "If", "no", "file_filters", "are", "present", "passes", "every", "file", "in", "directory", "as"...
python
train
sdonk/django-admin-ip-restrictor
admin_ip_restrictor/middleware.py
https://github.com/sdonk/django-admin-ip-restrictor/blob/29c948677e52bc416d44fff0f013d1f4ba2cb782/admin_ip_restrictor/middleware.py#L60-L71
def is_blocked(self, ip): """Determine if an IP address should be considered blocked.""" blocked = True if ip in self.allowed_admin_ips: blocked = False for allowed_range in self.allowed_admin_ip_ranges: if ipaddress.ip_address(ip) in ipaddress.ip_network(allowe...
[ "def", "is_blocked", "(", "self", ",", "ip", ")", ":", "blocked", "=", "True", "if", "ip", "in", "self", ".", "allowed_admin_ips", ":", "blocked", "=", "False", "for", "allowed_range", "in", "self", ".", "allowed_admin_ip_ranges", ":", "if", "ipaddress", "...
Determine if an IP address should be considered blocked.
[ "Determine", "if", "an", "IP", "address", "should", "be", "considered", "blocked", "." ]
python
train
awslabs/mxboard
python/mxboard/writer.py
https://github.com/awslabs/mxboard/blob/36057ff0f05325c9dc2fe046521325bf9d563a88/python/mxboard/writer.py#L482-L546
def add_embedding(self, tag, embedding, labels=None, images=None, global_step=None): """Adds embedding projector data to the event file. It will also create a config file used by the embedding projector in TensorBoard. The folder containing the embedding data is named using the formula: ...
[ "def", "add_embedding", "(", "self", ",", "tag", ",", "embedding", ",", "labels", "=", "None", ",", "images", "=", "None", ",", "global_step", "=", "None", ")", ":", "embedding_shape", "=", "embedding", ".", "shape", "if", "len", "(", "embedding_shape", ...
Adds embedding projector data to the event file. It will also create a config file used by the embedding projector in TensorBoard. The folder containing the embedding data is named using the formula: If global_step is not None, the folder name is `tag + '_' + str(global_step).zfill(6)`; ...
[ "Adds", "embedding", "projector", "data", "to", "the", "event", "file", ".", "It", "will", "also", "create", "a", "config", "file", "used", "by", "the", "embedding", "projector", "in", "TensorBoard", ".", "The", "folder", "containing", "the", "embedding", "d...
python
train
opinkerfi/nago
nago/extensions/plugins.py
https://github.com/opinkerfi/nago/blob/85e1bdd1de0122f56868a483e7599e1b36a439b0/nago/extensions/plugins.py#L13-L19
def get(search="unsigned"): """ List all available plugins""" plugins = [] for i in os.walk('/usr/lib/nagios/plugins'): for f in i[2]: plugins.append(f) return plugins
[ "def", "get", "(", "search", "=", "\"unsigned\"", ")", ":", "plugins", "=", "[", "]", "for", "i", "in", "os", ".", "walk", "(", "'/usr/lib/nagios/plugins'", ")", ":", "for", "f", "in", "i", "[", "2", "]", ":", "plugins", ".", "append", "(", "f", ...
List all available plugins
[ "List", "all", "available", "plugins" ]
python
train
ronaldguillen/wave
wave/reverse.py
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/reverse.py#L15-L32
def preserve_builtin_query_params(url, request=None): """ Given an incoming request, and an outgoing URL representation, append the value of any built-in query parameters. """ if request is None: return url overrides = [ api_settings.URL_FORMAT_OVERRIDE, ] for param in ...
[ "def", "preserve_builtin_query_params", "(", "url", ",", "request", "=", "None", ")", ":", "if", "request", "is", "None", ":", "return", "url", "overrides", "=", "[", "api_settings", ".", "URL_FORMAT_OVERRIDE", ",", "]", "for", "param", "in", "overrides", ":...
Given an incoming request, and an outgoing URL representation, append the value of any built-in query parameters.
[ "Given", "an", "incoming", "request", "and", "an", "outgoing", "URL", "representation", "append", "the", "value", "of", "any", "built", "-", "in", "query", "parameters", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/models/research/lm_experiments.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/lm_experiments.py#L45-L60
def lmx_base(): """Transformer on languagemodel_lm1b32k_packed. 50M Params.""" hparams = transformer.transformer_tpu() # sharing is counterproductive when underparameterized hparams.shared_embedding_and_softmax_weights = False # we judge by log-ppl, so label smoothing hurts. hparams.label_smoothing = 0.0 ...
[ "def", "lmx_base", "(", ")", ":", "hparams", "=", "transformer", ".", "transformer_tpu", "(", ")", "# sharing is counterproductive when underparameterized", "hparams", ".", "shared_embedding_and_softmax_weights", "=", "False", "# we judge by log-ppl, so label smoothing hurts.", ...
Transformer on languagemodel_lm1b32k_packed. 50M Params.
[ "Transformer", "on", "languagemodel_lm1b32k_packed", ".", "50M", "Params", "." ]
python
train
cloudify-cosmo/repex
repex.py
https://github.com/cloudify-cosmo/repex/blob/589e442857fa4a99fa88670d7df1a72f983bbd28/repex.py#L72-L83
def _import_yaml(config_file_path): """Return a configuration object """ try: logger.info('Importing config %s...', config_file_path) with open(config_file_path) as config_file: return yaml.safe_load(config_file.read()) except IOError as ex: raise RepexError('{0}: {1}...
[ "def", "_import_yaml", "(", "config_file_path", ")", ":", "try", ":", "logger", ".", "info", "(", "'Importing config %s...'", ",", "config_file_path", ")", "with", "open", "(", "config_file_path", ")", "as", "config_file", ":", "return", "yaml", ".", "safe_load"...
Return a configuration object
[ "Return", "a", "configuration", "object" ]
python
train
materialsproject/pymatgen
pymatgen/util/provenance.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/util/provenance.py#L300-L340
def from_structures(cls, structures, authors, projects=None, references='', remarks=None, data=None, histories=None, created_at=None): """ A convenience method for getting a list of StructureNL objects by specifying structures and metadata separate...
[ "def", "from_structures", "(", "cls", ",", "structures", ",", "authors", ",", "projects", "=", "None", ",", "references", "=", "''", ",", "remarks", "=", "None", ",", "data", "=", "None", ",", "histories", "=", "None", ",", "created_at", "=", "None", "...
A convenience method for getting a list of StructureNL objects by specifying structures and metadata separately. Some of the metadata is applied to all of the structures for ease of use. Args: structures: A list of Structure objects authors: *List* of {"name":'', "email"...
[ "A", "convenience", "method", "for", "getting", "a", "list", "of", "StructureNL", "objects", "by", "specifying", "structures", "and", "metadata", "separately", ".", "Some", "of", "the", "metadata", "is", "applied", "to", "all", "of", "the", "structures", "for"...
python
train
osrg/ryu
ryu/base/app_manager.py
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/base/app_manager.py#L305-L318
def send_event(self, name, ev, state=None): """ Send the specified event to the RyuApp instance specified by name. """ if name in SERVICE_BRICKS: if isinstance(ev, EventRequestBase): ev.src = self.name LOG.debug("EVENT %s->%s %s", ...
[ "def", "send_event", "(", "self", ",", "name", ",", "ev", ",", "state", "=", "None", ")", ":", "if", "name", "in", "SERVICE_BRICKS", ":", "if", "isinstance", "(", "ev", ",", "EventRequestBase", ")", ":", "ev", ".", "src", "=", "self", ".", "name", ...
Send the specified event to the RyuApp instance specified by name.
[ "Send", "the", "specified", "event", "to", "the", "RyuApp", "instance", "specified", "by", "name", "." ]
python
train
django-leonardo/django-leonardo
leonardo/utils/compress_patch.py
https://github.com/django-leonardo/django-leonardo/blob/4b933e1792221a13b4028753d5f1d3499b0816d4/leonardo/utils/compress_patch.py#L37-L62
def compress_monkey_patch(): """patch all compress we need access to variables from widget scss for example we have:: /themes/bootswatch/cyborg/_variables but only if is cyborg active for this reasone we need dynamically append import to every scss file """ from compressor.templ...
[ "def", "compress_monkey_patch", "(", ")", ":", "from", "compressor", ".", "templatetags", "import", "compress", "as", "compress_tags", "from", "compressor", "import", "base", "as", "compress_base", "compress_base", ".", "Compressor", ".", "filter_input", "=", "filte...
patch all compress we need access to variables from widget scss for example we have:: /themes/bootswatch/cyborg/_variables but only if is cyborg active for this reasone we need dynamically append import to every scss file
[ "patch", "all", "compress" ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/psutil/__init__.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/__init__.py#L546-L554
def get_memory_percent(self): """Compare physical system memory to process resident memory and calculate process memory utilization as a percentage. """ rss = self._platform_impl.get_memory_info()[0] try: return (rss / float(TOTAL_PHYMEM)) * 100 except ZeroDiv...
[ "def", "get_memory_percent", "(", "self", ")", ":", "rss", "=", "self", ".", "_platform_impl", ".", "get_memory_info", "(", ")", "[", "0", "]", "try", ":", "return", "(", "rss", "/", "float", "(", "TOTAL_PHYMEM", ")", ")", "*", "100", "except", "ZeroDi...
Compare physical system memory to process resident memory and calculate process memory utilization as a percentage.
[ "Compare", "physical", "system", "memory", "to", "process", "resident", "memory", "and", "calculate", "process", "memory", "utilization", "as", "a", "percentage", "." ]
python
test
PyHDI/Pyverilog
pyverilog/vparser/parser.py
https://github.com/PyHDI/Pyverilog/blob/b852cc5ed6a7a2712e33639f9d9782d0d1587a53/pyverilog/vparser/parser.py#L1332-L1335
def p_levelsig(self, p): 'levelsig : levelsig_base' p[0] = Sens(p[1], 'level', lineno=p.lineno(1)) p.set_lineno(0, p.lineno(1))
[ "def", "p_levelsig", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "Sens", "(", "p", "[", "1", "]", ",", "'level'", ",", "lineno", "=", "p", ".", "lineno", "(", "1", ")", ")", "p", ".", "set_lineno", "(", "0", ",", "p", ".", "...
levelsig : levelsig_base
[ "levelsig", ":", "levelsig_base" ]
python
train
postmanlabs/httpbin
httpbin/core.py
https://github.com/postmanlabs/httpbin/blob/f8ec666b4d1b654e4ff6aedd356f510dcac09f83/httpbin/core.py#L573-L644
def redirect_to(): """302/3XX Redirects to the given URL. --- tags: - Redirects produces: - text/html get: parameters: - in: query name: url type: string required: true - in: query name: status_code type: int pos...
[ "def", "redirect_to", "(", ")", ":", "args_dict", "=", "request", ".", "args", ".", "items", "(", ")", "args", "=", "CaseInsensitiveDict", "(", "args_dict", ")", "# We need to build the response manually and convert to UTF-8 to prevent", "# werkzeug from \"fixing\" the URL....
302/3XX Redirects to the given URL. --- tags: - Redirects produces: - text/html get: parameters: - in: query name: url type: string required: true - in: query name: status_code type: int post: consumes: ...
[ "302", "/", "3XX", "Redirects", "to", "the", "given", "URL", ".", "---", "tags", ":", "-", "Redirects", "produces", ":", "-", "text", "/", "html", "get", ":", "parameters", ":", "-", "in", ":", "query", "name", ":", "url", "type", ":", "string", "r...
python
train
wmayner/pyphi
pyphi/subsystem.py
https://github.com/wmayner/pyphi/blob/deeca69a084d782a6fde7bf26f59e93b593c5d77/pyphi/subsystem.py#L702-L707
def mie(self, mechanism, purviews=False): """Return the mechanism's maximally-irreducible effect (|MIE|). Alias for |find_mice()| with ``direction`` set to |EFFECT|. """ return self.find_mice(Direction.EFFECT, mechanism, purviews=purviews)
[ "def", "mie", "(", "self", ",", "mechanism", ",", "purviews", "=", "False", ")", ":", "return", "self", ".", "find_mice", "(", "Direction", ".", "EFFECT", ",", "mechanism", ",", "purviews", "=", "purviews", ")" ]
Return the mechanism's maximally-irreducible effect (|MIE|). Alias for |find_mice()| with ``direction`` set to |EFFECT|.
[ "Return", "the", "mechanism", "s", "maximally", "-", "irreducible", "effect", "(", "|MIE|", ")", "." ]
python
train
SCIP-Interfaces/PySCIPOpt
examples/unfinished/scheduling.py
https://github.com/SCIP-Interfaces/PySCIPOpt/blob/9c960b40d94a48b0304d73dbe28b467b9c065abe/examples/unfinished/scheduling.py#L57-L90
def scheduling_time_index(J,p,r,w): """ scheduling_time_index: model for the one machine total weighted tardiness problem Model for the one machine total weighted tardiness problem using the time index formulation Parameters: - J: set of jobs - p[j]: processing time of job j ...
[ "def", "scheduling_time_index", "(", "J", ",", "p", ",", "r", ",", "w", ")", ":", "model", "=", "Model", "(", "\"scheduling: time index\"", ")", "T", "=", "max", "(", "r", ".", "values", "(", ")", ")", "+", "sum", "(", "p", ".", "values", "(", ")...
scheduling_time_index: model for the one machine total weighted tardiness problem Model for the one machine total weighted tardiness problem using the time index formulation Parameters: - J: set of jobs - p[j]: processing time of job j - r[j]: earliest start time of job j -...
[ "scheduling_time_index", ":", "model", "for", "the", "one", "machine", "total", "weighted", "tardiness", "problem" ]
python
train
ensime/ensime-vim
ensime_shared/client.py
https://github.com/ensime/ensime-vim/blob/caa734e84f002b25446c615706283a74edd4ecfe/ensime_shared/client.py#L324-L330
def send_at_point(self, what, row, col): """Ask the server to perform an operation at a given point.""" pos = self.get_position(row, col) self.send_request( {"typehint": what + "AtPointReq", "file": self._file_info(), "point": pos})
[ "def", "send_at_point", "(", "self", ",", "what", ",", "row", ",", "col", ")", ":", "pos", "=", "self", ".", "get_position", "(", "row", ",", "col", ")", "self", ".", "send_request", "(", "{", "\"typehint\"", ":", "what", "+", "\"AtPointReq\"", ",", ...
Ask the server to perform an operation at a given point.
[ "Ask", "the", "server", "to", "perform", "an", "operation", "at", "a", "given", "point", "." ]
python
train
mcs07/ChemDataExtractor
chemdataextractor/cli/__init__.py
https://github.com/mcs07/ChemDataExtractor/blob/349a3bea965f2073141d62043b89319222e46af1/chemdataextractor/cli/__init__.py#L46-L53
def extract(ctx, input, output): """Run ChemDataExtractor on a document.""" log.info('chemdataextractor.extract') log.info('Reading %s' % input.name) doc = Document.from_file(input, fname=input.name) records = [record.serialize(primitive=True) for record in doc.records] jsonstring = json.dumps(r...
[ "def", "extract", "(", "ctx", ",", "input", ",", "output", ")", ":", "log", ".", "info", "(", "'chemdataextractor.extract'", ")", "log", ".", "info", "(", "'Reading %s'", "%", "input", ".", "name", ")", "doc", "=", "Document", ".", "from_file", "(", "i...
Run ChemDataExtractor on a document.
[ "Run", "ChemDataExtractor", "on", "a", "document", "." ]
python
train
L3viathan/sql-mojo-parser
sql_mojo_parser/__init__.py
https://github.com/L3viathan/sql-mojo-parser/blob/fc460c42f3fbcc21c6fc08c0aede8e2a5db637f3/sql_mojo_parser/__init__.py#L33-L36
def t_STRING(t): r"'([^'\\]+|\\'|\\\\)*'" t.value = t.value.replace(r'\\', chr(92)).replace(r"\'", r"'")[1:-1] return t
[ "def", "t_STRING", "(", "t", ")", ":", "t", ".", "value", "=", "t", ".", "value", ".", "replace", "(", "r'\\\\'", ",", "chr", "(", "92", ")", ")", ".", "replace", "(", "r\"\\'\"", ",", "r\"'\"", ")", "[", "1", ":", "-", "1", "]", "return", "t...
r"'([^'\\]+|\\'|\\\\)*
[ "r", "(", "[", "^", "\\\\", "]", "+", "|", "\\\\", "|", "\\\\\\\\", ")", "*" ]
python
test
adamcharnock/python-hue-client
hueclient/models/light.py
https://github.com/adamcharnock/python-hue-client/blob/b934d8eab29ad301ff4e43462e37f0f2d4e682e5/hueclient/models/light.py#L65-L71
def set_rgb(self, red, green, blue): """The red/green/blue color value of the light This will be converted and set as the :attr:`xy` value """ x, y = rgb_to_xy(red, green, blue) self.xy = [x, y]
[ "def", "set_rgb", "(", "self", ",", "red", ",", "green", ",", "blue", ")", ":", "x", ",", "y", "=", "rgb_to_xy", "(", "red", ",", "green", ",", "blue", ")", "self", ".", "xy", "=", "[", "x", ",", "y", "]" ]
The red/green/blue color value of the light This will be converted and set as the :attr:`xy` value
[ "The", "red", "/", "green", "/", "blue", "color", "value", "of", "the", "light" ]
python
train
rackerlabs/timid
timid/steps.py
https://github.com/rackerlabs/timid/blob/b1c6aa159ab380a033740f4aa392cf0d125e0ac6/timid/steps.py#L353-L409
def parse_file(cls, ctxt, fname, key=None, step_addr=None): """ Parse a YAML file containing test steps. :param ctxt: The context object. :param fname: The name of the file to parse. :param key: An optional dictionary key. If specified, the file must be a YA...
[ "def", "parse_file", "(", "cls", ",", "ctxt", ",", "fname", ",", "key", "=", "None", ",", "step_addr", "=", "None", ")", ":", "# Load the YAML file", "try", ":", "with", "open", "(", "fname", ")", "as", "f", ":", "step_data", "=", "yaml", ".", "load"...
Parse a YAML file containing test steps. :param ctxt: The context object. :param fname: The name of the file to parse. :param key: An optional dictionary key. If specified, the file must be a YAML dictionary, and the referenced value will be interpreted ...
[ "Parse", "a", "YAML", "file", "containing", "test", "steps", "." ]
python
test
mfcloud/python-zvm-sdk
smtLayer/powerVM.py
https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/powerVM.py#L487-L512
def pause(rh): """ Pause a virtual machine. Input: Request Handle with the following properties: function - 'POWERVM' subfunction - 'PAUSE' userid - userid of the virtual machine Output: Request Handle updated with the results. Return code - 0...
[ "def", "pause", "(", "rh", ")", ":", "rh", ".", "printSysLog", "(", "\"Enter powerVM.pause, userid: \"", "+", "rh", ".", "userid", ")", "parms", "=", "[", "\"-T\"", ",", "rh", ".", "userid", ",", "\"-k\"", ",", "\"PAUSE=YES\"", "]", "results", "=", "invo...
Pause a virtual machine. Input: Request Handle with the following properties: function - 'POWERVM' subfunction - 'PAUSE' userid - userid of the virtual machine Output: Request Handle updated with the results. Return code - 0: ok, non-zero: error
[ "Pause", "a", "virtual", "machine", "." ]
python
train
Pringley/spyglass
spyglass/scraper.py
https://github.com/Pringley/spyglass/blob/091d74f34837673af936daa9f462ad8216be9916/spyglass/scraper.py#L15-L37
def top(self, n=10, cache=None, prefetch=False): """Find the most popular torrents. Return an array of Torrent objects representing the top n torrents. If the cache option is non-None, override the Scraper's default caching settings. Use the prefetch option to hit each Torrent'...
[ "def", "top", "(", "self", ",", "n", "=", "10", ",", "cache", "=", "None", ",", "prefetch", "=", "False", ")", ":", "use_cache", "=", "self", ".", "_use_cache", "(", "cache", ")", "if", "use_cache", "and", "len", "(", "self", ".", "_top_cache", ")"...
Find the most popular torrents. Return an array of Torrent objects representing the top n torrents. If the cache option is non-None, override the Scraper's default caching settings. Use the prefetch option to hit each Torrent's info page up front (instead of lazy fetching the i...
[ "Find", "the", "most", "popular", "torrents", "." ]
python
train
InfoAgeTech/django-core
django_core/db/models/managers.py
https://github.com/InfoAgeTech/django-core/blob/9664a145473b75120bf71e1644e9c8086e7e8955/django_core/db/models/managers.py#L145-L165
def get_next_slug(self, slug, **kwargs): """Gets the next available slug. :param slug: the slug to slugify :param kwargs: additional filter criteria to check for when looking for a unique slug. Example: if the value "my-slug" is already taken, this method will appe...
[ "def", "get_next_slug", "(", "self", ",", "slug", ",", "*", "*", "kwargs", ")", ":", "original_slug", "=", "slug", "=", "slugify", "(", "slug", ")", "count", "=", "0", "while", "not", "self", ".", "is_slug_available", "(", "slug", "=", "slug", ",", "...
Gets the next available slug. :param slug: the slug to slugify :param kwargs: additional filter criteria to check for when looking for a unique slug. Example: if the value "my-slug" is already taken, this method will append "-n" to the end of the slug until the nex...
[ "Gets", "the", "next", "available", "slug", "." ]
python
train
intel-analytics/BigDL
pyspark/bigdl/optim/optimizer.py
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/optim/optimizer.py#L453-L460
def save(self, path, overWrite): """ save OptimMethod :param path path :param overWrite whether to overwrite """ method=self.value return callBigDlFunc(self.bigdl_type, "saveOptimMethod", method, path, overWrite)
[ "def", "save", "(", "self", ",", "path", ",", "overWrite", ")", ":", "method", "=", "self", ".", "value", "return", "callBigDlFunc", "(", "self", ".", "bigdl_type", ",", "\"saveOptimMethod\"", ",", "method", ",", "path", ",", "overWrite", ")" ]
save OptimMethod :param path path :param overWrite whether to overwrite
[ "save", "OptimMethod", ":", "param", "path", "path", ":", "param", "overWrite", "whether", "to", "overwrite" ]
python
test
materialsproject/pymatgen
pymatgen/core/structure.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L2055-L2098
def break_bond(self, ind1, ind2, tol=0.2): """ Returns two molecules based on breaking the bond between atoms at index ind1 and ind2. Args: ind1 (int): Index of first site. ind2 (int): Index of second site. tol (float): Relative tolerance to test. Bas...
[ "def", "break_bond", "(", "self", ",", "ind1", ",", "ind2", ",", "tol", "=", "0.2", ")", ":", "sites", "=", "self", ".", "_sites", "clusters", "=", "[", "[", "sites", "[", "ind1", "]", "]", ",", "[", "sites", "[", "ind2", "]", "]", "]", "sites"...
Returns two molecules based on breaking the bond between atoms at index ind1 and ind2. Args: ind1 (int): Index of first site. ind2 (int): Index of second site. tol (float): Relative tolerance to test. Basically, the code checks if the distance between...
[ "Returns", "two", "molecules", "based", "on", "breaking", "the", "bond", "between", "atoms", "at", "index", "ind1", "and", "ind2", "." ]
python
train
saltstack/salt
salt/states/bluecoat_sslv.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/bluecoat_sslv.py#L50-L95
def distinguished_name_list_exists(name, items): ''' Ensures that a distinguished name list exists with the items provided. name: The name of the module function to execute. name(str): The name of the distinguished names list. items(list): A list of items to ensure exist on the distinguished name...
[ "def", "distinguished_name_list_exists", "(", "name", ",", "items", ")", ":", "ret", "=", "_default_ret", "(", "name", ")", "req_change", "=", "False", "try", ":", "existing_lists", "=", "__salt__", "[", "'bluecoat_sslv.get_distinguished_name_lists'", "]", "(", ")...
Ensures that a distinguished name list exists with the items provided. name: The name of the module function to execute. name(str): The name of the distinguished names list. items(list): A list of items to ensure exist on the distinguished names list. SLS Example: .. code-block:: yaml ...
[ "Ensures", "that", "a", "distinguished", "name", "list", "exists", "with", "the", "items", "provided", "." ]
python
train
aws/aws-dynamodb-encryption-python
src/dynamodb_encryption_sdk/internal/formatting/material_description.py
https://github.com/aws/aws-dynamodb-encryption-python/blob/8de3bbe13df39c59b21bf431010f7acfcf629a2f/src/dynamodb_encryption_sdk/internal/formatting/material_description.py#L103-L119
def _read_version(material_description_bytes): # type: (io.BytesIO) -> None """Read the version from the serialized material description and raise an error if it is unknown. :param material_description_bytes: serializezd material description :type material_description_bytes: io.BytesIO :raises Inva...
[ "def", "_read_version", "(", "material_description_bytes", ")", ":", "# type: (io.BytesIO) -> None", "try", ":", "(", "version", ",", ")", "=", "unpack_value", "(", "\">4s\"", ",", "material_description_bytes", ")", "except", "struct", ".", "error", ":", "message", ...
Read the version from the serialized material description and raise an error if it is unknown. :param material_description_bytes: serializezd material description :type material_description_bytes: io.BytesIO :raises InvalidMaterialDescriptionError: if malformed version :raises InvalidMaterialDescriptio...
[ "Read", "the", "version", "from", "the", "serialized", "material", "description", "and", "raise", "an", "error", "if", "it", "is", "unknown", "." ]
python
train
ARMmbed/mbed-cloud-sdk-python
src/mbed_cloud/_backends/iam/apis/account_admin_api.py
https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/_backends/iam/apis/account_admin_api.py#L2116-L2137
def update_group_name(self, group_id, body, **kwargs): # noqa: E501 """Update the group name. # noqa: E501 An endpoint for updating a group name. **Example usage:** `curl -X PUT https://api.us-east-1.mbedcloud.com/v3/policy-groups/{group-id} -d '{\"name\": \"TestGroup2\"}' -H 'content-type: applica...
[ "def", "update_group_name", "(", "self", ",", "group_id", ",", "body", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'asynchronous'", ")", ":", "return", "s...
Update the group name. # noqa: E501 An endpoint for updating a group name. **Example usage:** `curl -X PUT https://api.us-east-1.mbedcloud.com/v3/policy-groups/{group-id} -d '{\"name\": \"TestGroup2\"}' -H 'content-type: application/json' -H 'Authorization: Bearer API_KEY'` # noqa: E501 This method...
[ "Update", "the", "group", "name", ".", "#", "noqa", ":", "E501" ]
python
train
sernst/cauldron
cauldron/session/display/__init__.py
https://github.com/sernst/cauldron/blob/4086aec9c038c402ea212c79fe8bd0d27104f9cf/cauldron/session/display/__init__.py#L55-L74
def text(value: str, preformatted: bool = False): """ Adds text to the display. If the text is not preformatted, it will be displayed in paragraph format. Preformatted text will be displayed inside a pre tag with a monospace font. :param value: The text to display. :param preformatted: ...
[ "def", "text", "(", "value", ":", "str", ",", "preformatted", ":", "bool", "=", "False", ")", ":", "if", "preformatted", ":", "result", "=", "render_texts", ".", "preformatted_text", "(", "value", ")", "else", ":", "result", "=", "render_texts", ".", "te...
Adds text to the display. If the text is not preformatted, it will be displayed in paragraph format. Preformatted text will be displayed inside a pre tag with a monospace font. :param value: The text to display. :param preformatted: Whether or not to preserve the whitespace display of t...
[ "Adds", "text", "to", "the", "display", ".", "If", "the", "text", "is", "not", "preformatted", "it", "will", "be", "displayed", "in", "paragraph", "format", ".", "Preformatted", "text", "will", "be", "displayed", "inside", "a", "pre", "tag", "with", "a", ...
python
train
llllllllll/codetransformer
codetransformer/decompiler/_343.py
https://github.com/llllllllll/codetransformer/blob/c5f551e915df45adc7da7e0b1b635f0cc6a1bb27/codetransformer/decompiler/_343.py#L1061-L1067
def make_call_positionals(stack_builders, count): """ Make the args entry for an ast.Call node. """ out = [make_expr(stack_builders) for _ in range(count)] out.reverse() return out
[ "def", "make_call_positionals", "(", "stack_builders", ",", "count", ")", ":", "out", "=", "[", "make_expr", "(", "stack_builders", ")", "for", "_", "in", "range", "(", "count", ")", "]", "out", ".", "reverse", "(", ")", "return", "out" ]
Make the args entry for an ast.Call node.
[ "Make", "the", "args", "entry", "for", "an", "ast", ".", "Call", "node", "." ]
python
train
chartbeat-labs/swailing
swailing/logger.py
https://github.com/chartbeat-labs/swailing/blob/d55e0dd7af59a2ba93f7c9c46ff56f6a4080b222/swailing/logger.py#L67-L73
def debug(self, msg=None, *args, **kwargs): """Write log at DEBUG level. Same arguments as Python's built-in Logger. """ return self._log(logging.DEBUG, msg, args, kwargs)
[ "def", "debug", "(", "self", ",", "msg", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_log", "(", "logging", ".", "DEBUG", ",", "msg", ",", "args", ",", "kwargs", ")" ]
Write log at DEBUG level. Same arguments as Python's built-in Logger.
[ "Write", "log", "at", "DEBUG", "level", ".", "Same", "arguments", "as", "Python", "s", "built", "-", "in", "Logger", "." ]
python
train
lsst-sqre/documenteer
documenteer/sphinxext/lssttasks/topiclists.py
https://github.com/lsst-sqre/documenteer/blob/75f02901a80042b28d074df1cc1dca32eb8e38c8/documenteer/sphinxext/lssttasks/topiclists.py#L176-L257
def process_task_topic_list(app, doctree, fromdocname): """Process the ``task_topic_list`` node to generate a rendered listing of Task, Configurable, or Config topics (as determined by the types key of the ``task_topic_list`` node). This is called during the "doctree-resolved" phase so that the ``l...
[ "def", "process_task_topic_list", "(", "app", ",", "doctree", ",", "fromdocname", ")", ":", "logger", "=", "getLogger", "(", "__name__", ")", "logger", ".", "debug", "(", "'Started process_task_list'", ")", "env", "=", "app", ".", "builder", ".", "env", "for...
Process the ``task_topic_list`` node to generate a rendered listing of Task, Configurable, or Config topics (as determined by the types key of the ``task_topic_list`` node). This is called during the "doctree-resolved" phase so that the ``lsst_task_topcs`` environment attribute is fully set.
[ "Process", "the", "task_topic_list", "node", "to", "generate", "a", "rendered", "listing", "of", "Task", "Configurable", "or", "Config", "topics", "(", "as", "determined", "by", "the", "types", "key", "of", "the", "task_topic_list", "node", ")", "." ]
python
train
dpgaspar/Flask-AppBuilder
flask_appbuilder/security/manager.py
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L774-L785
def _bind_indirect_user(self, ldap, con): """ If using AUTH_LDAP_BIND_USER bind this user before performing search :param ldap: The ldap module reference :param con: The ldap connection """ indirect_user = self.auth_ldap_bind_user if indirect_user: ...
[ "def", "_bind_indirect_user", "(", "self", ",", "ldap", ",", "con", ")", ":", "indirect_user", "=", "self", ".", "auth_ldap_bind_user", "if", "indirect_user", ":", "indirect_password", "=", "self", ".", "auth_ldap_bind_password", "log", ".", "debug", "(", "\"LDA...
If using AUTH_LDAP_BIND_USER bind this user before performing search :param ldap: The ldap module reference :param con: The ldap connection
[ "If", "using", "AUTH_LDAP_BIND_USER", "bind", "this", "user", "before", "performing", "search", ":", "param", "ldap", ":", "The", "ldap", "module", "reference", ":", "param", "con", ":", "The", "ldap", "connection" ]
python
train
ska-sa/montblanc
montblanc/impl/rime/tensorflow/sources/ms_source_provider.py
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L159-L167
def parallactic_angles(self, context): """ parallactic angle data source """ # Time and antenna extents (lt, ut), (la, ua) = context.dim_extents('ntime', 'na') return (mbu.parallactic_angles(self._times[lt:ut], self._antenna_positions[la:ua], self._phase_dir) ...
[ "def", "parallactic_angles", "(", "self", ",", "context", ")", ":", "# Time and antenna extents", "(", "lt", ",", "ut", ")", ",", "(", "la", ",", "ua", ")", "=", "context", ".", "dim_extents", "(", "'ntime'", ",", "'na'", ")", "return", "(", "mbu", "."...
parallactic angle data source
[ "parallactic", "angle", "data", "source" ]
python
train
wakatime/wakatime
wakatime/packages/configparser/__init__.py
https://github.com/wakatime/wakatime/blob/74519ace04e8472f3a3993269963732b9946a01d/wakatime/packages/configparser/__init__.py#L880-L891
def popitem(self): """Remove a section from the parser and return it as a (section_name, section_proxy) tuple. If no section is present, raise KeyError. The section DEFAULT is never returned because it cannot be removed. """ for key in self.sections(): value ...
[ "def", "popitem", "(", "self", ")", ":", "for", "key", "in", "self", ".", "sections", "(", ")", ":", "value", "=", "self", "[", "key", "]", "del", "self", "[", "key", "]", "return", "key", ",", "value", "raise", "KeyError" ]
Remove a section from the parser and return it as a (section_name, section_proxy) tuple. If no section is present, raise KeyError. The section DEFAULT is never returned because it cannot be removed.
[ "Remove", "a", "section", "from", "the", "parser", "and", "return", "it", "as", "a", "(", "section_name", "section_proxy", ")", "tuple", ".", "If", "no", "section", "is", "present", "raise", "KeyError", "." ]
python
train
theonion/django-bulbs
bulbs/contributions/email.py
https://github.com/theonion/django-bulbs/blob/0c0e6e3127a7dc487b96677fab95cacd2b3806da/bulbs/contributions/email.py#L167-L174
def get_contributors(self): """Return a list of contributors with contributions between the start/end dates.""" return User.objects.filter( freelanceprofile__is_freelance=True ).filter( contributions__content__published__gte=self.start, contributions__content_...
[ "def", "get_contributors", "(", "self", ")", ":", "return", "User", ".", "objects", ".", "filter", "(", "freelanceprofile__is_freelance", "=", "True", ")", ".", "filter", "(", "contributions__content__published__gte", "=", "self", ".", "start", ",", "contributions...
Return a list of contributors with contributions between the start/end dates.
[ "Return", "a", "list", "of", "contributors", "with", "contributions", "between", "the", "start", "/", "end", "dates", "." ]
python
train
CalebBell/ht
ht/conv_internal.py
https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/conv_internal.py#L1112-L1151
def turbulent_Gowen_Smith(Re, Pr, fd): r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as shown in [1]_. .. math:: Nu = \frac{Re Pr (f/8)^{0.5}} {4.5 + [0.155(Re(f/8)^{0.5})^{0.54} + (8/f)^{0.5}]Pr^{0.5}} Parameters ---------- Re ...
[ "def", "turbulent_Gowen_Smith", "(", "Re", ",", "Pr", ",", "fd", ")", ":", "return", "Re", "*", "Pr", "*", "(", "fd", "/", "8.", ")", "**", "0.5", "/", "(", "4.5", "+", "(", "0.155", "*", "(", "Re", "*", "(", "fd", "/", "8.", ")", "**", "0....
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as shown in [1]_. .. math:: Nu = \frac{Re Pr (f/8)^{0.5}} {4.5 + [0.155(Re(f/8)^{0.5})^{0.54} + (8/f)^{0.5}]Pr^{0.5}} Parameters ---------- Re : float Reynolds number, [-] Pr...
[ "r", "Calculates", "internal", "convection", "Nusselt", "number", "for", "turbulent", "flows", "in", "pipe", "according", "to", "[", "2", "]", "_", "as", "shown", "in", "[", "1", "]", "_", "." ]
python
train
rigetti/pyquil
pyquil/api/_qam.py
https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/api/_qam.py#L45-L59
def load(self, executable): """ Initialize a QAM into a fresh state. :param executable: Load a compiled executable onto the QAM. """ if self.status == 'loaded': warnings.warn("Overwriting previously loaded executable.") assert self.status in ['connected', 'do...
[ "def", "load", "(", "self", ",", "executable", ")", ":", "if", "self", ".", "status", "==", "'loaded'", ":", "warnings", ".", "warn", "(", "\"Overwriting previously loaded executable.\"", ")", "assert", "self", ".", "status", "in", "[", "'connected'", ",", "...
Initialize a QAM into a fresh state. :param executable: Load a compiled executable onto the QAM.
[ "Initialize", "a", "QAM", "into", "a", "fresh", "state", "." ]
python
train
vertexproject/synapse
synapse/lib/syntax.py
https://github.com/vertexproject/synapse/blob/22e67c5a8f6d7caddbcf34b39ab1bd2d6c4a6e0b/synapse/lib/syntax.py#L1461-L1493
def cmdargv(self): ''' cmdargv *must* have leading whitespace to prevent foo@bar from becoming cmdname foo with argv=[@bar] ''' argv = [] while self.more(): # cmdargv *requires* whitespace if not self.ignore(whitespace): break ...
[ "def", "cmdargv", "(", "self", ")", ":", "argv", "=", "[", "]", "while", "self", ".", "more", "(", ")", ":", "# cmdargv *requires* whitespace", "if", "not", "self", ".", "ignore", "(", "whitespace", ")", ":", "break", "# if we hit a | or a } we're done", "if...
cmdargv *must* have leading whitespace to prevent foo@bar from becoming cmdname foo with argv=[@bar]
[ "cmdargv", "*", "must", "*", "have", "leading", "whitespace", "to", "prevent", "foo" ]
python
train
datacats/datacats
datacats/environment.py
https://github.com/datacats/datacats/blob/e4bae503efa997660fb3f34fe166699569653157/datacats/environment.py#L452-L494
def _create_run_ini(self, port, production, output='development.ini', source='development.ini', override_site_url=True): """ Create run/development.ini in datadir with debug and site_url overridden and with correct db passwords inserted """ cp = SafeConfig...
[ "def", "_create_run_ini", "(", "self", ",", "port", ",", "production", ",", "output", "=", "'development.ini'", ",", "source", "=", "'development.ini'", ",", "override_site_url", "=", "True", ")", ":", "cp", "=", "SafeConfigParser", "(", ")", "try", ":", "cp...
Create run/development.ini in datadir with debug and site_url overridden and with correct db passwords inserted
[ "Create", "run", "/", "development", ".", "ini", "in", "datadir", "with", "debug", "and", "site_url", "overridden", "and", "with", "correct", "db", "passwords", "inserted" ]
python
train
aws/aws-xray-sdk-python
aws_xray_sdk/core/lambda_launcher.py
https://github.com/aws/aws-xray-sdk-python/blob/707358cd3a516d51f2ebf71cf34f00e8d906a667/aws_xray_sdk/core/lambda_launcher.py#L66-L79
def put_subsegment(self, subsegment): """ Refresh the facade segment every time this function is invoked to prevent a new subsegment from being attached to a leaked segment/subsegment. """ current_entity = self.get_trace_entity() if not self._is_subsegment(current_entity...
[ "def", "put_subsegment", "(", "self", ",", "subsegment", ")", ":", "current_entity", "=", "self", ".", "get_trace_entity", "(", ")", "if", "not", "self", ".", "_is_subsegment", "(", "current_entity", ")", "and", "current_entity", ".", "initializing", ":", "if"...
Refresh the facade segment every time this function is invoked to prevent a new subsegment from being attached to a leaked segment/subsegment.
[ "Refresh", "the", "facade", "segment", "every", "time", "this", "function", "is", "invoked", "to", "prevent", "a", "new", "subsegment", "from", "being", "attached", "to", "a", "leaked", "segment", "/", "subsegment", "." ]
python
train
jslang/responsys
responsys/client.py
https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L110-L131
def call(self, method, *args): """ Calls the service method defined with the arguments provided """ try: response = getattr(self.client.service, method)(*args) except (URLError, SSLError) as e: log.exception('Failed to connect to responsys service') raise Conn...
[ "def", "call", "(", "self", ",", "method", ",", "*", "args", ")", ":", "try", ":", "response", "=", "getattr", "(", "self", ".", "client", ".", "service", ",", "method", ")", "(", "*", "args", ")", "except", "(", "URLError", ",", "SSLError", ")", ...
Calls the service method defined with the arguments provided
[ "Calls", "the", "service", "method", "defined", "with", "the", "arguments", "provided" ]
python
train
sailthru/sailthru-python-client
sailthru/sailthru_client.py
https://github.com/sailthru/sailthru-python-client/blob/22aa39ba0c5bddd7b8743e24ada331128c0f4f54/sailthru/sailthru_client.py#L154-L162
def get_user(self, idvalue, options=None): """ get user by a given id http://getstarted.sailthru.com/api/user """ options = options or {} data = options.copy() data['id'] = idvalue return self.api_get('user', data)
[ "def", "get_user", "(", "self", ",", "idvalue", ",", "options", "=", "None", ")", ":", "options", "=", "options", "or", "{", "}", "data", "=", "options", ".", "copy", "(", ")", "data", "[", "'id'", "]", "=", "idvalue", "return", "self", ".", "api_g...
get user by a given id http://getstarted.sailthru.com/api/user
[ "get", "user", "by", "a", "given", "id", "http", ":", "//", "getstarted", ".", "sailthru", ".", "com", "/", "api", "/", "user" ]
python
train
adafruit/Adafruit_Python_PureIO
Adafruit_PureIO/smbus.py
https://github.com/adafruit/Adafruit_Python_PureIO/blob/6f4976d91c52d70b67b28bba75a429b5328a52c1/Adafruit_PureIO/smbus.py#L258-L268
def write_word_data(self, addr, cmd, val): """Write a word (2 bytes) of data to the specified cmd register of the device. Note that this will write the data in the endianness of the processor running Python (typically little endian)! """ assert self._device is not None, 'Bus mus...
[ "def", "write_word_data", "(", "self", ",", "addr", ",", "cmd", ",", "val", ")", ":", "assert", "self", ".", "_device", "is", "not", "None", ",", "'Bus must be opened before operations are made against it!'", "# Construct a string of data to send with the command register a...
Write a word (2 bytes) of data to the specified cmd register of the device. Note that this will write the data in the endianness of the processor running Python (typically little endian)!
[ "Write", "a", "word", "(", "2", "bytes", ")", "of", "data", "to", "the", "specified", "cmd", "register", "of", "the", "device", ".", "Note", "that", "this", "will", "write", "the", "data", "in", "the", "endianness", "of", "the", "processor", "running", ...
python
test
crytic/pyevmasm
pyevmasm/evmasm.py
https://github.com/crytic/pyevmasm/blob/d27daf19a36d630a31499e783b716cf1165798d8/pyevmasm/evmasm.py#L571-L596
def assemble_hex(asmcode, pc=0, fork=DEFAULT_FORK): """ Assemble an EVM program :param asmcode: an evm assembler program :type asmcode: str | iterator[Instruction] :param pc: program counter of the first instruction(optional) :type pc: int :param fork: fork name (optional) ...
[ "def", "assemble_hex", "(", "asmcode", ",", "pc", "=", "0", ",", "fork", "=", "DEFAULT_FORK", ")", ":", "if", "isinstance", "(", "asmcode", ",", "list", ")", ":", "return", "'0x'", "+", "hexlify", "(", "b''", ".", "join", "(", "[", "x", ".", "bytes...
Assemble an EVM program :param asmcode: an evm assembler program :type asmcode: str | iterator[Instruction] :param pc: program counter of the first instruction(optional) :type pc: int :param fork: fork name (optional) :type fork: str :return: the hex representati...
[ "Assemble", "an", "EVM", "program" ]
python
valid
goose3/goose3
goose3/extractors/title.py
https://github.com/goose3/goose3/blob/e6994b1b1826af2720a091d1bff5ca15594f558d/goose3/extractors/title.py#L33-L77
def clean_title(self, title): """Clean title with the use of og:site_name in this case try to get rid of site name and use TITLE_SPLITTERS to reformat title """ # check if we have the site name in opengraph data if "site_name" in list(self.article.opengraph.keys()): ...
[ "def", "clean_title", "(", "self", ",", "title", ")", ":", "# check if we have the site name in opengraph data", "if", "\"site_name\"", "in", "list", "(", "self", ".", "article", ".", "opengraph", ".", "keys", "(", ")", ")", ":", "site_name", "=", "self", ".",...
Clean title with the use of og:site_name in this case try to get rid of site name and use TITLE_SPLITTERS to reformat title
[ "Clean", "title", "with", "the", "use", "of", "og", ":", "site_name", "in", "this", "case", "try", "to", "get", "rid", "of", "site", "name", "and", "use", "TITLE_SPLITTERS", "to", "reformat", "title" ]
python
valid
mitsei/dlkit
dlkit/json_/assessment/managers.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/managers.py#L1160-L1182
def get_assessment_admin_session_for_bank(self, bank_id): """Gets the ``OsidSession`` associated with the assessment admin service for the given bank. arg: bank_id (osid.id.Id): the ``Id`` of the bank return: (osid.assessment.AssessmentAdminSession) - ``an _assessment_admin_s...
[ "def", "get_assessment_admin_session_for_bank", "(", "self", ",", "bank_id", ")", ":", "if", "not", "self", ".", "supports_assessment_admin", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "##", "# Also include check to see if the catalog Id is found ...
Gets the ``OsidSession`` associated with the assessment admin service for the given bank. arg: bank_id (osid.id.Id): the ``Id`` of the bank return: (osid.assessment.AssessmentAdminSession) - ``an _assessment_admin_session`` raise: NotFound - ``bank_id`` not found rai...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "assessment", "admin", "service", "for", "the", "given", "bank", "." ]
python
train