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
cloud9ers/gurumate
environment/lib/python2.7/site-packages/nose/ext/dtcompat.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/ext/dtcompat.py#L1823-L1844
def run_docstring_examples(f, globs, verbose=False, name="NoName", compileflags=None, optionflags=0): """ Test examples in the given object's docstring (`f`), using `globs` as globals. Optional argument `name` is used in failure messages. If the optional argument `verbose` is...
[ "def", "run_docstring_examples", "(", "f", ",", "globs", ",", "verbose", "=", "False", ",", "name", "=", "\"NoName\"", ",", "compileflags", "=", "None", ",", "optionflags", "=", "0", ")", ":", "# Find, parse, and run all tests in the given module.", "finder", "=",...
Test examples in the given object's docstring (`f`), using `globs` as globals. Optional argument `name` is used in failure messages. If the optional argument `verbose` is true, then generate output even if there are no failures. `compileflags` gives the set of flags that should be used by the Pyth...
[ "Test", "examples", "in", "the", "given", "object", "s", "docstring", "(", "f", ")", "using", "globs", "as", "globals", ".", "Optional", "argument", "name", "is", "used", "in", "failure", "messages", ".", "If", "the", "optional", "argument", "verbose", "is...
python
test
twoolie/NBT
nbt/region.py
https://github.com/twoolie/NBT/blob/b06dd6cc8117d2788da1d8416e642d58bad45762/nbt/region.py#L311-L356
def _parse_header(self): """Read the region header and stores: offset, length and status.""" # update the file size, needed when parse_header is called after # we have unlinked a chunk or writed a new one self.size = self.get_size() if self.size == 0: # Some region f...
[ "def", "_parse_header", "(", "self", ")", ":", "# update the file size, needed when parse_header is called after", "# we have unlinked a chunk or writed a new one", "self", ".", "size", "=", "self", ".", "get_size", "(", ")", "if", "self", ".", "size", "==", "0", ":", ...
Read the region header and stores: offset, length and status.
[ "Read", "the", "region", "header", "and", "stores", ":", "offset", "length", "and", "status", "." ]
python
train
tonybaloney/wily
wily/__main__.py
https://github.com/tonybaloney/wily/blob/bae259354a91b57d56603f0ca7403186f086a84c/wily/__main__.py#L107-L136
def build(ctx, max_revisions, targets, operators, archiver): """Build the wily cache.""" config = ctx.obj["CONFIG"] from wily.commands.build import build if max_revisions: logger.debug(f"Fixing revisions to {max_revisions}") config.max_revisions = max_revisions if operators: ...
[ "def", "build", "(", "ctx", ",", "max_revisions", ",", "targets", ",", "operators", ",", "archiver", ")", ":", "config", "=", "ctx", ".", "obj", "[", "\"CONFIG\"", "]", "from", "wily", ".", "commands", ".", "build", "import", "build", "if", "max_revision...
Build the wily cache.
[ "Build", "the", "wily", "cache", "." ]
python
train
pyparsing/pyparsing
examples/pymicko.py
https://github.com/pyparsing/pyparsing/blob/f0264bd8d1a548a50b3e5f7d99cfefd577942d14/examples/pymicko.py#L679-L682
def global_var(self, name): """Inserts a new static (global) variable definition""" self.newline_label(name, False, True) self.newline_text("WORD\t1", True)
[ "def", "global_var", "(", "self", ",", "name", ")", ":", "self", ".", "newline_label", "(", "name", ",", "False", ",", "True", ")", "self", ".", "newline_text", "(", "\"WORD\\t1\"", ",", "True", ")" ]
Inserts a new static (global) variable definition
[ "Inserts", "a", "new", "static", "(", "global", ")", "variable", "definition" ]
python
train
rlisagor/freshen
examples/twisted/features/steps.py
https://github.com/rlisagor/freshen/blob/5578f7368e8d53b4cf51c589fb192090d3524968/examples/twisted/features/steps.py#L10-L22
def simulate_async_event(): """Simulate an asynchronous event.""" scc.state = 'executing' def async_event(result): """All other asynchronous events or function calls returned from later steps will wait until this callback fires.""" scc.state = result return 'some even...
[ "def", "simulate_async_event", "(", ")", ":", "scc", ".", "state", "=", "'executing'", "def", "async_event", "(", "result", ")", ":", "\"\"\"All other asynchronous events or function calls\n returned from later steps will wait until this\n callback fires.\"\"\"", "scc...
Simulate an asynchronous event.
[ "Simulate", "an", "asynchronous", "event", "." ]
python
train
senaite/senaite.core
bika/lims/exportimport/instruments/shimadzu/gcms/qp2010se.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/exportimport/instruments/shimadzu/gcms/qp2010se.py#L221-L292
def parse_quantitationesultsline(self, line): """ Parses quantitation result lines Please see samples/GC-MS output.txt [MS Quantitative Results] section """ # [MS Quantitative Results] if line.startswith(self.QUANTITATIONRESULTS_KEY) \ or line.sta...
[ "def", "parse_quantitationesultsline", "(", "self", ",", "line", ")", ":", "# [MS Quantitative Results]", "if", "line", ".", "startswith", "(", "self", ".", "QUANTITATIONRESULTS_KEY", ")", "or", "line", ".", "startswith", "(", "self", ".", "QUANTITATIONRESULTS_NUMBE...
Parses quantitation result lines Please see samples/GC-MS output.txt [MS Quantitative Results] section
[ "Parses", "quantitation", "result", "lines", "Please", "see", "samples", "/", "GC", "-", "MS", "output", ".", "txt", "[", "MS", "Quantitative", "Results", "]", "section" ]
python
train
juju/charm-helpers
charmhelpers/core/hookenv.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/core/hookenv.py#L1215-L1221
def _run_atexit(): '''Hook frameworks must invoke this after the main hook body has successfully completed. Do not invoke it if the hook fails.''' global _atexit for callback, args, kwargs in reversed(_atexit): callback(*args, **kwargs) del _atexit[:]
[ "def", "_run_atexit", "(", ")", ":", "global", "_atexit", "for", "callback", ",", "args", ",", "kwargs", "in", "reversed", "(", "_atexit", ")", ":", "callback", "(", "*", "args", ",", "*", "*", "kwargs", ")", "del", "_atexit", "[", ":", "]" ]
Hook frameworks must invoke this after the main hook body has successfully completed. Do not invoke it if the hook fails.
[ "Hook", "frameworks", "must", "invoke", "this", "after", "the", "main", "hook", "body", "has", "successfully", "completed", ".", "Do", "not", "invoke", "it", "if", "the", "hook", "fails", "." ]
python
train
nickpandolfi/Cyther
cyther/commands.py
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/commands.py#L206-L220
def makeCommands(file): """ Given a high level preset, it will construct the basic args to pass over. 'ninja', 'beast', 'minimal', 'swift' """ commands = [['cython', '-a', '-p', '-o', file['c_name'], file['file_path']], ['gcc', '-DNDEBUG', '-g', '-fwrapv', '-O3', '-W...
[ "def", "makeCommands", "(", "file", ")", ":", "commands", "=", "[", "[", "'cython'", ",", "'-a'", ",", "'-p'", ",", "'-o'", ",", "file", "[", "'c_name'", "]", ",", "file", "[", "'file_path'", "]", "]", ",", "[", "'gcc'", ",", "'-DNDEBUG'", ",", "'-...
Given a high level preset, it will construct the basic args to pass over. 'ninja', 'beast', 'minimal', 'swift'
[ "Given", "a", "high", "level", "preset", "it", "will", "construct", "the", "basic", "args", "to", "pass", "over", ".", "ninja", "beast", "minimal", "swift" ]
python
train
pandas-dev/pandas
pandas/core/panel.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/panel.py#L239-L279
def from_dict(cls, data, intersect=False, orient='items', dtype=None): """ Construct Panel from dict of DataFrame objects. Parameters ---------- data : dict {field : DataFrame} intersect : boolean Intersect indexes of input DataFrames orie...
[ "def", "from_dict", "(", "cls", ",", "data", ",", "intersect", "=", "False", ",", "orient", "=", "'items'", ",", "dtype", "=", "None", ")", ":", "from", "collections", "import", "defaultdict", "orient", "=", "orient", ".", "lower", "(", ")", "if", "ori...
Construct Panel from dict of DataFrame objects. Parameters ---------- data : dict {field : DataFrame} intersect : boolean Intersect indexes of input DataFrames orient : {'items', 'minor'}, default 'items' The "orientation" of the data. If the ...
[ "Construct", "Panel", "from", "dict", "of", "DataFrame", "objects", "." ]
python
train
ToucanToco/toucan-data-sdk
toucan_data_sdk/utils/postprocess/converter.py
https://github.com/ToucanToco/toucan-data-sdk/blob/c3ca874e1b64f4bdcc2edda750a72d45d1561d8a/toucan_data_sdk/utils/postprocess/converter.py#L99-L154
def cast(df, column: str, type: str, new_column=None): """ Convert column's type into type --- ### Parameters *mandatory :* - `column` (*str*): name of the column to convert - `type` (*str*): output type. It can be : - `"int"` : integer type - `"float"` : general number ty...
[ "def", "cast", "(", "df", ",", "column", ":", "str", ",", "type", ":", "str", ",", "new_column", "=", "None", ")", ":", "new_column", "=", "new_column", "or", "column", "df", "[", "new_column", "]", "=", "df", "[", "column", "]", ".", "astype", "("...
Convert column's type into type --- ### Parameters *mandatory :* - `column` (*str*): name of the column to convert - `type` (*str*): output type. It can be : - `"int"` : integer type - `"float"` : general number type - `"str"` : text type *optional :* - `new_colum...
[ "Convert", "column", "s", "type", "into", "type" ]
python
test
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/edeposit_autoparser.py
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/edeposit_autoparser.py#L42-L64
def _locate_element(dom, el_content, transformer=None): """ Find element containing `el_content` in `dom`. Use `transformer` function to content of all elements in `dom` in order to correctly transforming them to match them with `el_content`. Args: dom (obj): HTMLElement tree. el_co...
[ "def", "_locate_element", "(", "dom", ",", "el_content", ",", "transformer", "=", "None", ")", ":", "return", "dom", ".", "find", "(", "None", ",", "fn", "=", "utils", ".", "content_matchs", "(", "el_content", ",", "transformer", ")", ")" ]
Find element containing `el_content` in `dom`. Use `transformer` function to content of all elements in `dom` in order to correctly transforming them to match them with `el_content`. Args: dom (obj): HTMLElement tree. el_content (str): Content of element will be picked from `dom`. t...
[ "Find", "element", "containing", "el_content", "in", "dom", ".", "Use", "transformer", "function", "to", "content", "of", "all", "elements", "in", "dom", "in", "order", "to", "correctly", "transforming", "them", "to", "match", "them", "with", "el_content", "."...
python
train
MKLab-ITI/reveal-user-annotation
reveal_user_annotation/twitter/twitter_util.py
https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/twitter/twitter_util.py#L27-L94
def safe_twitter_request_handler(twitter_api_func, call_rate_limit, call_counter, time_window_start, max_retries, wait_period, ...
[ "def", "safe_twitter_request_handler", "(", "twitter_api_func", ",", "call_rate_limit", ",", "call_counter", ",", "time_window_start", ",", "max_retries", ",", "wait_period", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "error_count", "=", "0", "while", "Tru...
This is a safe function handler for any twitter request. Inputs: - twitter_api_func: The twython function object to be safely called. - call_rate_limit: THe call rate limit for this specific Twitter API function. - call_counter: A counter that keeps track of the number of function calls ...
[ "This", "is", "a", "safe", "function", "handler", "for", "any", "twitter", "request", "." ]
python
train
VisualOps/cli
visualops/utils/dockervisops.py
https://github.com/VisualOps/cli/blob/e9ee9a804df0de3cce54be4c623528fd658838dc/visualops/utils/dockervisops.py#L203-L235
def _pull_assemble_error_status(logs): ''' Given input in this form:: u'{"status":"Pulling repository foo/ubuntubox"}: "image (latest) from foo/ ... rogress":"complete","id":"2c80228370c9"}' construct something like that (load JSON data is possible):: [u'{"status":"Pulli...
[ "def", "_pull_assemble_error_status", "(", "logs", ")", ":", "comment", "=", "'An error occurred pulling your image'", "try", ":", "for", "err_log", "in", "logs", ":", "if", "isinstance", "(", "err_log", ",", "dict", ")", ":", "if", "'errorDetail'", "in", "err_l...
Given input in this form:: u'{"status":"Pulling repository foo/ubuntubox"}: "image (latest) from foo/ ... rogress":"complete","id":"2c80228370c9"}' construct something like that (load JSON data is possible):: [u'{"status":"Pulling repository foo/ubuntubox"', {"status":"...
[ "Given", "input", "in", "this", "form", "::" ]
python
train
jmoiron/humanize
humanize/number.py
https://github.com/jmoiron/humanize/blob/32c469bc378de22e8eabd5f9565bd7cffe7c7ae0/humanize/number.py#L12-L32
def ordinal(value): """Converts an integer to its ordinal as a string. 1 is '1st', 2 is '2nd', 3 is '3rd', etc. Works for any integer or anything int() will turn into an integer. Anything other value will have nothing done to it.""" try: value = int(value) except (TypeError, ValueError): ...
[ "def", "ordinal", "(", "value", ")", ":", "try", ":", "value", "=", "int", "(", "value", ")", "except", "(", "TypeError", ",", "ValueError", ")", ":", "return", "value", "t", "=", "(", "P_", "(", "'0'", ",", "'th'", ")", ",", "P_", "(", "'1'", ...
Converts an integer to its ordinal as a string. 1 is '1st', 2 is '2nd', 3 is '3rd', etc. Works for any integer or anything int() will turn into an integer. Anything other value will have nothing done to it.
[ "Converts", "an", "integer", "to", "its", "ordinal", "as", "a", "string", ".", "1", "is", "1st", "2", "is", "2nd", "3", "is", "3rd", "etc", ".", "Works", "for", "any", "integer", "or", "anything", "int", "()", "will", "turn", "into", "an", "integer",...
python
train
horejsek/python-fastjsonschema
fastjsonschema/ref_resolver.py
https://github.com/horejsek/python-fastjsonschema/blob/8c38d0f91fa5d928ff629080cdb75ab23f96590f/fastjsonschema/ref_resolver.py#L133-L140
def get_scope_name(self): """ Get current scope and return it as a valid function name. """ name = 'validate_' + unquote(self.resolution_scope).replace('~1', '_').replace('~0', '_') name = re.sub(r'[:/#\.\-\%]', '_', name) name = name.lower().rstrip('_') re...
[ "def", "get_scope_name", "(", "self", ")", ":", "name", "=", "'validate_'", "+", "unquote", "(", "self", ".", "resolution_scope", ")", ".", "replace", "(", "'~1'", ",", "'_'", ")", ".", "replace", "(", "'~0'", ",", "'_'", ")", "name", "=", "re", ".",...
Get current scope and return it as a valid function name.
[ "Get", "current", "scope", "and", "return", "it", "as", "a", "valid", "function", "name", "." ]
python
train
stanfordnlp/stanza
stanza/monitoring/summary.py
https://github.com/stanfordnlp/stanza/blob/920c55d8eaa1e7105971059c66eb448a74c100d6/stanza/monitoring/summary.py#L325-L337
def write_events(stream, events): ''' Write a sequence of Event protos to file-like object `stream`. ''' for event in events: data = event.SerializeToString() len_field = struct.pack('<Q', len(data)) len_crc = struct.pack('<I', masked_crc(len_field)) data_crc = struct.pac...
[ "def", "write_events", "(", "stream", ",", "events", ")", ":", "for", "event", "in", "events", ":", "data", "=", "event", ".", "SerializeToString", "(", ")", "len_field", "=", "struct", ".", "pack", "(", "'<Q'", ",", "len", "(", "data", ")", ")", "le...
Write a sequence of Event protos to file-like object `stream`.
[ "Write", "a", "sequence", "of", "Event", "protos", "to", "file", "-", "like", "object", "stream", "." ]
python
train
UCL-INGI/INGInious
inginious/frontend/user_manager.py
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/user_manager.py#L294-L301
def disconnect_user(self): """ Disconnects the user currently logged-in :param ip_addr: the ip address of the client, that will be logged """ if self.session_logged_in(): self._logger.info("User %s disconnected - %s - %s - %s", self.session_username(), self.session_re...
[ "def", "disconnect_user", "(", "self", ")", ":", "if", "self", ".", "session_logged_in", "(", ")", ":", "self", ".", "_logger", ".", "info", "(", "\"User %s disconnected - %s - %s - %s\"", ",", "self", ".", "session_username", "(", ")", ",", "self", ".", "se...
Disconnects the user currently logged-in :param ip_addr: the ip address of the client, that will be logged
[ "Disconnects", "the", "user", "currently", "logged", "-", "in", ":", "param", "ip_addr", ":", "the", "ip", "address", "of", "the", "client", "that", "will", "be", "logged" ]
python
train
square/pylink
pylink/jlink.py
https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/pylink/jlink.py#L1133-L1146
def hardware_version(self): """Returns the hardware version of the connected J-Link as a major.minor string. Args: self (JLink): the ``JLink`` instance Returns: Hardware version string. """ version = self._dll.JLINKARM_GetHardwareVersion() ma...
[ "def", "hardware_version", "(", "self", ")", ":", "version", "=", "self", ".", "_dll", ".", "JLINKARM_GetHardwareVersion", "(", ")", "major", "=", "version", "/", "10000", "%", "100", "minor", "=", "version", "/", "100", "%", "100", "return", "'%d.%02d'", ...
Returns the hardware version of the connected J-Link as a major.minor string. Args: self (JLink): the ``JLink`` instance Returns: Hardware version string.
[ "Returns", "the", "hardware", "version", "of", "the", "connected", "J", "-", "Link", "as", "a", "major", ".", "minor", "string", "." ]
python
train
edeposit/edeposit.amqp.storage
src/edeposit/amqp/storage/web_tools.py
https://github.com/edeposit/edeposit.amqp.storage/blob/fb6bd326249847de04b17b64e856c878665cea92/src/edeposit/amqp/storage/web_tools.py#L31-L58
def compose_path(pub, uuid_url=False): """ Compose absolute path for given `pub`. Args: pub (obj): :class:`.DBPublication` instance. uuid_url (bool, default False): Compose URL using UUID. Returns: str: Absolute url-path of the publication, without server's address \ ...
[ "def", "compose_path", "(", "pub", ",", "uuid_url", "=", "False", ")", ":", "if", "uuid_url", ":", "return", "join", "(", "\"/\"", ",", "UUID_DOWNLOAD_KEY", ",", "str", "(", "pub", ".", "uuid", ")", ")", "return", "join", "(", "\"/\"", ",", "DOWNLOAD_K...
Compose absolute path for given `pub`. Args: pub (obj): :class:`.DBPublication` instance. uuid_url (bool, default False): Compose URL using UUID. Returns: str: Absolute url-path of the publication, without server's address \ and protocol. Raises: PrivatePublic...
[ "Compose", "absolute", "path", "for", "given", "pub", "." ]
python
train
singularityhub/sregistry-cli
sregistry/client/backend.py
https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/client/backend.py#L212-L234
def list_backends(backend=None): '''return a list of backends installed for the user, which is based on the config file keys found present Parameters ========== backend: a specific backend to list. If defined, just list parameters. ''' settings = read_client_secrets() # B...
[ "def", "list_backends", "(", "backend", "=", "None", ")", ":", "settings", "=", "read_client_secrets", "(", ")", "# Backend names are the keys", "backends", "=", "list", "(", "settings", ".", "keys", "(", ")", ")", "backends", "=", "[", "b", "for", "b", "i...
return a list of backends installed for the user, which is based on the config file keys found present Parameters ========== backend: a specific backend to list. If defined, just list parameters.
[ "return", "a", "list", "of", "backends", "installed", "for", "the", "user", "which", "is", "based", "on", "the", "config", "file", "keys", "found", "present", "Parameters", "==========", "backend", ":", "a", "specific", "backend", "to", "list", ".", "If", ...
python
test
datamachine/twx.botapi
twx/botapi/botapi.py
https://github.com/datamachine/twx.botapi/blob/c85184da738169e8f9d6d8e62970540f427c486e/twx/botapi/botapi.py#L4294-L4296
def forward_message(self, *args, **kwargs): """See :func:`forward_message`""" return forward_message(*args, **self._merge_overrides(**kwargs)).run()
[ "def", "forward_message", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "forward_message", "(", "*", "args", ",", "*", "*", "self", ".", "_merge_overrides", "(", "*", "*", "kwargs", ")", ")", ".", "run", "(", ")" ]
See :func:`forward_message`
[ "See", ":", "func", ":", "forward_message" ]
python
train
ninuxorg/nodeshot
nodeshot/interop/sync/synchronizers/base.py
https://github.com/ninuxorg/nodeshot/blob/2466f0a55f522b2696026f196436ce7ba3f1e5c6/nodeshot/interop/sync/synchronizers/base.py#L342-L431
def _convert_item(self, item): """ take a parsed item as input and returns a python dictionary the keys will be saved into the Node model either in their respective fields or in the hstore "data" field :param item: object representing parsed item """ item = self....
[ "def", "_convert_item", "(", "self", ",", "item", ")", ":", "item", "=", "self", ".", "parse_item", "(", "item", ")", "# name is required", "if", "not", "item", "[", "'name'", "]", ":", "raise", "Exception", "(", "'Expected property %s not found in item %s.'", ...
take a parsed item as input and returns a python dictionary the keys will be saved into the Node model either in their respective fields or in the hstore "data" field :param item: object representing parsed item
[ "take", "a", "parsed", "item", "as", "input", "and", "returns", "a", "python", "dictionary", "the", "keys", "will", "be", "saved", "into", "the", "Node", "model", "either", "in", "their", "respective", "fields", "or", "in", "the", "hstore", "data", "field"...
python
train
henrysher/kotocore
kotocore/session.py
https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/session.py#L133-L168
def get_collection(self, service_name, collection_name, base_class=None): """ Returns a ``Collection`` **class** for a given service. :param service_name: A string that specifies the name of the desired service. Ex. ``sqs``, ``sns``, ``dynamodb``, etc. :type service_name: st...
[ "def", "get_collection", "(", "self", ",", "service_name", ",", "collection_name", ",", "base_class", "=", "None", ")", ":", "try", ":", "return", "self", ".", "cache", ".", "get_collection", "(", "service_name", ",", "collection_name", ",", "base_class", "=",...
Returns a ``Collection`` **class** for a given service. :param service_name: A string that specifies the name of the desired service. Ex. ``sqs``, ``sns``, ``dynamodb``, etc. :type service_name: string :param collection_name: A string that specifies the name of the desired ...
[ "Returns", "a", "Collection", "**", "class", "**", "for", "a", "given", "service", "." ]
python
train
paylogic/pip-accel
pip_accel/caches/s3.py
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/caches/s3.py#L250-L302
def s3_connection(self): """ Connect to the Amazon S3 API. If the connection attempt fails because Boto can't find credentials the attempt is retried once with an anonymous connection. Called on demand by :attr:`s3_bucket`. :returns: A :class:`boto.s3.connection.S3Conn...
[ "def", "s3_connection", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'cached_connection'", ")", ":", "self", ".", "check_prerequisites", "(", ")", "with", "PatchedBotoConfig", "(", ")", ":", "import", "boto", "from", "boto", ".", "exce...
Connect to the Amazon S3 API. If the connection attempt fails because Boto can't find credentials the attempt is retried once with an anonymous connection. Called on demand by :attr:`s3_bucket`. :returns: A :class:`boto.s3.connection.S3Connection` object. :raises: :exc:`.Cache...
[ "Connect", "to", "the", "Amazon", "S3", "API", "." ]
python
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/plugin.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/plugin.py#L1504-L1518
def _remove_old_stderr_files(self): """ Remove stderr files left by previous Spyder instances. This is only required on Windows because we can't clean up stderr files while Spyder is running on it. """ if os.name == 'nt': tmpdir = get_temp_dir() ...
[ "def", "_remove_old_stderr_files", "(", "self", ")", ":", "if", "os", ".", "name", "==", "'nt'", ":", "tmpdir", "=", "get_temp_dir", "(", ")", "for", "fname", "in", "os", ".", "listdir", "(", "tmpdir", ")", ":", "if", "osp", ".", "splitext", "(", "fn...
Remove stderr files left by previous Spyder instances. This is only required on Windows because we can't clean up stderr files while Spyder is running on it.
[ "Remove", "stderr", "files", "left", "by", "previous", "Spyder", "instances", ".", "This", "is", "only", "required", "on", "Windows", "because", "we", "can", "t", "clean", "up", "stderr", "files", "while", "Spyder", "is", "running", "on", "it", "." ]
python
train
gitpython-developers/GitPython
git/objects/submodule/base.py
https://github.com/gitpython-developers/GitPython/blob/1f66e25c25cde2423917ee18c4704fff83b837d1/git/objects/submodule/base.py#L431-L645
def update(self, recursive=False, init=True, to_latest_revision=False, progress=None, dry_run=False, force=False, keep_going=False): """Update the repository of this submodule to point to the checkout we point at with the binsha of this instance. :param recursive: if True, we wil...
[ "def", "update", "(", "self", ",", "recursive", "=", "False", ",", "init", "=", "True", ",", "to_latest_revision", "=", "False", ",", "progress", "=", "None", ",", "dry_run", "=", "False", ",", "force", "=", "False", ",", "keep_going", "=", "False", ")...
Update the repository of this submodule to point to the checkout we point at with the binsha of this instance. :param recursive: if True, we will operate recursively and update child- modules as well. :param init: if True, the module repository will be cloned into place if necessary...
[ "Update", "the", "repository", "of", "this", "submodule", "to", "point", "to", "the", "checkout", "we", "point", "at", "with", "the", "binsha", "of", "this", "instance", "." ]
python
train
roclark/sportsreference
sportsreference/nfl/schedule.py
https://github.com/roclark/sportsreference/blob/ea0bae432be76450e137671d2998eb38f962dffd/sportsreference/nfl/schedule.py#L156-L203
def dataframe(self): """ Returns a pandas DataFrame containing all other class properties and values. The index for the DataFrame is the boxscore string. """ if self._points_scored is None and self._points_allowed is None: return None fields_to_include = { ...
[ "def", "dataframe", "(", "self", ")", ":", "if", "self", ".", "_points_scored", "is", "None", "and", "self", ".", "_points_allowed", "is", "None", ":", "return", "None", "fields_to_include", "=", "{", "'boxscore_index'", ":", "self", ".", "boxscore_index", "...
Returns a pandas DataFrame containing all other class properties and values. The index for the DataFrame is the boxscore string.
[ "Returns", "a", "pandas", "DataFrame", "containing", "all", "other", "class", "properties", "and", "values", ".", "The", "index", "for", "the", "DataFrame", "is", "the", "boxscore", "string", "." ]
python
train
horazont/aioopenssl
aioopenssl/__init__.py
https://github.com/horazont/aioopenssl/blob/95cb39b5904d6a9702afcef6704181c850371081/aioopenssl/__init__.py#L726-L849
def create_starttls_connection( loop, protocol_factory, host=None, port=None, *, sock=None, ssl_context_factory=None, use_starttls=False, local_addr=None, **kwargs): """ Create a connection which can later be upgraded to use TLS. ...
[ "def", "create_starttls_connection", "(", "loop", ",", "protocol_factory", ",", "host", "=", "None", ",", "port", "=", "None", ",", "*", ",", "sock", "=", "None", ",", "ssl_context_factory", "=", "None", ",", "use_starttls", "=", "False", ",", "local_addr", ...
Create a connection which can later be upgraded to use TLS. .. versionchanged:: 0.4 The `local_addr` argument was added. :param loop: The event loop to use. :type loop: :class:`asyncio.BaseEventLoop` :param protocol_factory: Factory for the protocol for the connection :param host: The hos...
[ "Create", "a", "connection", "which", "can", "later", "be", "upgraded", "to", "use", "TLS", "." ]
python
train
DataONEorg/d1_python
gmn/src/d1_gmn/app/views/slice.py
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/gmn/src/d1_gmn/app/views/slice.py#L79-L103
def _get_and_assert_slice_param(url_dict, param_name, default_int): """Return ``param_str`` converted to an int. If str cannot be converted to int or int is not zero or positive, raise InvalidRequest. """ param_str = url_dict['query'].get(param_name, default_int) try: n = int(param_str...
[ "def", "_get_and_assert_slice_param", "(", "url_dict", ",", "param_name", ",", "default_int", ")", ":", "param_str", "=", "url_dict", "[", "'query'", "]", ".", "get", "(", "param_name", ",", "default_int", ")", "try", ":", "n", "=", "int", "(", "param_str", ...
Return ``param_str`` converted to an int. If str cannot be converted to int or int is not zero or positive, raise InvalidRequest.
[ "Return", "param_str", "converted", "to", "an", "int", "." ]
python
train
andymccurdy/redis-py
redis/client.py
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1086-L1105
def shutdown(self, save=False, nosave=False): """Shutdown the Redis server. If Redis has persistence configured, data will be flushed before shutdown. If the "save" option is set, a data flush will be attempted even if there is no persistence configured. If the "nosave" option is set,...
[ "def", "shutdown", "(", "self", ",", "save", "=", "False", ",", "nosave", "=", "False", ")", ":", "if", "save", "and", "nosave", ":", "raise", "DataError", "(", "'SHUTDOWN save and nosave cannot both be set'", ")", "args", "=", "[", "'SHUTDOWN'", "]", "if", ...
Shutdown the Redis server. If Redis has persistence configured, data will be flushed before shutdown. If the "save" option is set, a data flush will be attempted even if there is no persistence configured. If the "nosave" option is set, no data flush will be attempted. The "save" and...
[ "Shutdown", "the", "Redis", "server", ".", "If", "Redis", "has", "persistence", "configured", "data", "will", "be", "flushed", "before", "shutdown", ".", "If", "the", "save", "option", "is", "set", "a", "data", "flush", "will", "be", "attempted", "even", "...
python
train
bionikspoon/pureyaml
pureyaml/__init__.py
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/__init__.py#L47-L49
def dumps(obj, indent=None, default=None, sort_keys=False, **kw): """Dump string.""" return YAMLEncoder(indent=indent, default=default, sort_keys=sort_keys, **kw).encode(obj)
[ "def", "dumps", "(", "obj", ",", "indent", "=", "None", ",", "default", "=", "None", ",", "sort_keys", "=", "False", ",", "*", "*", "kw", ")", ":", "return", "YAMLEncoder", "(", "indent", "=", "indent", ",", "default", "=", "default", ",", "sort_keys...
Dump string.
[ "Dump", "string", "." ]
python
train
singularityhub/sregistry-cli
sregistry/main/s3/query.py
https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/main/s3/query.py#L80-L103
def container_search(self, query, across_collections=False): '''search for a specific container. If across collections is False, the query is parsed as a full container name and a specific container is returned. If across_collections is True, the container is searched for across collections. If across c...
[ "def", "container_search", "(", "self", ",", "query", ",", "across_collections", "=", "False", ")", ":", "results", "=", "self", ".", "_search_all", "(", "quiet", "=", "True", ")", "matches", "=", "[", "]", "for", "result", "in", "results", ":", "# This ...
search for a specific container. If across collections is False, the query is parsed as a full container name and a specific container is returned. If across_collections is True, the container is searched for across collections. If across collections is True, details are not shown
[ "search", "for", "a", "specific", "container", ".", "If", "across", "collections", "is", "False", "the", "query", "is", "parsed", "as", "a", "full", "container", "name", "and", "a", "specific", "container", "is", "returned", ".", "If", "across_collections", ...
python
test
Iotic-Labs/py-IoticAgent
src/IoticAgent/Core/AmqpLink.py
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/AmqpLink.py#L367-L371
def __recv_exc_clear(self, log_if_exc_set=None): """Equivalent to __send_exc_clear""" if not (log_if_exc_set is None or self.__recv_exc is None): logger.info(log_if_exc_set) self.__recv_exc = None
[ "def", "__recv_exc_clear", "(", "self", ",", "log_if_exc_set", "=", "None", ")", ":", "if", "not", "(", "log_if_exc_set", "is", "None", "or", "self", ".", "__recv_exc", "is", "None", ")", ":", "logger", ".", "info", "(", "log_if_exc_set", ")", "self", "....
Equivalent to __send_exc_clear
[ "Equivalent", "to", "__send_exc_clear" ]
python
train
cocaine/cocaine-tools
cocaine/tools/dispatch.py
https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L2018-L2026
def keyring_edit(**kwargs): """ Edits interactively the keyring. """ ctx = Context(**kwargs) ctx.timeout = None ctx.execute_action('keyring:edit', **{ 'storage': ctx.repo.create_secure_service('storage'), })
[ "def", "keyring_edit", "(", "*", "*", "kwargs", ")", ":", "ctx", "=", "Context", "(", "*", "*", "kwargs", ")", "ctx", ".", "timeout", "=", "None", "ctx", ".", "execute_action", "(", "'keyring:edit'", ",", "*", "*", "{", "'storage'", ":", "ctx", ".", ...
Edits interactively the keyring.
[ "Edits", "interactively", "the", "keyring", "." ]
python
train
Dallinger/Dallinger
dallinger/models.py
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/models.py#L519-L532
def vectors(self, failed=False): """ Get vectors in the network. failed = { False, True, "all" } To get the vectors to/from to a specific node, see Node.vectors(). """ if failed not in ["all", False, True]: raise ValueError("{} is not a valid vector failed".f...
[ "def", "vectors", "(", "self", ",", "failed", "=", "False", ")", ":", "if", "failed", "not", "in", "[", "\"all\"", ",", "False", ",", "True", "]", ":", "raise", "ValueError", "(", "\"{} is not a valid vector failed\"", ".", "format", "(", "failed", ")", ...
Get vectors in the network. failed = { False, True, "all" } To get the vectors to/from to a specific node, see Node.vectors().
[ "Get", "vectors", "in", "the", "network", "." ]
python
train
Kozea/cairocffi
cairocffi/context.py
https://github.com/Kozea/cairocffi/blob/450853add7e32eea20985b6aa5f54d9cb3cd04fe/cairocffi/context.py#L741-L750
def set_matrix(self, matrix): """Modifies the current transformation matrix (CTM) by setting it equal to :obj:`matrix`. :param matrix: A transformation :class:`Matrix` from user space to device space. """ cairo.cairo_set_matrix(self._pointer, matrix._pointer) ...
[ "def", "set_matrix", "(", "self", ",", "matrix", ")", ":", "cairo", ".", "cairo_set_matrix", "(", "self", ".", "_pointer", ",", "matrix", ".", "_pointer", ")", "self", ".", "_check_status", "(", ")" ]
Modifies the current transformation matrix (CTM) by setting it equal to :obj:`matrix`. :param matrix: A transformation :class:`Matrix` from user space to device space.
[ "Modifies", "the", "current", "transformation", "matrix", "(", "CTM", ")", "by", "setting", "it", "equal", "to", ":", "obj", ":", "matrix", "." ]
python
train
hyperledger/sawtooth-core
cli/sawtooth_cli/transaction.py
https://github.com/hyperledger/sawtooth-core/blob/8cf473bc2207e51f02bd182d825158a57d72b098/cli/sawtooth_cli/transaction.py#L63-L125
def do_transaction(args): """Runs the transaction list or show command, printing to the console Args: args: The parsed arguments sent to the command at runtime """ rest_client = RestClient(args.url, args.user) if args.subcommand == 'list': transactions = rest_client.list_tr...
[ "def", "do_transaction", "(", "args", ")", ":", "rest_client", "=", "RestClient", "(", "args", ".", "url", ",", "args", ".", "user", ")", "if", "args", ".", "subcommand", "==", "'list'", ":", "transactions", "=", "rest_client", ".", "list_transactions", "(...
Runs the transaction list or show command, printing to the console Args: args: The parsed arguments sent to the command at runtime
[ "Runs", "the", "transaction", "list", "or", "show", "command", "printing", "to", "the", "console" ]
python
train
bukun/TorCMS
torcms/model/post_model.py
https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L361-L381
def query_cat_recent(cat_id, label=None, num=8, kind='1', order=False): ''' Query recent posts of catalog. ''' if label: recent_recs = MPost.query_cat_recent_with_label( cat_id, label=label, num=num, kind=kind, ...
[ "def", "query_cat_recent", "(", "cat_id", ",", "label", "=", "None", ",", "num", "=", "8", ",", "kind", "=", "'1'", ",", "order", "=", "False", ")", ":", "if", "label", ":", "recent_recs", "=", "MPost", ".", "query_cat_recent_with_label", "(", "cat_id", ...
Query recent posts of catalog.
[ "Query", "recent", "posts", "of", "catalog", "." ]
python
train
ARMmbed/yotta
yotta/lib/component.py
https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L669-L689
def satisfyTarget(self, target_name_and_version, update_installed=False, additional_config=None, install_missing=True): ''' Ensure that the specified target name (and optionally version, github ref or URL) is installed in the targets directory of the current component return...
[ "def", "satisfyTarget", "(", "self", ",", "target_name_and_version", ",", "update_installed", "=", "False", ",", "additional_config", "=", "None", ",", "install_missing", "=", "True", ")", ":", "# Target, , represent an installed target, internal", "from", "yotta", ".",...
Ensure that the specified target name (and optionally version, github ref or URL) is installed in the targets directory of the current component returns (derived_target, errors)
[ "Ensure", "that", "the", "specified", "target", "name", "(", "and", "optionally", "version", "github", "ref", "or", "URL", ")", "is", "installed", "in", "the", "targets", "directory", "of", "the", "current", "component" ]
python
valid
Iotic-Labs/py-IoticAgent
src/IoticAgent/Core/AmqpLink.py
https://github.com/Iotic-Labs/py-IoticAgent/blob/893e8582ad1dacfe32dfc0ee89452bbd6f57d28d/src/IoticAgent/Core/AmqpLink.py#L374-L423
def __send_run(self): """Send request thread """ while not self.__end.is_set(): try: with Connection(userid=self.__prefix + self.__epid, password=self.__passwd, virtual_host=self.__vhost, ...
[ "def", "__send_run", "(", "self", ")", ":", "while", "not", "self", ".", "__end", ".", "is_set", "(", ")", ":", "try", ":", "with", "Connection", "(", "userid", "=", "self", ".", "__prefix", "+", "self", ".", "__epid", ",", "password", "=", "self", ...
Send request thread
[ "Send", "request", "thread" ]
python
train
PythonCharmers/python-future
src/future/backports/urllib/request.py
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/backports/urllib/request.py#L2008-L2047
def open_data(self, url, data=None): """Use "data" URL.""" if not isinstance(url, str): raise URLError('data error: proxy support for data protocol currently not implemented') # ignore POSTed data # # syntax of data URLs: # dataurl := "data:" [ mediatype ] [...
[ "def", "open_data", "(", "self", ",", "url", ",", "data", "=", "None", ")", ":", "if", "not", "isinstance", "(", "url", ",", "str", ")", ":", "raise", "URLError", "(", "'data error: proxy support for data protocol currently not implemented'", ")", "# ignore POSTed...
Use "data" URL.
[ "Use", "data", "URL", "." ]
python
train
mlperf/training
reinforcement/tensorflow/minigo/mask_flags.py
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/mask_flags.py#L80-L100
def prepare_subprocess_cmd(subprocess_cmd): """Prepares a subprocess command by running --helpfull and masking flags. Args: subprocess_cmd: List[str], what would be passed into subprocess.call() i.e. ['python', 'train.py', '--flagfile=flags'] Returns: ['python', 'train.py', '--...
[ "def", "prepare_subprocess_cmd", "(", "subprocess_cmd", ")", ":", "help_cmd", "=", "subprocess_cmd", "+", "[", "'--helpfull'", "]", "help_output", "=", "subprocess", ".", "run", "(", "help_cmd", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", ".", "stdout"...
Prepares a subprocess command by running --helpfull and masking flags. Args: subprocess_cmd: List[str], what would be passed into subprocess.call() i.e. ['python', 'train.py', '--flagfile=flags'] Returns: ['python', 'train.py', '--train_flag=blah', '--more_flags']
[ "Prepares", "a", "subprocess", "command", "by", "running", "--", "helpfull", "and", "masking", "flags", "." ]
python
train
Radi85/Comment
comment/templatetags/comment_tags.py
https://github.com/Radi85/Comment/blob/c3c46afe51228cd7ee4e04f5e6164fff1be3a5bc/comment/templatetags/comment_tags.py#L68-L113
def get_comments(obj, request, oauth=False, paginate=False, cpp=10): """ Retrieves list of comments related to a certain object and renders The appropriate template to view it """ model_object = type(obj).objects.get(id=obj.id) comments = Comment.objects.filter_by_object(model_object) commen...
[ "def", "get_comments", "(", "obj", ",", "request", ",", "oauth", "=", "False", ",", "paginate", "=", "False", ",", "cpp", "=", "10", ")", ":", "model_object", "=", "type", "(", "obj", ")", ".", "objects", ".", "get", "(", "id", "=", "obj", ".", "...
Retrieves list of comments related to a certain object and renders The appropriate template to view it
[ "Retrieves", "list", "of", "comments", "related", "to", "a", "certain", "object", "and", "renders", "The", "appropriate", "template", "to", "view", "it" ]
python
train
BD2KGenomics/toil-scripts
src/toil_scripts/gatk_germline/germline.py
https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L483-L592
def prepare_bam(job, uuid, url, config, paired_url=None, rg_line=None): """ Prepares BAM file for Toil germline pipeline. Steps in pipeline 0: Download and align BAM or FASTQ sample 1: Sort BAM 2: Index BAM 3: Run GATK preprocessing pipeline (Optional) - Uploads preprocessed BAM to ...
[ "def", "prepare_bam", "(", "job", ",", "uuid", ",", "url", ",", "config", ",", "paired_url", "=", "None", ",", "rg_line", "=", "None", ")", ":", "# 0: Align FASTQ or realign BAM", "if", "config", ".", "run_bwa", ":", "get_bam", "=", "job", ".", "wrapJobFn"...
Prepares BAM file for Toil germline pipeline. Steps in pipeline 0: Download and align BAM or FASTQ sample 1: Sort BAM 2: Index BAM 3: Run GATK preprocessing pipeline (Optional) - Uploads preprocessed BAM to output directory :param JobFunctionWrappingJob job: passed automatically by Toi...
[ "Prepares", "BAM", "file", "for", "Toil", "germline", "pipeline", "." ]
python
train
pytroll/pyspectral
pyspectral/radiance_tb_conversion.py
https://github.com/pytroll/pyspectral/blob/fd296c0e0bdf5364fa180134a1292665d6bc50a3/pyspectral/radiance_tb_conversion.py#L130-L158
def _get_rsr(self): """ Get the relative spectral responses from file, find the bandname, and convert to the requested wave-spave (wavelength or wave number) """ sensor = RelativeSpectralResponse(self.platform_name, self.instrument) if self.wavespace == WAVE_NUMBER: ...
[ "def", "_get_rsr", "(", "self", ")", ":", "sensor", "=", "RelativeSpectralResponse", "(", "self", ".", "platform_name", ",", "self", ".", "instrument", ")", "if", "self", ".", "wavespace", "==", "WAVE_NUMBER", ":", "LOG", ".", "debug", "(", "\"Converting to ...
Get the relative spectral responses from file, find the bandname, and convert to the requested wave-spave (wavelength or wave number)
[ "Get", "the", "relative", "spectral", "responses", "from", "file", "find", "the", "bandname", "and", "convert", "to", "the", "requested", "wave", "-", "spave", "(", "wavelength", "or", "wave", "number", ")" ]
python
train
aio-libs/aioredis
aioredis/commands/geo.py
https://github.com/aio-libs/aioredis/blob/e8c33e39558d4cc91cf70dde490d8b330c97dc2e/aioredis/commands/geo.py#L26-L33
def geohash(self, key, member, *members, **kwargs): """Returns members of a geospatial index as standard geohash strings. :rtype: list[str or bytes or None] """ return self.execute( b'GEOHASH', key, member, *members, **kwargs )
[ "def", "geohash", "(", "self", ",", "key", ",", "member", ",", "*", "members", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "execute", "(", "b'GEOHASH'", ",", "key", ",", "member", ",", "*", "members", ",", "*", "*", "kwargs", ")" ]
Returns members of a geospatial index as standard geohash strings. :rtype: list[str or bytes or None]
[ "Returns", "members", "of", "a", "geospatial", "index", "as", "standard", "geohash", "strings", "." ]
python
train
GNS3/gns3-server
gns3server/compute/vpcs/vpcs_vm.py
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vpcs/vpcs_vm.py#L106-L124
def _check_requirements(self): """ Check if VPCS is available with the correct version. """ path = self._vpcs_path() if not path: raise VPCSError("No path to a VPCS executable has been set") # This raise an error if ubridge is not available self.ubri...
[ "def", "_check_requirements", "(", "self", ")", ":", "path", "=", "self", ".", "_vpcs_path", "(", ")", "if", "not", "path", ":", "raise", "VPCSError", "(", "\"No path to a VPCS executable has been set\"", ")", "# This raise an error if ubridge is not available", "self",...
Check if VPCS is available with the correct version.
[ "Check", "if", "VPCS", "is", "available", "with", "the", "correct", "version", "." ]
python
train
BHSPitMonkey/vmflib
tools/buildbsp.py
https://github.com/BHSPitMonkey/vmflib/blob/322757fcba98e05041ee8f416c8ffe847ca1fe64/tools/buildbsp.py#L34-L45
def get_game_dir(self, username=False): """Returns joined game directory path relative to Steamapps""" if not self.common and not username: raise RuntimeError("Can't determine this game's directory without username") if self.common: subdir = "common" else: ...
[ "def", "get_game_dir", "(", "self", ",", "username", "=", "False", ")", ":", "if", "not", "self", ".", "common", "and", "not", "username", ":", "raise", "RuntimeError", "(", "\"Can't determine this game's directory without username\"", ")", "if", "self", ".", "c...
Returns joined game directory path relative to Steamapps
[ "Returns", "joined", "game", "directory", "path", "relative", "to", "Steamapps" ]
python
test
profitbricks/profitbricks-sdk-python
profitbricks/client.py
https://github.com/profitbricks/profitbricks-sdk-python/blob/2c804b141688eccb07d6ae56601d5c60a62abebd/profitbricks/client.py#L1245-L1265
def get_server(self, datacenter_id, server_id, depth=1): """ Retrieves a server by its ID. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param server_id: The unique ID of the server. :type server_id: ``str`` ...
[ "def", "get_server", "(", "self", ",", "datacenter_id", ",", "server_id", ",", "depth", "=", "1", ")", ":", "response", "=", "self", ".", "_perform_request", "(", "'/datacenters/%s/servers/%s?depth=%s'", "%", "(", "datacenter_id", ",", "server_id", ",", "str", ...
Retrieves a server by its ID. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param server_id: The unique ID of the server. :type server_id: ``str`` :param depth: The depth of the response data. :type ...
[ "Retrieves", "a", "server", "by", "its", "ID", "." ]
python
valid
MrYsLab/PyMata
PyMata/pymata.py
https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata.py#L377-L406
def encoder_config(self, pin_a, pin_b, cb=None): """ This command enables the rotary encoder (2 pin + ground) and will enable encoder reporting. NOTE: This command is not currently part of standard arduino firmata, but is provided for legacy support of CodeShield on an Arduino U...
[ "def", "encoder_config", "(", "self", ",", "pin_a", ",", "pin_b", ",", "cb", "=", "None", ")", ":", "data", "=", "[", "pin_a", ",", "pin_b", "]", "self", ".", "_command_handler", ".", "digital_response_table", "[", "pin_a", "]", "[", "self", ".", "_com...
This command enables the rotary encoder (2 pin + ground) and will enable encoder reporting. NOTE: This command is not currently part of standard arduino firmata, but is provided for legacy support of CodeShield on an Arduino UNO. Encoder data is retrieved by performing a digital_read f...
[ "This", "command", "enables", "the", "rotary", "encoder", "(", "2", "pin", "+", "ground", ")", "and", "will", "enable", "encoder", "reporting", "." ]
python
valid
benley/butcher
butcher/targets/gendeb.py
https://github.com/benley/butcher/blob/8b18828ea040af56b7835beab5fd03eab23cc9ee/butcher/targets/gendeb.py#L270-L285
def validate_args(self): """Input validators for this rule type.""" base.BaseTarget.validate_args(self) params = self.params if params['extra_control_fields'] is not None: assert isinstance(params['extra_control_fields'], list), ( 'extra_control_fields must be...
[ "def", "validate_args", "(", "self", ")", ":", "base", ".", "BaseTarget", ".", "validate_args", "(", "self", ")", "params", "=", "self", ".", "params", "if", "params", "[", "'extra_control_fields'", "]", "is", "not", "None", ":", "assert", "isinstance", "(...
Input validators for this rule type.
[ "Input", "validators", "for", "this", "rule", "type", "." ]
python
train
buzzfeed/caliendo
caliendo/facade.py
https://github.com/buzzfeed/caliendo/blob/1628a10f7782ad67c0422b5cbc9bf4979ac40abc/caliendo/facade.py#L208-L221
def __store_callable(self, o, method_name, member): """ Stores a callable member to the private __store__ :param mixed o: Any callable (function or method) :param str method_name: The name of the attribute :param mixed member: A reference to the member """ self....
[ "def", "__store_callable", "(", "self", ",", "o", ",", "method_name", ",", "member", ")", ":", "self", ".", "__store__", "[", "'callables'", "]", "[", "method_name", "]", "=", "eval", "(", "\"o.\"", "+", "method_name", ")", "self", ".", "__store__", "[",...
Stores a callable member to the private __store__ :param mixed o: Any callable (function or method) :param str method_name: The name of the attribute :param mixed member: A reference to the member
[ "Stores", "a", "callable", "member", "to", "the", "private", "__store__" ]
python
train
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L428-L439
def stop(self): """ Stops the dependency manager (must be called before clear()) :return: The removed bindings (list) or None """ super(SimpleDependency, self).stop() if self.reference is not None: # Return a tuple of tuple return ((self._value, s...
[ "def", "stop", "(", "self", ")", ":", "super", "(", "SimpleDependency", ",", "self", ")", ".", "stop", "(", ")", "if", "self", ".", "reference", "is", "not", "None", ":", "# Return a tuple of tuple", "return", "(", "(", "self", ".", "_value", ",", "sel...
Stops the dependency manager (must be called before clear()) :return: The removed bindings (list) or None
[ "Stops", "the", "dependency", "manager", "(", "must", "be", "called", "before", "clear", "()", ")" ]
python
train
snare/scruffy
scruffy/file.py
https://github.com/snare/scruffy/blob/0fedc08cfdb6db927ff93c09f25f24ce5a04c541/scruffy/file.py#L348-L358
def cleanup(self): """ Clean up children and remove the directory. Directory will only be removed if the cleanup flag is set. """ for k in self._children: self._children[k].cleanup() if self._cleanup: self.remove(True)
[ "def", "cleanup", "(", "self", ")", ":", "for", "k", "in", "self", ".", "_children", ":", "self", ".", "_children", "[", "k", "]", ".", "cleanup", "(", ")", "if", "self", ".", "_cleanup", ":", "self", ".", "remove", "(", "True", ")" ]
Clean up children and remove the directory. Directory will only be removed if the cleanup flag is set.
[ "Clean", "up", "children", "and", "remove", "the", "directory", "." ]
python
test
mardix/Yass
yass/utils.py
https://github.com/mardix/Yass/blob/32f804c1a916f5b0a13d13fa750e52be3b6d666d/yass/utils.py#L58-L69
def load_conf(yml_file, conf={}): """ To load the config :param yml_file: the config file path :param conf: dict, to override global config :return: dict """ with open(yml_file) as f: data = yaml.load(f) if conf: data.update(conf) return dictdot(data)
[ "def", "load_conf", "(", "yml_file", ",", "conf", "=", "{", "}", ")", ":", "with", "open", "(", "yml_file", ")", "as", "f", ":", "data", "=", "yaml", ".", "load", "(", "f", ")", "if", "conf", ":", "data", ".", "update", "(", "conf", ")", "retur...
To load the config :param yml_file: the config file path :param conf: dict, to override global config :return: dict
[ "To", "load", "the", "config", ":", "param", "yml_file", ":", "the", "config", "file", "path", ":", "param", "conf", ":", "dict", "to", "override", "global", "config", ":", "return", ":", "dict" ]
python
train
saltstack/salt
salt/utils/vmware.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vmware.py#L1212-L1264
def get_dvportgroups(parent_ref, portgroup_names=None, get_all_portgroups=False): ''' Returns distributed virtual porgroups (dvportgroups). The parent object can be either a datacenter or a dvs. parent_ref The parent object reference. Can be either a datacenter or a dvs. ...
[ "def", "get_dvportgroups", "(", "parent_ref", ",", "portgroup_names", "=", "None", ",", "get_all_portgroups", "=", "False", ")", ":", "if", "not", "(", "isinstance", "(", "parent_ref", ",", "(", "vim", ".", "Datacenter", ",", "vim", ".", "DistributedVirtualSwi...
Returns distributed virtual porgroups (dvportgroups). The parent object can be either a datacenter or a dvs. parent_ref The parent object reference. Can be either a datacenter or a dvs. portgroup_names The names of the dvss to return. Default is None. get_all_portgroups Return...
[ "Returns", "distributed", "virtual", "porgroups", "(", "dvportgroups", ")", ".", "The", "parent", "object", "can", "be", "either", "a", "datacenter", "or", "a", "dvs", "." ]
python
train
ladybug-tools/ladybug
ladybug/designday.py
https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L1029-L1047
def from_json(cls, data): """Create a Wind Condition from a dictionary. Args: data = { "wind_speed": float, "wind_direction": float, "rain": bool, "snow_on_ground": bool} """ # Check required and optional keys optional_...
[ "def", "from_json", "(", "cls", ",", "data", ")", ":", "# Check required and optional keys", "optional_keys", "=", "{", "'wind_direction'", ":", "0", ",", "'rain'", ":", "False", ",", "'snow_on_ground'", ":", "False", "}", "assert", "'wind_speed'", "in", "data",...
Create a Wind Condition from a dictionary. Args: data = { "wind_speed": float, "wind_direction": float, "rain": bool, "snow_on_ground": bool}
[ "Create", "a", "Wind", "Condition", "from", "a", "dictionary", "." ]
python
train
diging/tethne
tethne/serialize/paper.py
https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/serialize/paper.py#L346-L424
def get_details_from_inst_literal(self, institute_literal, institution_id, institution_instance_id, paper_key): """ This method parses the institute literal to get the following 1. Department naame 2. Country 3. University name 4. ZIP, STATE AND CITY (Only if the country ...
[ "def", "get_details_from_inst_literal", "(", "self", ",", "institute_literal", ",", "institution_id", ",", "institution_instance_id", ",", "paper_key", ")", ":", "institute_details", "=", "institute_literal", ".", "split", "(", "','", ")", "institute_name", "=", "inst...
This method parses the institute literal to get the following 1. Department naame 2. Country 3. University name 4. ZIP, STATE AND CITY (Only if the country is USA. For other countries the standard may vary. So parsing these values becomes very difficult. However, the complete add...
[ "This", "method", "parses", "the", "institute", "literal", "to", "get", "the", "following", "1", ".", "Department", "naame", "2", ".", "Country", "3", ".", "University", "name", "4", ".", "ZIP", "STATE", "AND", "CITY", "(", "Only", "if", "the", "country"...
python
train
QualiSystems/vCenterShell
package/cloudshell/cp/vcenter/common/model_factory.py
https://github.com/QualiSystems/vCenterShell/blob/e2e24cd938a92a68f4a8e6a860810d3ef72aae6d/package/cloudshell/cp/vcenter/common/model_factory.py#L166-L179
def get_property_name_from_attribute_name(attribute): """ Returns property name from attribute name :param attribute: Attribute name, may contain upper and lower case and spaces :return: string """ if isinstance(attribute, str) or isinstance(attribute, unicode): ...
[ "def", "get_property_name_from_attribute_name", "(", "attribute", ")", ":", "if", "isinstance", "(", "attribute", ",", "str", ")", "or", "isinstance", "(", "attribute", ",", "unicode", ")", ":", "attribute_name", "=", "attribute", "elif", "hasattr", "(", "attrib...
Returns property name from attribute name :param attribute: Attribute name, may contain upper and lower case and spaces :return: string
[ "Returns", "property", "name", "from", "attribute", "name", ":", "param", "attribute", ":", "Attribute", "name", "may", "contain", "upper", "and", "lower", "case", "and", "spaces", ":", "return", ":", "string" ]
python
train
olitheolix/qtmacs
qtmacs/extensions/qtmacsscintilla_widget.py
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L458-L474
def commit(self): """ Put the document into the new state. """ if self.textAfter is None: # If this is the first 'commit' call then do not make # any changes but store the current document state # and its style. line, col = self.qteWidget.g...
[ "def", "commit", "(", "self", ")", ":", "if", "self", ".", "textAfter", "is", "None", ":", "# If this is the first 'commit' call then do not make", "# any changes but store the current document state", "# and its style.", "line", ",", "col", "=", "self", ".", "qteWidget",...
Put the document into the new state.
[ "Put", "the", "document", "into", "the", "new", "state", "." ]
python
train
pricingassistant/mrq
mrq/agent.py
https://github.com/pricingassistant/mrq/blob/d0a5a34de9cba38afa94fb7c9e17f9b570b79a50/mrq/agent.py#L159-L191
def queuestats(self): """ Compute ETAs for every known queue & subqueue """ start_time = time.time() log.debug("Starting queue stats...") # Fetch all known queues queues = [Queue(q) for q in Queue.all_known()] new_queues = {queue.id for queue in queues} old_que...
[ "def", "queuestats", "(", "self", ")", ":", "start_time", "=", "time", ".", "time", "(", ")", "log", ".", "debug", "(", "\"Starting queue stats...\"", ")", "# Fetch all known queues", "queues", "=", "[", "Queue", "(", "q", ")", "for", "q", "in", "Queue", ...
Compute ETAs for every known queue & subqueue
[ "Compute", "ETAs", "for", "every", "known", "queue", "&", "subqueue" ]
python
train
saltstack/salt
salt/modules/vsphere.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vsphere.py#L5792-L5812
def _validate_entity(entity): ''' Validates the entity dict representation entity Dictionary representation of an entity. See ``_get_entity`` docstrings for format. ''' #Validate entity: if entity['type'] == 'cluster': schema = ESXClusterEntitySchema.serialize() eli...
[ "def", "_validate_entity", "(", "entity", ")", ":", "#Validate entity:", "if", "entity", "[", "'type'", "]", "==", "'cluster'", ":", "schema", "=", "ESXClusterEntitySchema", ".", "serialize", "(", ")", "elif", "entity", "[", "'type'", "]", "==", "'vcenter'", ...
Validates the entity dict representation entity Dictionary representation of an entity. See ``_get_entity`` docstrings for format.
[ "Validates", "the", "entity", "dict", "representation" ]
python
train
saltstack/salt
salt/modules/saltutil.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/saltutil.py#L1207-L1234
def clear_job_cache(hours=24): ''' Forcibly removes job cache folders and files on a minion. .. versionadded:: 2018.3.0 WARNING: The safest way to clear a minion cache is by first stopping the minion and then deleting the cache files before restarting it. CLI Example: .. code-block:: bas...
[ "def", "clear_job_cache", "(", "hours", "=", "24", ")", ":", "threshold", "=", "time", ".", "time", "(", ")", "-", "hours", "*", "60", "*", "60", "for", "root", ",", "dirs", ",", "files", "in", "salt", ".", "utils", ".", "files", ".", "safe_walk", ...
Forcibly removes job cache folders and files on a minion. .. versionadded:: 2018.3.0 WARNING: The safest way to clear a minion cache is by first stopping the minion and then deleting the cache files before restarting it. CLI Example: .. code-block:: bash salt '*' saltutil.clear_job_cach...
[ "Forcibly", "removes", "job", "cache", "folders", "and", "files", "on", "a", "minion", "." ]
python
train
saltstack/salt
salt/modules/mac_power.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_power.py#L192-L217
def set_display_sleep(minutes): ''' Set the amount of idle time until the display sleeps. Pass "Never" of "Off" to never sleep. :param minutes: Can be an integer between 1 and 180 or "Never" or "Off" :ptype: int, str :return: True if successful, False if not :rtype: bool CLI Example: ...
[ "def", "set_display_sleep", "(", "minutes", ")", ":", "value", "=", "_validate_sleep", "(", "minutes", ")", "cmd", "=", "'systemsetup -setdisplaysleep {0}'", ".", "format", "(", "value", ")", "salt", ".", "utils", ".", "mac_utils", ".", "execute_return_success", ...
Set the amount of idle time until the display sleeps. Pass "Never" of "Off" to never sleep. :param minutes: Can be an integer between 1 and 180 or "Never" or "Off" :ptype: int, str :return: True if successful, False if not :rtype: bool CLI Example: .. code-block:: bash salt '*' ...
[ "Set", "the", "amount", "of", "idle", "time", "until", "the", "display", "sleeps", ".", "Pass", "Never", "of", "Off", "to", "never", "sleep", "." ]
python
train
mitsei/dlkit
dlkit/json_/assessment/objects.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/objects.py#L1097-L1112
def set_rubric(self, assessment_id): """Sets the rubric expressed as another assessment. arg: assessment_id (osid.id.Id): the assessment ``Id`` raise: InvalidArgument - ``assessment_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument...
[ "def", "set_rubric", "(", "self", ",", "assessment_id", ")", ":", "# Implemented from template for osid.resource.ResourceForm.set_avatar_template", "if", "self", ".", "get_rubric_metadata", "(", ")", ".", "is_read_only", "(", ")", ":", "raise", "errors", ".", "NoAccess"...
Sets the rubric expressed as another assessment. arg: assessment_id (osid.id.Id): the assessment ``Id`` raise: InvalidArgument - ``assessment_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``assessment_id`` is ``null`` *compli...
[ "Sets", "the", "rubric", "expressed", "as", "another", "assessment", "." ]
python
train
aio-libs/aioftp
aioftp/server.py
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/server.py#L504-L523
async def response_writer(self, stream, response_queue): """ :py:func:`asyncio.coroutine` Worker for write_response with current connection. Get data to response from queue, this is for right order of responses. Exits if received :py:class:`None`. :param stream: command...
[ "async", "def", "response_writer", "(", "self", ",", "stream", ",", "response_queue", ")", ":", "while", "True", ":", "args", "=", "await", "response_queue", ".", "get", "(", ")", "try", ":", "await", "self", ".", "write_response", "(", "stream", ",", "*...
:py:func:`asyncio.coroutine` Worker for write_response with current connection. Get data to response from queue, this is for right order of responses. Exits if received :py:class:`None`. :param stream: command connection stream :type connection: :py:class:`aioftp.StreamIO` ...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
python
valid
yeraydiazdiaz/lunr.py
lunr/builder.py
https://github.com/yeraydiazdiaz/lunr.py/blob/28ec3f6d4888295eed730211ee9617aa488d6ba3/lunr/builder.py#L181-L197
def build(self): """Builds the index, creating an instance of `lunr.Index`. This completes the indexing process and should only be called once all documents have been added to the index. """ self._calculate_average_field_lengths() self._create_field_vectors() sel...
[ "def", "build", "(", "self", ")", ":", "self", ".", "_calculate_average_field_lengths", "(", ")", "self", ".", "_create_field_vectors", "(", ")", "self", ".", "_create_token_set", "(", ")", "return", "Index", "(", "inverted_index", "=", "self", ".", "inverted_...
Builds the index, creating an instance of `lunr.Index`. This completes the indexing process and should only be called once all documents have been added to the index.
[ "Builds", "the", "index", "creating", "an", "instance", "of", "lunr", ".", "Index", "." ]
python
train
eng-tools/sfsimodels
sfsimodels/models/soils.py
https://github.com/eng-tools/sfsimodels/blob/65a690ca440d61307f5a9b8478e4704f203a5925/sfsimodels/models/soils.py#L1181-L1190
def get_v_eff_stress_at_depth(self, y_c): """ Determine the vertical effective stress at a single depth z_c. :param y_c: float, depth from surface """ sigma_v_c = self.get_v_total_stress_at_depth(y_c) pp = self.get_hydrostatic_pressure_at_depth(y_c) sigma_veff_c ...
[ "def", "get_v_eff_stress_at_depth", "(", "self", ",", "y_c", ")", ":", "sigma_v_c", "=", "self", ".", "get_v_total_stress_at_depth", "(", "y_c", ")", "pp", "=", "self", ".", "get_hydrostatic_pressure_at_depth", "(", "y_c", ")", "sigma_veff_c", "=", "sigma_v_c", ...
Determine the vertical effective stress at a single depth z_c. :param y_c: float, depth from surface
[ "Determine", "the", "vertical", "effective", "stress", "at", "a", "single", "depth", "z_c", "." ]
python
train
viniciuschiele/flask-io
flask_io/io.py
https://github.com/viniciuschiele/flask-io/blob/4e559419b3d8e6859f83fa16557b00542d5f3aa7/flask_io/io.py#L120-L131
def ok(self, data, schema=None, envelope=None): """ Gets a 200 response with the specified data. :param data: The content value. :param schema: The schema to serialize the data. :param envelope: The key used to envelope the data. :return: A Flask response object. ...
[ "def", "ok", "(", "self", ",", "data", ",", "schema", "=", "None", ",", "envelope", "=", "None", ")", ":", "data", "=", "marshal", "(", "data", ",", "schema", ",", "envelope", ")", "return", "self", ".", "__make_response", "(", "data", ")" ]
Gets a 200 response with the specified data. :param data: The content value. :param schema: The schema to serialize the data. :param envelope: The key used to envelope the data. :return: A Flask response object.
[ "Gets", "a", "200", "response", "with", "the", "specified", "data", "." ]
python
train
Yelp/kafka-utils
kafka_utils/util/validation.py
https://github.com/Yelp/kafka-utils/blob/cdb4d64308f3079ee0873250bf7b34d0d94eca50/kafka_utils/util/validation.py#L36-L47
def assignment_to_plan(assignment): """Convert an assignment to the format used by Kafka to describe a reassignment plan. """ return { 'version': 1, 'partitions': [{'topic': t_p[0], 'partition': t_p[1], 'replicas': replica } for t_p, replica in six.i...
[ "def", "assignment_to_plan", "(", "assignment", ")", ":", "return", "{", "'version'", ":", "1", ",", "'partitions'", ":", "[", "{", "'topic'", ":", "t_p", "[", "0", "]", ",", "'partition'", ":", "t_p", "[", "1", "]", ",", "'replicas'", ":", "replica", ...
Convert an assignment to the format used by Kafka to describe a reassignment plan.
[ "Convert", "an", "assignment", "to", "the", "format", "used", "by", "Kafka", "to", "describe", "a", "reassignment", "plan", "." ]
python
train
frictionlessdata/tabulator-py
tabulator/helpers.py
https://github.com/frictionlessdata/tabulator-py/blob/06c25845a7139d919326388cc6335f33f909db8c/tabulator/helpers.py#L105-L109
def detect_html(text): """Detect if text is HTML. """ pattern = re.compile('\\s*<(!doctype|html)', re.IGNORECASE) return bool(pattern.match(text))
[ "def", "detect_html", "(", "text", ")", ":", "pattern", "=", "re", ".", "compile", "(", "'\\\\s*<(!doctype|html)'", ",", "re", ".", "IGNORECASE", ")", "return", "bool", "(", "pattern", ".", "match", "(", "text", ")", ")" ]
Detect if text is HTML.
[ "Detect", "if", "text", "is", "HTML", "." ]
python
train
awickert/gFlex
gflex/base.py
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/base.py#L100-L135
def greatCircleDistance(self, lat1, long1, lat2, long2, radius): """ Returns the great circle distance between two points. Useful when using the SAS_NG solution in lat/lon coordinates Modified from http://www.johndcook.com/blog/python_longitude_latitude/ It should be able to take numpy arrays. "...
[ "def", "greatCircleDistance", "(", "self", ",", "lat1", ",", "long1", ",", "lat2", ",", "long2", ",", "radius", ")", ":", "# Convert latitude and longitude to", "# spherical coordinates in radians.", "degrees_to_radians", "=", "np", ".", "pi", "/", "180.0", "# theta...
Returns the great circle distance between two points. Useful when using the SAS_NG solution in lat/lon coordinates Modified from http://www.johndcook.com/blog/python_longitude_latitude/ It should be able to take numpy arrays.
[ "Returns", "the", "great", "circle", "distance", "between", "two", "points", ".", "Useful", "when", "using", "the", "SAS_NG", "solution", "in", "lat", "/", "lon", "coordinates", "Modified", "from", "http", ":", "//", "www", ".", "johndcook", ".", "com", "/...
python
train
rocky/python-uncompyle6
uncompyle6/semantics/pysource.py
https://github.com/rocky/python-uncompyle6/blob/c5d7944e657f0ad05a0e2edd34e1acb27001abc0/uncompyle6/semantics/pysource.py#L2059-L2156
def build_class(self, code): """Dump class definition, doc string and class body.""" assert iscode(code) self.classes.append(self.currentclass) code = Code(code, self.scanner, self.currentclass) indent = self.indent # self.println(indent, '#flags:\t', int(code.co_flags)...
[ "def", "build_class", "(", "self", ",", "code", ")", ":", "assert", "iscode", "(", "code", ")", "self", ".", "classes", ".", "append", "(", "self", ".", "currentclass", ")", "code", "=", "Code", "(", "code", ",", "self", ".", "scanner", ",", "self", ...
Dump class definition, doc string and class body.
[ "Dump", "class", "definition", "doc", "string", "and", "class", "body", "." ]
python
train
juju/charm-helpers
charmhelpers/contrib/openstack/utils.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/utils.py#L769-L782
def os_workload_status(configs, required_interfaces, charm_func=None): """ Decorator to set workload status based on complete contexts """ def wrap(f): @wraps(f) def wrapped_f(*args, **kwargs): # Run the original function first f(*args, **kwargs) # Set...
[ "def", "os_workload_status", "(", "configs", ",", "required_interfaces", ",", "charm_func", "=", "None", ")", ":", "def", "wrap", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "wrapped_f", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":"...
Decorator to set workload status based on complete contexts
[ "Decorator", "to", "set", "workload", "status", "based", "on", "complete", "contexts" ]
python
train
xflr6/gsheets
gsheets/export.py
https://github.com/xflr6/gsheets/blob/ca4f1273044704e529c1138e3f942836fc496e1b/gsheets/export.py#L21-L24
def write_csv(fileobj, rows, encoding=ENCODING, dialect=DIALECT): """Dump rows to ``fileobj`` with the given ``encoding`` and CSV ``dialect``.""" csvwriter = csv.writer(fileobj, dialect=dialect) csv_writerows(csvwriter, rows, encoding)
[ "def", "write_csv", "(", "fileobj", ",", "rows", ",", "encoding", "=", "ENCODING", ",", "dialect", "=", "DIALECT", ")", ":", "csvwriter", "=", "csv", ".", "writer", "(", "fileobj", ",", "dialect", "=", "dialect", ")", "csv_writerows", "(", "csvwriter", "...
Dump rows to ``fileobj`` with the given ``encoding`` and CSV ``dialect``.
[ "Dump", "rows", "to", "fileobj", "with", "the", "given", "encoding", "and", "CSV", "dialect", "." ]
python
train
Jaymon/endpoints
endpoints/call.py
https://github.com/Jaymon/endpoints/blob/2f1c4ae2c69a168e69447d3d8395ada7becaa5fb/endpoints/call.py#L360-L368
def get_class(self, module, class_name): """try and get the class_name from the module and make sure it is a valid controller""" # let's get the class class_object = getattr(module, class_name, None) if not class_object or not issubclass(class_object, Controller): cla...
[ "def", "get_class", "(", "self", ",", "module", ",", "class_name", ")", ":", "# let's get the class", "class_object", "=", "getattr", "(", "module", ",", "class_name", ",", "None", ")", "if", "not", "class_object", "or", "not", "issubclass", "(", "class_object...
try and get the class_name from the module and make sure it is a valid controller
[ "try", "and", "get", "the", "class_name", "from", "the", "module", "and", "make", "sure", "it", "is", "a", "valid", "controller" ]
python
train
zooniverse/panoptes-python-client
panoptes_client/panoptes.py
https://github.com/zooniverse/panoptes-python-client/blob/138d93cb03378501a8d349428e381ad73f928680/panoptes_client/panoptes.py#L1011-L1046
def add(self, objs): """ Adds the given `objs` to this `LinkCollection`. - **objs** can be a list of :py:class:`.PanoptesObject` instances, a list of object IDs, a single :py:class:`.PanoptesObject` instance, or a single object ID. Examples:: organizati...
[ "def", "add", "(", "self", ",", "objs", ")", ":", "if", "self", ".", "readonly", ":", "raise", "NotImplementedError", "(", "'{} links can\\'t be modified'", ".", "format", "(", "self", ".", "_slug", ")", ")", "if", "not", "self", ".", "_parent", ".", "id...
Adds the given `objs` to this `LinkCollection`. - **objs** can be a list of :py:class:`.PanoptesObject` instances, a list of object IDs, a single :py:class:`.PanoptesObject` instance, or a single object ID. Examples:: organization.links.projects.add(1234) o...
[ "Adds", "the", "given", "objs", "to", "this", "LinkCollection", "." ]
python
train
gpennington/PyMarvel
marvel/marvel.py
https://github.com/gpennington/PyMarvel/blob/2617162836f2b7c525ed6c4ff6f1e86a07284fd1/marvel/marvel.py#L152-L170
def get_comics(self, *args, **kwargs): """ Fetches list of comics. get /v1/public/comics :returns: ComicDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_comics(orderBy="issueNumber,-modified", limit="10", offset="15") ...
[ "def", "get_comics", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "json", ".", "loads", "(", "self", ".", "_call", "(", "Comic", ".", "resource_url", "(", ")", ",", "self", ".", "_params", "(", "kwargs", ")", ...
Fetches list of comics. get /v1/public/comics :returns: ComicDataWrapper >>> m = Marvel(public_key, private_key) >>> cdw = m.get_comics(orderBy="issueNumber,-modified", limit="10", offset="15") >>> print cdw.data.count 10 >>> print cdw....
[ "Fetches", "list", "of", "comics", "." ]
python
train
christian-oudard/htmltreediff
htmltreediff/util.py
https://github.com/christian-oudard/htmltreediff/blob/0e28f56492ae7e69bb0f74f9a79a8909a5ad588d/htmltreediff/util.py#L261-L272
def get_location(dom, location): """ Get the node at the specified location in the dom. Location is a sequence of child indices, starting at the children of the root element. If there is no node at this location, raise a ValueError. """ node = dom.documentElement for i in location: n...
[ "def", "get_location", "(", "dom", ",", "location", ")", ":", "node", "=", "dom", ".", "documentElement", "for", "i", "in", "location", ":", "node", "=", "get_child", "(", "node", ",", "i", ")", "if", "not", "node", ":", "raise", "ValueError", "(", "...
Get the node at the specified location in the dom. Location is a sequence of child indices, starting at the children of the root element. If there is no node at this location, raise a ValueError.
[ "Get", "the", "node", "at", "the", "specified", "location", "in", "the", "dom", ".", "Location", "is", "a", "sequence", "of", "child", "indices", "starting", "at", "the", "children", "of", "the", "root", "element", ".", "If", "there", "is", "no", "node",...
python
train
spotify/docker_interface
docker_interface/util.py
https://github.com/spotify/docker_interface/blob/4df80e1fe072d958020080d32c16551ff7703d51/docker_interface/util.py#L57-L74
def split_path(path, ref=None): """ Split a path into its components. Parameters ---------- path : str absolute or relative path with respect to `ref` ref : str or None reference path if `path` is relative Returns ------- list : str components of the path ...
[ "def", "split_path", "(", "path", ",", "ref", "=", "None", ")", ":", "path", "=", "abspath", "(", "path", ",", "ref", ")", "return", "path", ".", "strip", "(", "os", ".", "path", ".", "sep", ")", ".", "split", "(", "os", ".", "path", ".", "sep"...
Split a path into its components. Parameters ---------- path : str absolute or relative path with respect to `ref` ref : str or None reference path if `path` is relative Returns ------- list : str components of the path
[ "Split", "a", "path", "into", "its", "components", "." ]
python
train
mbarakaja/braulio
braulio/version.py
https://github.com/mbarakaja/braulio/blob/70ab6f0dd631ef78c4da1b39d1c6fb6f9a995d2b/braulio/version.py#L108-L155
def bump(self, bump_part): """Return a new bumped version instance.""" major, minor, patch, stage, n = tuple(self) # stage bump if bump_part not in {"major", "minor", "patch"}: if bump_part not in self.stages: raise ValueError(f"Unknown {bump_part} stage") ...
[ "def", "bump", "(", "self", ",", "bump_part", ")", ":", "major", ",", "minor", ",", "patch", ",", "stage", ",", "n", "=", "tuple", "(", "self", ")", "# stage bump", "if", "bump_part", "not", "in", "{", "\"major\"", ",", "\"minor\"", ",", "\"patch\"", ...
Return a new bumped version instance.
[ "Return", "a", "new", "bumped", "version", "instance", "." ]
python
train
saltstack/salt
salt/states/boto_secgroup.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L408-L499
def _rules_present(name, rules, delete_ingress_rules=True, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None): ''' given a group name or group name and vpc_id (or vpc name): 1. get lists of desired rule changes (using _get_rule_changes) 2. authorize/create ru...
[ "def", "_rules_present", "(", "name", ",", "rules", ",", "delete_ingress_rules", "=", "True", ",", "vpc_id", "=", "None", ",", "vpc_name", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=",...
given a group name or group name and vpc_id (or vpc name): 1. get lists of desired rule changes (using _get_rule_changes) 2. authorize/create rules missing rules 3. if delete_ingress_rules is True, delete/revoke non-requested rules 4. return 'old' and 'new' group rules
[ "given", "a", "group", "name", "or", "group", "name", "and", "vpc_id", "(", "or", "vpc", "name", ")", ":", "1", ".", "get", "lists", "of", "desired", "rule", "changes", "(", "using", "_get_rule_changes", ")", "2", ".", "authorize", "/", "create", "rule...
python
train
tdryer/hangups
hangups/conversation_event.py
https://github.com/tdryer/hangups/blob/85c0bf0a57698d077461283895707260f9dbf931/hangups/conversation_event.py#L34-L37
def user_id(self): """Who created the event (:class:`~hangups.user.UserID`).""" return user.UserID(chat_id=self._event.sender_id.chat_id, gaia_id=self._event.sender_id.gaia_id)
[ "def", "user_id", "(", "self", ")", ":", "return", "user", ".", "UserID", "(", "chat_id", "=", "self", ".", "_event", ".", "sender_id", ".", "chat_id", ",", "gaia_id", "=", "self", ".", "_event", ".", "sender_id", ".", "gaia_id", ")" ]
Who created the event (:class:`~hangups.user.UserID`).
[ "Who", "created", "the", "event", "(", ":", "class", ":", "~hangups", ".", "user", ".", "UserID", ")", "." ]
python
valid
pypa/pipenv
pipenv/vendor/chardet/universaldetector.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/chardet/universaldetector.py#L111-L218
def feed(self, byte_str): """ Takes a chunk of a document and feeds it through all of the relevant charset probers. After calling ``feed``, you can check the value of the ``done`` attribute to see if you need to continue feeding the ``UniversalDetector`` more data, or if...
[ "def", "feed", "(", "self", ",", "byte_str", ")", ":", "if", "self", ".", "done", ":", "return", "if", "not", "len", "(", "byte_str", ")", ":", "return", "if", "not", "isinstance", "(", "byte_str", ",", "bytearray", ")", ":", "byte_str", "=", "bytear...
Takes a chunk of a document and feeds it through all of the relevant charset probers. After calling ``feed``, you can check the value of the ``done`` attribute to see if you need to continue feeding the ``UniversalDetector`` more data, or if it has made a prediction (in the ``re...
[ "Takes", "a", "chunk", "of", "a", "document", "and", "feeds", "it", "through", "all", "of", "the", "relevant", "charset", "probers", "." ]
python
train
NoneGG/aredis
aredis/pool.py
https://github.com/NoneGG/aredis/blob/204caad740ac13e5760d46444a2ba7632982a046/aredis/pool.py#L376-L399
def release(self, connection): """ Releases the connection back to the pool """ self._checkpid() if connection.pid != self.pid: return # Remove the current connection from _in_use_connection and add it back to the available pool # There is cases where...
[ "def", "release", "(", "self", ",", "connection", ")", ":", "self", ".", "_checkpid", "(", ")", "if", "connection", ".", "pid", "!=", "self", ".", "pid", ":", "return", "# Remove the current connection from _in_use_connection and add it back to the available pool", "#...
Releases the connection back to the pool
[ "Releases", "the", "connection", "back", "to", "the", "pool" ]
python
train
adafruit/Adafruit_Python_DHT
Adafruit_DHT/common.py
https://github.com/adafruit/Adafruit_Python_DHT/blob/c9407aa0506321bbc63ec8ba3c59fc21291f4746/Adafruit_DHT/common.py#L83-L98
def read_retry(sensor, pin, retries=15, delay_seconds=2, platform=None): """Read DHT sensor of specified sensor type (DHT11, DHT22, or AM2302) on specified pin and return a tuple of humidity (as a floating point value in percent) and temperature (as a floating point value in Celsius). Unlike the read fu...
[ "def", "read_retry", "(", "sensor", ",", "pin", ",", "retries", "=", "15", ",", "delay_seconds", "=", "2", ",", "platform", "=", "None", ")", ":", "for", "i", "in", "range", "(", "retries", ")", ":", "humidity", ",", "temperature", "=", "read", "(", ...
Read DHT sensor of specified sensor type (DHT11, DHT22, or AM2302) on specified pin and return a tuple of humidity (as a floating point value in percent) and temperature (as a floating point value in Celsius). Unlike the read function, this read_retry function will attempt to read multiple times (up to ...
[ "Read", "DHT", "sensor", "of", "specified", "sensor", "type", "(", "DHT11", "DHT22", "or", "AM2302", ")", "on", "specified", "pin", "and", "return", "a", "tuple", "of", "humidity", "(", "as", "a", "floating", "point", "value", "in", "percent", ")", "and"...
python
train
mattja/distob
distob/distob.py
https://github.com/mattja/distob/blob/b0fc49e157189932c70231077ed35e1aa5717da9/distob/distob.py#L1019-L1078
def _scatter_ndarray(ar, axis=-1, destination=None, blocksize=None): """Turn a numpy ndarray into a DistArray or RemoteArray Args: ar (array_like) axis (int, optional): specifies along which axis to split the array to distribute it. The default is to split along the last axis. `None` means ...
[ "def", "_scatter_ndarray", "(", "ar", ",", "axis", "=", "-", "1", ",", "destination", "=", "None", ",", "blocksize", "=", "None", ")", ":", "from", ".", "arrays", "import", "DistArray", ",", "RemoteArray", "shape", "=", "ar", ".", "shape", "ndim", "=",...
Turn a numpy ndarray into a DistArray or RemoteArray Args: ar (array_like) axis (int, optional): specifies along which axis to split the array to distribute it. The default is to split along the last axis. `None` means do not distribute. destination (int or list of int, optional): Opti...
[ "Turn", "a", "numpy", "ndarray", "into", "a", "DistArray", "or", "RemoteArray", "Args", ":", "ar", "(", "array_like", ")", "axis", "(", "int", "optional", ")", ":", "specifies", "along", "which", "axis", "to", "split", "the", "array", "to", "distribute", ...
python
valid
samirelanduk/quickplots
quickplots/charts.py
https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/charts.py#L359-L390
def x_lower_limit(self, limit=None): """Returns or sets (if a value is provided) the value at which the x-axis should start. By default this is zero (unless there are negative values). :param limit: If given, the chart's x_lower_limit will be set to this. :raises ValueError: if ...
[ "def", "x_lower_limit", "(", "self", ",", "limit", "=", "None", ")", ":", "if", "limit", "is", "None", ":", "if", "self", ".", "_x_lower_limit", "is", "None", ":", "if", "self", ".", "smallest_x", "(", ")", "<", "0", ":", "if", "self", ".", "smalle...
Returns or sets (if a value is provided) the value at which the x-axis should start. By default this is zero (unless there are negative values). :param limit: If given, the chart's x_lower_limit will be set to this. :raises ValueError: if you try to make the lower limit larger than the\...
[ "Returns", "or", "sets", "(", "if", "a", "value", "is", "provided", ")", "the", "value", "at", "which", "the", "x", "-", "axis", "should", "start", ".", "By", "default", "this", "is", "zero", "(", "unless", "there", "are", "negative", "values", ")", ...
python
train
boriel/zxbasic
arch/zx48k/backend/__pload.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__pload.py#L432-L497
def _pstorestr(ins): """ Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer. Note: This procedure proceeds as _pstore16, since STRINGS are 16bit pointers. """ output = [] temporal = False # 2nd operand first, because must go int...
[ "def", "_pstorestr", "(", "ins", ")", ":", "output", "=", "[", "]", "temporal", "=", "False", "# 2nd operand first, because must go into the stack", "value", "=", "ins", ".", "quad", "[", "2", "]", "if", "value", "[", "0", "]", "==", "'*'", ":", "value", ...
Stores 2nd parameter at stack pointer (SP) + X, being X 1st parameter. 1st operand must be a SIGNED integer. Note: This procedure proceeds as _pstore16, since STRINGS are 16bit pointers.
[ "Stores", "2nd", "parameter", "at", "stack", "pointer", "(", "SP", ")", "+", "X", "being", "X", "1st", "parameter", "." ]
python
train
Kronuz/pyScss
scss/extension/compass/layouts.py
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/extension/compass/layouts.py#L114-L116
def AREA(a, b): """area: Sort pack by area""" return cmp(b[0] * b[1], a[0] * a[1]) or cmp(b[1], a[1]) or cmp(b[0], a[0])
[ "def", "AREA", "(", "a", ",", "b", ")", ":", "return", "cmp", "(", "b", "[", "0", "]", "*", "b", "[", "1", "]", ",", "a", "[", "0", "]", "*", "a", "[", "1", "]", ")", "or", "cmp", "(", "b", "[", "1", "]", ",", "a", "[", "1", "]", ...
area: Sort pack by area
[ "area", ":", "Sort", "pack", "by", "area" ]
python
train
saltstack/salt
salt/cloud/clouds/vmware.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L3434-L3475
def list_clusters_by_datacenter(kwargs=None, call=None): ''' List clusters for each datacenter; or clusters for a specified datacenter in this VMware environment To list clusters for each datacenter: CLI Example: .. code-block:: bash salt-cloud -f list_clusters_by_datacenter my-vmwar...
[ "def", "list_clusters_by_datacenter", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_clusters_by_datacenter function must be called with '", "'-f or --function.'", ")",...
List clusters for each datacenter; or clusters for a specified datacenter in this VMware environment To list clusters for each datacenter: CLI Example: .. code-block:: bash salt-cloud -f list_clusters_by_datacenter my-vmware-config To list clusters for a specified datacenter: CLI E...
[ "List", "clusters", "for", "each", "datacenter", ";", "or", "clusters", "for", "a", "specified", "datacenter", "in", "this", "VMware", "environment" ]
python
train
briandilley/ebs-deploy
ebs_deploy/__init__.py
https://github.com/briandilley/ebs-deploy/blob/4178c9c1282a9025fb987dab3470bea28c202e10/ebs_deploy/__init__.py#L251-L277
def upload_archive(self, filename, key, auto_create_bucket=True): """ Uploads an application archive version to s3 """ try: bucket = self.s3.get_bucket(self.aws.bucket) if (( self.aws.region != 'us-east-1' and self.aws.region != 'eu-west-1') and ...
[ "def", "upload_archive", "(", "self", ",", "filename", ",", "key", ",", "auto_create_bucket", "=", "True", ")", ":", "try", ":", "bucket", "=", "self", ".", "s3", ".", "get_bucket", "(", "self", ".", "aws", ".", "bucket", ")", "if", "(", "(", "self",...
Uploads an application archive version to s3
[ "Uploads", "an", "application", "archive", "version", "to", "s3" ]
python
valid
wright-group/WrightTools
WrightTools/kit/_list.py
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/kit/_list.py#L75-L99
def get_index(lis, argument): """Find the index of an item, given either the item or index as an argument. Particularly useful as a wrapper for arguments like channel or axis. Parameters ---------- lis : list List to parse. argument : int or object Argument. Returns --...
[ "def", "get_index", "(", "lis", ",", "argument", ")", ":", "# get channel", "if", "isinstance", "(", "argument", ",", "int", ")", ":", "if", "-", "len", "(", "lis", ")", "<=", "argument", "<", "len", "(", "lis", ")", ":", "return", "argument", "else"...
Find the index of an item, given either the item or index as an argument. Particularly useful as a wrapper for arguments like channel or axis. Parameters ---------- lis : list List to parse. argument : int or object Argument. Returns ------- int Index of chosen...
[ "Find", "the", "index", "of", "an", "item", "given", "either", "the", "item", "or", "index", "as", "an", "argument", "." ]
python
train
saltstack/salt
salt/modules/libcloud_loadbalancer.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/libcloud_loadbalancer.py#L104-L126
def list_balancers(profile, **libcloud_kwargs): ''' Return a list of load balancers. :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's list_balancers method :type libcloud_kwargs: ``dict`` CLI Example: .. code-block:: ba...
[ "def", "list_balancers", "(", "profile", ",", "*", "*", "libcloud_kwargs", ")", ":", "conn", "=", "_get_driver", "(", "profile", "=", "profile", ")", "libcloud_kwargs", "=", "salt", ".", "utils", ".", "args", ".", "clean_kwargs", "(", "*", "*", "libcloud_k...
Return a list of load balancers. :param profile: The profile key :type profile: ``str`` :param libcloud_kwargs: Extra arguments for the driver's list_balancers method :type libcloud_kwargs: ``dict`` CLI Example: .. code-block:: bash salt myminion libcloud_storage.list_balancers pr...
[ "Return", "a", "list", "of", "load", "balancers", "." ]
python
train
eruvanos/openbrokerapi
openbrokerapi/log_util.py
https://github.com/eruvanos/openbrokerapi/blob/29d514e5932f2eac27e03995dd41c8cecf40bb10/openbrokerapi/log_util.py#L5-L33
def basic_config(logger: logging.Logger = logging.root, level=logging.INFO): """ Configures a logger to log <=INFO to stdout and >INFO to stderr :param logger: Logger to configure, defaults to logging.root :param level: Defaults to INFO :return: configured logger (logger from parameters) """ ...
[ "def", "basic_config", "(", "logger", ":", "logging", ".", "Logger", "=", "logging", ".", "root", ",", "level", "=", "logging", ".", "INFO", ")", ":", "logger", ".", "setLevel", "(", "level", ")", "class", "InfoFilter", "(", "logging", ".", "Filter", "...
Configures a logger to log <=INFO to stdout and >INFO to stderr :param logger: Logger to configure, defaults to logging.root :param level: Defaults to INFO :return: configured logger (logger from parameters)
[ "Configures", "a", "logger", "to", "log", "<", "=", "INFO", "to", "stdout", "and", ">", "INFO", "to", "stderr" ]
python
train
santoshphilip/eppy
eppy/hvacbuilder.py
https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L982-L988
def getmakeidfobject(idf, key, name): """get idfobject or make it if it does not exist""" idfobject = idf.getobject(key, name) if not idfobject: return idf.newidfobject(key, Name=name) else: return idfobject
[ "def", "getmakeidfobject", "(", "idf", ",", "key", ",", "name", ")", ":", "idfobject", "=", "idf", ".", "getobject", "(", "key", ",", "name", ")", "if", "not", "idfobject", ":", "return", "idf", ".", "newidfobject", "(", "key", ",", "Name", "=", "nam...
get idfobject or make it if it does not exist
[ "get", "idfobject", "or", "make", "it", "if", "it", "does", "not", "exist" ]
python
train
Commonists/CommonsDownloader
commonsdownloader/commonsdownloader.py
https://github.com/Commonists/CommonsDownloader/blob/ac8147432b31ce3cdee5f7a75d0c48b788ee4666/commonsdownloader/commonsdownloader.py#L34-L44
def get_files_from_textfile(textfile_handler): """Yield the file names and widths by parsing a text file handler.""" for line in textfile_handler: line = line.rstrip() try: (image_name, width) = line.rsplit(',', 1) width = int(width) except ValueError: ...
[ "def", "get_files_from_textfile", "(", "textfile_handler", ")", ":", "for", "line", "in", "textfile_handler", ":", "line", "=", "line", ".", "rstrip", "(", ")", "try", ":", "(", "image_name", ",", "width", ")", "=", "line", ".", "rsplit", "(", "','", ","...
Yield the file names and widths by parsing a text file handler.
[ "Yield", "the", "file", "names", "and", "widths", "by", "parsing", "a", "text", "file", "handler", "." ]
python
train
guaix-ucm/numina
numina/array/wavecalib/arccalibration.py
https://github.com/guaix-ucm/numina/blob/6c829495df8937f77c2de9383c1038ffb3e713e3/numina/array/wavecalib/arccalibration.py#L428-L543
def arccalibration(wv_master, xpos_arc, naxis1_arc, crpix1, wv_ini_search, wv_end_search, wvmin_useful, wvmax_useful, error_xpos_arc, times_sigma_r, ...
[ "def", "arccalibration", "(", "wv_master", ",", "xpos_arc", ",", "naxis1_arc", ",", "crpix1", ",", "wv_ini_search", ",", "wv_end_search", ",", "wvmin_useful", ",", "wvmax_useful", ",", "error_xpos_arc", ",", "times_sigma_r", ",", "frac_triplets_for_sum", ",", "times...
Performs arc line identification for arc calibration. This function is a wrapper of two functions, which are responsible of computing all the relevant information concerning the triplets generated from the master table and the actual identification procedure of the arc lines, respectively. The sep...
[ "Performs", "arc", "line", "identification", "for", "arc", "calibration", "." ]
python
train
campaignmonitor/createsend-python
lib/createsend/administrator.py
https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/administrator.py#L42-L45
def delete(self): """Deletes the administrator from the account.""" params = {"email": self.email_address} response = self._delete("/admins.json", params=params)
[ "def", "delete", "(", "self", ")", ":", "params", "=", "{", "\"email\"", ":", "self", ".", "email_address", "}", "response", "=", "self", ".", "_delete", "(", "\"/admins.json\"", ",", "params", "=", "params", ")" ]
Deletes the administrator from the account.
[ "Deletes", "the", "administrator", "from", "the", "account", "." ]
python
train
FPGAwars/apio
apio/commands/boards.py
https://github.com/FPGAwars/apio/blob/5c6310f11a061a760764c6b5847bfb431dc3d0bc/apio/commands/boards.py#L18-L26
def cli(ctx, list, fpga): """Manage FPGA boards.""" if list: Resources().list_boards() elif fpga: Resources().list_fpgas() else: click.secho(ctx.get_help())
[ "def", "cli", "(", "ctx", ",", "list", ",", "fpga", ")", ":", "if", "list", ":", "Resources", "(", ")", ".", "list_boards", "(", ")", "elif", "fpga", ":", "Resources", "(", ")", ".", "list_fpgas", "(", ")", "else", ":", "click", ".", "secho", "("...
Manage FPGA boards.
[ "Manage", "FPGA", "boards", "." ]
python
train