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
pyca/pynacl
src/nacl/public.py
https://github.com/pyca/pynacl/blob/0df0c2c7693fa5d316846111ce510702756f5feb/src/nacl/public.py#L345-L364
def decrypt(self, ciphertext, encoder=encoding.RawEncoder): """ Decrypts the ciphertext using the ephemeral public key enclosed in the ciphertext and the SealedBox private key, returning the plaintext message. :param ciphertext: [:class:`bytes`] The encrypted message to decrypt ...
[ "def", "decrypt", "(", "self", ",", "ciphertext", ",", "encoder", "=", "encoding", ".", "RawEncoder", ")", ":", "# Decode our ciphertext", "ciphertext", "=", "encoder", ".", "decode", "(", "ciphertext", ")", "plaintext", "=", "nacl", ".", "bindings", ".", "c...
Decrypts the ciphertext using the ephemeral public key enclosed in the ciphertext and the SealedBox private key, returning the plaintext message. :param ciphertext: [:class:`bytes`] The encrypted message to decrypt :param encoder: The encoder used to decode the ciphertext. :retu...
[ "Decrypts", "the", "ciphertext", "using", "the", "ephemeral", "public", "key", "enclosed", "in", "the", "ciphertext", "and", "the", "SealedBox", "private", "key", "returning", "the", "plaintext", "message", "." ]
python
train
StellarCN/py-stellar-base
stellar_base/address.py
https://github.com/StellarCN/py-stellar-base/blob/cce2e782064fb3955c85e1696e630d67b1010848/stellar_base/address.py#L65-L93
def get(self): """Retrieve the account data that corresponds to this :class:`Address`. Retrieve the account data from Horizon for the account that corresponds to this :class:`Address`. Attempt to retrieve the following attributes from Horizon: * Sequence Number * Balanc...
[ "def", "get", "(", "self", ")", ":", "acc", "=", "self", ".", "horizon", ".", "account", "(", "self", ".", "address", ")", "self", ".", "sequence", "=", "acc", ".", "get", "(", "'sequence'", ")", "self", ".", "balances", "=", "acc", ".", "get", "...
Retrieve the account data that corresponds to this :class:`Address`. Retrieve the account data from Horizon for the account that corresponds to this :class:`Address`. Attempt to retrieve the following attributes from Horizon: * Sequence Number * Balances * Paging Token ...
[ "Retrieve", "the", "account", "data", "that", "corresponds", "to", "this", ":", "class", ":", "Address", "." ]
python
train
ray-project/ray
python/ray/experimental/serve/router/__init__.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/serve/router/__init__.py#L10-L23
def start_router(router_class, router_name): """Wrapper for starting a router and register it. Args: router_class: The router class to instantiate. router_name: The name to give to the router. Returns: A handle to newly started router actor. """ handle = router_class.remote...
[ "def", "start_router", "(", "router_class", ",", "router_name", ")", ":", "handle", "=", "router_class", ".", "remote", "(", "router_name", ")", "ray", ".", "experimental", ".", "register_actor", "(", "router_name", ",", "handle", ")", "handle", ".", "start", ...
Wrapper for starting a router and register it. Args: router_class: The router class to instantiate. router_name: The name to give to the router. Returns: A handle to newly started router actor.
[ "Wrapper", "for", "starting", "a", "router", "and", "register", "it", "." ]
python
train
gwastro/pycbc
pycbc/filter/qtransform.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/filter/qtransform.py#L183-L231
def qseries(fseries, Q, f0, return_complex=False): """Calculate the energy 'TimeSeries' for the given fseries Parameters ---------- fseries: 'pycbc FrequencySeries' frequency-series data set Q: q value f0: central frequency return_complex: {False, bool} Retur...
[ "def", "qseries", "(", "fseries", ",", "Q", ",", "f0", ",", "return_complex", "=", "False", ")", ":", "# normalize and generate bi-square window", "qprime", "=", "Q", "/", "11", "**", "(", "1", "/", "2.", ")", "norm", "=", "numpy", ".", "sqrt", "(", "3...
Calculate the energy 'TimeSeries' for the given fseries Parameters ---------- fseries: 'pycbc FrequencySeries' frequency-series data set Q: q value f0: central frequency return_complex: {False, bool} Return the raw complex series instead of the normalized power. ...
[ "Calculate", "the", "energy", "TimeSeries", "for", "the", "given", "fseries" ]
python
train
chaoss/grimoirelab-perceval
perceval/backends/core/stackexchange.py
https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/stackexchange.py#L305-L324
def setup_cmd_parser(cls): """Returns the StackExchange argument parser.""" parser = BackendCommandArgumentParser(cls.BACKEND.CATEGORIES, from_date=True, token_auth=True, ...
[ "def", "setup_cmd_parser", "(", "cls", ")", ":", "parser", "=", "BackendCommandArgumentParser", "(", "cls", ".", "BACKEND", ".", "CATEGORIES", ",", "from_date", "=", "True", ",", "token_auth", "=", "True", ",", "archive", "=", "True", ")", "# StackExchange opt...
Returns the StackExchange argument parser.
[ "Returns", "the", "StackExchange", "argument", "parser", "." ]
python
test
raiden-network/raiden
raiden/transfer/views.py
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/transfer/views.py#L413-L424
def get_channelstate_settling( chain_state: ChainState, payment_network_id: PaymentNetworkID, token_address: TokenAddress, ) -> List[NettingChannelState]: """Return the state of settling channels in a token network.""" return get_channelstate_filter( chain_state, payment_...
[ "def", "get_channelstate_settling", "(", "chain_state", ":", "ChainState", ",", "payment_network_id", ":", "PaymentNetworkID", ",", "token_address", ":", "TokenAddress", ",", ")", "->", "List", "[", "NettingChannelState", "]", ":", "return", "get_channelstate_filter", ...
Return the state of settling channels in a token network.
[ "Return", "the", "state", "of", "settling", "channels", "in", "a", "token", "network", "." ]
python
train
renzon/gaepagseguro
gaepagseguro/pagseguro_facade.py
https://github.com/renzon/gaepagseguro/blob/c88f00580c380ff5b35d873311d6c786fa1f29d2/gaepagseguro/pagseguro_facade.py#L57-L72
def generate_payment(redirect_url, client_name, client_email, payment_owner, validate_address_cmd, *validate_item_cmds): """ Function used to generate a payment on pagseguro See facade_tests to undestand the steps before generating a payment @param redirect_url: the url where payment status change mus...
[ "def", "generate_payment", "(", "redirect_url", ",", "client_name", ",", "client_email", ",", "payment_owner", ",", "validate_address_cmd", ",", "*", "validate_item_cmds", ")", ":", "return", "GeneratePayment", "(", "redirect_url", ",", "client_name", ",", "client_ema...
Function used to generate a payment on pagseguro See facade_tests to undestand the steps before generating a payment @param redirect_url: the url where payment status change must be sent @param client_name: client's name @param client_email: client's email @param payment_owner: owner of payment. H...
[ "Function", "used", "to", "generate", "a", "payment", "on", "pagseguro", "See", "facade_tests", "to", "undestand", "the", "steps", "before", "generating", "a", "payment" ]
python
train
resonai/ybt
yabt/buildcontext.py
https://github.com/resonai/ybt/blob/5b40df0922ef3383eb85f2b04a26a2db4b81b3fd/yabt/buildcontext.py#L465-L468
def register_target_artifact_metadata(self, target: str, metadata: dict): """Register the artifact metadata dictionary for a built target.""" with self.context_lock: self.artifacts_metadata[target.name] = metadata
[ "def", "register_target_artifact_metadata", "(", "self", ",", "target", ":", "str", ",", "metadata", ":", "dict", ")", ":", "with", "self", ".", "context_lock", ":", "self", ".", "artifacts_metadata", "[", "target", ".", "name", "]", "=", "metadata" ]
Register the artifact metadata dictionary for a built target.
[ "Register", "the", "artifact", "metadata", "dictionary", "for", "a", "built", "target", "." ]
python
train
chaoss/grimoirelab-perceval
perceval/backends/core/bugzilla.py
https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/bugzilla.py#L515-L528
def bugs(self, *bug_ids): """Get the information of a list of bugs in XML format. :param bug_ids: list of bug identifiers """ params = { self.PBUG_ID: bug_ids, self.PCTYPE: self.CTYPE_XML, self.PEXCLUDE_FIELD: 'attachmentdata' } respo...
[ "def", "bugs", "(", "self", ",", "*", "bug_ids", ")", ":", "params", "=", "{", "self", ".", "PBUG_ID", ":", "bug_ids", ",", "self", ".", "PCTYPE", ":", "self", ".", "CTYPE_XML", ",", "self", ".", "PEXCLUDE_FIELD", ":", "'attachmentdata'", "}", "respons...
Get the information of a list of bugs in XML format. :param bug_ids: list of bug identifiers
[ "Get", "the", "information", "of", "a", "list", "of", "bugs", "in", "XML", "format", "." ]
python
test
welbornprod/colr
colr/trans.py
https://github.com/welbornprod/colr/blob/417117fdbddbc53142096685ac2af006b2bd0220/colr/trans.py#L540-L550
def _init_code(self, code: int) -> None: """ Initialize from an int terminal code. """ if -1 < code < 256: self.code = '{:02}'.format(code) self.hexval = term2hex(code) self.rgb = hex2rgb(self.hexval) else: raise ValueError(' '.join(( ...
[ "def", "_init_code", "(", "self", ",", "code", ":", "int", ")", "->", "None", ":", "if", "-", "1", "<", "code", "<", "256", ":", "self", ".", "code", "=", "'{:02}'", ".", "format", "(", "code", ")", "self", ".", "hexval", "=", "term2hex", "(", ...
Initialize from an int terminal code.
[ "Initialize", "from", "an", "int", "terminal", "code", "." ]
python
train
jessemiller/HamlPy
hamlpy/hamlpy_watcher.py
https://github.com/jessemiller/HamlPy/blob/acb79e14381ce46e6d1cb64e7cb154751ae02dfe/hamlpy/hamlpy_watcher.py#L59-L108
def watch_folder(): """Main entry point. Expects one or two arguments (the watch folder + optional destination folder).""" argv = sys.argv[1:] if len(sys.argv) > 1 else [] args = arg_parser.parse_args(sys.argv[1:]) compiler_args = {} input_folder = os.path.realpath(args.input_dir) if not ar...
[ "def", "watch_folder", "(", ")", ":", "argv", "=", "sys", ".", "argv", "[", "1", ":", "]", "if", "len", "(", "sys", ".", "argv", ")", ">", "1", "else", "[", "]", "args", "=", "arg_parser", ".", "parse_args", "(", "sys", ".", "argv", "[", "1", ...
Main entry point. Expects one or two arguments (the watch folder + optional destination folder).
[ "Main", "entry", "point", ".", "Expects", "one", "or", "two", "arguments", "(", "the", "watch", "folder", "+", "optional", "destination", "folder", ")", "." ]
python
train
mushkevych/scheduler
synergy/scheduler/garbage_collector.py
https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/scheduler/garbage_collector.py#L37-L79
def scan_uow_candidates(self): """ method performs two actions: - enlist stale or invalid units of work into reprocessing queue - cancel UOWs that are older than 2 days and have been submitted more than 1 hour ago """ try: since = settings.settings['synergy_start_time...
[ "def", "scan_uow_candidates", "(", "self", ")", ":", "try", ":", "since", "=", "settings", ".", "settings", "[", "'synergy_start_timeperiod'", "]", "uow_list", "=", "self", ".", "uow_dao", ".", "get_reprocessing_candidates", "(", "since", ")", "except", "LookupE...
method performs two actions: - enlist stale or invalid units of work into reprocessing queue - cancel UOWs that are older than 2 days and have been submitted more than 1 hour ago
[ "method", "performs", "two", "actions", ":", "-", "enlist", "stale", "or", "invalid", "units", "of", "work", "into", "reprocessing", "queue", "-", "cancel", "UOWs", "that", "are", "older", "than", "2", "days", "and", "have", "been", "submitted", "more", "t...
python
train
mrstephenneal/dirutility
dirutility/walk/walk.py
https://github.com/mrstephenneal/dirutility/blob/339378659e2d7e09c53acfc51c5df745bb0cd517/dirutility/walk/walk.py#L190-L202
def creation_dates(self, sort=True): """ Return a list of (file_path, creation_date) tuples created from list of walked paths. :param sort: Bool, sorts file_paths on created_date from newest to oldest. :return: List of (file_path, created_date) tuples. """ if not sort: ...
[ "def", "creation_dates", "(", "self", ",", "sort", "=", "True", ")", ":", "if", "not", "sort", ":", "return", "pool_creation_date", "(", "self", ".", "filepaths", ")", "else", ":", "pcd", "=", "pool_creation_date", "(", "self", ".", "filepaths", ")", "pc...
Return a list of (file_path, creation_date) tuples created from list of walked paths. :param sort: Bool, sorts file_paths on created_date from newest to oldest. :return: List of (file_path, created_date) tuples.
[ "Return", "a", "list", "of", "(", "file_path", "creation_date", ")", "tuples", "created", "from", "list", "of", "walked", "paths", "." ]
python
train
DLR-RM/RAFCON
source/rafcon/gui/controllers/state_editor/outcomes.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/outcomes.py#L89-L105
def register_view(self, view): """Called when the View was registered Can be used e.g. to connect signals. Here, the destroy signal is connected to close the application """ super(StateOutcomesListController, self).register_view(view) if isinstance(view, StateOutcomesTreeView): ...
[ "def", "register_view", "(", "self", ",", "view", ")", ":", "super", "(", "StateOutcomesListController", ",", "self", ")", ".", "register_view", "(", "view", ")", "if", "isinstance", "(", "view", ",", "StateOutcomesTreeView", ")", ":", "self", ".", "connect_...
Called when the View was registered Can be used e.g. to connect signals. Here, the destroy signal is connected to close the application
[ "Called", "when", "the", "View", "was", "registered" ]
python
train
Addvilz/hemp
hemp/gitutils.py
https://github.com/Addvilz/hemp/blob/80d189f15ba20068a61efc2591070c80549c9d06/hemp/gitutils.py#L8-L21
def remote_tags(url): # type: (str) -> list """ List all available remote tags naturally sorted as version strings :rtype: list :param url: Remote URL of the repository :return: list of available tags """ tags = [] remote_git = Git() for line in remote_git.ls_remote('--tags', '--...
[ "def", "remote_tags", "(", "url", ")", ":", "# type: (str) -> list", "tags", "=", "[", "]", "remote_git", "=", "Git", "(", ")", "for", "line", "in", "remote_git", ".", "ls_remote", "(", "'--tags'", ",", "'--quiet'", ",", "url", ")", ".", "split", "(", ...
List all available remote tags naturally sorted as version strings :rtype: list :param url: Remote URL of the repository :return: list of available tags
[ "List", "all", "available", "remote", "tags", "naturally", "sorted", "as", "version", "strings", ":", "rtype", ":", "list", ":", "param", "url", ":", "Remote", "URL", "of", "the", "repository", ":", "return", ":", "list", "of", "available", "tags" ]
python
train
pyca/pyopenssl
src/OpenSSL/crypto.py
https://github.com/pyca/pyopenssl/blob/1fbe064c50fd030948141d7d630673761525b0d0/src/OpenSSL/crypto.py#L1141-L1154
def set_pubkey(self, pkey): """ Set the public key of the certificate. :param pkey: The public key. :type pkey: :py:class:`PKey` :return: :py:data:`None` """ if not isinstance(pkey, PKey): raise TypeError("pkey must be a PKey instance") set_...
[ "def", "set_pubkey", "(", "self", ",", "pkey", ")", ":", "if", "not", "isinstance", "(", "pkey", ",", "PKey", ")", ":", "raise", "TypeError", "(", "\"pkey must be a PKey instance\"", ")", "set_result", "=", "_lib", ".", "X509_set_pubkey", "(", "self", ".", ...
Set the public key of the certificate. :param pkey: The public key. :type pkey: :py:class:`PKey` :return: :py:data:`None`
[ "Set", "the", "public", "key", "of", "the", "certificate", "." ]
python
test
omnisci/mapd-core
SampleCode/fix_recursive_structs.py
https://github.com/omnisci/mapd-core/blob/83e87035696968748a61ff561c19631d55a3b902/SampleCode/fix_recursive_structs.py#L7-L37
def main(): """Rewrite Thrift-generated Python clients to handle recursive structs. For more details see: https://issues.apache.org/jira/browse/THRIFT-2642. Requires package `RedBaron`, available via pip: $ pip install redbaron To use: $ thrift -gen py mapd.thrift $ mv gen-py/mapd/ttypes....
[ "def", "main", "(", ")", ":", "in_file", "=", "open", "(", "sys", ".", "argv", "[", "1", "]", ",", "'r'", ")", "out_file", "=", "open", "(", "sys", ".", "argv", "[", "2", "]", ",", "'w'", ")", "red_ast", "=", "RedBaron", "(", "in_file", ".", ...
Rewrite Thrift-generated Python clients to handle recursive structs. For more details see: https://issues.apache.org/jira/browse/THRIFT-2642. Requires package `RedBaron`, available via pip: $ pip install redbaron To use: $ thrift -gen py mapd.thrift $ mv gen-py/mapd/ttypes.py gen-py/mapd/ttyp...
[ "Rewrite", "Thrift", "-", "generated", "Python", "clients", "to", "handle", "recursive", "structs", ".", "For", "more", "details", "see", ":", "https", ":", "//", "issues", ".", "apache", ".", "org", "/", "jira", "/", "browse", "/", "THRIFT", "-", "2642"...
python
train
persephone-tools/persephone
persephone/preprocess/wav.py
https://github.com/persephone-tools/persephone/blob/f94c63e4d5fe719fb1deba449b177bb299d225fb/persephone/preprocess/wav.py#L18-L43
def trim_wav_ms(in_path: Path, out_path: Path, start_time: int, end_time: int) -> None: """ Extracts part of a WAV File. First attempts to call sox. If sox is unavailable, it backs off to pydub+ffmpeg. Args: in_path: A path to the source file to extract a portion of out...
[ "def", "trim_wav_ms", "(", "in_path", ":", "Path", ",", "out_path", ":", "Path", ",", "start_time", ":", "int", ",", "end_time", ":", "int", ")", "->", "None", ":", "try", ":", "trim_wav_sox", "(", "in_path", ",", "out_path", ",", "start_time", ",", "e...
Extracts part of a WAV File. First attempts to call sox. If sox is unavailable, it backs off to pydub+ffmpeg. Args: in_path: A path to the source file to extract a portion of out_path: A path describing the to-be-created WAV file. start_time: The point in the source WAV file at whi...
[ "Extracts", "part", "of", "a", "WAV", "File", "." ]
python
train
rtfd/readthedocs-sphinx-ext
readthedocs_ext/readthedocs.py
https://github.com/rtfd/readthedocs-sphinx-ext/blob/f1a01c51c675d36ac365162ea06814544c2aa410/readthedocs_ext/readthedocs.py#L43-L57
def finalize_media(app): """Point media files at our media server.""" if (app.builder.name == 'readthedocssinglehtmllocalmedia' or app.builder.format != 'html' or not hasattr(app.builder, 'script_files')): return # Use local media for downloadable files # Pull project data ...
[ "def", "finalize_media", "(", "app", ")", ":", "if", "(", "app", ".", "builder", ".", "name", "==", "'readthedocssinglehtmllocalmedia'", "or", "app", ".", "builder", ".", "format", "!=", "'html'", "or", "not", "hasattr", "(", "app", ".", "builder", ",", ...
Point media files at our media server.
[ "Point", "media", "files", "at", "our", "media", "server", "." ]
python
train
darkfeline/animanager
animanager/cmd/results/aid.py
https://github.com/darkfeline/animanager/blob/55d92e4cbdc12aac8ebe302420d2cff3fa9fa148/animanager/cmd/results/aid.py#L83-L128
def parse_aid(self, text, default_key): """Parse argument text for aid. May retrieve the aid from search result tables as necessary. aresults determines which search results to use by default; True means aresults is the default. The last aid when no aid has been parsed yet is ...
[ "def", "parse_aid", "(", "self", ",", "text", ",", "default_key", ")", ":", "if", "default_key", "not", "in", "self", ":", "raise", "ResultKeyError", "(", "default_key", ")", "if", "text", "==", "'.'", ":", "return", "self", ".", "last_aid", "elif", "tex...
Parse argument text for aid. May retrieve the aid from search result tables as necessary. aresults determines which search results to use by default; True means aresults is the default. The last aid when no aid has been parsed yet is undefined. The accepted formats, in order:...
[ "Parse", "argument", "text", "for", "aid", "." ]
python
train
numba/llvmlite
llvmlite/ir/values.py
https://github.com/numba/llvmlite/blob/fcadf8af11947f3fd041c5d6526c5bf231564883/llvmlite/ir/values.py#L147-L158
def literal_array(cls, elems): """ Construct a literal array constant made of the given members. """ tys = [el.type for el in elems] if len(tys) == 0: raise ValueError("need at least one element") ty = tys[0] for other in tys: if ty != othe...
[ "def", "literal_array", "(", "cls", ",", "elems", ")", ":", "tys", "=", "[", "el", ".", "type", "for", "el", "in", "elems", "]", "if", "len", "(", "tys", ")", "==", "0", ":", "raise", "ValueError", "(", "\"need at least one element\"", ")", "ty", "="...
Construct a literal array constant made of the given members.
[ "Construct", "a", "literal", "array", "constant", "made", "of", "the", "given", "members", "." ]
python
train
horazont/aioxmpp
aioxmpp/forms/xso.py
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/forms/xso.py#L623-L640
def get_form_type(self): """ Extract the ``FORM_TYPE`` from the fields. :return: ``FORM_TYPE`` value or :data:`None` :rtype: :class:`str` or :data:`None` Return :data:`None` if no well-formed ``FORM_TYPE`` field is found in the list of fields. .. versionadded::...
[ "def", "get_form_type", "(", "self", ")", ":", "for", "field", "in", "self", ".", "fields", ":", "if", "field", ".", "var", "==", "\"FORM_TYPE\"", "and", "field", ".", "type_", "==", "FieldType", ".", "HIDDEN", ":", "if", "len", "(", "field", ".", "v...
Extract the ``FORM_TYPE`` from the fields. :return: ``FORM_TYPE`` value or :data:`None` :rtype: :class:`str` or :data:`None` Return :data:`None` if no well-formed ``FORM_TYPE`` field is found in the list of fields. .. versionadded:: 0.8
[ "Extract", "the", "FORM_TYPE", "from", "the", "fields", "." ]
python
train
swimlane/swimlane-python
swimlane/core/fields/comment.py
https://github.com/swimlane/swimlane-python/blob/588fc503a76799bcdb5aecdf2f64a6ee05e3922d/swimlane/core/fields/comment.py#L10-L27
def comment(self, message): """Add new comment to record comment field""" message = str(message) sw_repr = { '$type': 'Core.Models.Record.Comments, Core', 'createdByUser': self._record._swimlane.user.as_usergroup_selection(), 'createdDate': pendulum.now().to_...
[ "def", "comment", "(", "self", ",", "message", ")", ":", "message", "=", "str", "(", "message", ")", "sw_repr", "=", "{", "'$type'", ":", "'Core.Models.Record.Comments, Core'", ",", "'createdByUser'", ":", "self", ".", "_record", ".", "_swimlane", ".", "user...
Add new comment to record comment field
[ "Add", "new", "comment", "to", "record", "comment", "field" ]
python
train
google/grr
grr/server/grr_response_server/client_index.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/client_index.py#L275-L283
def AddClient(self, client): """Adds a client to the index. Args: client: A VFSGRRClient record to add or update. """ client_id, keywords = self.AnalyzeClient(client) self.AddKeywordsForName(client_id, keywords)
[ "def", "AddClient", "(", "self", ",", "client", ")", ":", "client_id", ",", "keywords", "=", "self", ".", "AnalyzeClient", "(", "client", ")", "self", ".", "AddKeywordsForName", "(", "client_id", ",", "keywords", ")" ]
Adds a client to the index. Args: client: A VFSGRRClient record to add or update.
[ "Adds", "a", "client", "to", "the", "index", "." ]
python
train
flowersteam/explauto
explauto/sensorimotor_model/inverse/cma.py
https://github.com/flowersteam/explauto/blob/cf0f81ecb9f6412f7276a95bd27359000e1e26b6/explauto/sensorimotor_model/inverse/cma.py#L7863-L7881
def pprint(to_be_printed): """nicely formated print""" try: import pprint as pp # generate an instance PrettyPrinter # pp.PrettyPrinter().pprint(to_be_printed) pp.pprint(to_be_printed) except ImportError: if isinstance(to_be_printed, dict): print('{') ...
[ "def", "pprint", "(", "to_be_printed", ")", ":", "try", ":", "import", "pprint", "as", "pp", "# generate an instance PrettyPrinter", "# pp.PrettyPrinter().pprint(to_be_printed)", "pp", ".", "pprint", "(", "to_be_printed", ")", "except", "ImportError", ":", "if", "isin...
nicely formated print
[ "nicely", "formated", "print" ]
python
train
maas/python-libmaas
maas/client/flesh/machines.py
https://github.com/maas/python-libmaas/blob/4092c68ef7fb1753efc843569848e2bcc3415002/maas/client/flesh/machines.py#L494-L560
def ssh( self, machine, *, username=None, command=None, boot_only=False, discovered=False, wait=300): """SSH into `machine`.""" start_time = time.monotonic() with utils.Spinner() as context: context.msg = colorized( "{autoblue}Deter...
[ "def", "ssh", "(", "self", ",", "machine", ",", "*", ",", "username", "=", "None", ",", "command", "=", "None", ",", "boot_only", "=", "False", ",", "discovered", "=", "False", ",", "wait", "=", "300", ")", ":", "start_time", "=", "time", ".", "mon...
SSH into `machine`.
[ "SSH", "into", "machine", "." ]
python
train
spyder-ide/spyder
spyder/plugins/projects/widgets/explorer.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/widgets/explorer.py#L208-L218
def set_project_dir(self, directory): """Set the project directory""" if directory is not None: self.treewidget.set_root_path(osp.dirname(directory)) self.treewidget.set_folder_names([osp.basename(directory)]) self.treewidget.setup_project_view() try: ...
[ "def", "set_project_dir", "(", "self", ",", "directory", ")", ":", "if", "directory", "is", "not", "None", ":", "self", ".", "treewidget", ".", "set_root_path", "(", "osp", ".", "dirname", "(", "directory", ")", ")", "self", ".", "treewidget", ".", "set_...
Set the project directory
[ "Set", "the", "project", "directory" ]
python
train
nornir-automation/nornir
nornir/plugins/tasks/networking/napalm_validate.py
https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/plugins/tasks/networking/napalm_validate.py#L8-L31
def napalm_validate( task: Task, src: Optional[str] = None, validation_source: ValidationSourceData = None, ) -> Result: """ Gather information with napalm and validate it: http://napalm.readthedocs.io/en/develop/validate/index.html Arguments: src: file to use as validation sou...
[ "def", "napalm_validate", "(", "task", ":", "Task", ",", "src", ":", "Optional", "[", "str", "]", "=", "None", ",", "validation_source", ":", "ValidationSourceData", "=", "None", ",", ")", "->", "Result", ":", "device", "=", "task", ".", "host", ".", "...
Gather information with napalm and validate it: http://napalm.readthedocs.io/en/develop/validate/index.html Arguments: src: file to use as validation source validation_source (list): data to validate device's state Returns: Result object with the following attributes set: ...
[ "Gather", "information", "with", "napalm", "and", "validate", "it", ":" ]
python
train
GiulioRossetti/dynetx
dynetx/classes/dyngraph.py
https://github.com/GiulioRossetti/dynetx/blob/634e2b38f8950885aebfa079dad7d5e8d7563f1d/dynetx/classes/dyngraph.py#L955-L1005
def time_slice(self, t_from, t_to=None): """Return an new graph containing nodes and interactions present in [t_from, t_to]. Parameters ---------- t_from : snapshot id, mandatory t_to : snapshot id, optional (default=None) If None t_to will be se...
[ "def", "time_slice", "(", "self", ",", "t_from", ",", "t_to", "=", "None", ")", ":", "# create new graph and copy subgraph into it", "H", "=", "self", ".", "__class__", "(", ")", "if", "t_to", "is", "not", "None", ":", "if", "t_to", "<", "t_from", ":", "...
Return an new graph containing nodes and interactions present in [t_from, t_to]. Parameters ---------- t_from : snapshot id, mandatory t_to : snapshot id, optional (default=None) If None t_to will be set equal to t_from Returns -...
[ "Return", "an", "new", "graph", "containing", "nodes", "and", "interactions", "present", "in", "[", "t_from", "t_to", "]", "." ]
python
train
opendatateam/udata
udata/commands/db.py
https://github.com/opendatateam/udata/blob/f016585af94b0ff6bd73738c700324adc8ba7f8f/udata/commands/db.py#L115-L119
def record_migration(plugin, filename, script, **kwargs): '''Only record a migration without applying it''' db = get_db() db.eval(RECORD_WRAPPER, plugin, filename, script) return True
[ "def", "record_migration", "(", "plugin", ",", "filename", ",", "script", ",", "*", "*", "kwargs", ")", ":", "db", "=", "get_db", "(", ")", "db", ".", "eval", "(", "RECORD_WRAPPER", ",", "plugin", ",", "filename", ",", "script", ")", "return", "True" ]
Only record a migration without applying it
[ "Only", "record", "a", "migration", "without", "applying", "it" ]
python
train
chrisjsewell/jsonextended
jsonextended/edict.py
https://github.com/chrisjsewell/jsonextended/blob/c3a7a880cc09789b3c61204265dcbb127be76c8a/jsonextended/edict.py#L941-L989
def remove_keyvals(d, keyvals=None, list_of_dicts=False, deepcopy=True): """remove paths with at least one branch leading to certain (key,value) pairs from dict Parameters ---------- d : dict keyvals : dict or list[tuple] (key,value) pairs to remove list_of_dicts: bool treat...
[ "def", "remove_keyvals", "(", "d", ",", "keyvals", "=", "None", ",", "list_of_dicts", "=", "False", ",", "deepcopy", "=", "True", ")", ":", "keyvals", "=", "[", "]", "if", "keyvals", "is", "None", "else", "keyvals", "list_of_dicts", "=", "'__list__'", "i...
remove paths with at least one branch leading to certain (key,value) pairs from dict Parameters ---------- d : dict keyvals : dict or list[tuple] (key,value) pairs to remove list_of_dicts: bool treat list of dicts as additional branches Examples -------- >>> from p...
[ "remove", "paths", "with", "at", "least", "one", "branch", "leading", "to", "certain", "(", "key", "value", ")", "pairs", "from", "dict" ]
python
train
awslabs/sockeye
sockeye/extract_parameters.py
https://github.com/awslabs/sockeye/blob/5d64a1ee1ef3cbba17c6d1d94bc061020c43f6ab/sockeye/extract_parameters.py#L92-L100
def main(): """ Commandline interface to extract parameters. """ setup_main_logger(console=True, file_logging=False) params = argparse.ArgumentParser(description="Extract specific parameters.") arguments.add_extract_args(params) args = params.parse_args() extract_parameters(args)
[ "def", "main", "(", ")", ":", "setup_main_logger", "(", "console", "=", "True", ",", "file_logging", "=", "False", ")", "params", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Extract specific parameters.\"", ")", "arguments", ".", "add_ext...
Commandline interface to extract parameters.
[ "Commandline", "interface", "to", "extract", "parameters", "." ]
python
train
l-hedgehog/sulu
sulu.py
https://github.com/l-hedgehog/sulu/blob/3fe2c318d842873ba06b2d84c3e80625ab486f94/sulu.py#L45-L82
def serialize_rdf(update_graph, signing): '''Tweak rdflib's pretty-xml serialization of update_graph into the "indentical" representation as defined in http://mzl.la/x4XF6o ''' unsorted_s = update_graph.serialize(format = 'pretty-xml') unsorted_s = unsorted_s.replace('xmlns:rdf', 'xmlns:RDF') un...
[ "def", "serialize_rdf", "(", "update_graph", ",", "signing", ")", ":", "unsorted_s", "=", "update_graph", ".", "serialize", "(", "format", "=", "'pretty-xml'", ")", "unsorted_s", "=", "unsorted_s", ".", "replace", "(", "'xmlns:rdf'", ",", "'xmlns:RDF'", ")", "...
Tweak rdflib's pretty-xml serialization of update_graph into the "indentical" representation as defined in http://mzl.la/x4XF6o
[ "Tweak", "rdflib", "s", "pretty", "-", "xml", "serialization", "of", "update_graph", "into", "the", "indentical", "representation", "as", "defined", "in", "http", ":", "//", "mzl", ".", "la", "/", "x4XF6o" ]
python
train
DarkEnergySurvey/ugali
ugali/utils/factory.py
https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/factory.py#L9-L23
def factory(type, module=None, **kwargs): """ Factory for creating objects. Arguments are passed directly to the constructor of the chosen class. """ cls = type if module is None: module = __name__ fn = lambda member: inspect.isclass(member) and member.__module__==module classes = odict(...
[ "def", "factory", "(", "type", ",", "module", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cls", "=", "type", "if", "module", "is", "None", ":", "module", "=", "__name__", "fn", "=", "lambda", "member", ":", "inspect", ".", "isclass", "(", "mem...
Factory for creating objects. Arguments are passed directly to the constructor of the chosen class.
[ "Factory", "for", "creating", "objects", ".", "Arguments", "are", "passed", "directly", "to", "the", "constructor", "of", "the", "chosen", "class", "." ]
python
train
metacloud/gilt
gilt/git.py
https://github.com/metacloud/gilt/blob/234eec23fe2f8144369d0ec3b35ad2fef508b8d1/gilt/git.py#L77-L106
def overlay(repository, files, version, debug=False): """ Overlay files from the specified repository/version into the given directory and return None. :param repository: A string containing the path to the repository to be extracted. :param files: A list of `FileConfig` objects. :param ve...
[ "def", "overlay", "(", "repository", ",", "files", ",", "version", ",", "debug", "=", "False", ")", ":", "with", "util", ".", "saved_cwd", "(", ")", ":", "os", ".", "chdir", "(", "repository", ")", "_get_version", "(", "version", ",", "debug", ")", "...
Overlay files from the specified repository/version into the given directory and return None. :param repository: A string containing the path to the repository to be extracted. :param files: A list of `FileConfig` objects. :param version: A string containing the branch/tag/sha to be exported. ...
[ "Overlay", "files", "from", "the", "specified", "repository", "/", "version", "into", "the", "given", "directory", "and", "return", "None", "." ]
python
train
GoogleCloudPlatform/appengine-gcs-client
python/src/cloudstorage/storage_api.py
https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/python/src/cloudstorage/storage_api.py#L606-L620
def read(self, size=-1): """Returns bytes from self._buffer and update related offsets. Args: size: number of bytes to read starting from current offset. Read the entire buffer if negative. Returns: Requested bytes from buffer. """ if size < 0: offset = len(self._buffer) ...
[ "def", "read", "(", "self", ",", "size", "=", "-", "1", ")", ":", "if", "size", "<", "0", ":", "offset", "=", "len", "(", "self", ".", "_buffer", ")", "else", ":", "offset", "=", "self", ".", "_offset", "+", "size", "return", "self", ".", "read...
Returns bytes from self._buffer and update related offsets. Args: size: number of bytes to read starting from current offset. Read the entire buffer if negative. Returns: Requested bytes from buffer.
[ "Returns", "bytes", "from", "self", ".", "_buffer", "and", "update", "related", "offsets", "." ]
python
train
ttinies/sc2players
sc2players/playerManagement.py
https://github.com/ttinies/sc2players/blob/fd9b37c268bf1005d9ef73a25e65ed97c8b7895f/sc2players/playerManagement.py#L47-L52
def getPlayer(name): """obtain a specific PlayerRecord settings file""" if isinstance(name, PlayerRecord): return name try: return getKnownPlayers()[name.lower()] except KeyError: raise ValueError("given player name '%s' is not a known player definition"%(name))
[ "def", "getPlayer", "(", "name", ")", ":", "if", "isinstance", "(", "name", ",", "PlayerRecord", ")", ":", "return", "name", "try", ":", "return", "getKnownPlayers", "(", ")", "[", "name", ".", "lower", "(", ")", "]", "except", "KeyError", ":", "raise"...
obtain a specific PlayerRecord settings file
[ "obtain", "a", "specific", "PlayerRecord", "settings", "file" ]
python
train
santosjorge/cufflinks
cufflinks/pandastools.py
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/pandastools.py#L78-L99
def normalize(self,asOf=None,multiplier=100): """ Returns a normalized series or DataFrame Example: Series.normalize() Returns: series of DataFrame Parameters: ----------- asOf : string Date format '2015-02-29' multiplier : int Factor by which the results will be adjusted """ if not asOf: ...
[ "def", "normalize", "(", "self", ",", "asOf", "=", "None", ",", "multiplier", "=", "100", ")", ":", "if", "not", "asOf", ":", "x0", "=", "self", ".", "ix", "[", "0", "]", "else", ":", "x0", "=", "self", ".", "ix", "[", "asOf", "]", "return", ...
Returns a normalized series or DataFrame Example: Series.normalize() Returns: series of DataFrame Parameters: ----------- asOf : string Date format '2015-02-29' multiplier : int Factor by which the results will be adjusted
[ "Returns", "a", "normalized", "series", "or", "DataFrame", "Example", ":", "Series", ".", "normalize", "()" ]
python
train
jahuth/litus
spikes.py
https://github.com/jahuth/litus/blob/712b016ea2dbb1cf0a30bfdbb0a136945a7b7c5e/spikes.py#L971-L990
def _absolute_spike_times_from_labels(self,time_dimension=0,*args,**kwargs): """ internal function that gives absolute_spike_times_from_labels, as well as the factor (maximum range) """ x = self[time_dimension].copy() #x = self.spike_times.get_converted(time_dime...
[ "def", "_absolute_spike_times_from_labels", "(", "self", ",", "time_dimension", "=", "0", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "x", "=", "self", "[", "time_dimension", "]", ".", "copy", "(", ")", "#x = self.spike_times.get_converted(time_dimensio...
internal function that gives absolute_spike_times_from_labels, as well as the factor (maximum range)
[ "internal", "function", "that", "gives", "absolute_spike_times_from_labels", "as", "well", "as", "the", "factor", "(", "maximum", "range", ")" ]
python
train
mitsei/dlkit
dlkit/json_/relationship/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L490-L511
def get_relationships_for_destination_on_date(self, destination_id, from_, to): """Gets a ``RelationshipList`` corresponding to the given peer ``Id`` with a starting effective date in the given range inclusive. arg: destination_id (osid.id.Id): a peer ``Id`` arg: from (osid.calendaring.Da...
[ "def", "get_relationships_for_destination_on_date", "(", "self", ",", "destination_id", ",", "from_", ",", "to", ")", ":", "# Implemented from template for", "# osid.relationship.RelationshipLookupSession.get_relationships_for_destination_on_date", "relationship_list", "=", "[", "]...
Gets a ``RelationshipList`` corresponding to the given peer ``Id`` with a starting effective date in the given range inclusive. arg: destination_id (osid.id.Id): a peer ``Id`` arg: from (osid.calendaring.DateTime): starting date arg: to (osid.calendaring.DateTime): ending date ...
[ "Gets", "a", "RelationshipList", "corresponding", "to", "the", "given", "peer", "Id", "with", "a", "starting", "effective", "date", "in", "the", "given", "range", "inclusive", "." ]
python
train
newville/wxmplot
wxmplot/stackedplotframe.py
https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/stackedplotframe.py#L94-L97
def set_ylabel(self,s, panel='top'): "set plot xlabel" panel = self.get_panel(panel) panel.set_ylabel(s)
[ "def", "set_ylabel", "(", "self", ",", "s", ",", "panel", "=", "'top'", ")", ":", "panel", "=", "self", ".", "get_panel", "(", "panel", ")", "panel", ".", "set_ylabel", "(", "s", ")" ]
set plot xlabel
[ "set", "plot", "xlabel" ]
python
train
RudolfCardinal/pythonlib
cardinal_pythonlib/datetimefunc.py
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/datetimefunc.py#L191-L201
def format_datetime(d: PotentialDatetimeType, fmt: str, default: str = None) -> Optional[str]: """ Format a datetime with a ``strftime`` format specification string, or return ``default`` if the input is ``None``. """ d = coerce_to_pendulum(d) if d is None...
[ "def", "format_datetime", "(", "d", ":", "PotentialDatetimeType", ",", "fmt", ":", "str", ",", "default", ":", "str", "=", "None", ")", "->", "Optional", "[", "str", "]", ":", "d", "=", "coerce_to_pendulum", "(", "d", ")", "if", "d", "is", "None", ":...
Format a datetime with a ``strftime`` format specification string, or return ``default`` if the input is ``None``.
[ "Format", "a", "datetime", "with", "a", "strftime", "format", "specification", "string", "or", "return", "default", "if", "the", "input", "is", "None", "." ]
python
train
albu/albumentations
albumentations/augmentations/bbox_utils.py
https://github.com/albu/albumentations/blob/b31393cd6126516d37a84e44c879bd92c68ffc93/albumentations/augmentations/bbox_utils.py#L47-L52
def calculate_bbox_area(bbox, rows, cols): """Calculate the area of a bounding box in pixels.""" bbox = denormalize_bbox(bbox, rows, cols) x_min, y_min, x_max, y_max = bbox[:4] area = (x_max - x_min) * (y_max - y_min) return area
[ "def", "calculate_bbox_area", "(", "bbox", ",", "rows", ",", "cols", ")", ":", "bbox", "=", "denormalize_bbox", "(", "bbox", ",", "rows", ",", "cols", ")", "x_min", ",", "y_min", ",", "x_max", ",", "y_max", "=", "bbox", "[", ":", "4", "]", "area", ...
Calculate the area of a bounding box in pixels.
[ "Calculate", "the", "area", "of", "a", "bounding", "box", "in", "pixels", "." ]
python
train
sternoru/goscalecms
goscale/decorators.py
https://github.com/sternoru/goscalecms/blob/7eee50357c47ebdfe3e573a8b4be3b67892d229e/goscale/decorators.py#L91-L102
def get_cached_item(cache_key, alternative_cache_key, *func_args, **func_kwargs): """Not a decorator, but a helper function to retrieve the cached item for a key created via get_cache_key. Args: - cache_key: if there was a specific cache key used to cache the function, it should be provided ...
[ "def", "get_cached_item", "(", "cache_key", ",", "alternative_cache_key", ",", "*", "func_args", ",", "*", "*", "func_kwargs", ")", ":", "key", "=", "get_cache_key", "(", "cache_key", ",", "func", ",", "*", "func_args", ",", "*", "*", "func_kwargs", ")", "...
Not a decorator, but a helper function to retrieve the cached item for a key created via get_cache_key. Args: - cache_key: if there was a specific cache key used to cache the function, it should be provided here. If not this should be None - func: the function which was cache - *...
[ "Not", "a", "decorator", "but", "a", "helper", "function", "to", "retrieve", "the", "cached", "item", "for", "a", "key", "created", "via", "get_cache_key", ".", "Args", ":", "-", "cache_key", ":", "if", "there", "was", "a", "specific", "cache", "key", "u...
python
train
zero-os/0-core
client/py-client/zeroos/core0/client/client.py
https://github.com/zero-os/0-core/blob/69f6ce845ab8b8ad805a79a415227e7ac566c218/client/py-client/zeroos/core0/client/client.py#L1710-L1739
def getinfo(self, disk, part=''): """ Get more info about a disk or a disk partition :param disk: (/dev/sda, /dev/sdb, etc..) :param part: (/dev/sda1, /dev/sdb2, etc...) :return: a dict with {"blocksize", "start", "size", and "free" sections} """ args = { ...
[ "def", "getinfo", "(", "self", ",", "disk", ",", "part", "=", "''", ")", ":", "args", "=", "{", "\"disk\"", ":", "disk", ",", "\"part\"", ":", "part", ",", "}", "self", ".", "_getpart_chk", ".", "check", "(", "args", ")", "response", "=", "self", ...
Get more info about a disk or a disk partition :param disk: (/dev/sda, /dev/sdb, etc..) :param part: (/dev/sda1, /dev/sdb2, etc...) :return: a dict with {"blocksize", "start", "size", and "free" sections}
[ "Get", "more", "info", "about", "a", "disk", "or", "a", "disk", "partition" ]
python
train
petl-developers/petl
petl/transform/reductions.py
https://github.com/petl-developers/petl/blob/1d33ca055f7e04e0d28a772041c9fd30c8d415d6/petl/transform/reductions.py#L335-L342
def groupcountdistinctvalues(table, key, value): """Group by the `key` field then count the number of distinct values in the `value` field.""" s1 = cut(table, key, value) s2 = distinct(s1) s3 = aggregate(s2, key, len) return s3
[ "def", "groupcountdistinctvalues", "(", "table", ",", "key", ",", "value", ")", ":", "s1", "=", "cut", "(", "table", ",", "key", ",", "value", ")", "s2", "=", "distinct", "(", "s1", ")", "s3", "=", "aggregate", "(", "s2", ",", "key", ",", "len", ...
Group by the `key` field then count the number of distinct values in the `value` field.
[ "Group", "by", "the", "key", "field", "then", "count", "the", "number", "of", "distinct", "values", "in", "the", "value", "field", "." ]
python
train
kubernetes-client/python
kubernetes/client/apis/storage_v1_api.py
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/storage_v1_api.py#L945-L971
def list_volume_attachment(self, **kwargs): """ list or watch objects of kind VolumeAttachment This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_volume_attachment(async_req=True) ...
[ "def", "list_volume_attachment", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "list_volume_attachment_with_http_info"...
list or watch objects of kind VolumeAttachment This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_volume_attachment(async_req=True) >>> result = thread.get() :param async_req bool ...
[ "list", "or", "watch", "objects", "of", "kind", "VolumeAttachment", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ">>>"...
python
train
gem/oq-engine
openquake/baselib/parallel.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/baselib/parallel.py#L390-L440
def safely_call(func, args, task_no=0, mon=dummy_mon): """ Call the given function with the given arguments safely, i.e. by trapping the exceptions. Return a pair (result, exc_type) where exc_type is None if no exceptions occur, otherwise it is the exception class and the result is a string containi...
[ "def", "safely_call", "(", "func", ",", "args", ",", "task_no", "=", "0", ",", "mon", "=", "dummy_mon", ")", ":", "isgenfunc", "=", "inspect", ".", "isgeneratorfunction", "(", "func", ")", "if", "hasattr", "(", "args", "[", "0", "]", ",", "'unpickle'",...
Call the given function with the given arguments safely, i.e. by trapping the exceptions. Return a pair (result, exc_type) where exc_type is None if no exceptions occur, otherwise it is the exception class and the result is a string containing error message and traceback. :param func: the function ...
[ "Call", "the", "given", "function", "with", "the", "given", "arguments", "safely", "i", ".", "e", ".", "by", "trapping", "the", "exceptions", ".", "Return", "a", "pair", "(", "result", "exc_type", ")", "where", "exc_type", "is", "None", "if", "no", "exce...
python
train
materialsproject/pymatgen
pymatgen/analysis/structure_matcher.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_matcher.py#L428-L464
def _get_supercells(self, struct1, struct2, fu, s1_supercell): """ Computes all supercells of one structure close to the lattice of the other if s1_supercell == True, it makes the supercells of struct1, otherwise it makes them of s2 yields: s1, s2, supercell_matrix, aver...
[ "def", "_get_supercells", "(", "self", ",", "struct1", ",", "struct2", ",", "fu", ",", "s1_supercell", ")", ":", "def", "av_lat", "(", "l1", ",", "l2", ")", ":", "params", "=", "(", "np", ".", "array", "(", "l1", ".", "lengths_and_angles", ")", "+", ...
Computes all supercells of one structure close to the lattice of the other if s1_supercell == True, it makes the supercells of struct1, otherwise it makes them of s2 yields: s1, s2, supercell_matrix, average_lattice, supercell_matrix
[ "Computes", "all", "supercells", "of", "one", "structure", "close", "to", "the", "lattice", "of", "the", "other", "if", "s1_supercell", "==", "True", "it", "makes", "the", "supercells", "of", "struct1", "otherwise", "it", "makes", "them", "of", "s2" ]
python
train
dh1tw/pyhamtools
pyhamtools/locator.py
https://github.com/dh1tw/pyhamtools/blob/ee7e4b8732e23c298da10e07163748156c16d0fa/pyhamtools/locator.py#L57-L125
def locator_to_latlong (locator): """converts Maidenhead locator in the corresponding WGS84 coordinates Args: locator (string): Locator, either 4 or 6 characters Returns: tuple (float, float): Latitude, Longitude Raises: ValueError: When called with wro...
[ "def", "locator_to_latlong", "(", "locator", ")", ":", "locator", "=", "locator", ".", "upper", "(", ")", "if", "len", "(", "locator", ")", "==", "5", "or", "len", "(", "locator", ")", "<", "4", ":", "raise", "ValueError", "if", "ord", "(", "locator"...
converts Maidenhead locator in the corresponding WGS84 coordinates Args: locator (string): Locator, either 4 or 6 characters Returns: tuple (float, float): Latitude, Longitude Raises: ValueError: When called with wrong or invalid input arg TypeE...
[ "converts", "Maidenhead", "locator", "in", "the", "corresponding", "WGS84", "coordinates" ]
python
train
robinandeer/puzzle
puzzle/plugins/vcf/mixins/variant_mixin.py
https://github.com/robinandeer/puzzle/blob/9476f05b416d3a5135d25492cb31411fdf831c58/puzzle/plugins/vcf/mixins/variant_mixin.py#L233-L317
def _format_variants(self, variant, index, case_obj, add_all_info=False): """Return a Variant object Format variant make a variant that includes enough information for the variant view. If add_all_info then all transcripts will be parsed Args: variant (cython2.Varia...
[ "def", "_format_variants", "(", "self", ",", "variant", ",", "index", ",", "case_obj", ",", "add_all_info", "=", "False", ")", ":", "header_line", "=", "self", ".", "head", ".", "header", "# Get the individual ids for individuals in vcf file", "vcf_individuals", "="...
Return a Variant object Format variant make a variant that includes enough information for the variant view. If add_all_info then all transcripts will be parsed Args: variant (cython2.Variant): A variant object index (int): The index of the variant c...
[ "Return", "a", "Variant", "object" ]
python
train
SHTOOLS/SHTOOLS
pyshtools/shio/shread.py
https://github.com/SHTOOLS/SHTOOLS/blob/9a115cf83002df2ddec6b7f41aeb6be688e285de/pyshtools/shio/shread.py#L240-L258
def _iscomment(line): """ Determine if a line is a comment line. A valid line contains at least three words, with the first two being integers. Note that Python 2 and 3 deal with strings differently. """ if line.isspace(): return True elif len(line.split()) >= 3: try: # pyth...
[ "def", "_iscomment", "(", "line", ")", ":", "if", "line", ".", "isspace", "(", ")", ":", "return", "True", "elif", "len", "(", "line", ".", "split", "(", ")", ")", ">=", "3", ":", "try", ":", "# python 3 str", "if", "line", ".", "split", "(", ")"...
Determine if a line is a comment line. A valid line contains at least three words, with the first two being integers. Note that Python 2 and 3 deal with strings differently.
[ "Determine", "if", "a", "line", "is", "a", "comment", "line", ".", "A", "valid", "line", "contains", "at", "least", "three", "words", "with", "the", "first", "two", "being", "integers", ".", "Note", "that", "Python", "2", "and", "3", "deal", "with", "s...
python
train
relwell/corenlp-xml-lib
corenlp_xml/document.py
https://github.com/relwell/corenlp-xml-lib/blob/9b0f8c912ba3ecedd34473f74a9f2d033a75baf9/corenlp_xml/document.py#L276-L288
def collapsed_ccprocessed_dependencies(self): """ Accesses collapsed, CC-processed dependencies :getter: Returns the dependency graph for collapsed and cc processed dependencies :type: corenlp_xml.dependencies.DependencyGraph """ if self._basic_dependencies is None: ...
[ "def", "collapsed_ccprocessed_dependencies", "(", "self", ")", ":", "if", "self", ".", "_basic_dependencies", "is", "None", ":", "deps", "=", "self", ".", "_element", ".", "xpath", "(", "'dependencies[@type=\"collapsed-ccprocessed-dependencies\"]'", ")", "if", "len", ...
Accesses collapsed, CC-processed dependencies :getter: Returns the dependency graph for collapsed and cc processed dependencies :type: corenlp_xml.dependencies.DependencyGraph
[ "Accesses", "collapsed", "CC", "-", "processed", "dependencies" ]
python
train
mila-iqia/fuel
fuel/converters/caltech101_silhouettes.py
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/converters/caltech101_silhouettes.py#L9-L61
def convert_silhouettes(size, directory, output_directory, output_filename=None): """ Convert the CalTech 101 Silhouettes Datasets. Parameters ---------- size : {16, 28} Convert either the 16x16 or 28x28 sized version of the dataset. directory : str Directory...
[ "def", "convert_silhouettes", "(", "size", ",", "directory", ",", "output_directory", ",", "output_filename", "=", "None", ")", ":", "if", "size", "not", "in", "(", "16", ",", "28", ")", ":", "raise", "ValueError", "(", "'size must be 16 or 28'", ")", "if", ...
Convert the CalTech 101 Silhouettes Datasets. Parameters ---------- size : {16, 28} Convert either the 16x16 or 28x28 sized version of the dataset. directory : str Directory in which the required input files reside. output_filename : str Where to save the converted dataset.
[ "Convert", "the", "CalTech", "101", "Silhouettes", "Datasets", "." ]
python
train
pycontribs/pyrax
pyrax/queueing.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/queueing.py#L347-L358
def delete(self, msg, claim_id=None): """ Deletes the specified message from its queue. If the message has been claimed, the ID of that claim must be passed as the 'claim_id' parameter. """ msg_id = utils.get_id(msg) if claim_id: uri = "/%s/%s?claim_id...
[ "def", "delete", "(", "self", ",", "msg", ",", "claim_id", "=", "None", ")", ":", "msg_id", "=", "utils", ".", "get_id", "(", "msg", ")", "if", "claim_id", ":", "uri", "=", "\"/%s/%s?claim_id=%s\"", "%", "(", "self", ".", "uri_base", ",", "msg_id", "...
Deletes the specified message from its queue. If the message has been claimed, the ID of that claim must be passed as the 'claim_id' parameter.
[ "Deletes", "the", "specified", "message", "from", "its", "queue", ".", "If", "the", "message", "has", "been", "claimed", "the", "ID", "of", "that", "claim", "must", "be", "passed", "as", "the", "claim_id", "parameter", "." ]
python
train
amaas-fintech/amaas-core-sdk-python
amaascore/transactions/interface.py
https://github.com/amaas-fintech/amaas-core-sdk-python/blob/347b71f8e776b2dde582b015e31b4802d91e8040/amaascore/transactions/interface.py#L536-L574
def pnl_search(self, asset_manager_id, pnl_type, business_date, **kwargs): """ Search pnl records. Args: asset_manager_id (int): id of asset manager owning the pnl records pnl_type (str): either "Position" or "Transaction business_date (dat...
[ "def", "pnl_search", "(", "self", ",", "asset_manager_id", ",", "pnl_type", ",", "business_date", ",", "*", "*", "kwargs", ")", ":", "self", ".", "logger", ".", "info", "(", "'Retrieving Pnls - Asset Manager: %s - Business Date: %s'", "%", "(", "asset_manager_id", ...
Search pnl records. Args: asset_manager_id (int): id of asset manager owning the pnl records pnl_type (str): either "Position" or "Transaction business_date (date): date of the pnl records to return book_ids (list): book id filter on pnl records asset...
[ "Search", "pnl", "records", "." ]
python
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/applelink.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/applelink.py#L42-L68
def generate(env): """Add Builders and construction variables for applelink to an Environment.""" link.generate(env) env['FRAMEWORKPATHPREFIX'] = '-F' env['_FRAMEWORKPATH'] = '${_concat(FRAMEWORKPATHPREFIX, FRAMEWORKPATH, "", __env__)}' env['_FRAMEWORKS'] = '${_concat("-framework ", FRAMEWORKS,...
[ "def", "generate", "(", "env", ")", ":", "link", ".", "generate", "(", "env", ")", "env", "[", "'FRAMEWORKPATHPREFIX'", "]", "=", "'-F'", "env", "[", "'_FRAMEWORKPATH'", "]", "=", "'${_concat(FRAMEWORKPATHPREFIX, FRAMEWORKPATH, \"\", __env__)}'", "env", "[", "'_FR...
Add Builders and construction variables for applelink to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "applelink", "to", "an", "Environment", "." ]
python
train
briney/abutils
abutils/core/sequence.py
https://github.com/briney/abutils/blob/944755fc7d28bfc7d4f1ffad94ca0bf9d74ec54b/abutils/core/sequence.py#L183-L191
def fasta(self): ''' str: Returns the sequence, as a FASTA-formatted string Note: The FASTA string is built using ``Sequence.id`` and ``Sequence.sequence``. ''' if not self._fasta: self._fasta = '>{}\n{}'.format(self.id, self.sequence) return self._fasta
[ "def", "fasta", "(", "self", ")", ":", "if", "not", "self", ".", "_fasta", ":", "self", ".", "_fasta", "=", "'>{}\\n{}'", ".", "format", "(", "self", ".", "id", ",", "self", ".", "sequence", ")", "return", "self", ".", "_fasta" ]
str: Returns the sequence, as a FASTA-formatted string Note: The FASTA string is built using ``Sequence.id`` and ``Sequence.sequence``.
[ "str", ":", "Returns", "the", "sequence", "as", "a", "FASTA", "-", "formatted", "string" ]
python
train
lionel/counterparts
counterparts.py
https://github.com/lionel/counterparts/blob/20db9852feff531f854972f76b412c442b2fafbf/counterparts.py#L199-L222
def no_counterpart_found(string, options, rc_so_far): """Takes action determined by options.else_action. Unless told to raise an exception, this function returns the errno that is supposed to be returned in this case. :param string: The lookup string. :param options: ArgumentParser or equivalent t...
[ "def", "no_counterpart_found", "(", "string", ",", "options", ",", "rc_so_far", ")", ":", "logger", ".", "debug", "(", "\"options.else_action: %s\"", ",", "options", ".", "else_action", ")", "if", "options", ".", "else_action", "==", "\"passthrough\"", ":", "for...
Takes action determined by options.else_action. Unless told to raise an exception, this function returns the errno that is supposed to be returned in this case. :param string: The lookup string. :param options: ArgumentParser or equivalent to provide options.else_action, options.else_errno, op...
[ "Takes", "action", "determined", "by", "options", ".", "else_action", ".", "Unless", "told", "to", "raise", "an", "exception", "this", "function", "returns", "the", "errno", "that", "is", "supposed", "to", "be", "returned", "in", "this", "case", "." ]
python
train
google/grumpy
third_party/pythonparser/parser.py
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/pythonparser/parser.py#L1455-L1460
def star_expr__30(self, star_opt, expr): """(3.0, 3.1) star_expr: ['*'] expr""" if star_opt: return ast.Starred(value=expr, ctx=None, star_loc=star_opt, loc=expr.loc.join(star_opt)) return expr
[ "def", "star_expr__30", "(", "self", ",", "star_opt", ",", "expr", ")", ":", "if", "star_opt", ":", "return", "ast", ".", "Starred", "(", "value", "=", "expr", ",", "ctx", "=", "None", ",", "star_loc", "=", "star_opt", ",", "loc", "=", "expr", ".", ...
(3.0, 3.1) star_expr: ['*'] expr
[ "(", "3", ".", "0", "3", ".", "1", ")", "star_expr", ":", "[", "*", "]", "expr" ]
python
valid
aio-libs/aiohttp
aiohttp/http_websocket.py
https://github.com/aio-libs/aiohttp/blob/9504fe2affaaff673fa4f3754c1c44221f8ba47d/aiohttp/http_websocket.py#L622-L626
async def pong(self, message: bytes=b'') -> None: """Send pong message.""" if isinstance(message, str): message = message.encode('utf-8') await self._send_frame(message, WSMsgType.PONG)
[ "async", "def", "pong", "(", "self", ",", "message", ":", "bytes", "=", "b''", ")", "->", "None", ":", "if", "isinstance", "(", "message", ",", "str", ")", ":", "message", "=", "message", ".", "encode", "(", "'utf-8'", ")", "await", "self", ".", "_...
Send pong message.
[ "Send", "pong", "message", "." ]
python
train
sentinel-hub/sentinelhub-py
sentinelhub/constants.py
https://github.com/sentinel-hub/sentinelhub-py/blob/08a83b7f1e289187159a643336995d8369860fea/sentinelhub/constants.py#L225-L239
def _get_utm_code(zone, direction): """ Get UTM code given a zone and direction Direction is encoded as NORTH=6, SOUTH=7, while zone is the UTM zone number zero-padded. For instance, the code 32604 is returned for zone number 4, north direction. :param zone: UTM zone number :type zone: int :pa...
[ "def", "_get_utm_code", "(", "zone", ",", "direction", ")", ":", "dir_dict", "=", "{", "_Direction", ".", "NORTH", ":", "'6'", ",", "_Direction", ".", "SOUTH", ":", "'7'", "}", "return", "'{}{}{}'", ".", "format", "(", "'32'", ",", "dir_dict", "[", "di...
Get UTM code given a zone and direction Direction is encoded as NORTH=6, SOUTH=7, while zone is the UTM zone number zero-padded. For instance, the code 32604 is returned for zone number 4, north direction. :param zone: UTM zone number :type zone: int :param direction: Direction enum type :type...
[ "Get", "UTM", "code", "given", "a", "zone", "and", "direction" ]
python
train
nornir-automation/nornir
nornir/core/inventory.py
https://github.com/nornir-automation/nornir/blob/3425c47fd870db896cb80f619bae23bd98d50c74/nornir/core/inventory.py#L198-L212
def get(self, item, default=None): """ Returns the value ``item`` from the host or hosts group variables. Arguments: item(``str``): The variable to get default(``any``): Return value if item not found """ if hasattr(self, item): return getattr...
[ "def", "get", "(", "self", ",", "item", ",", "default", "=", "None", ")", ":", "if", "hasattr", "(", "self", ",", "item", ")", ":", "return", "getattr", "(", "self", ",", "item", ")", "try", ":", "return", "self", ".", "__getitem__", "(", "item", ...
Returns the value ``item`` from the host or hosts group variables. Arguments: item(``str``): The variable to get default(``any``): Return value if item not found
[ "Returns", "the", "value", "item", "from", "the", "host", "or", "hosts", "group", "variables", "." ]
python
train
gwastro/pycbc
pycbc/workflow/core.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/workflow/core.py#L1542-L1547
def dump(self, filename): """ Output this AhopeFileList to a pickle file """ f = open(filename, 'w') cPickle.dump(self, f)
[ "def", "dump", "(", "self", ",", "filename", ")", ":", "f", "=", "open", "(", "filename", ",", "'w'", ")", "cPickle", ".", "dump", "(", "self", ",", "f", ")" ]
Output this AhopeFileList to a pickle file
[ "Output", "this", "AhopeFileList", "to", "a", "pickle", "file" ]
python
train
TissueMAPS/TmClient
src/python/tmclient/api.py
https://github.com/TissueMAPS/TmClient/blob/6fb40622af19142cb5169a64b8c2965993a25ab1/src/python/tmclient/api.py#L2642-L2671
def upload_jterator_project(self, pipeline, handles): '''Uploads a *jterator* project. Parameters ---------- pipeline: dict description of the jterator pipeline handles: dict, optional description of each module in the jterator pipeline See also ...
[ "def", "upload_jterator_project", "(", "self", ",", "pipeline", ",", "handles", ")", ":", "logger", ".", "info", "(", "'upload jterator project for experiment \"%s\"'", ",", "self", ".", "experiment_name", ")", "content", "=", "{", "'pipeline'", ":", "pipeline", "...
Uploads a *jterator* project. Parameters ---------- pipeline: dict description of the jterator pipeline handles: dict, optional description of each module in the jterator pipeline See also -------- :func:`tmserver.api.workflow.update_jter...
[ "Uploads", "a", "*", "jterator", "*", "project", "." ]
python
train
BerkeleyAutomation/perception
perception/image.py
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L797-L807
def finite_pixels(self): """ Return an array of the finite pixels. Returns ------- :obj:`numpy.ndarray` Nx2 array of the finite pixels """ finite_px = np.where(np.isfinite(self.data)) finite_px = np.c_[finite_px[0], finite_px[1]] return finit...
[ "def", "finite_pixels", "(", "self", ")", ":", "finite_px", "=", "np", ".", "where", "(", "np", ".", "isfinite", "(", "self", ".", "data", ")", ")", "finite_px", "=", "np", ".", "c_", "[", "finite_px", "[", "0", "]", ",", "finite_px", "[", "1", "...
Return an array of the finite pixels. Returns ------- :obj:`numpy.ndarray` Nx2 array of the finite pixels
[ "Return", "an", "array", "of", "the", "finite", "pixels", "." ]
python
train
manns/pyspread
pyspread/src/actions/_grid_actions.py
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_actions.py#L1201-L1209
def zoom_out(self): """Zooms out by zoom factor""" zoom = self.grid.grid_renderer.zoom target_zoom = zoom * (1 - config["zoom_factor"]) if target_zoom > config["minimum_zoom"]: self.zoom(target_zoom)
[ "def", "zoom_out", "(", "self", ")", ":", "zoom", "=", "self", ".", "grid", ".", "grid_renderer", ".", "zoom", "target_zoom", "=", "zoom", "*", "(", "1", "-", "config", "[", "\"zoom_factor\"", "]", ")", "if", "target_zoom", ">", "config", "[", "\"minim...
Zooms out by zoom factor
[ "Zooms", "out", "by", "zoom", "factor" ]
python
train
HttpRunner/HttpRunner
httprunner/parser.py
https://github.com/HttpRunner/HttpRunner/blob/f259551bf9c8ba905eae5c1afcf2efea20ae0871/httprunner/parser.py#L878-L896
def __prepare_config(config, project_mapping, session_variables_set=None): """ parse testcase/testsuite config. """ # get config variables raw_config_variables = config.pop("variables", {}) raw_config_variables_mapping = utils.ensure_mapping_format(raw_config_variables) override_variables = util...
[ "def", "__prepare_config", "(", "config", ",", "project_mapping", ",", "session_variables_set", "=", "None", ")", ":", "# get config variables", "raw_config_variables", "=", "config", ".", "pop", "(", "\"variables\"", ",", "{", "}", ")", "raw_config_variables_mapping"...
parse testcase/testsuite config.
[ "parse", "testcase", "/", "testsuite", "config", "." ]
python
train
newville/wxmplot
wxmplot/basepanel.py
https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/basepanel.py#L287-L296
def onRightDown(self, event=None): """ right button down: show pop-up""" if event is None: return # note that the matplotlib event location have to be converted if event.inaxes is not None and self.popup_menu is not None: pos = event.guiEvent.GetPosition() ...
[ "def", "onRightDown", "(", "self", ",", "event", "=", "None", ")", ":", "if", "event", "is", "None", ":", "return", "# note that the matplotlib event location have to be converted", "if", "event", ".", "inaxes", "is", "not", "None", "and", "self", ".", "popup_me...
right button down: show pop-up
[ "right", "button", "down", ":", "show", "pop", "-", "up" ]
python
train
mwgielen/jackal
jackal/scripts/nmap.py
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/nmap.py#L270-L314
def os_discovery(): """ Performs os (and domain) discovery of smb hosts. """ hs = HostSearch() hosts = hs.get_hosts(ports=[445], tags=['!nmap_os']) # TODO fix filter for emtpy fields. hosts = [host for host in hosts if not host.os] host_dict = {} for host in hosts: hos...
[ "def", "os_discovery", "(", ")", ":", "hs", "=", "HostSearch", "(", ")", "hosts", "=", "hs", ".", "get_hosts", "(", "ports", "=", "[", "445", "]", ",", "tags", "=", "[", "'!nmap_os'", "]", ")", "# TODO fix filter for emtpy fields.", "hosts", "=", "[", ...
Performs os (and domain) discovery of smb hosts.
[ "Performs", "os", "(", "and", "domain", ")", "discovery", "of", "smb", "hosts", "." ]
python
valid
scivision/histutils
histutils/timedmc.py
https://github.com/scivision/histutils/blob/859a91d3894cb57faed34881c6ea16130b90571e/histutils/timedmc.py#L69-L93
def datetime2unix(T): """ converts datetime to UT1 unix epoch time """ T = atleast_1d(T) ut1_unix = empty(T.shape, dtype=float) for i, t in enumerate(T): if isinstance(t, (datetime, datetime64)): pass elif isinstance(t, str): try: ut1_unix...
[ "def", "datetime2unix", "(", "T", ")", ":", "T", "=", "atleast_1d", "(", "T", ")", "ut1_unix", "=", "empty", "(", "T", ".", "shape", ",", "dtype", "=", "float", ")", "for", "i", ",", "t", "in", "enumerate", "(", "T", ")", ":", "if", "isinstance",...
converts datetime to UT1 unix epoch time
[ "converts", "datetime", "to", "UT1", "unix", "epoch", "time" ]
python
train
ArchiveTeam/wpull
wpull/document/css.py
https://github.com/ArchiveTeam/wpull/blob/ddf051aa3322479325ba20aa778cb2cb97606bf5/wpull/document/css.py#L44-L54
def is_file(cls, file): '''Return whether the file is likely CSS.''' peeked_data = wpull.string.printable_bytes( wpull.util.peek_file(file)).lower() if b'<html' in peeked_data: return VeryFalse if re.search(br'@import |color:|background[a-z-]*:|font[a-z-]*:', ...
[ "def", "is_file", "(", "cls", ",", "file", ")", ":", "peeked_data", "=", "wpull", ".", "string", ".", "printable_bytes", "(", "wpull", ".", "util", ".", "peek_file", "(", "file", ")", ")", ".", "lower", "(", ")", "if", "b'<html'", "in", "peeked_data", ...
Return whether the file is likely CSS.
[ "Return", "whether", "the", "file", "is", "likely", "CSS", "." ]
python
train
google/apitools
apitools/base/py/base_api.py
https://github.com/google/apitools/blob/f3745a7ea535aa0e88b0650c16479b696d6fd446/apitools/base/py/base_api.py#L479-L491
def GetMethodConfig(self, method): """Returns service cached method config for given method.""" method_config = self._method_configs.get(method) if method_config: return method_config func = getattr(self, method, None) if func is None: raise KeyError(metho...
[ "def", "GetMethodConfig", "(", "self", ",", "method", ")", ":", "method_config", "=", "self", ".", "_method_configs", ".", "get", "(", "method", ")", "if", "method_config", ":", "return", "method_config", "func", "=", "getattr", "(", "self", ",", "method", ...
Returns service cached method config for given method.
[ "Returns", "service", "cached", "method", "config", "for", "given", "method", "." ]
python
train
learningequality/ricecooker
ricecooker/utils/linecook.py
https://github.com/learningequality/ricecooker/blob/2f0385282500cb77ef2894646c6f9ce11bd7a853/ricecooker/utils/linecook.py#L26-L44
def chan_path_from_rel_path(rel_path, channeldir): """ Convert `rel_path` form os.walk tuple format to a tuple of directories and subdirectories, starting with the `channeldir` folder, e.g.,:: >>> chan_path_from_rel_path('content/open_stax_zip/Open Stax/Math/Elementary', ...
[ "def", "chan_path_from_rel_path", "(", "rel_path", ",", "channeldir", ")", ":", "rel_path_parts", "=", "rel_path", ".", "split", "(", "os", ".", "path", ".", "sep", ")", "dirs_before_channeldir", "=", "channeldir", ".", "split", "(", "os", ".", "path", ".", ...
Convert `rel_path` form os.walk tuple format to a tuple of directories and subdirectories, starting with the `channeldir` folder, e.g.,:: >>> chan_path_from_rel_path('content/open_stax_zip/Open Stax/Math/Elementary', 'content/open_stax_zip/Open Stax') 'Open Stax/Math...
[ "Convert", "rel_path", "form", "os", ".", "walk", "tuple", "format", "to", "a", "tuple", "of", "directories", "and", "subdirectories", "starting", "with", "the", "channeldir", "folder", "e", ".", "g", ".", "::" ]
python
train
peri-source/peri
scripts/does_matter/common.py
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/does_matter/common.py#L129-L138
def translate_fourier(image, dx): """ Translate an image in fourier-space with plane waves """ N = image.shape[0] f = 2*np.pi*np.fft.fftfreq(N) kx,ky,kz = np.meshgrid(*(f,)*3, indexing='ij') kv = np.array([kx,ky,kz]).T q = np.fft.fftn(image)*np.exp(-1.j*(kv*dx).sum(axis=-1)).T return np.re...
[ "def", "translate_fourier", "(", "image", ",", "dx", ")", ":", "N", "=", "image", ".", "shape", "[", "0", "]", "f", "=", "2", "*", "np", ".", "pi", "*", "np", ".", "fft", ".", "fftfreq", "(", "N", ")", "kx", ",", "ky", ",", "kz", "=", "np",...
Translate an image in fourier-space with plane waves
[ "Translate", "an", "image", "in", "fourier", "-", "space", "with", "plane", "waves" ]
python
valid
MJL85/natlas
natlas/output_diagram.py
https://github.com/MJL85/natlas/blob/5e7ae3cc7b5dd7ad884fa2b8b93bbdd9275474c4/natlas/output_diagram.py#L421-L498
def __get_node_text(self, diagram, node, fmt): ''' Generate the node text given the format string 'fmt' ''' fmt_proc = fmt # IF blocks while (1): if_block = re.search('<%if ([^%]*): ([^%]*)%>', fmt_proc) if (if_block == None): brea...
[ "def", "__get_node_text", "(", "self", ",", "diagram", ",", "node", ",", "fmt", ")", ":", "fmt_proc", "=", "fmt", "# IF blocks", "while", "(", "1", ")", ":", "if_block", "=", "re", ".", "search", "(", "'<%if ([^%]*): ([^%]*)%>'", ",", "fmt_proc", ")", "i...
Generate the node text given the format string 'fmt'
[ "Generate", "the", "node", "text", "given", "the", "format", "string", "fmt" ]
python
train
openvax/pyensembl
pyensembl/download_cache.py
https://github.com/openvax/pyensembl/blob/4b995fb72e848206d6fbf11950cf30964cd9b3aa/pyensembl/download_cache.py#L227-L241
def _copy_if_necessary(self, local_path, overwrite): """ Return cached path to local file, copying it to the cache if necessary. """ local_path = abspath(local_path) if not exists(local_path): raise MissingLocalFile(local_path) elif not self.copy_local_files_t...
[ "def", "_copy_if_necessary", "(", "self", ",", "local_path", ",", "overwrite", ")", ":", "local_path", "=", "abspath", "(", "local_path", ")", "if", "not", "exists", "(", "local_path", ")", ":", "raise", "MissingLocalFile", "(", "local_path", ")", "elif", "n...
Return cached path to local file, copying it to the cache if necessary.
[ "Return", "cached", "path", "to", "local", "file", "copying", "it", "to", "the", "cache", "if", "necessary", "." ]
python
train
adafruit/Adafruit_Python_CharLCD
Adafruit_CharLCD/Adafruit_CharLCD.py
https://github.com/adafruit/Adafruit_Python_CharLCD/blob/c126e6b673074c12a03f4bd36afb2fe40272341e/Adafruit_CharLCD/Adafruit_CharLCD.py#L455-L459
def is_pressed(self, button): """Return True if the provided button is pressed, False otherwise.""" if button not in set((SELECT, RIGHT, DOWN, UP, LEFT)): raise ValueError('Unknown button, must be SELECT, RIGHT, DOWN, UP, or LEFT.') return self._mcp.input(button) == GPIO.LOW
[ "def", "is_pressed", "(", "self", ",", "button", ")", ":", "if", "button", "not", "in", "set", "(", "(", "SELECT", ",", "RIGHT", ",", "DOWN", ",", "UP", ",", "LEFT", ")", ")", ":", "raise", "ValueError", "(", "'Unknown button, must be SELECT, RIGHT, DOWN, ...
Return True if the provided button is pressed, False otherwise.
[ "Return", "True", "if", "the", "provided", "button", "is", "pressed", "False", "otherwise", "." ]
python
train
pzs741/TEDT
TEDT/release_time.py
https://github.com/pzs741/TEDT/blob/6b6663227b755005fe1a1e3e807a05bdb521e066/TEDT/release_time.py#L111-L142
def common_time_extrator(self, string): """一般时间抽取,即年月日分别出现 Keyword arguments: string -- 含有时间的文本,str类型 """ try: if not self.year_check: str_year = int(re.search('(\d{4})年', string).group(1)) check_year = datetime.datetime....
[ "def", "common_time_extrator", "(", "self", ",", "string", ")", ":", "try", ":", "if", "not", "self", ".", "year_check", ":", "str_year", "=", "int", "(", "re", ".", "search", "(", "'(\\d{4})年', ", "s", "ring).", "g", "r", "oup(1", ")", ")", "", "", ...
一般时间抽取,即年月日分别出现 Keyword arguments: string -- 含有时间的文本,str类型
[ "一般时间抽取,即年月日分别出现" ]
python
train
Phylliade/ikpy
src/ikpy/geometry_utils.py
https://github.com/Phylliade/ikpy/blob/60e36d6163136942bf520d952db17123c658d0b6/src/ikpy/geometry_utils.py#L28-L34
def symbolic_Rz_matrix(symbolic_theta): """Matrice symbolique de rotation autour de l'axe Z""" return sympy.Matrix([ [sympy.cos(symbolic_theta), -sympy.sin(symbolic_theta), 0], [sympy.sin(symbolic_theta), sympy.cos(symbolic_theta), 0], [0, 0, 1] ])
[ "def", "symbolic_Rz_matrix", "(", "symbolic_theta", ")", ":", "return", "sympy", ".", "Matrix", "(", "[", "[", "sympy", ".", "cos", "(", "symbolic_theta", ")", ",", "-", "sympy", ".", "sin", "(", "symbolic_theta", ")", ",", "0", "]", ",", "[", "sympy",...
Matrice symbolique de rotation autour de l'axe Z
[ "Matrice", "symbolique", "de", "rotation", "autour", "de", "l", "axe", "Z" ]
python
train
nicolargo/glances
glances/plugins/glances_processlist.py
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_processlist.py#L441-L475
def __msg_curse_header(self, ret, process_sort_key, args=None): """Build the header and add it to the ret dict.""" sort_style = 'SORT' if args.disable_irix and 0 < self.nb_log_core < 10: msg = self.layout_header['cpu'].format('CPU%/' + str(self.nb_log_core)) elif args.disabl...
[ "def", "__msg_curse_header", "(", "self", ",", "ret", ",", "process_sort_key", ",", "args", "=", "None", ")", ":", "sort_style", "=", "'SORT'", "if", "args", ".", "disable_irix", "and", "0", "<", "self", ".", "nb_log_core", "<", "10", ":", "msg", "=", ...
Build the header and add it to the ret dict.
[ "Build", "the", "header", "and", "add", "it", "to", "the", "ret", "dict", "." ]
python
train
uber-common/opentracing-python-instrumentation
opentracing_instrumentation/http_server.py
https://github.com/uber-common/opentracing-python-instrumentation/blob/57b29fb9f647e073cde8c75155f4708cb5661d20/opentracing_instrumentation/http_server.py#L35-L86
def before_request(request, tracer=None): """ Attempts to extract a tracing span from incoming request. If no tracing context is passed in the headers, or the data cannot be parsed, a new root span is started. :param request: HTTP request with `.headers` property exposed that satisfies a re...
[ "def", "before_request", "(", "request", ",", "tracer", "=", "None", ")", ":", "if", "tracer", "is", "None", ":", "# pragma: no cover", "tracer", "=", "opentracing", ".", "tracer", "# we need to prepare tags upfront, mainly because RPC_SERVER tag must be", "# set when sta...
Attempts to extract a tracing span from incoming request. If no tracing context is passed in the headers, or the data cannot be parsed, a new root span is started. :param request: HTTP request with `.headers` property exposed that satisfies a regular dictionary interface :param tracer: optional...
[ "Attempts", "to", "extract", "a", "tracing", "span", "from", "incoming", "request", ".", "If", "no", "tracing", "context", "is", "passed", "in", "the", "headers", "or", "the", "data", "cannot", "be", "parsed", "a", "new", "root", "span", "is", "started", ...
python
train
deepmind/pysc2
pysc2/lib/features.py
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/features.py#L342-L363
def _to_point(dims): """Convert (width, height) or size -> point.Point.""" assert dims if isinstance(dims, (tuple, list)): if len(dims) != 2: raise ValueError( "A two element tuple or list is expected here, got {}.".format(dims)) else: width = int(dims[0]) height = int(dims[1]...
[ "def", "_to_point", "(", "dims", ")", ":", "assert", "dims", "if", "isinstance", "(", "dims", ",", "(", "tuple", ",", "list", ")", ")", ":", "if", "len", "(", "dims", ")", "!=", "2", ":", "raise", "ValueError", "(", "\"A two element tuple or list is expe...
Convert (width, height) or size -> point.Point.
[ "Convert", "(", "width", "height", ")", "or", "size", "-", ">", "point", ".", "Point", "." ]
python
train
kervi/kervi-core
kervi/actions/action.py
https://github.com/kervi/kervi-core/blob/3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23/kervi/actions/action.py#L94-L118
def execute(self, *args, **kwargs): """Executes the action.""" timeout = kwargs.pop("timeout", -1) run_async = kwargs.pop("run_async", False) self._is_running = True result = None if self._action_lock.acquire(False): self._state = ACTION_PENDING se...
[ "def", "execute", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "timeout", "=", "kwargs", ".", "pop", "(", "\"timeout\"", ",", "-", "1", ")", "run_async", "=", "kwargs", ".", "pop", "(", "\"run_async\"", ",", "False", ")", "self...
Executes the action.
[ "Executes", "the", "action", "." ]
python
train
log2timeline/plaso
plaso/cli/image_export_tool.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/cli/image_export_tool.py#L521-L565
def _ReadSpecificationFile(self, path): """Reads the format specification file. Args: path (str): path of the format specification file. Returns: FormatSpecificationStore: format specification store. """ specification_store = specification.FormatSpecificationStore() with io.open( ...
[ "def", "_ReadSpecificationFile", "(", "self", ",", "path", ")", ":", "specification_store", "=", "specification", ".", "FormatSpecificationStore", "(", ")", "with", "io", ".", "open", "(", "path", ",", "'rt'", ",", "encoding", "=", "self", ".", "_SPECIFICATION...
Reads the format specification file. Args: path (str): path of the format specification file. Returns: FormatSpecificationStore: format specification store.
[ "Reads", "the", "format", "specification", "file", "." ]
python
train
RIPE-NCC/ripe.atlas.sagan
ripe/atlas/sagan/ssl.py
https://github.com/RIPE-NCC/ripe.atlas.sagan/blob/f0e57221cf0ba3504baddd3ea460fc955bc41cc6/ripe/atlas/sagan/ssl.py#L101-L111
def _name_attribute_to_string(self, name): """ Build a /-separated string from an x509.Name. """ return "".join( "/{}={}".format( self._get_oid_name(attr.oid), attr.value, ) for attr in name )
[ "def", "_name_attribute_to_string", "(", "self", ",", "name", ")", ":", "return", "\"\"", ".", "join", "(", "\"/{}={}\"", ".", "format", "(", "self", ".", "_get_oid_name", "(", "attr", ".", "oid", ")", ",", "attr", ".", "value", ",", ")", "for", "attr"...
Build a /-separated string from an x509.Name.
[ "Build", "a", "/", "-", "separated", "string", "from", "an", "x509", ".", "Name", "." ]
python
train
iotile/coretools
iotilebuild/iotile/build/config/site_scons/release.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/site_scons/release.py#L16-L34
def create_release_settings_action(target, source, env): """Copy module_settings.json and add release and build information """ with open(str(source[0]), "r") as fileobj: settings = json.load(fileobj) settings['release'] = True settings['release_date'] = datetime.datetime.utcnow().isoforma...
[ "def", "create_release_settings_action", "(", "target", ",", "source", ",", "env", ")", ":", "with", "open", "(", "str", "(", "source", "[", "0", "]", ")", ",", "\"r\"", ")", "as", "fileobj", ":", "settings", "=", "json", ".", "load", "(", "fileobj", ...
Copy module_settings.json and add release and build information
[ "Copy", "module_settings", ".", "json", "and", "add", "release", "and", "build", "information" ]
python
train
draperjames/qtpandas
qtpandas/ui/fallback/easygui/boxes/derived_boxes.py
https://github.com/draperjames/qtpandas/blob/64294fb69f1839e53dee5ea453337266bfaf24f4/qtpandas/ui/fallback/easygui/boxes/derived_boxes.py#L202-L224
def msgbox(msg="(Your message goes here)", title=" ", ok_button="OK", image=None, root=None): """ Display a message box :param str msg: the msg to be displayed :param str title: the window title :param str ok_button: text to show in the button :param str image: Filename of image to d...
[ "def", "msgbox", "(", "msg", "=", "\"(Your message goes here)\"", ",", "title", "=", "\" \"", ",", "ok_button", "=", "\"OK\"", ",", "image", "=", "None", ",", "root", "=", "None", ")", ":", "if", "not", "isinstance", "(", "ok_button", ",", "ut", ".", "...
Display a message box :param str msg: the msg to be displayed :param str title: the window title :param str ok_button: text to show in the button :param str image: Filename of image to display :param tk_widget root: Top-level Tk widget :return: the text of the ok_button
[ "Display", "a", "message", "box" ]
python
train
YosaiProject/yosai_alchemystore
yosai_alchemystore/accountstore/accountstore.py
https://github.com/YosaiProject/yosai_alchemystore/blob/6479c159ab2ac357e6b70cdd71a2d673279e86bb/yosai_alchemystore/accountstore/accountstore.py#L159-L166
def _get_roles_query(self, session, identifier): """ :type identifier: string """ return (session.query(Role). join(role_membership_table, Role.pk_id == role_membership_table.c.role_id). join(User, role_membership_table.c.user_id == User.pk_id). ...
[ "def", "_get_roles_query", "(", "self", ",", "session", ",", "identifier", ")", ":", "return", "(", "session", ".", "query", "(", "Role", ")", ".", "join", "(", "role_membership_table", ",", "Role", ".", "pk_id", "==", "role_membership_table", ".", "c", "....
:type identifier: string
[ ":", "type", "identifier", ":", "string" ]
python
train
fprimex/zdesk
zdesk/zdesk_api.py
https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L1489-L1493
def help_center_article_labels(self, id, **kwargs): "https://developer.zendesk.com/rest_api/docs/help_center/labels#list-article-labels" api_path = "/api/v2/help_center/articles/{id}/labels.json" api_path = api_path.format(id=id) return self.call(api_path, **kwargs)
[ "def", "help_center_article_labels", "(", "self", ",", "id", ",", "*", "*", "kwargs", ")", ":", "api_path", "=", "\"/api/v2/help_center/articles/{id}/labels.json\"", "api_path", "=", "api_path", ".", "format", "(", "id", "=", "id", ")", "return", "self", ".", ...
https://developer.zendesk.com/rest_api/docs/help_center/labels#list-article-labels
[ "https", ":", "//", "developer", ".", "zendesk", ".", "com", "/", "rest_api", "/", "docs", "/", "help_center", "/", "labels#list", "-", "article", "-", "labels" ]
python
train
NaviNet/JiraRobot
JiraRobot/JiraRobot.py
https://github.com/NaviNet/JiraRobot/blob/fdcc369dde3ab546b7b4b7e69deda67a0bc7160e/JiraRobot/JiraRobot.py#L132-L147
def assign_user_to_issue(self, issue, JIRAUsername): # TODO: Review docs """ Adds a user to a specified issue's watcher list Arguments: | issue (string) | A JIRA Issue that a user needs to be assigned to, can be an issue ID or Key | | JIRAUsername (strin...
[ "def", "assign_user_to_issue", "(", "self", ",", "issue", ",", "JIRAUsername", ")", ":", "# TODO: Review docs\r", "self", ".", "jira", ".", "assign_issue", "(", "issue", "=", "issue", ",", "assignee", "=", "JIRAUsername", ")" ]
Adds a user to a specified issue's watcher list Arguments: | issue (string) | A JIRA Issue that a user needs to be assigned to, can be an issue ID or Key | | JIRAUsername (string) | A JIRA Username to assign a user to an issue | Example: | ...
[ "Adds", "a", "user", "to", "a", "specified", "issue", "s", "watcher", "list", "Arguments", ":", "|", "issue", "(", "string", ")", "|", "A", "JIRA", "Issue", "that", "a", "user", "needs", "to", "be", "assigned", "to", "can", "be", "an", "issue", "ID",...
python
train
cirruscluster/cirruscluster
cirruscluster/ext/ansible/playbook/__init__.py
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/playbook/__init__.py#L256-L293
def _run_task_internal(self, task): ''' run a particular module step in a playbook ''' hosts = self._list_available_hosts() self.inventory.restrict_to(hosts) runner = cirruscluster.ext.ansible.runner.Runner( pattern=task.play.hosts, inventory=self.inventory, module_name=tas...
[ "def", "_run_task_internal", "(", "self", ",", "task", ")", ":", "hosts", "=", "self", ".", "_list_available_hosts", "(", ")", "self", ".", "inventory", ".", "restrict_to", "(", "hosts", ")", "runner", "=", "cirruscluster", ".", "ext", ".", "ansible", ".",...
run a particular module step in a playbook
[ "run", "a", "particular", "module", "step", "in", "a", "playbook" ]
python
train
EntilZha/PyFunctional
functional/pipeline.py
https://github.com/EntilZha/PyFunctional/blob/ac04e4a8552b0c464a7f492f7c9862424867b63e/functional/pipeline.py#L1037-L1072
def aggregate(self, *args): """ Aggregates the sequence by specified arguments. Its behavior varies depending on if one, two, or three arguments are passed. Assuming the type of the sequence is A: One Argument: argument specifies a function of the type f(current: B, next: A => result: B...
[ "def", "aggregate", "(", "self", ",", "*", "args", ")", ":", "seed", "=", "None", "result_lambda", "=", "identity", "if", "len", "(", "args", ")", "==", "1", ":", "func", "=", "args", "[", "0", "]", "elif", "len", "(", "args", ")", "==", "2", "...
Aggregates the sequence by specified arguments. Its behavior varies depending on if one, two, or three arguments are passed. Assuming the type of the sequence is A: One Argument: argument specifies a function of the type f(current: B, next: A => result: B. current represents results computed so...
[ "Aggregates", "the", "sequence", "by", "specified", "arguments", ".", "Its", "behavior", "varies", "depending", "on", "if", "one", "two", "or", "three", "arguments", "are", "passed", ".", "Assuming", "the", "type", "of", "the", "sequence", "is", "A", ":" ]
python
train
qacafe/cdrouter.py
cdrouter/system.py
https://github.com/qacafe/cdrouter.py/blob/aacf2c6ab0b987250f7b1892f4bba14bb2b7dbe5/cdrouter/system.py#L452-L460
def get_preferences(self): """Get preferences from /usr/cdrouter-data/etc/config.yml. :return: :class:`system.Preferences <system.Preferences>` object :rtype: system.Preferences """ schema = PreferencesSchema() resp = self.service.get(self.base+'preferences/') re...
[ "def", "get_preferences", "(", "self", ")", ":", "schema", "=", "PreferencesSchema", "(", ")", "resp", "=", "self", ".", "service", ".", "get", "(", "self", ".", "base", "+", "'preferences/'", ")", "return", "self", ".", "service", ".", "decode", "(", ...
Get preferences from /usr/cdrouter-data/etc/config.yml. :return: :class:`system.Preferences <system.Preferences>` object :rtype: system.Preferences
[ "Get", "preferences", "from", "/", "usr", "/", "cdrouter", "-", "data", "/", "etc", "/", "config", ".", "yml", "." ]
python
train
jantman/versionfinder
versionfinder/versioninfo.py
https://github.com/jantman/versionfinder/blob/773dd9c0a99fa02e515347111c352471a7a3e30c/versionfinder/versioninfo.py#L306-L324
def as_dict(self): """ Return the constructor arguments as a dictionary (effectively the kwargs to the constructor). :return: dict of constructor arguments :rtype: dict """ return { 'pip_version': self._pip_version, 'pip_url': self._pip_ur...
[ "def", "as_dict", "(", "self", ")", ":", "return", "{", "'pip_version'", ":", "self", ".", "_pip_version", ",", "'pip_url'", ":", "self", ".", "_pip_url", ",", "'pip_requirement'", ":", "self", ".", "_pip_requirement", ",", "'pkg_resources_version'", ":", "sel...
Return the constructor arguments as a dictionary (effectively the kwargs to the constructor). :return: dict of constructor arguments :rtype: dict
[ "Return", "the", "constructor", "arguments", "as", "a", "dictionary", "(", "effectively", "the", "kwargs", "to", "the", "constructor", ")", "." ]
python
train
cogniteev/docido-python-sdk
docido_sdk/toolbox/rate_limits.py
https://github.com/cogniteev/docido-python-sdk/blob/58ecb6c6f5757fd40c0601657ab18368da7ddf33/docido_sdk/toolbox/rate_limits.py#L102-L114
def uri(self, context=None): """ :param dict context: keys that were missing in the static context given in constructor to resolve the butcket name. """ if context is None: context = self.context else: ctx = copy.deepcopy(self.context) ...
[ "def", "uri", "(", "self", ",", "context", "=", "None", ")", ":", "if", "context", "is", "None", ":", "context", "=", "self", ".", "context", "else", ":", "ctx", "=", "copy", ".", "deepcopy", "(", "self", ".", "context", ")", "ctx", ".", "update", ...
:param dict context: keys that were missing in the static context given in constructor to resolve the butcket name.
[ ":", "param", "dict", "context", ":", "keys", "that", "were", "missing", "in", "the", "static", "context", "given", "in", "constructor", "to", "resolve", "the", "butcket", "name", "." ]
python
train
Jajcus/pyxmpp2
pyxmpp2/ext/muc/muc.py
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/muc/muc.py#L783-L793
def request_instant_room(self): """ Request an "instant room" -- the default configuration for a MUC room. :return: id of the request stanza. :returntype: `unicode` """ if self.configured: raise RuntimeError("Instant room may be requested for unconfigured roo...
[ "def", "request_instant_room", "(", "self", ")", ":", "if", "self", ".", "configured", ":", "raise", "RuntimeError", "(", "\"Instant room may be requested for unconfigured room only\"", ")", "form", "=", "Form", "(", "\"submit\"", ")", "return", "self", ".", "config...
Request an "instant room" -- the default configuration for a MUC room. :return: id of the request stanza. :returntype: `unicode`
[ "Request", "an", "instant", "room", "--", "the", "default", "configuration", "for", "a", "MUC", "room", "." ]
python
valid
pywbem/pywbem
pywbem/_server.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/_server.py#L533-L626
def delete_namespace(self, namespace): """ Delete the specified CIM namespace in the WBEM server and update this WBEMServer object to reflect the removed namespace there. The specified namespace must be empty (i.e. must not contain any classes, instances, or qualifier ty...
[ "def", "delete_namespace", "(", "self", ",", "namespace", ")", ":", "std_namespace", "=", "_ensure_unicode", "(", "namespace", ".", "strip", "(", "'/'", ")", ")", "# Use approach 1: DeleteInstance of CIM class for namespaces", "# Refresh the list of namespaces in this object ...
Delete the specified CIM namespace in the WBEM server and update this WBEMServer object to reflect the removed namespace there. The specified namespace must be empty (i.e. must not contain any classes, instances, or qualifier types. This method attempts the following approaches...
[ "Delete", "the", "specified", "CIM", "namespace", "in", "the", "WBEM", "server", "and", "update", "this", "WBEMServer", "object", "to", "reflect", "the", "removed", "namespace", "there", "." ]
python
train
bcbio/bcbio-nextgen
bcbio/structural/purple.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/purple.py#L166-L197
def _amber_het_file(method, vrn_files, work_dir, paired): """Create file of BAFs in normal heterozygous positions compatible with AMBER. Two available methods: - pon -- Use panel of normals with likely heterozygous sites. - variants -- Use pre-existing variant calls, filtered to likely heterozygote...
[ "def", "_amber_het_file", "(", "method", ",", "vrn_files", ",", "work_dir", ",", "paired", ")", ":", "assert", "vrn_files", ",", "\"Did not find compatible variant calling files for PURPLE inputs\"", "from", "bcbio", ".", "heterogeneity", "import", "bubbletree", "if", "...
Create file of BAFs in normal heterozygous positions compatible with AMBER. Two available methods: - pon -- Use panel of normals with likely heterozygous sites. - variants -- Use pre-existing variant calls, filtered to likely heterozygotes. https://github.com/hartwigmedical/hmftools/tree/master/am...
[ "Create", "file", "of", "BAFs", "in", "normal", "heterozygous", "positions", "compatible", "with", "AMBER", "." ]
python
train
StackStorm/pybind
pybind/nos/v6_0_2f/brocade_interface_ext_rpc/get_media_detail/output/interface/qsfpp/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/brocade_interface_ext_rpc/get_media_detail/output/interface/qsfpp/__init__.py#L186-L210
def _set_encoding(self, v, load=False): """ Setter method for encoding, mapped from YANG variable /brocade_interface_ext_rpc/get_media_detail/output/interface/qsfpp/encoding (enumeration) If this variable is read-only (config: false) in the source YANG file, then _set_encoding is considered as a private...
[ "def", "_set_encoding", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "base"...
Setter method for encoding, mapped from YANG variable /brocade_interface_ext_rpc/get_media_detail/output/interface/qsfpp/encoding (enumeration) If this variable is read-only (config: false) in the source YANG file, then _set_encoding is considered as a private method. Backends looking to populate this varia...
[ "Setter", "method", "for", "encoding", "mapped", "from", "YANG", "variable", "/", "brocade_interface_ext_rpc", "/", "get_media_detail", "/", "output", "/", "interface", "/", "qsfpp", "/", "encoding", "(", "enumeration", ")", "If", "this", "variable", "is", "read...
python
train