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
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py#L261-L356
def parse_uri(uri, default_port=DEFAULT_PORT, validate=True, warn=False): """Parse and validate a MongoDB URI. Returns a dict of the form:: { 'nodelist': <list of (host, port) tuples>, 'username': <username> or None, 'password': <password> or None, 'data...
[ "def", "parse_uri", "(", "uri", ",", "default_port", "=", "DEFAULT_PORT", ",", "validate", "=", "True", ",", "warn", "=", "False", ")", ":", "if", "not", "uri", ".", "startswith", "(", "SCHEME", ")", ":", "raise", "InvalidURI", "(", "\"Invalid URI scheme: ...
Parse and validate a MongoDB URI. Returns a dict of the form:: { 'nodelist': <list of (host, port) tuples>, 'username': <username> or None, 'password': <password> or None, 'database': <database name> or None, 'collection': <collection name> or No...
[ "Parse", "and", "validate", "a", "MongoDB", "URI", "." ]
python
train
farshidce/touchworks-python
touchworks/api/http.py
https://github.com/farshidce/touchworks-python/blob/ea8f93a0f4273de1317a318e945a571f5038ba62/touchworks/api/http.py#L312-L329
def find_document_type_by_name(self, entity_name, active='Y', match_case=True): """ search document types by name and active(Y/N) status :param entity_name: entity name :return: """ all_types = self.get_dictionary('Document_Type_DE') ...
[ "def", "find_document_type_by_name", "(", "self", ",", "entity_name", ",", "active", "=", "'Y'", ",", "match_case", "=", "True", ")", ":", "all_types", "=", "self", ".", "get_dictionary", "(", "'Document_Type_DE'", ")", "if", "match_case", ":", "filtered", "="...
search document types by name and active(Y/N) status :param entity_name: entity name :return:
[ "search", "document", "types", "by", "name", "and", "active", "(", "Y", "/", "N", ")", "status", ":", "param", "entity_name", ":", "entity", "name", ":", "return", ":" ]
python
train
saltstack/salt
salt/modules/aliases.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aliases.py#L141-L158
def has_target(alias, target): ''' Return true if the alias/target is set CLI Example: .. code-block:: bash salt '*' aliases.has_target alias target ''' if target == '': raise SaltInvocationError('target can not be an empty string') aliases = list_aliases() if alias no...
[ "def", "has_target", "(", "alias", ",", "target", ")", ":", "if", "target", "==", "''", ":", "raise", "SaltInvocationError", "(", "'target can not be an empty string'", ")", "aliases", "=", "list_aliases", "(", ")", "if", "alias", "not", "in", "aliases", ":", ...
Return true if the alias/target is set CLI Example: .. code-block:: bash salt '*' aliases.has_target alias target
[ "Return", "true", "if", "the", "alias", "/", "target", "is", "set" ]
python
train
DomainTools/python_api
domaintools/api.py
https://github.com/DomainTools/python_api/blob/17be85fd4913fbe14d7660a4f4829242f1663e60/domaintools/api.py#L189-L197
def phisheye_term_list(self, include_inactive=False, **kwargs): """Provides a list of terms that are set up for this account. This call is not charged against your API usage limit. NOTE: The terms must be configured in the PhishEye web interface: https://research.domaintools.com/phisheye....
[ "def", "phisheye_term_list", "(", "self", ",", "include_inactive", "=", "False", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_results", "(", "'phisheye_term_list'", ",", "'/v1/phisheye/term-list'", ",", "include_inactive", "=", "include_inactive", "...
Provides a list of terms that are set up for this account. This call is not charged against your API usage limit. NOTE: The terms must be configured in the PhishEye web interface: https://research.domaintools.com/phisheye. There is no API call to set up the terms.
[ "Provides", "a", "list", "of", "terms", "that", "are", "set", "up", "for", "this", "account", ".", "This", "call", "is", "not", "charged", "against", "your", "API", "usage", "limit", "." ]
python
train
OCA/openupgradelib
openupgradelib/openupgrade.py
https://github.com/OCA/openupgradelib/blob/b220b6498075d62c1b64073cc934513a465cfd85/openupgradelib/openupgrade.py#L397-L502
def rename_fields(env, field_spec, no_deep=False): """Rename fields. Typically called in the pre script. WARNING: If using this on base module, pass the argument ``no_deep`` with True value for avoiding the using of the environment (which is not yet loaded). This, in contrast of ``rename_columns``, per...
[ "def", "rename_fields", "(", "env", ",", "field_spec", ",", "no_deep", "=", "False", ")", ":", "cr", "=", "env", ".", "cr", "for", "model", ",", "table", ",", "old_field", ",", "new_field", "in", "field_spec", ":", "if", "column_exists", "(", "cr", ","...
Rename fields. Typically called in the pre script. WARNING: If using this on base module, pass the argument ``no_deep`` with True value for avoiding the using of the environment (which is not yet loaded). This, in contrast of ``rename_columns``, performs all the steps for completely rename a field from...
[ "Rename", "fields", ".", "Typically", "called", "in", "the", "pre", "script", ".", "WARNING", ":", "If", "using", "this", "on", "base", "module", "pass", "the", "argument", "no_deep", "with", "True", "value", "for", "avoiding", "the", "using", "of", "the",...
python
train
Synerty/peek-plugin-base
peek_plugin_base/server/PeekPlatformServerHttpHookABC.py
https://github.com/Synerty/peek-plugin-base/blob/276101d028e1ee0678af514c761b74cce5a5cda9/peek_plugin_base/server/PeekPlatformServerHttpHookABC.py#L30-L41
def addServerResource(self, pluginSubPath: bytes, resource: BasicResource) -> None: """ Add Server Resource Add a cusotom implementation of a served http resource. :param pluginSubPath: The resource path where you want to serve this resource. :param resource: The resource to serve. ...
[ "def", "addServerResource", "(", "self", ",", "pluginSubPath", ":", "bytes", ",", "resource", ":", "BasicResource", ")", "->", "None", ":", "pluginSubPath", "=", "pluginSubPath", ".", "strip", "(", "b'/'", ")", "self", ".", "__rootServerResource", ".", "putChi...
Add Server Resource Add a cusotom implementation of a served http resource. :param pluginSubPath: The resource path where you want to serve this resource. :param resource: The resource to serve. :return: None
[ "Add", "Server", "Resource" ]
python
train
Erotemic/utool
utool/util_cache.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_cache.py#L989-L993
def delete_global_cache(appname='default'): """ Reads cache files to a safe place in each operating system """ #close_global_shelf(appname) shelf_fpath = get_global_shelf_fpath(appname) util_path.remove_file(shelf_fpath, verbose=True, dryrun=False)
[ "def", "delete_global_cache", "(", "appname", "=", "'default'", ")", ":", "#close_global_shelf(appname)", "shelf_fpath", "=", "get_global_shelf_fpath", "(", "appname", ")", "util_path", ".", "remove_file", "(", "shelf_fpath", ",", "verbose", "=", "True", ",", "dryru...
Reads cache files to a safe place in each operating system
[ "Reads", "cache", "files", "to", "a", "safe", "place", "in", "each", "operating", "system" ]
python
train
ASMfreaK/habitipy
habitipy/util.py
https://github.com/ASMfreaK/habitipy/blob/555b8b20faf6d553353092614a8a0d612f0adbde/habitipy/util.py#L166-L169
def get_translation_functions(package_name: str, names: Tuple[str, ...] = ('gettext',)): """finds and installs translation functions for package""" translation = get_translation_for(package_name) return [getattr(translation, x) for x in names]
[ "def", "get_translation_functions", "(", "package_name", ":", "str", ",", "names", ":", "Tuple", "[", "str", ",", "...", "]", "=", "(", "'gettext'", ",", ")", ")", ":", "translation", "=", "get_translation_for", "(", "package_name", ")", "return", "[", "ge...
finds and installs translation functions for package
[ "finds", "and", "installs", "translation", "functions", "for", "package" ]
python
train
buildbot/buildbot
master/buildbot/db/pool.py
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/db/pool.py#L152-L159
def shutdown(self): """Manually stop the pool. This is only necessary from tests, as the pool will stop itself when the reactor stops under normal circumstances.""" if not self._stop_evt: return # pool is already stopped self.reactor.removeSystemEventTrigger(self._s...
[ "def", "shutdown", "(", "self", ")", ":", "if", "not", "self", ".", "_stop_evt", ":", "return", "# pool is already stopped", "self", ".", "reactor", ".", "removeSystemEventTrigger", "(", "self", ".", "_stop_evt", ")", "self", ".", "_stop", "(", ")" ]
Manually stop the pool. This is only necessary from tests, as the pool will stop itself when the reactor stops under normal circumstances.
[ "Manually", "stop", "the", "pool", ".", "This", "is", "only", "necessary", "from", "tests", "as", "the", "pool", "will", "stop", "itself", "when", "the", "reactor", "stops", "under", "normal", "circumstances", "." ]
python
train
goose3/goose3
goose3/extractors/content.py
https://github.com/goose3/goose3/blob/e6994b1b1826af2720a091d1bff5ca15594f558d/goose3/extractors/content.py#L198-L225
def get_siblings_content(self, current_sibling, baselinescore_siblings_para): """ adds any siblings that may have a decent score to this node """ if current_sibling.tag == 'p' and self.parser.getText(current_sibling): tmp = current_sibling if tmp.tail: ...
[ "def", "get_siblings_content", "(", "self", ",", "current_sibling", ",", "baselinescore_siblings_para", ")", ":", "if", "current_sibling", ".", "tag", "==", "'p'", "and", "self", ".", "parser", ".", "getText", "(", "current_sibling", ")", ":", "tmp", "=", "cur...
adds any siblings that may have a decent score to this node
[ "adds", "any", "siblings", "that", "may", "have", "a", "decent", "score", "to", "this", "node" ]
python
valid
bw2/ConfigArgParse
configargparse.py
https://github.com/bw2/ConfigArgParse/blob/8bbc7de67f884184068d62af7f78e723d01c0081/configargparse.py#L701-L754
def _open_config_files(self, command_line_args): """Tries to parse config file path(s) from within command_line_args. Returns a list of opened config files, including files specified on the commandline as well as any default_config_files specified in the constructor that are present on d...
[ "def", "_open_config_files", "(", "self", ",", "command_line_args", ")", ":", "# open any default config files", "config_files", "=", "[", "open", "(", "f", ")", "for", "files", "in", "map", "(", "glob", ".", "glob", ",", "map", "(", "os", ".", "path", "."...
Tries to parse config file path(s) from within command_line_args. Returns a list of opened config files, including files specified on the commandline as well as any default_config_files specified in the constructor that are present on disk. Args: command_line_args: List of a...
[ "Tries", "to", "parse", "config", "file", "path", "(", "s", ")", "from", "within", "command_line_args", ".", "Returns", "a", "list", "of", "opened", "config", "files", "including", "files", "specified", "on", "the", "commandline", "as", "well", "as", "any", ...
python
train
buruzaemon/natto-py
natto/environment.py
https://github.com/buruzaemon/natto-py/blob/018fe004c47c45c66bdf2e03fe24e981ae089b76/natto/environment.py#L164-L199
def __regkey_value(self, path, name='', start_key=None): r'''Return the data of value mecabrc at MeCab HKEY node. On Windows, the path to the mecabrc as set in the Windows Registry is used to deduce the path to libmecab.dll. Returns: The full path to the mecabrc on W...
[ "def", "__regkey_value", "(", "self", ",", "path", ",", "name", "=", "''", ",", "start_key", "=", "None", ")", ":", "if", "sys", ".", "version", "<", "'3'", ":", "import", "_winreg", "as", "reg", "else", ":", "import", "winreg", "as", "reg", "def", ...
r'''Return the data of value mecabrc at MeCab HKEY node. On Windows, the path to the mecabrc as set in the Windows Registry is used to deduce the path to libmecab.dll. Returns: The full path to the mecabrc on Windows. Raises: WindowsError: A problem wa...
[ "r", "Return", "the", "data", "of", "value", "mecabrc", "at", "MeCab", "HKEY", "node", ".", "On", "Windows", "the", "path", "to", "the", "mecabrc", "as", "set", "in", "the", "Windows", "Registry", "is", "used", "to", "deduce", "the", "path", "to", "lib...
python
train
katerina7479/pypdflite
pypdflite/pdflite.py
https://github.com/katerina7479/pypdflite/blob/ac2501f30d6619eae9dea5644717575ca9263d0a/pypdflite/pdflite.py#L313-L326
def _text_to_string(self, text): """ Provides for escape characters and converting to pdf text object (pdf strings are in parantheses). Mainly for use in the information block here, this functionality is also present in the text object. """ if text: ...
[ "def", "_text_to_string", "(", "self", ",", "text", ")", ":", "if", "text", ":", "for", "i", ",", "j", "in", "[", "(", "\"\\\\\"", ",", "\"\\\\\\\\\"", ")", ",", "(", "\")\"", ",", "\"\\\\)\"", ")", ",", "(", "\"(\"", ",", "\"\\\\(\"", ")", "]", ...
Provides for escape characters and converting to pdf text object (pdf strings are in parantheses). Mainly for use in the information block here, this functionality is also present in the text object.
[ "Provides", "for", "escape", "characters", "and", "converting", "to", "pdf", "text", "object", "(", "pdf", "strings", "are", "in", "parantheses", ")", ".", "Mainly", "for", "use", "in", "the", "information", "block", "here", "this", "functionality", "is", "a...
python
test
pudo/dataset
dataset/util.py
https://github.com/pudo/dataset/blob/a008d120c7f3c48ccba98a282c0c67d6e719c0e5/dataset/util.py#L111-L120
def pad_chunk_columns(chunk): """Given a set of items to be inserted, make sure they all have the same columns by padding columns with None if they are missing.""" columns = set() for record in chunk: columns.update(record.keys()) for record in chunk: for column in columns: ...
[ "def", "pad_chunk_columns", "(", "chunk", ")", ":", "columns", "=", "set", "(", ")", "for", "record", "in", "chunk", ":", "columns", ".", "update", "(", "record", ".", "keys", "(", ")", ")", "for", "record", "in", "chunk", ":", "for", "column", "in",...
Given a set of items to be inserted, make sure they all have the same columns by padding columns with None if they are missing.
[ "Given", "a", "set", "of", "items", "to", "be", "inserted", "make", "sure", "they", "all", "have", "the", "same", "columns", "by", "padding", "columns", "with", "None", "if", "they", "are", "missing", "." ]
python
train
SoCo/SoCo
soco/data_structures.py
https://github.com/SoCo/SoCo/blob/671937e07d7973b78c0cbee153d4f3ad68ec48c6/soco/data_structures.py#L54-L78
def to_didl_string(*args): """Convert any number of `DidlObjects <DidlObject>` to a unicode xml string. Args: *args (DidlObject): One or more `DidlObject` (or subclass) instances. Returns: str: A unicode string representation of DIDL-Lite XML in the form ``'<DIDL-Lite ...>...</...
[ "def", "to_didl_string", "(", "*", "args", ")", ":", "didl", "=", "XML", ".", "Element", "(", "'DIDL-Lite'", ",", "{", "'xmlns'", ":", "\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\"", ",", "'xmlns:dc'", ":", "\"http://purl.org/dc/elements/1.1/\"", ",", "'xmlns:upnp...
Convert any number of `DidlObjects <DidlObject>` to a unicode xml string. Args: *args (DidlObject): One or more `DidlObject` (or subclass) instances. Returns: str: A unicode string representation of DIDL-Lite XML in the form ``'<DIDL-Lite ...>...</DIDL-Lite>'``.
[ "Convert", "any", "number", "of", "DidlObjects", "<DidlObject", ">", "to", "a", "unicode", "xml", "string", "." ]
python
train
prompt-toolkit/pyvim
pyvim/commands/commands.py
https://github.com/prompt-toolkit/pyvim/blob/5928b53b9d700863c1a06d2181a034a955f94594/pyvim/commands/commands.py#L302-L306
def quit_all(editor, force=False): """ Quit all. """ quit(editor, all_=True, force=force)
[ "def", "quit_all", "(", "editor", ",", "force", "=", "False", ")", ":", "quit", "(", "editor", ",", "all_", "=", "True", ",", "force", "=", "force", ")" ]
Quit all.
[ "Quit", "all", "." ]
python
train
marl/jams
jams/display.py
https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/display.py#L71-L76
def hierarchy(annotation, **kwargs): '''Plotting wrapper for hierarchical segmentations''' htimes, hlabels = hierarchy_flatten(annotation) htimes = [np.asarray(_) for _ in htimes] return mir_eval.display.hierarchy(htimes, hlabels, **kwargs)
[ "def", "hierarchy", "(", "annotation", ",", "*", "*", "kwargs", ")", ":", "htimes", ",", "hlabels", "=", "hierarchy_flatten", "(", "annotation", ")", "htimes", "=", "[", "np", ".", "asarray", "(", "_", ")", "for", "_", "in", "htimes", "]", "return", ...
Plotting wrapper for hierarchical segmentations
[ "Plotting", "wrapper", "for", "hierarchical", "segmentations" ]
python
valid
python-cmd2/cmd2
cmd2/cmd2.py
https://github.com/python-cmd2/cmd2/blob/b22c0bd891ed08c8b09df56df9d91f48166a5e2a/cmd2/cmd2.py#L2261-L2284
def alias_create(self, args: argparse.Namespace) -> None: """Create or overwrite an alias""" # Validate the alias name valid, errmsg = self.statement_parser.is_valid_command(args.name) if not valid: self.perror("Invalid alias name: {}".format(errmsg), traceback_war=False) ...
[ "def", "alias_create", "(", "self", ",", "args", ":", "argparse", ".", "Namespace", ")", "->", "None", ":", "# Validate the alias name", "valid", ",", "errmsg", "=", "self", ".", "statement_parser", ".", "is_valid_command", "(", "args", ".", "name", ")", "if...
Create or overwrite an alias
[ "Create", "or", "overwrite", "an", "alias" ]
python
train
PolyJIT/benchbuild
benchbuild/likwid.py
https://github.com/PolyJIT/benchbuild/blob/9ad2ec54d96e97b642b1f06eddcbad9ba7aeaf58/benchbuild/likwid.py#L110-L123
def read_tables(fstream): """ Read all tables from likwid's file stream. Args: fstream: Likwid's output file stream. Returns: A generator that can be used to iterate over all tables in the fstream. """ table = read_table(fstream) while table is not None: yield table...
[ "def", "read_tables", "(", "fstream", ")", ":", "table", "=", "read_table", "(", "fstream", ")", "while", "table", "is", "not", "None", ":", "yield", "table", "table", "=", "read_table", "(", "fstream", ")" ]
Read all tables from likwid's file stream. Args: fstream: Likwid's output file stream. Returns: A generator that can be used to iterate over all tables in the fstream.
[ "Read", "all", "tables", "from", "likwid", "s", "file", "stream", "." ]
python
train
bspaans/python-mingus
mingus/extra/tablature.py
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/extra/tablature.py#L433-L440
def _get_width(maxwidth): """Return the width of a single bar, when width of the page is given.""" width = maxwidth / 3 if maxwidth <= 60: width = maxwidth elif 60 < maxwidth <= 120: width = maxwidth / 2 return width
[ "def", "_get_width", "(", "maxwidth", ")", ":", "width", "=", "maxwidth", "/", "3", "if", "maxwidth", "<=", "60", ":", "width", "=", "maxwidth", "elif", "60", "<", "maxwidth", "<=", "120", ":", "width", "=", "maxwidth", "/", "2", "return", "width" ]
Return the width of a single bar, when width of the page is given.
[ "Return", "the", "width", "of", "a", "single", "bar", "when", "width", "of", "the", "page", "is", "given", "." ]
python
train
b3j0f/annotation
b3j0f/annotation/async.py
https://github.com/b3j0f/annotation/blob/738035a974e4092696d9dc1bbd149faa21c8c51f/b3j0f/annotation/async.py#L279-L287
def notify_observers(self, joinpoint, post=False): """Notify observers with parameter calls and information about pre/post call. """ _observers = tuple(self.observers) for observer in _observers: observer.notify(joinpoint=joinpoint, post=post)
[ "def", "notify_observers", "(", "self", ",", "joinpoint", ",", "post", "=", "False", ")", ":", "_observers", "=", "tuple", "(", "self", ".", "observers", ")", "for", "observer", "in", "_observers", ":", "observer", ".", "notify", "(", "joinpoint", "=", "...
Notify observers with parameter calls and information about pre/post call.
[ "Notify", "observers", "with", "parameter", "calls", "and", "information", "about", "pre", "/", "post", "call", "." ]
python
train
noahbenson/pimms
pimms/immutable.py
https://github.com/noahbenson/pimms/blob/9051b86d6b858a7a13511b72c48dc21bc903dab2/pimms/immutable.py#L482-L499
def require(f): ''' The @require decorator, usable in an immutable class (see immutable), specifies that the following function is actually a validation check on the immutable class. These functions will appear as static members of the class and get called automatically when the relevant data change...
[ "def", "require", "(", "f", ")", ":", "(", "args", ",", "varargs", ",", "kwargs", ",", "dflts", ")", "=", "getargspec_py27like", "(", "f", ")", "if", "varargs", "is", "not", "None", "or", "kwargs", "is", "not", "None", "or", "dflts", ":", "raise", ...
The @require decorator, usable in an immutable class (see immutable), specifies that the following function is actually a validation check on the immutable class. These functions will appear as static members of the class and get called automatically when the relevant data change. Daughter classes can overl...
[ "The" ]
python
train
juju-solutions/charms.reactive
charms/reactive/bus.py
https://github.com/juju-solutions/charms.reactive/blob/e37e781432e77c12b63d2c739bd6cd70d3230c3a/charms/reactive/bus.py#L185-L199
def register_flags(self, flags): """ Register flags as being relevant to this handler. Relevant flags will be used to determine if the handler should be re-invoked due to changes in the set of active flags. If this handler has already been invoked during this :func:`dispatch` r...
[ "def", "register_flags", "(", "self", ",", "flags", ")", ":", "self", ".", "_CONSUMED_FLAGS", ".", "update", "(", "flags", ")", "self", ".", "_flags", ".", "update", "(", "flags", ")" ]
Register flags as being relevant to this handler. Relevant flags will be used to determine if the handler should be re-invoked due to changes in the set of active flags. If this handler has already been invoked during this :func:`dispatch` run and none of its relevant flags have been s...
[ "Register", "flags", "as", "being", "relevant", "to", "this", "handler", "." ]
python
train
RudolfCardinal/pythonlib
cardinal_pythonlib/extract_text.py
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/extract_text.py#L478-L505
def gen_xml_files_from_docx(fp: BinaryIO) -> Iterator[str]: """ Generate XML files (as strings) from a DOCX file. Args: fp: :class:`BinaryIO` object for reading the ``.DOCX`` file Yields: the string contents of each individual XML file within the ``.DOCX`` file Raises: ...
[ "def", "gen_xml_files_from_docx", "(", "fp", ":", "BinaryIO", ")", "->", "Iterator", "[", "str", "]", ":", "try", ":", "z", "=", "zipfile", ".", "ZipFile", "(", "fp", ")", "filelist", "=", "z", ".", "namelist", "(", ")", "for", "filename", "in", "fil...
Generate XML files (as strings) from a DOCX file. Args: fp: :class:`BinaryIO` object for reading the ``.DOCX`` file Yields: the string contents of each individual XML file within the ``.DOCX`` file Raises: zipfile.BadZipFile: if the zip is unreadable (encrypted?)
[ "Generate", "XML", "files", "(", "as", "strings", ")", "from", "a", "DOCX", "file", "." ]
python
train
neo4j-drivers/neobolt
neobolt/impl/python/direct.py
https://github.com/neo4j-drivers/neobolt/blob/724569d76e85777c4f5e30e8d0a18116bda4d8cd/neobolt/impl/python/direct.py#L300-L310
def reset(self): """ Add a RESET message to the outgoing queue, send it and consume all remaining messages. """ def fail(metadata): raise ProtocolError("RESET failed %r" % metadata) log_debug("[#%04X] C: RESET", self.local_port) self._append(b"\x0F", respon...
[ "def", "reset", "(", "self", ")", ":", "def", "fail", "(", "metadata", ")", ":", "raise", "ProtocolError", "(", "\"RESET failed %r\"", "%", "metadata", ")", "log_debug", "(", "\"[#%04X] C: RESET\"", ",", "self", ".", "local_port", ")", "self", ".", "_append...
Add a RESET message to the outgoing queue, send it and consume all remaining messages.
[ "Add", "a", "RESET", "message", "to", "the", "outgoing", "queue", "send", "it", "and", "consume", "all", "remaining", "messages", "." ]
python
train
Vagrants/blackbird
blackbird/utils/configread.py
https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L150-L166
def _merge_includes(self): """ If "include" option exists in "default.cfg", read the file(glob-match) in the directory. """ raw_include_path = self.get_global_include() if raw_include_path: abs_include_path = self._get_global_include_abs_path( ...
[ "def", "_merge_includes", "(", "self", ")", ":", "raw_include_path", "=", "self", ".", "get_global_include", "(", ")", "if", "raw_include_path", ":", "abs_include_path", "=", "self", ".", "_get_global_include_abs_path", "(", "raw_include_path", ")", "self", ".", "...
If "include" option exists in "default.cfg", read the file(glob-match) in the directory.
[ "If", "include", "option", "exists", "in", "default", ".", "cfg", "read", "the", "file", "(", "glob", "-", "match", ")", "in", "the", "directory", "." ]
python
train
numenta/nupic
src/nupic/swarming/hypersearch_worker.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/swarming/hypersearch_worker.py#L127-L231
def _processUpdatedModels(self, cjDAO): """ For all models that modified their results since last time this method was called, send their latest results to the Hypersearch implementation. """ # Get the latest update counters. This returns a list of tuples: # (modelID, updateCounter) curModelI...
[ "def", "_processUpdatedModels", "(", "self", ",", "cjDAO", ")", ":", "# Get the latest update counters. This returns a list of tuples:", "# (modelID, updateCounter)", "curModelIDCtrList", "=", "cjDAO", ".", "modelsGetUpdateCounters", "(", "self", ".", "_options", ".", "jobID...
For all models that modified their results since last time this method was called, send their latest results to the Hypersearch implementation.
[ "For", "all", "models", "that", "modified", "their", "results", "since", "last", "time", "this", "method", "was", "called", "send", "their", "latest", "results", "to", "the", "Hypersearch", "implementation", "." ]
python
valid
riverrun/drat
drat/analysis.py
https://github.com/riverrun/drat/blob/50cbbf69c022b6ca6641cd55386813b0695c21f5/drat/analysis.py#L60-L72
def run_check(self, data): """Check for uncommon words and difficult words in file.""" if not data: sys.exit(1) data, sentences, chars, num_words = self.pre_check(data) w_dict = Counter(data) uniq_len, uncommon, uncom_len = self.gsl(w_dict) non_dchall_set = Co...
[ "def", "run_check", "(", "self", ",", "data", ")", ":", "if", "not", "data", ":", "sys", ".", "exit", "(", "1", ")", "data", ",", "sentences", ",", "chars", ",", "num_words", "=", "self", ".", "pre_check", "(", "data", ")", "w_dict", "=", "Counter"...
Check for uncommon words and difficult words in file.
[ "Check", "for", "uncommon", "words", "and", "difficult", "words", "in", "file", "." ]
python
train
synw/goerr
goerr/messages.py
https://github.com/synw/goerr/blob/08b3809d6715bffe26899a769d96fa5de8573faf/goerr/messages.py#L18-L25
def error(self, i: int=None) -> str: """ Returns an error message """ head = "[" + colors.red("error") + "]" if i is not None: head = str(i) + " " + head return head
[ "def", "error", "(", "self", ",", "i", ":", "int", "=", "None", ")", "->", "str", ":", "head", "=", "\"[\"", "+", "colors", ".", "red", "(", "\"error\"", ")", "+", "\"]\"", "if", "i", "is", "not", "None", ":", "head", "=", "str", "(", "i", ")...
Returns an error message
[ "Returns", "an", "error", "message" ]
python
train
peerplays-network/python-peerplays
peerplays/cli/bookie.py
https://github.com/peerplays-network/python-peerplays/blob/188f04238e7e21d5f73e9b01099eea44289ef6b7/peerplays/cli/bookie.py#L62-L68
def bmgs(ctx, event): """ [bookie] List betting market groups for an event :param str event: Event id """ eg = Event(event, peerplays_instance=ctx.peerplays) click.echo(pretty_print(eg.bettingmarketgroups, ctx=ctx))
[ "def", "bmgs", "(", "ctx", ",", "event", ")", ":", "eg", "=", "Event", "(", "event", ",", "peerplays_instance", "=", "ctx", ".", "peerplays", ")", "click", ".", "echo", "(", "pretty_print", "(", "eg", ".", "bettingmarketgroups", ",", "ctx", "=", "ctx",...
[bookie] List betting market groups for an event :param str event: Event id
[ "[", "bookie", "]", "List", "betting", "market", "groups", "for", "an", "event" ]
python
train
Turbo87/aerofiles
aerofiles/igc/writer.py
https://github.com/Turbo87/aerofiles/blob/d8b7b04a1fcea5c98f89500de1164619a4ec7ef4/aerofiles/igc/writer.py#L552-L607
def write_task_point(self, latitude=None, longitude=None, text='', distance_min=None, distance_max=None, bearing1=None, bearing2=None): """ Write a task declaration point:: writer.write_task_point( latitude=(51 + 7.345 / 60.)...
[ "def", "write_task_point", "(", "self", ",", "latitude", "=", "None", ",", "longitude", "=", "None", ",", "text", "=", "''", ",", "distance_min", "=", "None", ",", "distance_max", "=", "None", ",", "bearing1", "=", "None", ",", "bearing2", "=", "None", ...
Write a task declaration point:: writer.write_task_point( latitude=(51 + 7.345 / 60.), longitude=(6 + 24.765 / 60.), text='Meiersberg', ) # -> C5107345N00624765EMeiersberg If no ``latitude`` or ``longitude`` is passed, the fie...
[ "Write", "a", "task", "declaration", "point", "::" ]
python
train
rocky/python3-trepan
trepan/interfaces/server.py
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/interfaces/server.py#L61-L78
def confirm(self, prompt, default): """ Called when a dangerous action is about to be done to make sure it's okay. `prompt' is printed; user response is returned.""" while True: try: self.write_confirm(prompt, default) reply = self.readline('').strip()...
[ "def", "confirm", "(", "self", ",", "prompt", ",", "default", ")", ":", "while", "True", ":", "try", ":", "self", ".", "write_confirm", "(", "prompt", ",", "default", ")", "reply", "=", "self", ".", "readline", "(", "''", ")", ".", "strip", "(", ")...
Called when a dangerous action is about to be done to make sure it's okay. `prompt' is printed; user response is returned.
[ "Called", "when", "a", "dangerous", "action", "is", "about", "to", "be", "done", "to", "make", "sure", "it", "s", "okay", ".", "prompt", "is", "printed", ";", "user", "response", "is", "returned", "." ]
python
test
dev-pipeline/dev-pipeline-core
lib/devpipeline_core/command.py
https://github.com/dev-pipeline/dev-pipeline-core/blob/fa40c050a56202485070b0300bb8695e9388c34f/lib/devpipeline_core/command.py#L53-L66
def set_version(self, version): """ Add the --version string with appropriate output. Arguments: version - the version of whatever provides the command """ self.parser.add_argument( "--version", action="version", version="%(prog)s {} (...
[ "def", "set_version", "(", "self", ",", "version", ")", ":", "self", ".", "parser", ".", "add_argument", "(", "\"--version\"", ",", "action", "=", "\"version\"", ",", "version", "=", "\"%(prog)s {} (core {})\"", ".", "format", "(", "version", ",", "devpipeline...
Add the --version string with appropriate output. Arguments: version - the version of whatever provides the command
[ "Add", "the", "--", "version", "string", "with", "appropriate", "output", "." ]
python
train
bitesofcode/projexui
projexui/widgets/xviewwidget/xviewprofiletoolbar.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewprofiletoolbar.py#L218-L237
def exportProfile(self, profile, filename=None): """ Exports this toolbar to the given filename. :param profile | <XViewProfile> filename | <str> || None """ if not filename: filename = QFileDialog.getSaveFileName(self, ...
[ "def", "exportProfile", "(", "self", ",", "profile", ",", "filename", "=", "None", ")", ":", "if", "not", "filename", ":", "filename", "=", "QFileDialog", ".", "getSaveFileName", "(", "self", ",", "'Export Profile'", ",", "''", ",", "'XML Files (*.xml)'", ")...
Exports this toolbar to the given filename. :param profile | <XViewProfile> filename | <str> || None
[ "Exports", "this", "toolbar", "to", "the", "given", "filename", ".", ":", "param", "profile", "|", "<XViewProfile", ">", "filename", "|", "<str", ">", "||", "None" ]
python
train
BlueBrain/NeuroM
neurom/core/tree.py
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/core/tree.py#L66-L72
def ipreorder(self): '''Depth-first pre-order iteration of tree nodes''' children = deque((self, )) while children: cur_node = children.pop() children.extend(reversed(cur_node.children)) yield cur_node
[ "def", "ipreorder", "(", "self", ")", ":", "children", "=", "deque", "(", "(", "self", ",", ")", ")", "while", "children", ":", "cur_node", "=", "children", ".", "pop", "(", ")", "children", ".", "extend", "(", "reversed", "(", "cur_node", ".", "chil...
Depth-first pre-order iteration of tree nodes
[ "Depth", "-", "first", "pre", "-", "order", "iteration", "of", "tree", "nodes" ]
python
train
python-diamond/Diamond
src/collectors/jolokia/jolokia.py
https://github.com/python-diamond/Diamond/blob/0f3eb04327d6d3ed5e53a9967d6c9d2c09714a47/src/collectors/jolokia/jolokia.py#L213-L238
def _list_request(self): """Returns a dictionary with JMX domain names as keys""" try: # https://jolokia.org/reference/html/protocol.html # # A maxDepth of 1 restricts the return value to a map with the JMX # domains as keys. The values of the maps don't h...
[ "def", "_list_request", "(", "self", ")", ":", "try", ":", "# https://jolokia.org/reference/html/protocol.html", "#", "# A maxDepth of 1 restricts the return value to a map with the JMX", "# domains as keys. The values of the maps don't have any meaning", "# and are dummy values.", "#", ...
Returns a dictionary with JMX domain names as keys
[ "Returns", "a", "dictionary", "with", "JMX", "domain", "names", "as", "keys" ]
python
train
SBRG/ssbio
ssbio/protein/sequence/properties/scratch.py
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/properties/scratch.py#L147-L150
def accpro_results(self): """Parse the ACCpro output file and return a dict of secondary structure compositions. """ return ssbio.protein.sequence.utils.fasta.load_fasta_file_as_dict_of_seqs(self.out_accpro)
[ "def", "accpro_results", "(", "self", ")", ":", "return", "ssbio", ".", "protein", ".", "sequence", ".", "utils", ".", "fasta", ".", "load_fasta_file_as_dict_of_seqs", "(", "self", ".", "out_accpro", ")" ]
Parse the ACCpro output file and return a dict of secondary structure compositions.
[ "Parse", "the", "ACCpro", "output", "file", "and", "return", "a", "dict", "of", "secondary", "structure", "compositions", "." ]
python
train
koordinates/python-client
koordinates/layers.py
https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L179-L184
def is_draft_version(self): """ Return if this version is the draft version of a layer """ pub_ver = getattr(self, 'published_version', None) latest_ver = getattr(self, 'latest_version', None) this_ver = getattr(self, 'this_version', None) return this_ver and latest_ver and (this...
[ "def", "is_draft_version", "(", "self", ")", ":", "pub_ver", "=", "getattr", "(", "self", ",", "'published_version'", ",", "None", ")", "latest_ver", "=", "getattr", "(", "self", ",", "'latest_version'", ",", "None", ")", "this_ver", "=", "getattr", "(", "...
Return if this version is the draft version of a layer
[ "Return", "if", "this", "version", "is", "the", "draft", "version", "of", "a", "layer" ]
python
train
improbable-research/keanu
keanu-python/keanu/vertex/generated.py
https://github.com/improbable-research/keanu/blob/73189a8f569078e156168e795f82c7366c59574b/keanu-python/keanu/vertex/generated.py#L512-L520
def Slice(input_vertex: vertex_constructor_param_types, dimension: int, index: int, label: Optional[str]=None) -> Vertex: """ Takes the slice along a given dimension and index of a vertex :param input_vertex: the input vertex :param dimension: the dimension to extract along :param index: the in...
[ "def", "Slice", "(", "input_vertex", ":", "vertex_constructor_param_types", ",", "dimension", ":", "int", ",", "index", ":", "int", ",", "label", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "Vertex", ":", "return", "Double", "(", "context", ...
Takes the slice along a given dimension and index of a vertex :param input_vertex: the input vertex :param dimension: the dimension to extract along :param index: the index of extraction
[ "Takes", "the", "slice", "along", "a", "given", "dimension", "and", "index", "of", "a", "vertex", ":", "param", "input_vertex", ":", "the", "input", "vertex", ":", "param", "dimension", ":", "the", "dimension", "to", "extract", "along", ":", "param", "inde...
python
train
hugapi/hug
examples/static_serve.py
https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/examples/static_serve.py#L12-L48
def setup(api=None): """Sets up and fills test directory for serving. Using different filetypes to see how they are dealt with. The tempoary directory will clean itself up. """ global tmp_dir_object tmp_dir_object = tempfile.TemporaryDirectory() dir_name = tmp_dir_object.name dir_a =...
[ "def", "setup", "(", "api", "=", "None", ")", ":", "global", "tmp_dir_object", "tmp_dir_object", "=", "tempfile", ".", "TemporaryDirectory", "(", ")", "dir_name", "=", "tmp_dir_object", ".", "name", "dir_a", "=", "os", ".", "path", ".", "join", "(", "dir_n...
Sets up and fills test directory for serving. Using different filetypes to see how they are dealt with. The tempoary directory will clean itself up.
[ "Sets", "up", "and", "fills", "test", "directory", "for", "serving", "." ]
python
train
StackStorm/pybind
pybind/slxos/v17s_1_02/mpls_config/router/mpls/mpls_cmds_holder/ldp/ldp_holder/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/mpls_config/router/mpls/mpls_cmds_holder/ldp/ldp_holder/__init__.py#L214-L235
def _set_ldp_hello_timeout_basic(self, v, load=False): """ Setter method for ldp_hello_timeout_basic, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/ldp/ldp_holder/ldp_hello_timeout_basic (uint32) If this variable is read-only (config: false) in the source YANG file, then _set_ldp_h...
[ "def", "_set_ldp_hello_timeout_basic", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ...
Setter method for ldp_hello_timeout_basic, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/ldp/ldp_holder/ldp_hello_timeout_basic (uint32) If this variable is read-only (config: false) in the source YANG file, then _set_ldp_hello_timeout_basic is considered as a private method. Backends ...
[ "Setter", "method", "for", "ldp_hello_timeout_basic", "mapped", "from", "YANG", "variable", "/", "mpls_config", "/", "router", "/", "mpls", "/", "mpls_cmds_holder", "/", "ldp", "/", "ldp_holder", "/", "ldp_hello_timeout_basic", "(", "uint32", ")", "If", "this", ...
python
train
juju/charm-helpers
charmhelpers/core/hookenv.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/core/hookenv.py#L616-L619
def metadata(): """Get the current charm metadata.yaml contents as a python object""" with open(os.path.join(charm_dir(), 'metadata.yaml')) as md: return yaml.safe_load(md)
[ "def", "metadata", "(", ")", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "charm_dir", "(", ")", ",", "'metadata.yaml'", ")", ")", "as", "md", ":", "return", "yaml", ".", "safe_load", "(", "md", ")" ]
Get the current charm metadata.yaml contents as a python object
[ "Get", "the", "current", "charm", "metadata", ".", "yaml", "contents", "as", "a", "python", "object" ]
python
train
pypa/pipenv
pipenv/vendor/requests/sessions.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requests/sessions.py#L276-L315
def rebuild_proxies(self, prepared_request, proxies): """This method re-evaluates the proxy configuration by considering the environment variables. If we are redirected to a URL covered by NO_PROXY, we strip the proxy configuration. Otherwise, we set missing proxy keys for this URL (in c...
[ "def", "rebuild_proxies", "(", "self", ",", "prepared_request", ",", "proxies", ")", ":", "proxies", "=", "proxies", "if", "proxies", "is", "not", "None", "else", "{", "}", "headers", "=", "prepared_request", ".", "headers", "url", "=", "prepared_request", "...
This method re-evaluates the proxy configuration by considering the environment variables. If we are redirected to a URL covered by NO_PROXY, we strip the proxy configuration. Otherwise, we set missing proxy keys for this URL (in case they were stripped by a previous redirect). ...
[ "This", "method", "re", "-", "evaluates", "the", "proxy", "configuration", "by", "considering", "the", "environment", "variables", ".", "If", "we", "are", "redirected", "to", "a", "URL", "covered", "by", "NO_PROXY", "we", "strip", "the", "proxy", "configuratio...
python
train
ethereum/py-trie
trie/smt.py
https://github.com/ethereum/py-trie/blob/d33108d21b54d59ee311f61d978496c84a6f1f8b/trie/smt.py#L144-L186
def update(self, key: bytes, value: bytes, node_updates: Sequence[Hash32]): """ Merge an update for another key with the one we are tracking internally. :param key: keypath of the update we are processing :param value: value of the update we are processing :param node_updates: s...
[ "def", "update", "(", "self", ",", "key", ":", "bytes", ",", "value", ":", "bytes", ",", "node_updates", ":", "Sequence", "[", "Hash32", "]", ")", ":", "validate_is_bytes", "(", "key", ")", "validate_length", "(", "key", ",", "self", ".", "_key_size", ...
Merge an update for another key with the one we are tracking internally. :param key: keypath of the update we are processing :param value: value of the update we are processing :param node_updates: sequence of sibling nodes (in root->leaf order) must be at least as ...
[ "Merge", "an", "update", "for", "another", "key", "with", "the", "one", "we", "are", "tracking", "internally", "." ]
python
train
CitrineInformatics/pif-dft
dfttopif/parsers/base.py
https://github.com/CitrineInformatics/pif-dft/blob/d5411dc1f6c6e8d454b132977ca7ab3bb8131a80/dfttopif/parsers/base.py#L296-L304
def get_number_of_atoms(self): """Get the number of atoms in the calculated structure. Returns: Property, where number of atoms is a scalar. """ strc = self.get_output_structure() if not strc: return None return Property(scalars=[Scalar(value=len(strc))], uni...
[ "def", "get_number_of_atoms", "(", "self", ")", ":", "strc", "=", "self", ".", "get_output_structure", "(", ")", "if", "not", "strc", ":", "return", "None", "return", "Property", "(", "scalars", "=", "[", "Scalar", "(", "value", "=", "len", "(", "strc", ...
Get the number of atoms in the calculated structure. Returns: Property, where number of atoms is a scalar.
[ "Get", "the", "number", "of", "atoms", "in", "the", "calculated", "structure", "." ]
python
train
santoshphilip/eppy
eppy/geometry/surface.py
https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/geometry/surface.py#L89-L98
def angle2vecs(vec1, vec2): """angle between two vectors""" # vector a * vector b = |a|*|b|* cos(angle between vector a and vector b) dot = np.dot(vec1, vec2) vec1_modulus = np.sqrt(np.multiply(vec1, vec1).sum()) vec2_modulus = np.sqrt(np.multiply(vec2, vec2).sum()) if (vec1_modulus * vec2_modul...
[ "def", "angle2vecs", "(", "vec1", ",", "vec2", ")", ":", "# vector a * vector b = |a|*|b|* cos(angle between vector a and vector b)", "dot", "=", "np", ".", "dot", "(", "vec1", ",", "vec2", ")", "vec1_modulus", "=", "np", ".", "sqrt", "(", "np", ".", "multiply",...
angle between two vectors
[ "angle", "between", "two", "vectors" ]
python
train
ambitioninc/django-query-builder
querybuilder/query.py
https://github.com/ambitioninc/django-query-builder/blob/113a7d845d3ddc6a45621b9880308e756f87c5bf/querybuilder/query.py#L1583-L1680
def select(self, return_models=False, nest=False, bypass_safe_limit=False, sql=None, sql_args=None): """ Executes the SELECT statement and returns the rows as a list of dictionaries or a list of model instances :type return_models: bool :param return_models: Set to True to retur...
[ "def", "select", "(", "self", ",", "return_models", "=", "False", ",", "nest", "=", "False", ",", "bypass_safe_limit", "=", "False", ",", "sql", "=", "None", ",", "sql_args", "=", "None", ")", ":", "# Check if we need to set a safe limit", "if", "bypass_safe_l...
Executes the SELECT statement and returns the rows as a list of dictionaries or a list of model instances :type return_models: bool :param return_models: Set to True to return a list of models instead of a list of dictionaries. Defaults to False :type nest: bool :pa...
[ "Executes", "the", "SELECT", "statement", "and", "returns", "the", "rows", "as", "a", "list", "of", "dictionaries", "or", "a", "list", "of", "model", "instances" ]
python
train
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L770-L827
def calc_gamma_from_energy_autocorrelation_fit(self, GammaGuess=None, silent=False, MakeFig=True, show_fig=True): """ Calculates the total damping, i.e. Gamma, by calculating the energy each point in time. This energy array is then used for the autocorrleation. The autocorrelation is f...
[ "def", "calc_gamma_from_energy_autocorrelation_fit", "(", "self", ",", "GammaGuess", "=", "None", ",", "silent", "=", "False", ",", "MakeFig", "=", "True", ",", "show_fig", "=", "True", ")", ":", "autocorrelation", "=", "calc_autocorrelation", "(", "self", ".", ...
Calculates the total damping, i.e. Gamma, by calculating the energy each point in time. This energy array is then used for the autocorrleation. The autocorrelation is fitted with an exponential relaxation function and the function returns the parameters with errors. Parameters ...
[ "Calculates", "the", "total", "damping", "i", ".", "e", ".", "Gamma", "by", "calculating", "the", "energy", "each", "point", "in", "time", ".", "This", "energy", "array", "is", "then", "used", "for", "the", "autocorrleation", ".", "The", "autocorrelation", ...
python
train
apache/incubator-heron
heron/tools/admin/src/python/standalone.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L377-L387
def add_additional_args(parsers): ''' add additional parameters to parser ''' for parser in parsers: cli_args.add_verbose(parser) cli_args.add_config(parser) parser.add_argument( '--heron-dir', default=config.get_heron_dir(), help='Path to Heron home directory')
[ "def", "add_additional_args", "(", "parsers", ")", ":", "for", "parser", "in", "parsers", ":", "cli_args", ".", "add_verbose", "(", "parser", ")", "cli_args", ".", "add_config", "(", "parser", ")", "parser", ".", "add_argument", "(", "'--heron-dir'", ",", "d...
add additional parameters to parser
[ "add", "additional", "parameters", "to", "parser" ]
python
valid
fukuball/fuku-ml
FukuML/Utility.py
https://github.com/fukuball/fuku-ml/blob/0da15ad7af76adf344b5a6b3f3dbabbbab3446b0/FukuML/Utility.py#L251-L269
def kernel_matrix_xX(svm_model, original_x, original_X): if (svm_model.svm_kernel == 'polynomial_kernel' or svm_model.svm_kernel == 'soft_polynomial_kernel'): K = (svm_model.zeta + svm_model.gamma * np.dot(original_x, original_X.T)) ** svm_model.Q elif (svm_model.svm_kernel == 'gaussian_ker...
[ "def", "kernel_matrix_xX", "(", "svm_model", ",", "original_x", ",", "original_X", ")", ":", "if", "(", "svm_model", ".", "svm_kernel", "==", "'polynomial_kernel'", "or", "svm_model", ".", "svm_kernel", "==", "'soft_polynomial_kernel'", ")", ":", "K", "=", "(", ...
K = np.zeros((svm_model.data_num, svm_model.data_num)) for i in range(svm_model.data_num): for j in range(svm_model.data_num): if (svm_model.svm_kernel == 'polynomial_kernel' or svm_model.svm_kernel == 'soft_polynomial_kernel'): K[i, j] = Kernel.polynomial_kernel...
[ "K", "=", "np", ".", "zeros", "((", "svm_model", ".", "data_num", "svm_model", ".", "data_num", "))" ]
python
test
VingtCinq/python-mailchimp
mailchimp3/entities/campaignfolders.py
https://github.com/VingtCinq/python-mailchimp/blob/1b472f1b64fdde974732ac4b7ed48908bb707260/mailchimp3/entities/campaignfolders.py#L97-L106
def delete(self, folder_id): """ Delete a specific campaign folder, and mark all the campaigns in the folder as ‘unfiled’. :param folder_id: The unique id for the campaign folder. :type folder_id: :py:class:`str` """ self.folder_id = folder_id return self...
[ "def", "delete", "(", "self", ",", "folder_id", ")", ":", "self", ".", "folder_id", "=", "folder_id", "return", "self", ".", "_mc_client", ".", "_delete", "(", "url", "=", "self", ".", "_build_path", "(", "folder_id", ")", ")" ]
Delete a specific campaign folder, and mark all the campaigns in the folder as ‘unfiled’. :param folder_id: The unique id for the campaign folder. :type folder_id: :py:class:`str`
[ "Delete", "a", "specific", "campaign", "folder", "and", "mark", "all", "the", "campaigns", "in", "the", "folder", "as", "‘unfiled’", "." ]
python
valid
saltstack/salt
salt/states/file.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/file.py#L5355-L5456
def comment(name, regex, char='#', backup='.bak'): ''' Comment out specified lines in a file. name The full path to the file to be edited regex A regular expression used to find the lines that are to be commented; this pattern will be wrapped in parenthesis and will move any ...
[ "def", "comment", "(", "name", ",", "regex", ",", "char", "=", "'#'", ",", "backup", "=", "'.bak'", ")", ":", "name", "=", "os", ".", "path", ".", "expanduser", "(", "name", ")", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{",...
Comment out specified lines in a file. name The full path to the file to be edited regex A regular expression used to find the lines that are to be commented; this pattern will be wrapped in parenthesis and will move any preceding/trailing ``^`` or ``$`` characters outside the p...
[ "Comment", "out", "specified", "lines", "in", "a", "file", "." ]
python
train
grycap/RADL
radl/radl.py
https://github.com/grycap/RADL/blob/03ccabb0313a48a5aa0e20c1f7983fddcb95e9cb/radl/radl.py#L966-L969
def setUserPasswdCredentials(self, username, password): """Set username and password in ``disk.0.os.credentials``.""" self.setCredentialValues(username=username, password=password)
[ "def", "setUserPasswdCredentials", "(", "self", ",", "username", ",", "password", ")", ":", "self", ".", "setCredentialValues", "(", "username", "=", "username", ",", "password", "=", "password", ")" ]
Set username and password in ``disk.0.os.credentials``.
[ "Set", "username", "and", "password", "in", "disk", ".", "0", ".", "os", ".", "credentials", "." ]
python
train
micheles/decorator
src/decorator.py
https://github.com/micheles/decorator/blob/7495513ee24deffbf5060860eb69b224fe1d0fe4/src/decorator.py#L259-L293
def decorator(caller, _func=None): """decorator(caller) converts a caller function into a decorator""" if _func is not None: # return a decorated function # this is obsolete behavior; you should use decorate instead return decorate(_func, caller) # else return a decorator function defau...
[ "def", "decorator", "(", "caller", ",", "_func", "=", "None", ")", ":", "if", "_func", "is", "not", "None", ":", "# return a decorated function", "# this is obsolete behavior; you should use decorate instead", "return", "decorate", "(", "_func", ",", "caller", ")", ...
decorator(caller) converts a caller function into a decorator
[ "decorator", "(", "caller", ")", "converts", "a", "caller", "function", "into", "a", "decorator" ]
python
train
ewels/MultiQC
multiqc/modules/damageprofiler/damageprofiler.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/damageprofiler/damageprofiler.py#L174-L208
def addSummaryMetrics(self, dict_to_plot): """ Take the parsed stats from the DamageProfiler and add it to the basic stats table at the top of the report """ headers = OrderedDict() headers['std'] = { 'title': 'Read length std. dev.', 'description': 'Read length...
[ "def", "addSummaryMetrics", "(", "self", ",", "dict_to_plot", ")", ":", "headers", "=", "OrderedDict", "(", ")", "headers", "[", "'std'", "]", "=", "{", "'title'", ":", "'Read length std. dev.'", ",", "'description'", ":", "'Read length std. dev.'", ",", "'suffi...
Take the parsed stats from the DamageProfiler and add it to the basic stats table at the top of the report
[ "Take", "the", "parsed", "stats", "from", "the", "DamageProfiler", "and", "add", "it", "to", "the", "basic", "stats", "table", "at", "the", "top", "of", "the", "report" ]
python
train
gwpy/gwpy
gwpy/plot/axes.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/plot/axes.py#L149-L162
def set_epoch(self, epoch): """Set the epoch for the current GPS scale. This method will fail if the current X-axis scale isn't one of the GPS scales. See :ref:`gwpy-plot-gps` for more details. Parameters ---------- epoch : `float`, `str` GPS-compatible time...
[ "def", "set_epoch", "(", "self", ",", "epoch", ")", ":", "scale", "=", "self", ".", "get_xscale", "(", ")", "return", "self", ".", "set_xscale", "(", "scale", ",", "epoch", "=", "epoch", ")" ]
Set the epoch for the current GPS scale. This method will fail if the current X-axis scale isn't one of the GPS scales. See :ref:`gwpy-plot-gps` for more details. Parameters ---------- epoch : `float`, `str` GPS-compatible time or date object, anything parseable by ...
[ "Set", "the", "epoch", "for", "the", "current", "GPS", "scale", "." ]
python
train
hyperledger/indy-plenum
stp_core/loop/looper.py
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/loop/looper.py#L204-L217
async def runOnceNicely(self): """ Execute `runOnce` with a small tolerance of 0.01 seconds so that the Prodables can complete their other asynchronous tasks not running on the event-loop. """ start = time.perf_counter() msgsProcessed = await self.prodAllOnce() if...
[ "async", "def", "runOnceNicely", "(", "self", ")", ":", "start", "=", "time", ".", "perf_counter", "(", ")", "msgsProcessed", "=", "await", "self", ".", "prodAllOnce", "(", ")", "if", "msgsProcessed", "==", "0", ":", "# if no let other stuff run", "await", "...
Execute `runOnce` with a small tolerance of 0.01 seconds so that the Prodables can complete their other asynchronous tasks not running on the event-loop.
[ "Execute", "runOnce", "with", "a", "small", "tolerance", "of", "0", ".", "01", "seconds", "so", "that", "the", "Prodables", "can", "complete", "their", "other", "asynchronous", "tasks", "not", "running", "on", "the", "event", "-", "loop", "." ]
python
train
aio-libs/aioodbc
aioodbc/cursor.py
https://github.com/aio-libs/aioodbc/blob/01245560828d4adce0d7d16930fa566102322a0a/aioodbc/cursor.py#L124-L132
def executemany(self, sql, *params): """Prepare a database query or command and then execute it against all parameter sequences found in the sequence seq_of_params. :param sql: the SQL statement to execute with optional ? parameters :param params: sequence parameters for the markers in...
[ "def", "executemany", "(", "self", ",", "sql", ",", "*", "params", ")", ":", "fut", "=", "self", ".", "_run_operation", "(", "self", ".", "_impl", ".", "executemany", ",", "sql", ",", "*", "params", ")", "return", "fut" ]
Prepare a database query or command and then execute it against all parameter sequences found in the sequence seq_of_params. :param sql: the SQL statement to execute with optional ? parameters :param params: sequence parameters for the markers in the SQL.
[ "Prepare", "a", "database", "query", "or", "command", "and", "then", "execute", "it", "against", "all", "parameter", "sequences", "found", "in", "the", "sequence", "seq_of_params", "." ]
python
train
StagPython/StagPy
stagpy/time_series.py
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/time_series.py#L96-L122
def plot_time_series(sdat, lovs): """Plot requested time series. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. lovs (nested list of str): nested list of series names such as the one produced by :func:`stagpy.misc.list_of_vars`. Other Parameters: ...
[ "def", "plot_time_series", "(", "sdat", ",", "lovs", ")", ":", "sovs", "=", "misc", ".", "set_of_vars", "(", "lovs", ")", "tseries", "=", "{", "}", "times", "=", "{", "}", "metas", "=", "{", "}", "for", "tvar", "in", "sovs", ":", "series", ",", "...
Plot requested time series. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. lovs (nested list of str): nested list of series names such as the one produced by :func:`stagpy.misc.list_of_vars`. Other Parameters: conf.time.tstart: the starting time...
[ "Plot", "requested", "time", "series", "." ]
python
train
apache/airflow
airflow/contrib/hooks/bigquery_hook.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L923-L994
def run_copy(self, source_project_dataset_tables, destination_project_dataset_table, write_disposition='WRITE_EMPTY', create_disposition='CREATE_IF_NEEDED', labels=None): """ Executes a BigQuery copy command to copy dat...
[ "def", "run_copy", "(", "self", ",", "source_project_dataset_tables", ",", "destination_project_dataset_table", ",", "write_disposition", "=", "'WRITE_EMPTY'", ",", "create_disposition", "=", "'CREATE_IF_NEEDED'", ",", "labels", "=", "None", ")", ":", "source_project_data...
Executes a BigQuery copy command to copy data from one BigQuery table to another. See here: https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.copy For more details about these parameters. :param source_project_dataset_tables: One or more dotted ``(proj...
[ "Executes", "a", "BigQuery", "copy", "command", "to", "copy", "data", "from", "one", "BigQuery", "table", "to", "another", ".", "See", "here", ":" ]
python
test
google/grr
grr/server/grr_response_server/aff4.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4.py#L339-L361
def SetAttributes(self, urn, attributes, to_delete, add_child_index=True, mutation_pool=None): """Sets the attributes in the data store.""" attributes[AFF4Object.SchemaCls.LAST] = [ rdfvalue.RDFDatetime....
[ "def", "SetAttributes", "(", "self", ",", "urn", ",", "attributes", ",", "to_delete", ",", "add_child_index", "=", "True", ",", "mutation_pool", "=", "None", ")", ":", "attributes", "[", "AFF4Object", ".", "SchemaCls", ".", "LAST", "]", "=", "[", "rdfvalue...
Sets the attributes in the data store.
[ "Sets", "the", "attributes", "in", "the", "data", "store", "." ]
python
train
mitsei/dlkit
dlkit/handcar/relationship/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/relationship/sessions.py#L1002-L1029
def get_relationship_form_for_update(self, relationship_id=None): """Gets the relationship form for updating an existing relationship. A new relationship form should be requested for each update transaction. arg: relationship_id (osid.id.Id): the ``Id`` of the ``Rela...
[ "def", "get_relationship_form_for_update", "(", "self", ",", "relationship_id", "=", "None", ")", ":", "if", "relationship_id", "is", "None", ":", "raise", "NullArgument", "(", ")", "try", ":", "url_path", "=", "(", "'/handcar/services/relationship/families/'", "+",...
Gets the relationship form for updating an existing relationship. A new relationship form should be requested for each update transaction. arg: relationship_id (osid.id.Id): the ``Id`` of the ``Relationship`` return: (osid.relationship.RelationshipForm) - the relatio...
[ "Gets", "the", "relationship", "form", "for", "updating", "an", "existing", "relationship", "." ]
python
train
YosaiProject/yosai
yosai/web/session/session.py
https://github.com/YosaiProject/yosai/blob/7f96aa6b837ceae9bf3d7387cd7e35f5ab032575/yosai/web/session/session.py#L132-L139
def on_expiration(self, session, ese=None, session_key=None): """ :type session: session_abcs.Session :type ese: ExpiredSessionException :type session_key: session_abcs.SessionKey """ super().on_expiration(session, ese, session_key) self.on_invalidation(session_k...
[ "def", "on_expiration", "(", "self", ",", "session", ",", "ese", "=", "None", ",", "session_key", "=", "None", ")", ":", "super", "(", ")", ".", "on_expiration", "(", "session", ",", "ese", ",", "session_key", ")", "self", ".", "on_invalidation", "(", ...
:type session: session_abcs.Session :type ese: ExpiredSessionException :type session_key: session_abcs.SessionKey
[ ":", "type", "session", ":", "session_abcs", ".", "Session", ":", "type", "ese", ":", "ExpiredSessionException", ":", "type", "session_key", ":", "session_abcs", ".", "SessionKey" ]
python
train
mandiant/ioc_writer
ioc_writer/ioc_common.py
https://github.com/mandiant/ioc_writer/blob/712247f3a10bdc2584fa18ac909fc763f71df21a/ioc_writer/ioc_common.py#L743-L755
def make_processitem_path(path, condition='contains', negate=False, preserve_case=False): """ Create a node for ProcessItem/path :return: A IndicatorItem represented as an Element node """ document = 'ProcessItem' search = 'ProcessItem/path' content_type = 'string' content = path ...
[ "def", "make_processitem_path", "(", "path", ",", "condition", "=", "'contains'", ",", "negate", "=", "False", ",", "preserve_case", "=", "False", ")", ":", "document", "=", "'ProcessItem'", "search", "=", "'ProcessItem/path'", "content_type", "=", "'string'", "...
Create a node for ProcessItem/path :return: A IndicatorItem represented as an Element node
[ "Create", "a", "node", "for", "ProcessItem", "/", "path", ":", "return", ":", "A", "IndicatorItem", "represented", "as", "an", "Element", "node" ]
python
train
jobovy/galpy
galpy/actionAngle/actionAngleAxi.py
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/actionAngle/actionAngleAxi.py#L330-L347
def calcELAxi(R,vR,vT,pot,vc=1.,ro=1.): """ NAME: calcELAxi PURPOSE: calculate the energy and angular momentum INPUT: R - Galactocentric radius (/ro) vR - radial part of the velocity (/vc) vT - azimuthal part of the velocity (/vc) vc - circular velocity r...
[ "def", "calcELAxi", "(", "R", ",", "vR", ",", "vT", ",", "pot", ",", "vc", "=", "1.", ",", "ro", "=", "1.", ")", ":", "return", "(", "potentialAxi", "(", "R", ",", "pot", ")", "+", "vR", "**", "2.", "/", "2.", "+", "vT", "**", "2.", "/", ...
NAME: calcELAxi PURPOSE: calculate the energy and angular momentum INPUT: R - Galactocentric radius (/ro) vR - radial part of the velocity (/vc) vT - azimuthal part of the velocity (/vc) vc - circular velocity ro - reference radius OUTPUT: (E,L) HI...
[ "NAME", ":", "calcELAxi", "PURPOSE", ":", "calculate", "the", "energy", "and", "angular", "momentum", "INPUT", ":", "R", "-", "Galactocentric", "radius", "(", "/", "ro", ")", "vR", "-", "radial", "part", "of", "the", "velocity", "(", "/", "vc", ")", "v...
python
train
secynic/ipwhois
ipwhois/scripts/ipwhois_cli.py
https://github.com/secynic/ipwhois/blob/b5d634d36b0b942d538d38d77b3bdcd815f155a0/ipwhois/scripts/ipwhois_cli.py#L406-L426
def generate_output_header(self, query_type='RDAP'): """ The function for generating the CLI output header. Args: query_type (:obj:`str`): The IPWhois query type. Defaults to 'RDAP'. Returns: str: The generated output. """ output...
[ "def", "generate_output_header", "(", "self", ",", "query_type", "=", "'RDAP'", ")", ":", "output", "=", "'\\n{0}{1}{2} query for {3}:{4}\\n\\n'", ".", "format", "(", "ANSI", "[", "'ul'", "]", ",", "ANSI", "[", "'b'", "]", ",", "query_type", ",", "self", "."...
The function for generating the CLI output header. Args: query_type (:obj:`str`): The IPWhois query type. Defaults to 'RDAP'. Returns: str: The generated output.
[ "The", "function", "for", "generating", "the", "CLI", "output", "header", "." ]
python
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py#L760-L950
def _find_next_ready_node(self): """ Finds the next node that is ready to be built. This is *the* main guts of the DAG walk. We loop through the list of candidates, looking for something that has no un-built children (i.e., that is a leaf Node or has dependencies that are ...
[ "def", "_find_next_ready_node", "(", "self", ")", ":", "self", ".", "ready_exc", "=", "None", "T", "=", "self", ".", "trace", "if", "T", ":", "T", ".", "write", "(", "SCons", ".", "Util", ".", "UnicodeType", "(", "'\\n'", ")", "+", "self", ".", "tr...
Finds the next node that is ready to be built. This is *the* main guts of the DAG walk. We loop through the list of candidates, looking for something that has no un-built children (i.e., that is a leaf Node or has dependencies that are all leaf Nodes or up-to-date). Candidate Nodes ar...
[ "Finds", "the", "next", "node", "that", "is", "ready", "to", "be", "built", "." ]
python
train
Netflix-Skunkworks/historical
historical/common/dynamodb.py
https://github.com/Netflix-Skunkworks/historical/blob/c3ebaa8388a3fe67e23a6c9c6b04c3e618497c4a/historical/common/dynamodb.py#L254-L275
def deserialize_durable_record_to_current_model(record, current_model): """ Utility function that will take a Durable Dynamo event record and turn it into the proper Current Dynamo object. This will properly deserialize the ugly Dynamo datatypes away. :param record: :param current_model: :retur...
[ "def", "deserialize_durable_record_to_current_model", "(", "record", ",", "current_model", ")", ":", "# Was the item in question too big for SNS? If so, then we need to fetch the item from the current Dynamo table:", "if", "record", ".", "get", "(", "EVENT_TOO_BIG_FLAG", ")", ":", ...
Utility function that will take a Durable Dynamo event record and turn it into the proper Current Dynamo object. This will properly deserialize the ugly Dynamo datatypes away. :param record: :param current_model: :return:
[ "Utility", "function", "that", "will", "take", "a", "Durable", "Dynamo", "event", "record", "and", "turn", "it", "into", "the", "proper", "Current", "Dynamo", "object", "." ]
python
train
bitesofcode/projex
projex/plugin.py
https://github.com/bitesofcode/projex/blob/d31743ec456a41428709968ab11a2cf6c6c76247/projex/plugin.py#L683-L727
def fromFile(cls, filepath): """ Creates a proxy instance from the inputted registry file. :param filepath | <str> :return <PluginProxy> || None """ xdata = ElementTree.parse(nstr(filepath)) xroot = xdata.getroot() # collect var...
[ "def", "fromFile", "(", "cls", ",", "filepath", ")", ":", "xdata", "=", "ElementTree", ".", "parse", "(", "nstr", "(", "filepath", ")", ")", "xroot", "=", "xdata", ".", "getroot", "(", ")", "# collect variable information", "name", "=", "xroot", ".", "ge...
Creates a proxy instance from the inputted registry file. :param filepath | <str> :return <PluginProxy> || None
[ "Creates", "a", "proxy", "instance", "from", "the", "inputted", "registry", "file", ".", ":", "param", "filepath", "|", "<str", ">", ":", "return", "<PluginProxy", ">", "||", "None" ]
python
train
saltstack/salt
salt/modules/boto_elbv2.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_elbv2.py#L166-L206
def delete_target_group(name, region=None, key=None, keyid=None, profile=None): ''' Delete target group. name (string) - Target Group Name or Amazon Resource Name (ARN). returns (bool) - Tru...
[ "def", "delete_target_group", "(", "name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "conn", "=", "_get_conn", "(", "region", "=", "region", ",", "key", "=", "key", ",", "...
Delete target group. name (string) - Target Group Name or Amazon Resource Name (ARN). returns (bool) - True on success, False on failure. CLI example: .. code-block:: bash salt myminion boto_elbv2.delete_target_group arn:aws:elasticloadbalancing:us-west-2:644138682826:target...
[ "Delete", "target", "group", "." ]
python
train
CZ-NIC/yangson
yangson/schemadata.py
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L368-L393
def path2route(path: SchemaPath) -> SchemaRoute: """Translate a schema/data path to a schema/data route. Args: path: Schema path. Raises: InvalidSchemaPath: Invalid path. """ if path == "/" or path == "": return [] nlist = path.split(...
[ "def", "path2route", "(", "path", ":", "SchemaPath", ")", "->", "SchemaRoute", ":", "if", "path", "==", "\"/\"", "or", "path", "==", "\"\"", ":", "return", "[", "]", "nlist", "=", "path", ".", "split", "(", "\"/\"", ")", "prevns", "=", "None", "res",...
Translate a schema/data path to a schema/data route. Args: path: Schema path. Raises: InvalidSchemaPath: Invalid path.
[ "Translate", "a", "schema", "/", "data", "path", "to", "a", "schema", "/", "data", "route", "." ]
python
train
pazz/urwidtrees
urwidtrees/widgets.py
https://github.com/pazz/urwidtrees/blob/d1fa38ce4f37db00bdfc574b856023b5db4c7ead/urwidtrees/widgets.py#L156-L165
def collapse_focussed(self): """ Collapse currently focussed position; works only if the underlying tree allows it. """ if implementsCollapseAPI(self._tree): w, focuspos = self.get_focus() self._tree.collapse(focuspos) self._walker.clear_cache(...
[ "def", "collapse_focussed", "(", "self", ")", ":", "if", "implementsCollapseAPI", "(", "self", ".", "_tree", ")", ":", "w", ",", "focuspos", "=", "self", ".", "get_focus", "(", ")", "self", ".", "_tree", ".", "collapse", "(", "focuspos", ")", "self", "...
Collapse currently focussed position; works only if the underlying tree allows it.
[ "Collapse", "currently", "focussed", "position", ";", "works", "only", "if", "the", "underlying", "tree", "allows", "it", "." ]
python
train
KyleWpppd/css-audit
cssaudit/parser.py
https://github.com/KyleWpppd/css-audit/blob/cab4d4204cf30d54bc1881deee6ad92ae6aacc56/cssaudit/parser.py#L213-L236
def extract_leftmost_selector(selector_list): """ Because we aren't building a DOM tree to transverse, the only way to get the most general selectors is to take the leftmost. For example with `div.outer div.inner`, we can't tell if `div.inner` has been used in context without building a tree. "...
[ "def", "extract_leftmost_selector", "(", "selector_list", ")", ":", "classes", "=", "set", "(", ")", "ids", "=", "set", "(", ")", "elements", "=", "set", "(", ")", "# print \"Selector list: %s \\n\\n\\n\\n\\n\\n\" % selector_list", "for", "selector", "in", "selec...
Because we aren't building a DOM tree to transverse, the only way to get the most general selectors is to take the leftmost. For example with `div.outer div.inner`, we can't tell if `div.inner` has been used in context without building a tree.
[ "Because", "we", "aren", "t", "building", "a", "DOM", "tree", "to", "transverse", "the", "only", "way", "to", "get", "the", "most", "general", "selectors", "is", "to", "take", "the", "leftmost", ".", "For", "example", "with", "div", ".", "outer", "div", ...
python
train
iotile/coretools
iotileemulate/iotile/emulate/reference/controller_features/tile_manager.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/tile_manager.py#L108-L120
def insert_tile(self, tile_info): """Add or replace an entry in the tile cache. Args: tile_info (TileInfo): The newly registered tile. """ for i, tile in enumerate(self.registered_tiles): if tile.slot == tile_info.slot: self.registered_tiles[i] =...
[ "def", "insert_tile", "(", "self", ",", "tile_info", ")", ":", "for", "i", ",", "tile", "in", "enumerate", "(", "self", ".", "registered_tiles", ")", ":", "if", "tile", ".", "slot", "==", "tile_info", ".", "slot", ":", "self", ".", "registered_tiles", ...
Add or replace an entry in the tile cache. Args: tile_info (TileInfo): The newly registered tile.
[ "Add", "or", "replace", "an", "entry", "in", "the", "tile", "cache", "." ]
python
train
ProjetPP/PPP-Core
ppp_core/__init__.py
https://github.com/ProjetPP/PPP-Core/blob/49ee5b16325aa7134e2e423cf75e7b2609df96a0/ppp_core/__init__.py#L6-L9
def app(environ, start_response): """Function called by the WSGI server.""" r = HttpRequestHandler(environ, start_response, Router).dispatch() return r
[ "def", "app", "(", "environ", ",", "start_response", ")", ":", "r", "=", "HttpRequestHandler", "(", "environ", ",", "start_response", ",", "Router", ")", ".", "dispatch", "(", ")", "return", "r" ]
Function called by the WSGI server.
[ "Function", "called", "by", "the", "WSGI", "server", "." ]
python
train
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/d5d12499f3755199d5eedd8b363450f1cf4073bd/influxdb/client.py#L976-L1020
def create_continuous_query(self, name, select, database=None, resample_opts=None): r"""Create a continuous query for a database. :param name: the name of continuous query to create :type name: str :param select: select statement for the continuous query ...
[ "def", "create_continuous_query", "(", "self", ",", "name", ",", "select", ",", "database", "=", "None", ",", "resample_opts", "=", "None", ")", ":", "query_string", "=", "(", "\"CREATE CONTINUOUS QUERY {0} ON {1}{2} BEGIN {3} END\"", ")", ".", "format", "(", "quo...
r"""Create a continuous query for a database. :param name: the name of continuous query to create :type name: str :param select: select statement for the continuous query :type select: str :param database: the database for which the continuous query is created. Defau...
[ "r", "Create", "a", "continuous", "query", "for", "a", "database", "." ]
python
train
BrianHicks/emit
emit/router/core.py
https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/core.py#L386-L399
def get_name(self, func): ''' Get the name to reference a function by :param func: function to get the name of :type func: callable ''' if hasattr(func, 'name'): return func.name return '%s.%s' % ( func.__module__, func.__name...
[ "def", "get_name", "(", "self", ",", "func", ")", ":", "if", "hasattr", "(", "func", ",", "'name'", ")", ":", "return", "func", ".", "name", "return", "'%s.%s'", "%", "(", "func", ".", "__module__", ",", "func", ".", "__name__", ")" ]
Get the name to reference a function by :param func: function to get the name of :type func: callable
[ "Get", "the", "name", "to", "reference", "a", "function", "by" ]
python
train
earlye/nephele
nephele/AwsProcessor.py
https://github.com/earlye/nephele/blob/a7dadc68f4124671457f09119419978c4d22013e/nephele/AwsProcessor.py#L140-L161
def do_mfa(self, args): """ Enter a 6-digit MFA token. Nephele will execute the appropriate `aws` command line to authenticate that token. mfa -h for more details """ parser = CommandArgumentParser("mfa") parser.add_argument(dest='token',help='MFA token...
[ "def", "do_mfa", "(", "self", ",", "args", ")", ":", "parser", "=", "CommandArgumentParser", "(", "\"mfa\"", ")", "parser", ".", "add_argument", "(", "dest", "=", "'token'", ",", "help", "=", "'MFA token value'", ")", "parser", ".", "add_argument", "(", "\...
Enter a 6-digit MFA token. Nephele will execute the appropriate `aws` command line to authenticate that token. mfa -h for more details
[ "Enter", "a", "6", "-", "digit", "MFA", "token", ".", "Nephele", "will", "execute", "the", "appropriate", "aws", "command", "line", "to", "authenticate", "that", "token", "." ]
python
train
tjcsl/ion
intranet/apps/users/models.py
https://github.com/tjcsl/ion/blob/5d722b0725d572039bb0929fd5715a4070c82c72/intranet/apps/users/models.py#L113-L133
def get_teachers_sorted(self): """Get teachers sorted by last name. This is used for the announcement request page. """ teachers = self.get_teachers() teachers = [(u.last_name, u.first_name, u.id) for u in teachers] for t in teachers: if t is None or t[0] is...
[ "def", "get_teachers_sorted", "(", "self", ")", ":", "teachers", "=", "self", ".", "get_teachers", "(", ")", "teachers", "=", "[", "(", "u", ".", "last_name", ",", "u", ".", "first_name", ",", "u", ".", "id", ")", "for", "u", "in", "teachers", "]", ...
Get teachers sorted by last name. This is used for the announcement request page.
[ "Get", "teachers", "sorted", "by", "last", "name", "." ]
python
train
saltstack/salt
salt/modules/tuned.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/tuned.py#L94-L109
def profile(profile_name): ''' Activate specified profile CLI Example: .. code-block:: bash salt '*' tuned.profile virtual-guest ''' # run tuned-adm with the profile specified result = __salt__['cmd.retcode']('tuned-adm profile {0}'.format(profile_name)) if int(result) != 0: ...
[ "def", "profile", "(", "profile_name", ")", ":", "# run tuned-adm with the profile specified", "result", "=", "__salt__", "[", "'cmd.retcode'", "]", "(", "'tuned-adm profile {0}'", ".", "format", "(", "profile_name", ")", ")", "if", "int", "(", "result", ")", "!="...
Activate specified profile CLI Example: .. code-block:: bash salt '*' tuned.profile virtual-guest
[ "Activate", "specified", "profile" ]
python
train
watson-developer-cloud/python-sdk
ibm_watson/discovery_v1.py
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/discovery_v1.py#L8126-L8135
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'sentiment') and self.sentiment is not None: _dict['sentiment'] = self.sentiment if hasattr(self, 'emotion') and self.emotion is not None: _dict['emotion'] = se...
[ "def", "_to_dict", "(", "self", ")", ":", "_dict", "=", "{", "}", "if", "hasattr", "(", "self", ",", "'sentiment'", ")", "and", "self", ".", "sentiment", "is", "not", "None", ":", "_dict", "[", "'sentiment'", "]", "=", "self", ".", "sentiment", "if",...
Return a json dictionary representing this model.
[ "Return", "a", "json", "dictionary", "representing", "this", "model", "." ]
python
train
worstcase/blockade
blockade/net.py
https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/net.py#L235-L251
def insert_rule(self, chain, src=None, dest=None, target=None): """Insert a new rule in the chain """ if not chain: raise ValueError("Invalid chain") if not target: raise ValueError("Invalid target") if not (src or dest): raise ValueError("Need...
[ "def", "insert_rule", "(", "self", ",", "chain", ",", "src", "=", "None", ",", "dest", "=", "None", ",", "target", "=", "None", ")", ":", "if", "not", "chain", ":", "raise", "ValueError", "(", "\"Invalid chain\"", ")", "if", "not", "target", ":", "ra...
Insert a new rule in the chain
[ "Insert", "a", "new", "rule", "in", "the", "chain" ]
python
valid
JensAstrup/pyOutlook
pyOutlook/core/message.py
https://github.com/JensAstrup/pyOutlook/blob/f4ca9d4a8629c0a41f78102ce84fab702a841167/pyOutlook/core/message.py#L343-L356
def reply(self, reply_comment): """Reply to the Message. Notes: HTML can be inserted in the string and will be interpreted properly by Outlook. Args: reply_comment: String message to send with email. """ payload = '{ "Comment": "' + reply_comment + '"}'...
[ "def", "reply", "(", "self", ",", "reply_comment", ")", ":", "payload", "=", "'{ \"Comment\": \"'", "+", "reply_comment", "+", "'\"}'", "endpoint", "=", "'https://outlook.office.com/api/v2.0/me/messages/'", "+", "self", ".", "message_id", "+", "'/reply'", "self", "....
Reply to the Message. Notes: HTML can be inserted in the string and will be interpreted properly by Outlook. Args: reply_comment: String message to send with email.
[ "Reply", "to", "the", "Message", "." ]
python
train
gdestuynder/simple_bugzilla
bugzilla.py
https://github.com/gdestuynder/simple_bugzilla/blob/c69766a81fa7960a8f2b22287968fa4787f1bcfe/bugzilla.py#L98-L108
def post_bug(self, bug): '''http://bugzilla.readthedocs.org/en/latest/api/core/v1/bug.html#create-bug''' assert type(bug) is DotDict assert 'product' in bug assert 'component' in bug assert 'summary' in bug if (not 'version' in bug): bug.version = 'other' if (not ...
[ "def", "post_bug", "(", "self", ",", "bug", ")", ":", "assert", "type", "(", "bug", ")", "is", "DotDict", "assert", "'product'", "in", "bug", "assert", "'component'", "in", "bug", "assert", "'summary'", "in", "bug", "if", "(", "not", "'version'", "in", ...
http://bugzilla.readthedocs.org/en/latest/api/core/v1/bug.html#create-bug
[ "http", ":", "//", "bugzilla", ".", "readthedocs", ".", "org", "/", "en", "/", "latest", "/", "api", "/", "core", "/", "v1", "/", "bug", ".", "html#create", "-", "bug" ]
python
train
mattimck/python-exist
exist/auth.py
https://github.com/mattimck/python-exist/blob/2c4be9d176d8e8007c4e020ee7cd6263a2096abb/exist/auth.py#L75-L82
def authorize_url(self): """ Build the authorization url and save the state. Return the authorization url """ url, self.state = self.oauth.authorization_url( '%sauthorize' % OAUTH_URL) return url
[ "def", "authorize_url", "(", "self", ")", ":", "url", ",", "self", ".", "state", "=", "self", ".", "oauth", ".", "authorization_url", "(", "'%sauthorize'", "%", "OAUTH_URL", ")", "return", "url" ]
Build the authorization url and save the state. Return the authorization url
[ "Build", "the", "authorization", "url", "and", "save", "the", "state", ".", "Return", "the", "authorization", "url" ]
python
train
hazelcast/hazelcast-python-client
hazelcast/serialization/base.py
https://github.com/hazelcast/hazelcast-python-client/blob/3f6639443c23d6d036aa343f8e094f052250d2c1/hazelcast/serialization/base.py#L169-L180
def serializer_by_type_id(self, type_id): """ Find and return the serializer for the type-id :param type_id: type-id the serializer :return: the serializer """ if type_id <= 0: indx = index_for_default_type(type_id) serializer = self._constant_type...
[ "def", "serializer_by_type_id", "(", "self", ",", "type_id", ")", ":", "if", "type_id", "<=", "0", ":", "indx", "=", "index_for_default_type", "(", "type_id", ")", "serializer", "=", "self", ".", "_constant_type_ids", ".", "get", "(", "indx", ",", "None", ...
Find and return the serializer for the type-id :param type_id: type-id the serializer :return: the serializer
[ "Find", "and", "return", "the", "serializer", "for", "the", "type", "-", "id", ":", "param", "type_id", ":", "type", "-", "id", "the", "serializer", ":", "return", ":", "the", "serializer" ]
python
train
santoshphilip/eppy
eppy/modeleditor.py
https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/modeleditor.py#L321-L333
def equalfield(bunchdt, data, commdct, idfobj1, idfobj2, fieldname, places=7): """returns true if the two fields are equal will test for retaincase places is used if the field is float/real""" # TODO test if both objects are of same type key1 = idfobj1.obj[0].upper() key2 = idfobj2.obj[0].upper(...
[ "def", "equalfield", "(", "bunchdt", ",", "data", ",", "commdct", ",", "idfobj1", ",", "idfobj2", ",", "fieldname", ",", "places", "=", "7", ")", ":", "# TODO test if both objects are of same type", "key1", "=", "idfobj1", ".", "obj", "[", "0", "]", ".", "...
returns true if the two fields are equal will test for retaincase places is used if the field is float/real
[ "returns", "true", "if", "the", "two", "fields", "are", "equal", "will", "test", "for", "retaincase", "places", "is", "used", "if", "the", "field", "is", "float", "/", "real" ]
python
train
roclark/sportsreference
sportsreference/nhl/roster.py
https://github.com/roclark/sportsreference/blob/ea0bae432be76450e137671d2998eb38f962dffd/sportsreference/nhl/roster.py#L548-L556
def team_abbreviation(self): """ Returns a ``string`` of the team's abbreviation, such as 'DET' for the Detroit Red Wings. """ # For career stats, skip the team abbreviation. if self._season[self._index].lower() == 'career': return None return self._te...
[ "def", "team_abbreviation", "(", "self", ")", ":", "# For career stats, skip the team abbreviation.", "if", "self", ".", "_season", "[", "self", ".", "_index", "]", ".", "lower", "(", ")", "==", "'career'", ":", "return", "None", "return", "self", ".", "_team_...
Returns a ``string`` of the team's abbreviation, such as 'DET' for the Detroit Red Wings.
[ "Returns", "a", "string", "of", "the", "team", "s", "abbreviation", "such", "as", "DET", "for", "the", "Detroit", "Red", "Wings", "." ]
python
train
Robpol86/flake8-pydocstyle
flake8_pydocstyle.py
https://github.com/Robpol86/flake8-pydocstyle/blob/657425541e1d868a6a5241a83c3a16a9a715d6b5/flake8_pydocstyle.py#L87-L112
def parse_options(cls, options): """Read parsed options from flake8. :param options: Options to add to flake8's command line options. """ # Handle flake8 options. cls.options['explain'] = bool(options.show_pydocstyle) cls.options['ignore'] = options.ignore # Han...
[ "def", "parse_options", "(", "cls", ",", "options", ")", ":", "# Handle flake8 options.", "cls", ".", "options", "[", "'explain'", "]", "=", "bool", "(", "options", ".", "show_pydocstyle", ")", "cls", ".", "options", "[", "'ignore'", "]", "=", "options", "...
Read parsed options from flake8. :param options: Options to add to flake8's command line options.
[ "Read", "parsed", "options", "from", "flake8", "." ]
python
train
juju/python-libjuju
juju/client/connection.py
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/client/connection.py#L250-L278
async def _pinger(self): ''' A Controller can time us out if we are silent for too long. This is especially true in JaaS, which has a fairly strict timeout. To prevent timing out, we send a ping every ten seconds. ''' async def _do_ping(): try: ...
[ "async", "def", "_pinger", "(", "self", ")", ":", "async", "def", "_do_ping", "(", ")", ":", "try", ":", "await", "pinger_facade", ".", "Ping", "(", ")", "await", "asyncio", ".", "sleep", "(", "10", ",", "loop", "=", "self", ".", "loop", ")", "exce...
A Controller can time us out if we are silent for too long. This is especially true in JaaS, which has a fairly strict timeout. To prevent timing out, we send a ping every ten seconds.
[ "A", "Controller", "can", "time", "us", "out", "if", "we", "are", "silent", "for", "too", "long", ".", "This", "is", "especially", "true", "in", "JaaS", "which", "has", "a", "fairly", "strict", "timeout", "." ]
python
train
payu-org/payu
payu/laboratory.py
https://github.com/payu-org/payu/blob/1442a9a226012eff248b8097cc1eaabc3e224867/payu/laboratory.py#L51-L69
def get_default_lab_path(self, config): """Generate a default laboratory path based on user environment.""" # Default path settings # Append project name if present (NCI-specific) default_project = os.environ.get('PROJECT', '') default_short_path = os.path.join('/short', default...
[ "def", "get_default_lab_path", "(", "self", ",", "config", ")", ":", "# Default path settings", "# Append project name if present (NCI-specific)", "default_project", "=", "os", ".", "environ", ".", "get", "(", "'PROJECT'", ",", "''", ")", "default_short_path", "=", "o...
Generate a default laboratory path based on user environment.
[ "Generate", "a", "default", "laboratory", "path", "based", "on", "user", "environment", "." ]
python
train
pypa/pipenv
pipenv/vendor/requirementslib/models/utils.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/requirementslib/models/utils.py#L752-L788
def make_install_requirement(name, version, extras, markers, constraint=False): """ Generates an :class:`~pip._internal.req.req_install.InstallRequirement`. Create an InstallRequirement from the supplied metadata. :param name: The requirement's name. :type name: str :param version: The require...
[ "def", "make_install_requirement", "(", "name", ",", "version", ",", "extras", ",", "markers", ",", "constraint", "=", "False", ")", ":", "# If no extras are specified, the extras string is blank", "from", "pip_shims", ".", "shims", "import", "install_req_from_line", "e...
Generates an :class:`~pip._internal.req.req_install.InstallRequirement`. Create an InstallRequirement from the supplied metadata. :param name: The requirement's name. :type name: str :param version: The requirement version (must be pinned). :type version: str. :param extras: The desired extras...
[ "Generates", "an", ":", "class", ":", "~pip", ".", "_internal", ".", "req", ".", "req_install", ".", "InstallRequirement", "." ]
python
train
intel-analytics/BigDL
pyspark/bigdl/transform/vision/image.py
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/transform/vision/image.py#L87-L92
def get_label(self): """ get label as ndarray from ImageFeature """ label = callBigDlFunc(self.bigdl_type, "imageFeatureToLabelTensor", self.value) return label.to_ndarray()
[ "def", "get_label", "(", "self", ")", ":", "label", "=", "callBigDlFunc", "(", "self", ".", "bigdl_type", ",", "\"imageFeatureToLabelTensor\"", ",", "self", ".", "value", ")", "return", "label", ".", "to_ndarray", "(", ")" ]
get label as ndarray from ImageFeature
[ "get", "label", "as", "ndarray", "from", "ImageFeature" ]
python
test
pip-services3-python/pip-services3-commons-python
pip_services3_commons/convert/BooleanConverter.py
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/convert/BooleanConverter.py#L63-L74
def to_boolean_with_default(value, default_value): """ Converts value into boolean or returns default value when conversion is not possible :param value: the value to convert. :param default_value: the default value :return: boolean value or default when conversion is not supp...
[ "def", "to_boolean_with_default", "(", "value", ",", "default_value", ")", ":", "result", "=", "BooleanConverter", ".", "to_nullable_boolean", "(", "value", ")", "return", "result", "if", "result", "!=", "None", "else", "default_value" ]
Converts value into boolean or returns default value when conversion is not possible :param value: the value to convert. :param default_value: the default value :return: boolean value or default when conversion is not supported.
[ "Converts", "value", "into", "boolean", "or", "returns", "default", "value", "when", "conversion", "is", "not", "possible" ]
python
train
michael-lazar/rtv
rtv/packages/praw/__init__.py
https://github.com/michael-lazar/rtv/blob/ccef2af042566ad384977028cf0bde01bc524dda/rtv/packages/praw/__init__.py#L2380-L2395
def rename_multireddit(self, current_name, new_name, *args, **kwargs): """Rename a Multireddit. :param current_name: The name of the multireddit to rename :param new_name: The new name to assign to this multireddit The additional parameters are passed directly into :meth:`~praw...
[ "def", "rename_multireddit", "(", "self", ",", "current_name", ",", "new_name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "current_path", "=", "self", ".", "MULTI_PATH", ".", "format", "(", "self", ".", "user", ".", "name", ",", "current_name"...
Rename a Multireddit. :param current_name: The name of the multireddit to rename :param new_name: The new name to assign to this multireddit The additional parameters are passed directly into :meth:`~praw.__init__.BaseReddit.request_json`
[ "Rename", "a", "Multireddit", "." ]
python
train
clalancette/pycdlib
pycdlib/pycdlib.py
https://github.com/clalancette/pycdlib/blob/1e7b77a809e905d67dc71e12d70e850be26b6233/pycdlib/pycdlib.py#L5217-L5385
def add_symlink(self, symlink_path, rr_symlink_name=None, rr_path=None, joliet_path=None, udf_symlink_path=None, udf_target=None): # type: (str, Optional[str], Optional[str], Optional[str], Optional[str], Optional[str]) -> None ''' Add a symlink from rr_symlink_name to the rr...
[ "def", "add_symlink", "(", "self", ",", "symlink_path", ",", "rr_symlink_name", "=", "None", ",", "rr_path", "=", "None", ",", "joliet_path", "=", "None", ",", "udf_symlink_path", "=", "None", ",", "udf_target", "=", "None", ")", ":", "# type: (str, Optional[s...
Add a symlink from rr_symlink_name to the rr_path. The ISO must have either Rock Ridge or UDF support (or both). Parameters: symlink_path - The ISO9660 name of the symlink itself on the ISO. rr_symlink_name - The Rock Ridge name of the symlink itself on the ISO. rr_path - Th...
[ "Add", "a", "symlink", "from", "rr_symlink_name", "to", "the", "rr_path", ".", "The", "ISO", "must", "have", "either", "Rock", "Ridge", "or", "UDF", "support", "(", "or", "both", ")", "." ]
python
train
mozilla/socorrolib
socorrolib/lib/ooid.py
https://github.com/mozilla/socorrolib/blob/4ec08c6a4ee2c8a69150268afdd324f5f22b90c8/socorrolib/lib/ooid.py#L14-L26
def createNewOoid(timestamp=None, depth=None): """Create a new Ooid for a given time, to be stored at a given depth timestamp: the year-month-day is encoded in the ooid. If none, use current day depth: the expected storage depth is encoded in the ooid. If non, use the defaultDepth returns a new opaque id string...
[ "def", "createNewOoid", "(", "timestamp", "=", "None", ",", "depth", "=", "None", ")", ":", "if", "not", "timestamp", ":", "timestamp", "=", "utc_now", "(", ")", ".", "date", "(", ")", "if", "not", "depth", ":", "depth", "=", "defaultDepth", "assert", ...
Create a new Ooid for a given time, to be stored at a given depth timestamp: the year-month-day is encoded in the ooid. If none, use current day depth: the expected storage depth is encoded in the ooid. If non, use the defaultDepth returns a new opaque id string holding 24 random hex digits and encoded date and d...
[ "Create", "a", "new", "Ooid", "for", "a", "given", "time", "to", "be", "stored", "at", "a", "given", "depth", "timestamp", ":", "the", "year", "-", "month", "-", "day", "is", "encoded", "in", "the", "ooid", ".", "If", "none", "use", "current", "day",...
python
train
couchbase/couchbase-python-client
couchbase/exceptions.py
https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/exceptions.py#L754-L767
def exc_from_rc(rc, msg=None, obj=None): """ .. warning:: INTERNAL For those rare cases when an exception needs to be thrown from Python using a libcouchbase error code. :param rc: The error code :param msg: Message (description) :param obj: Context :return: a raisable exception ""...
[ "def", "exc_from_rc", "(", "rc", ",", "msg", "=", "None", ",", "obj", "=", "None", ")", ":", "newcls", "=", "CouchbaseError", ".", "rc_to_exctype", "(", "rc", ")", "return", "newcls", "(", "params", "=", "{", "'rc'", ":", "rc", ",", "'objextra'", ":"...
.. warning:: INTERNAL For those rare cases when an exception needs to be thrown from Python using a libcouchbase error code. :param rc: The error code :param msg: Message (description) :param obj: Context :return: a raisable exception
[ "..", "warning", "::", "INTERNAL" ]
python
train
ajenti/jadi
jadi/jadi.py
https://github.com/ajenti/jadi/blob/db76e1c5330672d282f03787fedcd702c04b007f/jadi/jadi.py#L141-L175
def component(iface): ''' Marks the decorated class as a component implementing the given ``iface`` :param iface: the interface to implement :type iface: :func:`interface` ''' def decorator(cls): if not cls: return None # Run custom verificator if any if ha...
[ "def", "component", "(", "iface", ")", ":", "def", "decorator", "(", "cls", ")", ":", "if", "not", "cls", ":", "return", "None", "# Run custom verificator if any", "if", "hasattr", "(", "cls", ",", "'__verify__'", ")", ":", "if", "not", "cls", ".", "__ve...
Marks the decorated class as a component implementing the given ``iface`` :param iface: the interface to implement :type iface: :func:`interface`
[ "Marks", "the", "decorated", "class", "as", "a", "component", "implementing", "the", "given", "iface" ]
python
train
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/bson/json_util.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/bson/json_util.py#L634-L639
def _parse_canonical_code(doc): """Decode a JSON code to bson.code.Code.""" for key in doc: if key not in ('$code', '$scope'): raise TypeError('Bad $code, extra field(s): %s' % (doc,)) return Code(doc['$code'], scope=doc.get('$scope'))
[ "def", "_parse_canonical_code", "(", "doc", ")", ":", "for", "key", "in", "doc", ":", "if", "key", "not", "in", "(", "'$code'", ",", "'$scope'", ")", ":", "raise", "TypeError", "(", "'Bad $code, extra field(s): %s'", "%", "(", "doc", ",", ")", ")", "retu...
Decode a JSON code to bson.code.Code.
[ "Decode", "a", "JSON", "code", "to", "bson", ".", "code", ".", "Code", "." ]
python
train