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
django-salesforce/django-salesforce
salesforce/dbapi/subselect.py
https://github.com/django-salesforce/django-salesforce/blob/6fd5643dba69d49c5881de50875cf90204a8f808/salesforce/dbapi/subselect.py#L231-L251
def find_closing_parenthesis(sql, startpos): """Find the pair of opening and closing parentheses. Starts search at the position startpos. Returns tuple of positions (opening, closing) if search succeeds, otherwise None. """ pattern = re.compile(r'[()]') level = 0 opening = [] for match ...
[ "def", "find_closing_parenthesis", "(", "sql", ",", "startpos", ")", ":", "pattern", "=", "re", ".", "compile", "(", "r'[()]'", ")", "level", "=", "0", "opening", "=", "[", "]", "for", "match", "in", "pattern", ".", "finditer", "(", "sql", ",", "startp...
Find the pair of opening and closing parentheses. Starts search at the position startpos. Returns tuple of positions (opening, closing) if search succeeds, otherwise None.
[ "Find", "the", "pair", "of", "opening", "and", "closing", "parentheses", "." ]
python
train
emencia/emencia-django-forum
forum/markup.py
https://github.com/emencia/emencia-django-forum/blob/cda74ed7e5822675c340ee5ec71548d981bccd3b/forum/markup.py#L20-L28
def clean_restructuredtext(form_instance, content): """ RST syntax validation """ if content: errors = SourceReporter(content) if errors: raise ValidationError(map(map_parsing_errors, errors)) return content
[ "def", "clean_restructuredtext", "(", "form_instance", ",", "content", ")", ":", "if", "content", ":", "errors", "=", "SourceReporter", "(", "content", ")", "if", "errors", ":", "raise", "ValidationError", "(", "map", "(", "map_parsing_errors", ",", "errors", ...
RST syntax validation
[ "RST", "syntax", "validation" ]
python
train
hydpy-dev/hydpy
hydpy/core/autodoctools.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/autodoctools.py#L287-L336
def get_role(member, cython=False): """Return the reStructuredText role `func`, `class`, or `const` best describing the given member. Some examples based on the site-package |numpy|. |numpy.clip| is a function: >>> from hydpy.core.autodoctools import Substituter >>> im...
[ "def", "get_role", "(", "member", ",", "cython", "=", "False", ")", ":", "if", "inspect", ".", "isroutine", "(", "member", ")", "or", "isinstance", "(", "member", ",", "numpy", ".", "ufunc", ")", ":", "return", "'func'", "elif", "inspect", ".", "isclas...
Return the reStructuredText role `func`, `class`, or `const` best describing the given member. Some examples based on the site-package |numpy|. |numpy.clip| is a function: >>> from hydpy.core.autodoctools import Substituter >>> import numpy >>> Substituter.get_role(num...
[ "Return", "the", "reStructuredText", "role", "func", "class", "or", "const", "best", "describing", "the", "given", "member", "." ]
python
train
ConsenSys/mythril-classic
mythril/laser/smt/bitvec.py
https://github.com/ConsenSys/mythril-classic/blob/27af71c34b2ce94f4fae5613ec457f93df1a8f56/mythril/laser/smt/bitvec.py#L408-L415
def URem(a: BitVec, b: BitVec) -> BitVec: """Create an unsigned remainder expression. :param a: :param b: :return: """ return _arithmetic_helper(a, b, z3.URem)
[ "def", "URem", "(", "a", ":", "BitVec", ",", "b", ":", "BitVec", ")", "->", "BitVec", ":", "return", "_arithmetic_helper", "(", "a", ",", "b", ",", "z3", ".", "URem", ")" ]
Create an unsigned remainder expression. :param a: :param b: :return:
[ "Create", "an", "unsigned", "remainder", "expression", "." ]
python
train
UCSBarchlab/PyRTL
pyrtl/corecircuits.py
https://github.com/UCSBarchlab/PyRTL/blob/0988e5c9c10ededd5e1f58d5306603f9edf4b3e2/pyrtl/corecircuits.py#L184-L193
def signed_mult(a, b): """ Return a*b where a and b are treated as signed values. """ a, b = as_wires(a), as_wires(b) final_len = len(a) + len(b) # sign extend both inputs to the final target length a, b = a.sign_extended(final_len), b.sign_extended(final_len) # the result is the multiplication ...
[ "def", "signed_mult", "(", "a", ",", "b", ")", ":", "a", ",", "b", "=", "as_wires", "(", "a", ")", ",", "as_wires", "(", "b", ")", "final_len", "=", "len", "(", "a", ")", "+", "len", "(", "b", ")", "# sign extend both inputs to the final target length"...
Return a*b where a and b are treated as signed values.
[ "Return", "a", "*", "b", "where", "a", "and", "b", "are", "treated", "as", "signed", "values", "." ]
python
train
robmcmullen/atrcopy
atrcopy/segments.py
https://github.com/robmcmullen/atrcopy/blob/dafba8e74c718e95cf81fd72c184fa193ecec730/atrcopy/segments.py#L725-L775
def get_entire_style_ranges(self, split_comments=None, **kwargs): """Find sections of the segment that have the same style value. The arguments to this function are used as a mask for the style to determine where to split the styles. Style bits that aren't included in the list will be i...
[ "def", "get_entire_style_ranges", "(", "self", ",", "split_comments", "=", "None", ",", "*", "*", "kwargs", ")", ":", "style_bits", "=", "self", ".", "get_style_bits", "(", "*", "*", "kwargs", ")", "matches", "=", "self", ".", "get_comment_locations", "(", ...
Find sections of the segment that have the same style value. The arguments to this function are used as a mask for the style to determine where to split the styles. Style bits that aren't included in the list will be ignored when splitting. The returned list covers the entire length of ...
[ "Find", "sections", "of", "the", "segment", "that", "have", "the", "same", "style", "value", "." ]
python
train
mirceaulinic/pypluribus
pyPluribus/config.py
https://github.com/mirceaulinic/pypluribus/blob/99bb9b6de40a0e465e3f0e6636b26acdeabbbd90/pyPluribus/config.py#L63-L78
def _upload_config_content(self, configuration, rollbacked=False): """Will try to upload a specific configuration on the device.""" try: for configuration_line in configuration.splitlines(): self._device.cli(configuration_line) self._config_changed = True # confi...
[ "def", "_upload_config_content", "(", "self", ",", "configuration", ",", "rollbacked", "=", "False", ")", ":", "try", ":", "for", "configuration_line", "in", "configuration", ".", "splitlines", "(", ")", ":", "self", ".", "_device", ".", "cli", "(", "configu...
Will try to upload a specific configuration on the device.
[ "Will", "try", "to", "upload", "a", "specific", "configuration", "on", "the", "device", "." ]
python
train
razor-x/scipy-data_fitting
examples/example_helper.py
https://github.com/razor-x/scipy-data_fitting/blob/c756a645da8629699b3f22244bfb7d5d4d88b179/examples/example_helper.py#L10-L23
def save_example_fit(fit): """ Save fit result to a json file and a plot to an svg file. """ json_directory = os.path.join('examples', 'json') plot_directory = os.path.join('examples', 'plots') if not os.path.isdir(json_directory): os.makedirs(json_directory) if not os.path.isdir(plot_direct...
[ "def", "save_example_fit", "(", "fit", ")", ":", "json_directory", "=", "os", ".", "path", ".", "join", "(", "'examples'", ",", "'json'", ")", "plot_directory", "=", "os", ".", "path", ".", "join", "(", "'examples'", ",", "'plots'", ")", "if", "not", "...
Save fit result to a json file and a plot to an svg file.
[ "Save", "fit", "result", "to", "a", "json", "file", "and", "a", "plot", "to", "an", "svg", "file", "." ]
python
train
coded-by-hand/mass
env/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg/pip/__init__.py
https://github.com/coded-by-hand/mass/blob/59005479efed3cd8598a8f0c66791a4482071899/env/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg/pip/__init__.py#L18-L80
def autocomplete(): """Command and option completion for the main option parser (and options) and its subcommands (and options). Enable by sourcing one of the completion shell scripts (bash or zsh). """ # Don't complete if user hasn't sourced bash_completion file. if 'PIP_AUTO_COMPLETE' not in ...
[ "def", "autocomplete", "(", ")", ":", "# Don't complete if user hasn't sourced bash_completion file.", "if", "'PIP_AUTO_COMPLETE'", "not", "in", "os", ".", "environ", ":", "return", "cwords", "=", "os", ".", "environ", "[", "'COMP_WORDS'", "]", ".", "split", "(", ...
Command and option completion for the main option parser (and options) and its subcommands (and options). Enable by sourcing one of the completion shell scripts (bash or zsh).
[ "Command", "and", "option", "completion", "for", "the", "main", "option", "parser", "(", "and", "options", ")", "and", "its", "subcommands", "(", "and", "options", ")", "." ]
python
train
euske/pdfminer
pdfminer/psparser.py
https://github.com/euske/pdfminer/blob/8150458718e9024c80b00e74965510b20206e588/pdfminer/psparser.py#L191-L206
def seek(self, pos): """Seeks the parser to the given position. """ if self.debug: logging.debug('seek: %r' % pos) self.fp.seek(pos) # reset the status for nextline() self.bufpos = pos self.buf = b'' self.charpos = 0 # reset the status ...
[ "def", "seek", "(", "self", ",", "pos", ")", ":", "if", "self", ".", "debug", ":", "logging", ".", "debug", "(", "'seek: %r'", "%", "pos", ")", "self", ".", "fp", ".", "seek", "(", "pos", ")", "# reset the status for nextline()", "self", ".", "bufpos",...
Seeks the parser to the given position.
[ "Seeks", "the", "parser", "to", "the", "given", "position", "." ]
python
train
BlackEarth/bl
bl/string.py
https://github.com/BlackEarth/bl/blob/edf6f37dac718987260b90ad0e7f7fe084a7c1a3/bl/string.py#L68-L91
def titleify(self, lang='en', allwords=False, lastword=True): """takes a string and makes a title from it""" if lang in LOWERCASE_WORDS: lc_words = LOWERCASE_WORDS[lang] else: lc_words = [] s = str(self).strip() l = re.split(r"([_\W]+)", s) ...
[ "def", "titleify", "(", "self", ",", "lang", "=", "'en'", ",", "allwords", "=", "False", ",", "lastword", "=", "True", ")", ":", "if", "lang", "in", "LOWERCASE_WORDS", ":", "lc_words", "=", "LOWERCASE_WORDS", "[", "lang", "]", "else", ":", "lc_words", ...
takes a string and makes a title from it
[ "takes", "a", "string", "and", "makes", "a", "title", "from", "it" ]
python
train
aaugustin/websockets
src/websockets/server.py
https://github.com/aaugustin/websockets/blob/17b3f47549b6f752a1be07fa1ba3037cb59c7d56/src/websockets/server.py#L219-L242
async def read_http_request(self) -> Tuple[str, Headers]: """ Read request line and headers from the HTTP request. Raise :exc:`~websockets.exceptions.InvalidMessage` if the HTTP message is malformed or isn't an HTTP/1.1 GET request. Don't attempt to read the request body becaus...
[ "async", "def", "read_http_request", "(", "self", ")", "->", "Tuple", "[", "str", ",", "Headers", "]", ":", "try", ":", "path", ",", "headers", "=", "await", "read_request", "(", "self", ".", "reader", ")", "except", "ValueError", "as", "exc", ":", "ra...
Read request line and headers from the HTTP request. Raise :exc:`~websockets.exceptions.InvalidMessage` if the HTTP message is malformed or isn't an HTTP/1.1 GET request. Don't attempt to read the request body because WebSocket handshake requests don't have one. If the request contains...
[ "Read", "request", "line", "and", "headers", "from", "the", "HTTP", "request", "." ]
python
train
yougov/vr.runners
vr/runners/image.py
https://github.com/yougov/vr.runners/blob/f43ba50a64b17ee4f07596fe225bcb38ca6652ad/vr/runners/image.py#L19-L26
def ensure_image(name, url, images_root, md5, untar_to=None): """Ensure OS image at url has been downloaded and (optionally) unpacked.""" image_dir_path = os.path.join(images_root, name) mkdir(image_dir_path) image_file_path = os.path.join(image_dir_path, os.path.basename(url)) ensure_file(url, imag...
[ "def", "ensure_image", "(", "name", ",", "url", ",", "images_root", ",", "md5", ",", "untar_to", "=", "None", ")", ":", "image_dir_path", "=", "os", ".", "path", ".", "join", "(", "images_root", ",", "name", ")", "mkdir", "(", "image_dir_path", ")", "i...
Ensure OS image at url has been downloaded and (optionally) unpacked.
[ "Ensure", "OS", "image", "at", "url", "has", "been", "downloaded", "and", "(", "optionally", ")", "unpacked", "." ]
python
train
angr/angr
angr/state_plugins/abstract_memory.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/abstract_memory.py#L331-L380
def normalize_address(self, addr, is_write=False, convert_to_valueset=False, target_region=None, condition=None): #pylint:disable=arguments-differ """ Convert a ValueSet object into a list of addresses. :param addr: A ValueSet object (which describes an address) :param is_write: Is this...
[ "def", "normalize_address", "(", "self", ",", "addr", ",", "is_write", "=", "False", ",", "convert_to_valueset", "=", "False", ",", "target_region", "=", "None", ",", "condition", "=", "None", ")", ":", "#pylint:disable=arguments-differ", "targets_limit", "=", "...
Convert a ValueSet object into a list of addresses. :param addr: A ValueSet object (which describes an address) :param is_write: Is this address used in a write or not :param convert_to_valueset: True if you want to have a list of ValueSet instances instead of AddressWrappers, ...
[ "Convert", "a", "ValueSet", "object", "into", "a", "list", "of", "addresses", "." ]
python
train
calmjs/calmjs
src/calmjs/base.py
https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/base.py#L520-L544
def find_node_modules_basedir(self): """ Find all node_modules directories configured to be accessible through this driver instance. This is typically used for adding the direct instance, and does not traverse the parent directories like what Node.js does. Returns a lis...
[ "def", "find_node_modules_basedir", "(", "self", ")", ":", "paths", "=", "[", "]", "# First do the working dir.", "local_node_path", "=", "self", ".", "join_cwd", "(", "NODE_MODULES", ")", "if", "isdir", "(", "local_node_path", ")", ":", "paths", ".", "append", ...
Find all node_modules directories configured to be accessible through this driver instance. This is typically used for adding the direct instance, and does not traverse the parent directories like what Node.js does. Returns a list of directories that contain a 'node_modules' di...
[ "Find", "all", "node_modules", "directories", "configured", "to", "be", "accessible", "through", "this", "driver", "instance", "." ]
python
train
vanheeringen-lab/gimmemotifs
gimmemotifs/genome_index.py
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L400-L409
def _read_index_file(self): """read the param_file, index_dir should already be set """ param_file = os.path.join(self.index_dir, self.param_file) with open(param_file) as f: for line in f.readlines(): (name, fasta_file, index_file, line_size, total_size) = line.strip...
[ "def", "_read_index_file", "(", "self", ")", ":", "param_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "index_dir", ",", "self", ".", "param_file", ")", "with", "open", "(", "param_file", ")", "as", "f", ":", "for", "line", "in", "f",...
read the param_file, index_dir should already be set
[ "read", "the", "param_file", "index_dir", "should", "already", "be", "set" ]
python
train
Nekroze/partpy
partpy/sourcestring.py
https://github.com/Nekroze/partpy/blob/dbb7d2fb285464fc43d85bc31f5af46192d301f6/partpy/sourcestring.py#L50-L55
def reset_position(self): """Reset all current positions.""" self.pos = 0 self.col = 0 self.row = 1 self.eos = 0
[ "def", "reset_position", "(", "self", ")", ":", "self", ".", "pos", "=", "0", "self", ".", "col", "=", "0", "self", ".", "row", "=", "1", "self", ".", "eos", "=", "0" ]
Reset all current positions.
[ "Reset", "all", "current", "positions", "." ]
python
train
bcbio/bcbio-nextgen
scripts/utils/hydra_to_vcf.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/scripts/utils/hydra_to_vcf.py#L300-L319
def _get_vcf_breakends(hydra_file, genome_2bit, options=None): """Parse BEDPE input, yielding VCF ready breakends. """ if options is None: options = {} for features in group_hydra_breakends(hydra_parser(hydra_file, options)): if len(features) == 1 and is_deletion(features[0], options): ...
[ "def", "_get_vcf_breakends", "(", "hydra_file", ",", "genome_2bit", ",", "options", "=", "None", ")", ":", "if", "options", "is", "None", ":", "options", "=", "{", "}", "for", "features", "in", "group_hydra_breakends", "(", "hydra_parser", "(", "hydra_file", ...
Parse BEDPE input, yielding VCF ready breakends.
[ "Parse", "BEDPE", "input", "yielding", "VCF", "ready", "breakends", "." ]
python
train
frawau/aiolifx
aiolifx/aiolifx.py
https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L390-L410
def set_label(self, value,callb=None): """Convenience method to set the label of the device This method will send a SetLabel message to the device, and request callb be executed when an ACK is received. The default callback will simply cache the value. :param value: The new label ...
[ "def", "set_label", "(", "self", ",", "value", ",", "callb", "=", "None", ")", ":", "if", "len", "(", "value", ")", ">", "32", ":", "value", "=", "value", "[", ":", "32", "]", "mypartial", "=", "partial", "(", "self", ".", "resp_set_label", ",", ...
Convenience method to set the label of the device This method will send a SetLabel message to the device, and request callb be executed when an ACK is received. The default callback will simply cache the value. :param value: The new label :type value: str :param cal...
[ "Convenience", "method", "to", "set", "the", "label", "of", "the", "device" ]
python
train
neon-jungle/wagtailnews
wagtailnews/models.py
https://github.com/neon-jungle/wagtailnews/blob/4cdec7013cca276dcfc658d3c986444ba6a42a84/wagtailnews/models.py#L80-L86
def respond(self, request, view, newsitems, extra_context={}): """A helper that takes some news items and returns an HttpResponse""" context = self.get_context(request, view=view) context.update(self.paginate_newsitems(request, newsitems)) context.update(extra_context) template =...
[ "def", "respond", "(", "self", ",", "request", ",", "view", ",", "newsitems", ",", "extra_context", "=", "{", "}", ")", ":", "context", "=", "self", ".", "get_context", "(", "request", ",", "view", "=", "view", ")", "context", ".", "update", "(", "se...
A helper that takes some news items and returns an HttpResponse
[ "A", "helper", "that", "takes", "some", "news", "items", "and", "returns", "an", "HttpResponse" ]
python
train
unbit/sftpclone
sftpclone/sftpclone.py
https://github.com/unbit/sftpclone/blob/1cc89478e680fc4e0d12b1a15b5bafd0390d05da/sftpclone/sftpclone.py#L53-L59
def path_join(*args): """ Wrapper around `os.path.join`. Makes sure to join paths of the same type (bytes). """ args = (paramiko.py3compat.u(arg) for arg in args) return os.path.join(*args)
[ "def", "path_join", "(", "*", "args", ")", ":", "args", "=", "(", "paramiko", ".", "py3compat", ".", "u", "(", "arg", ")", "for", "arg", "in", "args", ")", "return", "os", ".", "path", ".", "join", "(", "*", "args", ")" ]
Wrapper around `os.path.join`. Makes sure to join paths of the same type (bytes).
[ "Wrapper", "around", "os", ".", "path", ".", "join", ".", "Makes", "sure", "to", "join", "paths", "of", "the", "same", "type", "(", "bytes", ")", "." ]
python
train
fgmacedo/django-export-action
export_action/introspection.py
https://github.com/fgmacedo/django-export-action/blob/215fecb9044d22e3ae19d86c3b220041a11fad07/export_action/introspection.py#L50-L63
def get_relation_fields_from_model(model_class): """ Get related fields (m2m, FK, and reverse FK) """ relation_fields = [] all_fields_names = _get_all_field_names(model_class) for field_name in all_fields_names: field, model, direct, m2m = _get_field_by_name(model_class, field_name) # ge...
[ "def", "get_relation_fields_from_model", "(", "model_class", ")", ":", "relation_fields", "=", "[", "]", "all_fields_names", "=", "_get_all_field_names", "(", "model_class", ")", "for", "field_name", "in", "all_fields_names", ":", "field", ",", "model", ",", "direct...
Get related fields (m2m, FK, and reverse FK)
[ "Get", "related", "fields", "(", "m2m", "FK", "and", "reverse", "FK", ")" ]
python
train
fermiPy/fermipy
fermipy/diffuse/diffuse_src_manager.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/diffuse_src_manager.py#L377-L434
def make_diffuse_comp_info_dict(self, diffuse_sources, components): """ Make a dictionary maping from diffuse component to information about that component Parameters ---------- diffuse_sources : dict Dictionary with diffuse source defintions components : dict ...
[ "def", "make_diffuse_comp_info_dict", "(", "self", ",", "diffuse_sources", ",", "components", ")", ":", "ret_dict", "=", "{", "}", "for", "key", ",", "value", "in", "diffuse_sources", ".", "items", "(", ")", ":", "if", "value", "is", "None", ":", "continue...
Make a dictionary maping from diffuse component to information about that component Parameters ---------- diffuse_sources : dict Dictionary with diffuse source defintions components : dict Dictionary with event selection defintions, needed for select...
[ "Make", "a", "dictionary", "maping", "from", "diffuse", "component", "to", "information", "about", "that", "component" ]
python
train
Parquery/icontract
icontract/_metaclass.py
https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_metaclass.py#L172-L268
def _decorate_namespace_property(bases: List[type], namespace: MutableMapping[str, Any], key: str) -> None: """Collect contracts for all getters/setters/deleters corresponding to ``key`` and decorate them.""" # pylint: disable=too-many-locals # pylint: disable=too-many-branches # pylint: disable=too-man...
[ "def", "_decorate_namespace_property", "(", "bases", ":", "List", "[", "type", "]", ",", "namespace", ":", "MutableMapping", "[", "str", ",", "Any", "]", ",", "key", ":", "str", ")", "->", "None", ":", "# pylint: disable=too-many-locals", "# pylint: disable=too-...
Collect contracts for all getters/setters/deleters corresponding to ``key`` and decorate them.
[ "Collect", "contracts", "for", "all", "getters", "/", "setters", "/", "deleters", "corresponding", "to", "key", "and", "decorate", "them", "." ]
python
train
pyamg/pyamg
pyamg/util/utils.py
https://github.com/pyamg/pyamg/blob/89dc54aa27e278f65d2f54bdaf16ab97d7768fa6/pyamg/util/utils.py#L42-L89
def profile_solver(ml, accel=None, **kwargs): """Profile a particular multilevel object. Parameters ---------- ml : multilevel Fully constructed multilevel object accel : function pointer Pointer to a valid Krylov solver (e.g. gmres, cg) Returns ------- residuals : arra...
[ "def", "profile_solver", "(", "ml", ",", "accel", "=", "None", ",", "*", "*", "kwargs", ")", ":", "A", "=", "ml", ".", "levels", "[", "0", "]", ".", "A", "b", "=", "A", "*", "sp", ".", "rand", "(", "A", ".", "shape", "[", "0", "]", ",", "...
Profile a particular multilevel object. Parameters ---------- ml : multilevel Fully constructed multilevel object accel : function pointer Pointer to a valid Krylov solver (e.g. gmres, cg) Returns ------- residuals : array Array of residuals for each iteration ...
[ "Profile", "a", "particular", "multilevel", "object", "." ]
python
train
hazelcast/hazelcast-python-client
hazelcast/protocol/codec/transaction_create_codec.py
https://github.com/hazelcast/hazelcast-python-client/blob/3f6639443c23d6d036aa343f8e094f052250d2c1/hazelcast/protocol/codec/transaction_create_codec.py#L20-L30
def encode_request(timeout, durability, transaction_type, thread_id): """ Encode request into client_message""" client_message = ClientMessage(payload_size=calculate_size(timeout, durability, transaction_type, thread_id)) client_message.set_message_type(REQUEST_TYPE) client_message.set_retryable(RETRYAB...
[ "def", "encode_request", "(", "timeout", ",", "durability", ",", "transaction_type", ",", "thread_id", ")", ":", "client_message", "=", "ClientMessage", "(", "payload_size", "=", "calculate_size", "(", "timeout", ",", "durability", ",", "transaction_type", ",", "t...
Encode request into client_message
[ "Encode", "request", "into", "client_message" ]
python
train
CS207-Final-Project-Group-10/cs207-FinalProject
solar_system/eight_planets.py
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/solar_system/eight_planets.py#L154-L186
def make_frame(fig, ax, plot_x: np.ndarray, plot_y: np.ndarray, frame_num: int, bodies: List[str], plot_colors: Dict[str, str], markersize_tbl: Dict[str, float], fname: str): """ Make a series of frames of the planetary orbits that can be assembled into a movie. q is a Nx3B ar...
[ "def", "make_frame", "(", "fig", ",", "ax", ",", "plot_x", ":", "np", ".", "ndarray", ",", "plot_y", ":", "np", ".", "ndarray", ",", "frame_num", ":", "int", ",", "bodies", ":", "List", "[", "str", "]", ",", "plot_colors", ":", "Dict", "[", "str", ...
Make a series of frames of the planetary orbits that can be assembled into a movie. q is a Nx3B array. t indexes time points. 3B columns are (x, y, z) for the bodies in order.
[ "Make", "a", "series", "of", "frames", "of", "the", "planetary", "orbits", "that", "can", "be", "assembled", "into", "a", "movie", ".", "q", "is", "a", "Nx3B", "array", ".", "t", "indexes", "time", "points", ".", "3B", "columns", "are", "(", "x", "y"...
python
train
libnano/primer3-py
primer3/wrappers.py
https://github.com/libnano/primer3-py/blob/0901c0ef3ac17afd69329d23db71136c00bcb635/primer3/wrappers.py#L70-L94
def calcTm(seq, mv_conc=50, dv_conc=0, dntp_conc=0.8, dna_conc=50, max_nn_length=60, tm_method='santalucia', salt_corrections_method='santalucia'): ''' Return the tm of `seq` as a float. ''' tm_meth = _tm_methods.get(tm_method) if tm_meth is None: raise ValueError('{} is no...
[ "def", "calcTm", "(", "seq", ",", "mv_conc", "=", "50", ",", "dv_conc", "=", "0", ",", "dntp_conc", "=", "0.8", ",", "dna_conc", "=", "50", ",", "max_nn_length", "=", "60", ",", "tm_method", "=", "'santalucia'", ",", "salt_corrections_method", "=", "'san...
Return the tm of `seq` as a float.
[ "Return", "the", "tm", "of", "seq", "as", "a", "float", "." ]
python
train
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_0/tfvc/tfvc_client.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_0/tfvc/tfvc_client.py#L610-L645
def get_labels(self, request_data, project=None, top=None, skip=None): """GetLabels. Get a collection of shallow label references. :param :class:`<TfvcLabelRequestData> <azure.devops.v5_0.tfvc.models.TfvcLabelRequestData>` request_data: labelScope, name, owner, and itemLabelFilter :param...
[ "def", "get_labels", "(", "self", ",", "request_data", ",", "project", "=", "None", ",", "top", "=", "None", ",", "skip", "=", "None", ")", ":", "route_values", "=", "{", "}", "if", "project", "is", "not", "None", ":", "route_values", "[", "'project'",...
GetLabels. Get a collection of shallow label references. :param :class:`<TfvcLabelRequestData> <azure.devops.v5_0.tfvc.models.TfvcLabelRequestData>` request_data: labelScope, name, owner, and itemLabelFilter :param str project: Project ID or project name :param int top: Max number of lab...
[ "GetLabels", ".", "Get", "a", "collection", "of", "shallow", "label", "references", ".", ":", "param", ":", "class", ":", "<TfvcLabelRequestData", ">", "<azure", ".", "devops", ".", "v5_0", ".", "tfvc", ".", "models", ".", "TfvcLabelRequestData", ">", "reque...
python
train
MrYsLab/PyMata
PyMata/pymata.py
https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata.py#L644-L654
def i2c_get_read_data(self, address): """ This method retrieves the i2c read data as the result of an i2c_read() command. :param address: i2c device address :return: raw data read from device """ if address in self._command_handler.i2c_map: map_entry = self....
[ "def", "i2c_get_read_data", "(", "self", ",", "address", ")", ":", "if", "address", "in", "self", ".", "_command_handler", ".", "i2c_map", ":", "map_entry", "=", "self", ".", "_command_handler", ".", "i2c_map", "[", "address", "]", "return", "map_entry", "["...
This method retrieves the i2c read data as the result of an i2c_read() command. :param address: i2c device address :return: raw data read from device
[ "This", "method", "retrieves", "the", "i2c", "read", "data", "as", "the", "result", "of", "an", "i2c_read", "()", "command", "." ]
python
valid
moderngl/moderngl
moderngl/buffer.py
https://github.com/moderngl/moderngl/blob/a8f5dce8dc72ae84a2f9523887fb5f6b620049b9/moderngl/buffer.py#L171-L183
def bind_to_uniform_block(self, binding=0, *, offset=0, size=-1) -> None: ''' Bind the buffer to a uniform block. Args: binding (int): The uniform block binding. Keyword Args: offset (int): The offset. size (int): The size. Va...
[ "def", "bind_to_uniform_block", "(", "self", ",", "binding", "=", "0", ",", "*", ",", "offset", "=", "0", ",", "size", "=", "-", "1", ")", "->", "None", ":", "self", ".", "mglo", ".", "bind_to_uniform_block", "(", "binding", ",", "offset", ",", "size...
Bind the buffer to a uniform block. Args: binding (int): The uniform block binding. Keyword Args: offset (int): The offset. size (int): The size. Value ``-1`` means all.
[ "Bind", "the", "buffer", "to", "a", "uniform", "block", "." ]
python
train
apache/incubator-mxnet
python/mxnet/ndarray/ndarray.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/ndarray/ndarray.py#L3584-L3641
def logical_or(lhs, rhs): """Returns the result of element-wise **logical or** comparison operation with broadcasting. For each element in input arrays, return 1(true) if lhs elements or rhs elements are true, otherwise return 0(false). Equivalent to ``lhs or rhs`` and ``mx.nd.broadcast_logical_or...
[ "def", "logical_or", "(", "lhs", ",", "rhs", ")", ":", "# pylint: disable= no-member, protected-access", "return", "_ufunc_helper", "(", "lhs", ",", "rhs", ",", "op", ".", "broadcast_logical_or", ",", "lambda", "x", ",", "y", ":", "1", "if", "x", "or", "y", ...
Returns the result of element-wise **logical or** comparison operation with broadcasting. For each element in input arrays, return 1(true) if lhs elements or rhs elements are true, otherwise return 0(false). Equivalent to ``lhs or rhs`` and ``mx.nd.broadcast_logical_or(lhs, rhs)``. .. note:: ...
[ "Returns", "the", "result", "of", "element", "-", "wise", "**", "logical", "or", "**", "comparison", "operation", "with", "broadcasting", "." ]
python
train
lsst-sqre/ltd-conveyor
ltdconveyor/fastly.py
https://github.com/lsst-sqre/ltd-conveyor/blob/c492937c4c1e050ccc4a0b9dcc38f9980d57e305/ltdconveyor/fastly.py#L14-L52
def purge_key(surrogate_key, service_id, api_key): """Instant purge URLs with a given surrogate key from the Fastly caches. Parameters ---------- surrogate_key : `str` Surrogate key header (``x-amz-meta-surrogate-key``) value of objects to purge from the Fastly cache. service_id : `...
[ "def", "purge_key", "(", "surrogate_key", ",", "service_id", ",", "api_key", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "__name__", ")", "api_root", "=", "'https://api.fastly.com'", "path", "=", "'/service/{service}/purge/{surrogate_key}'", ".", "for...
Instant purge URLs with a given surrogate key from the Fastly caches. Parameters ---------- surrogate_key : `str` Surrogate key header (``x-amz-meta-surrogate-key``) value of objects to purge from the Fastly cache. service_id : `str` Fastly service ID. api_key : `str` ...
[ "Instant", "purge", "URLs", "with", "a", "given", "surrogate", "key", "from", "the", "Fastly", "caches", "." ]
python
test
wavefrontHQ/python-client
wavefront_api_client/api/search_api.py
https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/api/search_api.py#L1889-L1910
def search_external_links_for_facet(self, facet, **kwargs): # noqa: E501 """Lists the values of a specific facet over the customer's external links # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass as...
[ "def", "search_external_links_for_facet", "(", "self", ",", "facet", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", "...
Lists the values of a specific facet over the customer's external links # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.search_external_links_for_facet(facet, async_re...
[ "Lists", "the", "values", "of", "a", "specific", "facet", "over", "the", "customer", "s", "external", "links", "#", "noqa", ":", "E501" ]
python
train
materialsproject/pymatgen
pymatgen/core/structure.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L1778-L1830
def from_str(cls, input_string, fmt, primitive=False, sort=False, merge_tol=0.0): """ Reads a structure from a string. Args: input_string (str): String to parse. fmt (str): A format specification. primitive (bool): Whether to find a primitive...
[ "def", "from_str", "(", "cls", ",", "input_string", ",", "fmt", ",", "primitive", "=", "False", ",", "sort", "=", "False", ",", "merge_tol", "=", "0.0", ")", ":", "from", "pymatgen", ".", "io", ".", "cif", "import", "CifParser", "from", "pymatgen", "."...
Reads a structure from a string. Args: input_string (str): String to parse. fmt (str): A format specification. primitive (bool): Whether to find a primitive cell. Defaults to False. sort (bool): Whether to sort the sites in accordance to the defau...
[ "Reads", "a", "structure", "from", "a", "string", "." ]
python
train
timothydmorton/VESPA
vespa/stars/populations.py
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L685-L693
def hidden_constraints(self): """ Constraints applied to the population, but temporarily removed. """ try: return self._hidden_constraints except AttributeError: self._hidden_constraints = ConstraintDict() return self._hidden_constraints
[ "def", "hidden_constraints", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_hidden_constraints", "except", "AttributeError", ":", "self", ".", "_hidden_constraints", "=", "ConstraintDict", "(", ")", "return", "self", ".", "_hidden_constraints" ]
Constraints applied to the population, but temporarily removed.
[ "Constraints", "applied", "to", "the", "population", "but", "temporarily", "removed", "." ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_aaa.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_aaa.py#L884-L893
def root_sa_root_enable(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") root_sa = ET.SubElement(config, "root-sa", xmlns="urn:brocade.com:mgmt:brocade-aaa") root = ET.SubElement(root_sa, "root") enable = ET.SubElement(root, "enable") cal...
[ "def", "root_sa_root_enable", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "root_sa", "=", "ET", ".", "SubElement", "(", "config", ",", "\"root-sa\"", ",", "xmlns", "=", "\"urn:brocade.com:mgm...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
azraq27/neural
neural/decon.py
https://github.com/azraq27/neural/blob/fe91bfeecbf73ad99708cf5dca66cb61fcd529f5/neural/decon.py#L459-L530
def smooth_decon_to_fwhm(decon,fwhm,cache=True): '''takes an input :class:`Decon` object and uses ``3dBlurToFWHM`` to make the output as close as possible to ``fwhm`` returns the final measured fwhm. If ``cache`` is ``True``, will save the blurred input file (and use it again in the future)''' if os.path.ex...
[ "def", "smooth_decon_to_fwhm", "(", "decon", ",", "fwhm", ",", "cache", "=", "True", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "decon", ".", "prefix", ")", ":", "return", "blur_dset", "=", "lambda", "dset", ":", "nl", ".", "suffix", "(",...
takes an input :class:`Decon` object and uses ``3dBlurToFWHM`` to make the output as close as possible to ``fwhm`` returns the final measured fwhm. If ``cache`` is ``True``, will save the blurred input file (and use it again in the future)
[ "takes", "an", "input", ":", "class", ":", "Decon", "object", "and", "uses", "3dBlurToFWHM", "to", "make", "the", "output", "as", "close", "as", "possible", "to", "fwhm", "returns", "the", "final", "measured", "fwhm", ".", "If", "cache", "is", "True", "w...
python
train
BlueBrain/hpcbench
hpcbench/benchmark/hpl.py
https://github.com/BlueBrain/hpcbench/blob/192d0ec142b897157ec25f131d1ef28f84752592/hpcbench/benchmark/hpl.py#L263-L268
def mpirun(self): """Additional options passed as a list to the ``mpirun`` command""" cmd = self.attributes['mpirun'] if cmd and cmd[0] != 'mpirun': cmd = ['mpirun'] return [str(e) for e in cmd]
[ "def", "mpirun", "(", "self", ")", ":", "cmd", "=", "self", ".", "attributes", "[", "'mpirun'", "]", "if", "cmd", "and", "cmd", "[", "0", "]", "!=", "'mpirun'", ":", "cmd", "=", "[", "'mpirun'", "]", "return", "[", "str", "(", "e", ")", "for", ...
Additional options passed as a list to the ``mpirun`` command
[ "Additional", "options", "passed", "as", "a", "list", "to", "the", "mpirun", "command" ]
python
train
Yelp/kafka-utils
kafka_utils/kafka_cluster_manager/cluster_info/partition_count_balancer.py
https://github.com/Yelp/kafka-utils/blob/cdb4d64308f3079ee0873250bf7b34d0d94eca50/kafka_utils/kafka_cluster_manager/cluster_info/partition_count_balancer.py#L204-L207
def rebalance_brokers(self): """Rebalance partition-count across brokers within each replication-group.""" for rg in six.itervalues(self.cluster_topology.rgs): rg.rebalance_brokers()
[ "def", "rebalance_brokers", "(", "self", ")", ":", "for", "rg", "in", "six", ".", "itervalues", "(", "self", ".", "cluster_topology", ".", "rgs", ")", ":", "rg", ".", "rebalance_brokers", "(", ")" ]
Rebalance partition-count across brokers within each replication-group.
[ "Rebalance", "partition", "-", "count", "across", "brokers", "within", "each", "replication", "-", "group", "." ]
python
train
tensorflow/probability
tensorflow_probability/python/bijectors/affine.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/bijectors/affine.py#L34-L37
def _as_tensor(x, name, dtype): """Convenience to convert to `Tensor` or leave as `None`.""" return None if x is None else tf.convert_to_tensor( value=x, name=name, dtype=dtype)
[ "def", "_as_tensor", "(", "x", ",", "name", ",", "dtype", ")", ":", "return", "None", "if", "x", "is", "None", "else", "tf", ".", "convert_to_tensor", "(", "value", "=", "x", ",", "name", "=", "name", ",", "dtype", "=", "dtype", ")" ]
Convenience to convert to `Tensor` or leave as `None`.
[ "Convenience", "to", "convert", "to", "Tensor", "or", "leave", "as", "None", "." ]
python
test
GoogleCloudPlatform/appengine-gcs-client
python/src/cloudstorage/storage_api.py
https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/python/src/cloudstorage/storage_api.py#L536-L568
def seek(self, offset, whence=os.SEEK_SET): """Set the file's current offset. Note if the new offset is out of bound, it is adjusted to either 0 or EOF. Args: offset: seek offset as number. whence: seek mode. Supported modes are os.SEEK_SET (absolute seek), os.SEEK_CUR (seek relative t...
[ "def", "seek", "(", "self", ",", "offset", ",", "whence", "=", "os", ".", "SEEK_SET", ")", ":", "self", ".", "_check_open", "(", ")", "self", ".", "_buffer", ".", "reset", "(", ")", "self", ".", "_buffer_future", "=", "None", "if", "whence", "==", ...
Set the file's current offset. Note if the new offset is out of bound, it is adjusted to either 0 or EOF. Args: offset: seek offset as number. whence: seek mode. Supported modes are os.SEEK_SET (absolute seek), os.SEEK_CUR (seek relative to the current position), and os.SEEK_END (s...
[ "Set", "the", "file", "s", "current", "offset", "." ]
python
train
lemieuxl/pyGenClean
pyGenClean/DupSNPs/duplicated_snps.py
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/DupSNPs/duplicated_snps.py#L231-L438
def createAndCleanTPED(tped, tfam, snps, prefix, chosenSNPs, completion, concordance, snpsToComplete, tfamFileName, completionT, concordanceT): """Complete a TPED for duplicated SNPs. :param tped: a representation of the ``tped`` of duplicated markers. :param t...
[ "def", "createAndCleanTPED", "(", "tped", ",", "tfam", ",", "snps", ",", "prefix", ",", "chosenSNPs", ",", "completion", ",", "concordance", ",", "snpsToComplete", ",", "tfamFileName", ",", "completionT", ",", "concordanceT", ")", ":", "zeroedOutFile", "=", "N...
Complete a TPED for duplicated SNPs. :param tped: a representation of the ``tped`` of duplicated markers. :param tfam: a representation of the ``tfam``. :param snps: the position of duplicated markers in the ``tped``. :param prefix: the prefix of the output files. :param chosenSNPs: the markers tha...
[ "Complete", "a", "TPED", "for", "duplicated", "SNPs", "." ]
python
train
quantopian/zipline
zipline/finance/ledger.py
https://github.com/quantopian/zipline/blob/77ad15e6dc4c1cbcdc133653bac8a63fc704f7fe/zipline/finance/ledger.py#L181-L222
def pay_dividends(self, next_trading_day): """ Returns a cash payment based on the dividends that should be paid out according to the accumulated bookkeeping of earned, unpaid, and stock dividends. """ net_cash_payment = 0.0 try: payments = self._unpa...
[ "def", "pay_dividends", "(", "self", ",", "next_trading_day", ")", ":", "net_cash_payment", "=", "0.0", "try", ":", "payments", "=", "self", ".", "_unpaid_dividends", "[", "next_trading_day", "]", "# Mark these dividends as paid by dropping them from our unpaid", "del", ...
Returns a cash payment based on the dividends that should be paid out according to the accumulated bookkeeping of earned, unpaid, and stock dividends.
[ "Returns", "a", "cash", "payment", "based", "on", "the", "dividends", "that", "should", "be", "paid", "out", "according", "to", "the", "accumulated", "bookkeeping", "of", "earned", "unpaid", "and", "stock", "dividends", "." ]
python
train
log2timeline/dfdatetime
dfdatetime/time_elements.py
https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/time_elements.py#L497-L526
def CopyFromStringTuple(self, time_elements_tuple): """Copies time elements from string-based time elements tuple. Args: time_elements_tuple (Optional[tuple[str, str, str, str, str, str, str]]): time elements, contains year, month, day of month, hours, minutes, seconds and fraction of...
[ "def", "CopyFromStringTuple", "(", "self", ",", "time_elements_tuple", ")", ":", "if", "len", "(", "time_elements_tuple", ")", "<", "7", ":", "raise", "ValueError", "(", "(", "'Invalid time elements tuple at least 7 elements required,'", "'got: {0:d}'", ")", ".", "for...
Copies time elements from string-based time elements tuple. Args: time_elements_tuple (Optional[tuple[str, str, str, str, str, str, str]]): time elements, contains year, month, day of month, hours, minutes, seconds and fraction of seconds. Raises: ValueError: if the time elemen...
[ "Copies", "time", "elements", "from", "string", "-", "based", "time", "elements", "tuple", "." ]
python
train
hyperledger/indy-plenum
plenum/server/primary_decider.py
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/primary_decider.py#L132-L139
def send(self, msg): """ Send a message to the node on which this replica resides. :param msg: the message to send """ logger.debug("{}'s elector sending {}".format(self.name, msg)) self.outBox.append(msg)
[ "def", "send", "(", "self", ",", "msg", ")", ":", "logger", ".", "debug", "(", "\"{}'s elector sending {}\"", ".", "format", "(", "self", ".", "name", ",", "msg", ")", ")", "self", ".", "outBox", ".", "append", "(", "msg", ")" ]
Send a message to the node on which this replica resides. :param msg: the message to send
[ "Send", "a", "message", "to", "the", "node", "on", "which", "this", "replica", "resides", "." ]
python
train
exosite-labs/pyonep
pyonep/onep.py
https://github.com/exosite-labs/pyonep/blob/d27b621b00688a542e0adcc01f3e3354c05238a1/pyonep/onep.py#L279-L287
def create(self, auth, type, desc, defer=False): """ Create something in Exosite. Args: auth: <cik> type: What thing to create. desc: Information about thing. """ return self._call('create', auth, [type, desc], defer)
[ "def", "create", "(", "self", ",", "auth", ",", "type", ",", "desc", ",", "defer", "=", "False", ")", ":", "return", "self", ".", "_call", "(", "'create'", ",", "auth", ",", "[", "type", ",", "desc", "]", ",", "defer", ")" ]
Create something in Exosite. Args: auth: <cik> type: What thing to create. desc: Information about thing.
[ "Create", "something", "in", "Exosite", "." ]
python
train
warrenspe/hconf
hconf/Config.py
https://github.com/warrenspe/hconf/blob/12074d15dc3641d3903488c95d89a507386a32d5/hconf/Config.py#L75-L98
def addConfig(self, name, default=None, cast=None, required=False, description=None): """ Adds the given configuration option to the ConfigManager. Inputs: name - The configuration name to accept. required - A boolean indicating whether or not the configuration option ...
[ "def", "addConfig", "(", "self", ",", "name", ",", "default", "=", "None", ",", "cast", "=", "None", ",", "required", "=", "False", ",", "description", "=", "None", ")", ":", "# Validate the name", "if", "not", "self", ".", "configNameRE", ".", "match", ...
Adds the given configuration option to the ConfigManager. Inputs: name - The configuration name to accept. required - A boolean indicating whether or not the configuration option is required or not. cast - A type (or function accepting 1 argument and returning a...
[ "Adds", "the", "given", "configuration", "option", "to", "the", "ConfigManager", "." ]
python
train
angr/angr
angr/simos/cgc.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/cgc.py#L29-L68
def state_blank(self, flag_page=None, **kwargs): """ :param flag_page: Flag page content, either a string or a list of BV8s """ s = super(SimCGC, self).state_blank(**kwargs) # pylint:disable=invalid-name # Special stack base for CGC binaries to work with Shellphish CRS ...
[ "def", "state_blank", "(", "self", ",", "flag_page", "=", "None", ",", "*", "*", "kwargs", ")", ":", "s", "=", "super", "(", "SimCGC", ",", "self", ")", ".", "state_blank", "(", "*", "*", "kwargs", ")", "# pylint:disable=invalid-name", "# Special stack bas...
:param flag_page: Flag page content, either a string or a list of BV8s
[ ":", "param", "flag_page", ":", "Flag", "page", "content", "either", "a", "string", "or", "a", "list", "of", "BV8s" ]
python
train
CivicSpleen/ambry
ambry/library/search_backends/postgres_backend.py
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/postgres_backend.py#L515-L523
def is_indexed(self, partition): """ Returns True if partition is already indexed. Otherwise returns False. """ query = text(""" SELECT vid FROM partition_index WHERE vid = :vid; """) result = self.execute(query, vid=partition.vid) return bool(...
[ "def", "is_indexed", "(", "self", ",", "partition", ")", ":", "query", "=", "text", "(", "\"\"\"\n SELECT vid\n FROM partition_index\n WHERE vid = :vid;\n \"\"\"", ")", "result", "=", "self", ".", "execute", "(", "query", ",", "vid"...
Returns True if partition is already indexed. Otherwise returns False.
[ "Returns", "True", "if", "partition", "is", "already", "indexed", ".", "Otherwise", "returns", "False", "." ]
python
train
django-danceschool/django-danceschool
danceschool/private_lessons/forms.py
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/forms.py#L70-L94
def clean(self): ''' Only allow submission if there are not already slots in the submitted window, and only allow rooms associated with the chosen location. ''' super(SlotCreationForm,self).clean() startDate = self.cleaned_data.get('startDate') endDate ...
[ "def", "clean", "(", "self", ")", ":", "super", "(", "SlotCreationForm", ",", "self", ")", ".", "clean", "(", ")", "startDate", "=", "self", ".", "cleaned_data", ".", "get", "(", "'startDate'", ")", "endDate", "=", "self", ".", "cleaned_data", ".", "ge...
Only allow submission if there are not already slots in the submitted window, and only allow rooms associated with the chosen location.
[ "Only", "allow", "submission", "if", "there", "are", "not", "already", "slots", "in", "the", "submitted", "window", "and", "only", "allow", "rooms", "associated", "with", "the", "chosen", "location", "." ]
python
train
pypyr/pypyr-cli
pypyr/utils/filesystem.py
https://github.com/pypyr/pypyr-cli/blob/4003f999cd5eb030b4c7407317de728f5115a80f/pypyr/utils/filesystem.py#L252-L303
def in_to_out(self, in_path, out_path=None): """Write a single file in to out, running self.formatter on each line. If in_path and out_path point to the same thing it will in-place edit and overwrite the in path. Even easier, if you do want to edit a file in place, don't specify out_pat...
[ "def", "in_to_out", "(", "self", ",", "in_path", ",", "out_path", "=", "None", ")", ":", "is_in_place_edit", "=", "False", "if", "is_same_file", "(", "in_path", ",", "out_path", ")", ":", "logger", ".", "debug", "(", "\"in path and out path are the same file. wr...
Write a single file in to out, running self.formatter on each line. If in_path and out_path point to the same thing it will in-place edit and overwrite the in path. Even easier, if you do want to edit a file in place, don't specify out_path, or set it to None. Args: in_path...
[ "Write", "a", "single", "file", "in", "to", "out", "running", "self", ".", "formatter", "on", "each", "line", "." ]
python
train
tamasgal/km3pipe
km3pipe/shell.py
https://github.com/tamasgal/km3pipe/blob/7a9b59ac899a28775b5bdc5d391d9a5340d08040/km3pipe/shell.py#L227-L229
def _add_two_argument_command(self, command, arg1, arg2): """Helper function for two-argument commands""" self.lines.append("{} {} {}".format(command, arg1, arg2))
[ "def", "_add_two_argument_command", "(", "self", ",", "command", ",", "arg1", ",", "arg2", ")", ":", "self", ".", "lines", ".", "append", "(", "\"{} {} {}\"", ".", "format", "(", "command", ",", "arg1", ",", "arg2", ")", ")" ]
Helper function for two-argument commands
[ "Helper", "function", "for", "two", "-", "argument", "commands" ]
python
train
materialsproject/pymatgen
pymatgen/core/surface.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/surface.py#L336-L349
def dipole(self): """ Calculates the dipole of the Slab in the direction of the surface normal. Note that the Slab must be oxidation state-decorated for this to work properly. Otherwise, the Slab will always have a dipole of 0. """ dipole = np.zeros(3) mid_pt = np...
[ "def", "dipole", "(", "self", ")", ":", "dipole", "=", "np", ".", "zeros", "(", "3", ")", "mid_pt", "=", "np", ".", "sum", "(", "self", ".", "cart_coords", ",", "axis", "=", "0", ")", "/", "len", "(", "self", ")", "normal", "=", "self", ".", ...
Calculates the dipole of the Slab in the direction of the surface normal. Note that the Slab must be oxidation state-decorated for this to work properly. Otherwise, the Slab will always have a dipole of 0.
[ "Calculates", "the", "dipole", "of", "the", "Slab", "in", "the", "direction", "of", "the", "surface", "normal", ".", "Note", "that", "the", "Slab", "must", "be", "oxidation", "state", "-", "decorated", "for", "this", "to", "work", "properly", ".", "Otherwi...
python
train
AgeOfLearning/coeus-unity-python-framework
coeus_unity/assertions.py
https://github.com/AgeOfLearning/coeus-unity-python-framework/blob/cf8ca6800ace1425d917ea2628dbd05ed959fdd7/coeus_unity/assertions.py#L93-L105
def assert_await_scene_loaded(cli, scene_name, is_loaded=DEFAULT_SCENE_LOADED, timeout_seconds=DEFAULT_TIMEOUT_SECONDS): """ Asserts that we successfully awaited for the scene to be loaded based on is_loaded. If the timeout passes or the expression is_registered != actual state, then it will fail. :para...
[ "def", "assert_await_scene_loaded", "(", "cli", ",", "scene_name", ",", "is_loaded", "=", "DEFAULT_SCENE_LOADED", ",", "timeout_seconds", "=", "DEFAULT_TIMEOUT_SECONDS", ")", ":", "result", "=", "commands", ".", "await_scene_loaded", "(", "cli", ",", "scene_name", "...
Asserts that we successfully awaited for the scene to be loaded based on is_loaded. If the timeout passes or the expression is_registered != actual state, then it will fail. :param cli: :param scene_name: :param is_loaded: (True | False) the state change we are waiting for. :param timeout_seconds: T...
[ "Asserts", "that", "we", "successfully", "awaited", "for", "the", "scene", "to", "be", "loaded", "based", "on", "is_loaded", ".", "If", "the", "timeout", "passes", "or", "the", "expression", "is_registered", "!", "=", "actual", "state", "then", "it", "will",...
python
train
KelSolaar/Umbra
umbra/ui/widgets/search_QLineEdit.py
https://github.com/KelSolaar/Umbra/blob/66f45f08d9d723787f1191989f8b0dda84b412ce/umbra/ui/widgets/search_QLineEdit.py#L451-L460
def __set_style_sheet(self): """ Sets the Widget stylesheet. """ frame_width = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth) self.setStyleSheet(QString("QLineEdit {{ padding-left: {0}px; padding-right: {1}px; }}".format( self.__search_active_label.sizeHint()....
[ "def", "__set_style_sheet", "(", "self", ")", ":", "frame_width", "=", "self", ".", "style", "(", ")", ".", "pixelMetric", "(", "QStyle", ".", "PM_DefaultFrameWidth", ")", "self", ".", "setStyleSheet", "(", "QString", "(", "\"QLineEdit {{ padding-left: {0}px; padd...
Sets the Widget stylesheet.
[ "Sets", "the", "Widget", "stylesheet", "." ]
python
train
ambitioninc/django-query-builder
querybuilder/query.py
https://github.com/ambitioninc/django-query-builder/blob/113a7d845d3ddc6a45621b9880308e756f87c5bf/querybuilder/query.py#L310-L326
def get_condition_value(self, operator, value): """ Gets the condition value based on the operator and value :param operator: the condition operator name :type operator: str :param value: the value to be formatted based on the condition operator :type value: object ...
[ "def", "get_condition_value", "(", "self", ",", "operator", ",", "value", ")", ":", "if", "operator", "in", "(", "'contains'", ",", "'icontains'", ")", ":", "value", "=", "'%{0}%'", ".", "format", "(", "value", ")", "elif", "operator", "==", "'startswith'"...
Gets the condition value based on the operator and value :param operator: the condition operator name :type operator: str :param value: the value to be formatted based on the condition operator :type value: object :return: the comparison operator from the Where class's comparis...
[ "Gets", "the", "condition", "value", "based", "on", "the", "operator", "and", "value" ]
python
train
DataBiosphere/dsub
dsub/providers/local.py
https://github.com/DataBiosphere/dsub/blob/443ce31daa6023dc2fd65ef2051796e19d18d5a7/dsub/providers/local.py#L704-L745
def _delocalize_logging_command(self, logging_path, user_project): """Returns a command to delocalize logs. Args: logging_path: location of log files. user_project: name of the project to be billed for the request. Returns: eg. 'gs://bucket/path/myfile' or 'gs://bucket/script-foobar-12' ...
[ "def", "_delocalize_logging_command", "(", "self", ",", "logging_path", ",", "user_project", ")", ":", "# Get the logging prefix (everything up to \".log\")", "logging_prefix", "=", "os", ".", "path", ".", "splitext", "(", "logging_path", ".", "uri", ")", "[", "0", ...
Returns a command to delocalize logs. Args: logging_path: location of log files. user_project: name of the project to be billed for the request. Returns: eg. 'gs://bucket/path/myfile' or 'gs://bucket/script-foobar-12'
[ "Returns", "a", "command", "to", "delocalize", "logs", "." ]
python
valid
MacHu-GWU/crawl_zillow-project
crawl_zillow/scheduler.py
https://github.com/MacHu-GWU/crawl_zillow-project/blob/c6d7ca8e4c80e7e7e963496433ef73df1413c16e/crawl_zillow/scheduler.py#L78-L140
def user_process(self, input_data): """ :param input_data: :return: output_data, list of next model instance. For example, if model is :class:`~crawl_zillow.model.State`, then next model is :class:`~crawl_zillow.model.County`. """ url = input_data.doc.url ...
[ "def", "user_process", "(", "self", ",", "input_data", ")", ":", "url", "=", "input_data", ".", "doc", ".", "url", "self", ".", "logger", ".", "info", "(", "\"Crawl %s .\"", "%", "url", ",", "1", ")", "output_data", "=", "OutputData", "(", "data", "=",...
:param input_data: :return: output_data, list of next model instance. For example, if model is :class:`~crawl_zillow.model.State`, then next model is :class:`~crawl_zillow.model.County`.
[ ":", "param", "input_data", ":", ":", "return", ":", "output_data", "list", "of", "next", "model", "instance", ".", "For", "example", "if", "model", "is", ":", "class", ":", "~crawl_zillow", ".", "model", ".", "State", "then", "next", "model", "is", ":",...
python
train
nabla-c0d3/sslyze
sslyze/plugins/utils/trust_store/trust_store_repository.py
https://github.com/nabla-c0d3/sslyze/blob/0fb3ae668453d7ecf616d0755f237ca7be9f62fa/sslyze/plugins/utils/trust_store/trust_store_repository.py#L123-L146
def update_default(cls) -> 'TrustStoresRepository': """Update the default trust stores used by SSLyze. The latest stores will be downloaded from https://github.com/nabla-c0d3/trust_stores_observatory. """ temp_path = mkdtemp() try: # Download the latest trust stores ...
[ "def", "update_default", "(", "cls", ")", "->", "'TrustStoresRepository'", ":", "temp_path", "=", "mkdtemp", "(", ")", "try", ":", "# Download the latest trust stores", "archive_path", "=", "join", "(", "temp_path", ",", "'trust_stores_as_pem.tar.gz'", ")", "urlretrie...
Update the default trust stores used by SSLyze. The latest stores will be downloaded from https://github.com/nabla-c0d3/trust_stores_observatory.
[ "Update", "the", "default", "trust", "stores", "used", "by", "SSLyze", "." ]
python
train
pip-services3-python/pip-services3-commons-python
pip_services3_commons/random/RandomDateTime.py
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/random/RandomDateTime.py#L82-L98
def update_datetime(value, range = None): """ Updates (drifts) a Date value within specified range defined :param value: a Date value to drift. :param range: (optional) a range in milliseconds. Default: 10 days :return: an updated DateTime value. """ range = ra...
[ "def", "update_datetime", "(", "value", ",", "range", "=", "None", ")", ":", "range", "=", "range", "if", "range", "!=", "None", "else", "10", "if", "range", "<", "0", ":", "return", "value", "days", "=", "RandomFloat", ".", "next_float", "(", "-", "...
Updates (drifts) a Date value within specified range defined :param value: a Date value to drift. :param range: (optional) a range in milliseconds. Default: 10 days :return: an updated DateTime value.
[ "Updates", "(", "drifts", ")", "a", "Date", "value", "within", "specified", "range", "defined" ]
python
train
gwpy/gwpy
gwpy/signal/spectral/_utils.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/signal/spectral/_utils.py#L27-L54
def scale_timeseries_unit(tsunit, scaling='density'): """Scale the unit of a `TimeSeries` to match that of a `FrequencySeries` Parameters ---------- tsunit : `~astropy.units.UnitBase` input unit from `TimeSeries` scaling : `str` type of frequency series, either 'density' for a PSD, ...
[ "def", "scale_timeseries_unit", "(", "tsunit", ",", "scaling", "=", "'density'", ")", ":", "# set units", "if", "scaling", "==", "'density'", ":", "baseunit", "=", "units", ".", "Hertz", "elif", "scaling", "==", "'spectrum'", ":", "baseunit", "=", "units", "...
Scale the unit of a `TimeSeries` to match that of a `FrequencySeries` Parameters ---------- tsunit : `~astropy.units.UnitBase` input unit from `TimeSeries` scaling : `str` type of frequency series, either 'density' for a PSD, or 'spectrum' for a power spectrum. Returns ...
[ "Scale", "the", "unit", "of", "a", "TimeSeries", "to", "match", "that", "of", "a", "FrequencySeries" ]
python
train
etcher-be/emiz
emiz/avwx/speech.py
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/speech.py#L72-L83
def altimeter(alt: Number, unit: str = 'inHg') -> str: """ Format altimeter details into a spoken word string """ ret = 'Altimeter ' if not alt: ret += 'unknown' elif unit == 'inHg': ret += core.spoken_number(alt.repr[:2]) + ' point ' + core.spoken_number(alt.repr[2:]) elif u...
[ "def", "altimeter", "(", "alt", ":", "Number", ",", "unit", ":", "str", "=", "'inHg'", ")", "->", "str", ":", "ret", "=", "'Altimeter '", "if", "not", "alt", ":", "ret", "+=", "'unknown'", "elif", "unit", "==", "'inHg'", ":", "ret", "+=", "core", "...
Format altimeter details into a spoken word string
[ "Format", "altimeter", "details", "into", "a", "spoken", "word", "string" ]
python
train
saltstack/salt
salt/modules/freebsdports.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/freebsdports.py#L392-L453
def update(extract=False): ''' Update the ports tree extract : False If ``True``, runs a ``portsnap extract`` after fetching, should be used for first-time installation of the ports tree. CLI Example: .. code-block:: bash salt '*' ports.update ''' result = __salt_...
[ "def", "update", "(", "extract", "=", "False", ")", ":", "result", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "_portsnap", "(", ")", "+", "[", "'fetch'", "]", ",", "python_shell", "=", "False", ")", "if", "not", "result", "[", "'retcode'", "]", ...
Update the ports tree extract : False If ``True``, runs a ``portsnap extract`` after fetching, should be used for first-time installation of the ports tree. CLI Example: .. code-block:: bash salt '*' ports.update
[ "Update", "the", "ports", "tree" ]
python
train
softlayer/softlayer-python
SoftLayer/managers/ticket.py
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/ticket.py#L25-L43
def list_tickets(self, open_status=True, closed_status=True): """List all tickets. :param boolean open_status: include open tickets :param boolean closed_status: include closed tickets """ mask = """mask[id, title, assignedUser[firstName, lastName], priority, c...
[ "def", "list_tickets", "(", "self", ",", "open_status", "=", "True", ",", "closed_status", "=", "True", ")", ":", "mask", "=", "\"\"\"mask[id, title, assignedUser[firstName, lastName], priority,\n createDate, lastEditDate, accountId, status, updateCount]\"\"\"", "c...
List all tickets. :param boolean open_status: include open tickets :param boolean closed_status: include closed tickets
[ "List", "all", "tickets", "." ]
python
train
cgrok/clashroyale
clashroyale/official_api/client.py
https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L309-L321
def get_clan(self, tag: crtag, timeout: int=None): """Get inforamtion about a clan Parameters ---------- tag: str A valid tournament tag. Minimum length: 3 Valid characters: 0289PYLQGRJCUV timeout: Optional[int] = None Custom timeout that over...
[ "def", "get_clan", "(", "self", ",", "tag", ":", "crtag", ",", "timeout", ":", "int", "=", "None", ")", ":", "url", "=", "self", ".", "api", ".", "CLAN", "+", "'/'", "+", "tag", "return", "self", ".", "_get_model", "(", "url", ",", "FullClan", ",...
Get inforamtion about a clan Parameters ---------- tag: str A valid tournament tag. Minimum length: 3 Valid characters: 0289PYLQGRJCUV timeout: Optional[int] = None Custom timeout that overwrites Client.timeout
[ "Get", "inforamtion", "about", "a", "clan" ]
python
valid
rocky/python3-trepan
trepan/processor/cmdfns.py
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/processor/cmdfns.py#L175-L181
def run_show_bool(obj, what=None): """Generic subcommand showing a boolean-valued debugger setting. 'obj' is generally a subcommand that has 'name' and 'debugger.setting' attributes.""" val = show_onoff(obj.debugger.settings[obj.name]) if not what: what = obj.name return obj.msg("%s is %s." % (w...
[ "def", "run_show_bool", "(", "obj", ",", "what", "=", "None", ")", ":", "val", "=", "show_onoff", "(", "obj", ".", "debugger", ".", "settings", "[", "obj", ".", "name", "]", ")", "if", "not", "what", ":", "what", "=", "obj", ".", "name", "return", ...
Generic subcommand showing a boolean-valued debugger setting. 'obj' is generally a subcommand that has 'name' and 'debugger.setting' attributes.
[ "Generic", "subcommand", "showing", "a", "boolean", "-", "valued", "debugger", "setting", ".", "obj", "is", "generally", "a", "subcommand", "that", "has", "name", "and", "debugger", ".", "setting", "attributes", "." ]
python
test
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/FS.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/FS.py#L1007-L1013
def must_be_same(self, klass): """Called to make sure a Node is a Dir. Since we're an Entry, we can morph into one.""" if self.__class__ is not klass: self.__class__ = klass self._morph() self.clear()
[ "def", "must_be_same", "(", "self", ",", "klass", ")", ":", "if", "self", ".", "__class__", "is", "not", "klass", ":", "self", ".", "__class__", "=", "klass", "self", ".", "_morph", "(", ")", "self", ".", "clear", "(", ")" ]
Called to make sure a Node is a Dir. Since we're an Entry, we can morph into one.
[ "Called", "to", "make", "sure", "a", "Node", "is", "a", "Dir", ".", "Since", "we", "re", "an", "Entry", "we", "can", "morph", "into", "one", "." ]
python
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/xhtml2pdf_reportlab.py
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/xhtml2pdf_reportlab.py#L788-L839
def wrap(self, availWidth, availHeight): """ All table properties should be known by now. """ widths = (availWidth - self.rightColumnWidth, self.rightColumnWidth) # makes an internal table which does all the work. # we draw the LAST RUN's entries! If ...
[ "def", "wrap", "(", "self", ",", "availWidth", ",", "availHeight", ")", ":", "widths", "=", "(", "availWidth", "-", "self", ".", "rightColumnWidth", ",", "self", ".", "rightColumnWidth", ")", "# makes an internal table which does all the work.", "# we draw the LAST RU...
All table properties should be known by now.
[ "All", "table", "properties", "should", "be", "known", "by", "now", "." ]
python
train
seequent/properties
properties/base/containers.py
https://github.com/seequent/properties/blob/096b07012fff86b0a880c8c018320c3b512751b9/properties/base/containers.py#L261-L281
def validate(self, instance, value): """Check the class of the container and validate each element This returns a copy of the container to prevent unwanted sharing of pointers. """ if not self.coerce and not isinstance(value, self._class_container): self.error(instan...
[ "def", "validate", "(", "self", ",", "instance", ",", "value", ")", ":", "if", "not", "self", ".", "coerce", "and", "not", "isinstance", "(", "value", ",", "self", ".", "_class_container", ")", ":", "self", ".", "error", "(", "instance", ",", "value", ...
Check the class of the container and validate each element This returns a copy of the container to prevent unwanted sharing of pointers.
[ "Check", "the", "class", "of", "the", "container", "and", "validate", "each", "element" ]
python
train
MagicStack/asyncpg
asyncpg/connection.py
https://github.com/MagicStack/asyncpg/blob/92c2d81256a1efd8cab12c0118d74ccd1c18131b/asyncpg/connection.py#L1071-L1088
async def close(self, *, timeout=None): """Close the connection gracefully. :param float timeout: Optional timeout value in seconds. .. versionchanged:: 0.14.0 Added the *timeout* parameter. """ try: if not self.is_closed(): aw...
[ "async", "def", "close", "(", "self", ",", "*", ",", "timeout", "=", "None", ")", ":", "try", ":", "if", "not", "self", ".", "is_closed", "(", ")", ":", "await", "self", ".", "_protocol", ".", "close", "(", "timeout", ")", "except", "Exception", ":...
Close the connection gracefully. :param float timeout: Optional timeout value in seconds. .. versionchanged:: 0.14.0 Added the *timeout* parameter.
[ "Close", "the", "connection", "gracefully", "." ]
python
train
cloudant/python-cloudant
src/cloudant/document.py
https://github.com/cloudant/python-cloudant/blob/e0ba190f6ba07fe3522a668747128214ad573c7e/src/cloudant/document.py#L264-L299
def update_field(self, action, field, value, max_tries=10): """ Updates a field in the remote document. If a conflict exists, the document is re-fetched from the remote database and the update is retried. This is performed up to ``max_tries`` number of times. Use this method wh...
[ "def", "update_field", "(", "self", ",", "action", ",", "field", ",", "value", ",", "max_tries", "=", "10", ")", ":", "self", ".", "_update_field", "(", "action", ",", "field", ",", "value", ",", "max_tries", ")" ]
Updates a field in the remote document. If a conflict exists, the document is re-fetched from the remote database and the update is retried. This is performed up to ``max_tries`` number of times. Use this method when you want to update a single field in a document, and don't want to ri...
[ "Updates", "a", "field", "in", "the", "remote", "document", ".", "If", "a", "conflict", "exists", "the", "document", "is", "re", "-", "fetched", "from", "the", "remote", "database", "and", "the", "update", "is", "retried", ".", "This", "is", "performed", ...
python
train
isislovecruft/python-gnupg
pretty_bad_protocol/_parsers.py
https://github.com/isislovecruft/python-gnupg/blob/784571449032e811587249743e183fc5e908a673/pretty_bad_protocol/_parsers.py#L127-L141
def _fix_unsafe(shell_input): """Find characters used to escape from a string into a shell, and wrap them in quotes if they exist. Regex pilfered from Python3 :mod:`shlex` module. :param str shell_input: The input intended for the GnuPG process. """ _unsafe = re.compile(r'[^\w@%+=:,./-]', 256) ...
[ "def", "_fix_unsafe", "(", "shell_input", ")", ":", "_unsafe", "=", "re", ".", "compile", "(", "r'[^\\w@%+=:,./-]'", ",", "256", ")", "try", ":", "if", "len", "(", "_unsafe", ".", "findall", "(", "shell_input", ")", ")", "==", "0", ":", "return", "shel...
Find characters used to escape from a string into a shell, and wrap them in quotes if they exist. Regex pilfered from Python3 :mod:`shlex` module. :param str shell_input: The input intended for the GnuPG process.
[ "Find", "characters", "used", "to", "escape", "from", "a", "string", "into", "a", "shell", "and", "wrap", "them", "in", "quotes", "if", "they", "exist", ".", "Regex", "pilfered", "from", "Python3", ":", "mod", ":", "shlex", "module", "." ]
python
train
miquelo/resort
packages/resort/__init__.py
https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/__init__.py#L397-L451
def command_update(prog_name, prof_mgr, prof_name, prog_args): """ Update components. """ # Retrieve arguments parser = argparse.ArgumentParser( prog=prog_name ) parser.add_argument( "components", metavar="comps", nargs=argparse.REMAINDER, help="system components" ) args = parser.parse_args(prog_a...
[ "def", "command_update", "(", "prog_name", ",", "prof_mgr", ",", "prof_name", ",", "prog_args", ")", ":", "# Retrieve arguments", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "prog_name", ")", "parser", ".", "add_argument", "(", "\"compone...
Update components.
[ "Update", "components", "." ]
python
train
AustralianSynchrotron/lightflow
lightflow/models/task_data.py
https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/task_data.py#L261-L273
def get_by_index(self, index): """ Return a dataset by its index. Args: index (int): The index of the dataset that should be returned. Raises: DataInvalidIndex: If the index does not represent a valid dataset. """ if index >= len(self._datasets): ...
[ "def", "get_by_index", "(", "self", ",", "index", ")", ":", "if", "index", ">=", "len", "(", "self", ".", "_datasets", ")", ":", "raise", "DataInvalidIndex", "(", "'A dataset with index {} does not exist'", ".", "format", "(", "index", ")", ")", "return", "s...
Return a dataset by its index. Args: index (int): The index of the dataset that should be returned. Raises: DataInvalidIndex: If the index does not represent a valid dataset.
[ "Return", "a", "dataset", "by", "its", "index", "." ]
python
train
phaethon/kamene
kamene/contrib/igmpv3.py
https://github.com/phaethon/kamene/blob/11d4064844f4f68ac5d7546f5633ac7d02082914/kamene/contrib/igmpv3.py#L144-L158
def post_build(self, p, pay): """Called implicitly before a packet is sent to compute and place IGMPv3 checksum. Parameters: self The instantiation of an IGMPv3 class p The IGMPv3 message in hex in network byte order pay Additional payload for the IGMPv3 message """ p += ...
[ "def", "post_build", "(", "self", ",", "p", ",", "pay", ")", ":", "p", "+=", "pay", "if", "self", ".", "type", "in", "[", "0", ",", "0x31", ",", "0x32", ",", "0x22", "]", ":", "# for these, field is reserved (0)", "p", "=", "p", "[", ":", "1", "]...
Called implicitly before a packet is sent to compute and place IGMPv3 checksum. Parameters: self The instantiation of an IGMPv3 class p The IGMPv3 message in hex in network byte order pay Additional payload for the IGMPv3 message
[ "Called", "implicitly", "before", "a", "packet", "is", "sent", "to", "compute", "and", "place", "IGMPv3", "checksum", "." ]
python
train
spyder-ide/spyder
spyder/widgets/mixins.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L524-L535
def get_character(self, position, offset=0): """Return character at *position* with the given offset.""" position = self.get_position(position) + offset cursor = self.textCursor() cursor.movePosition(QTextCursor.End) if position < cursor.position(): cursor.setPo...
[ "def", "get_character", "(", "self", ",", "position", ",", "offset", "=", "0", ")", ":", "position", "=", "self", ".", "get_position", "(", "position", ")", "+", "offset", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "movePosition",...
Return character at *position* with the given offset.
[ "Return", "character", "at", "*", "position", "*", "with", "the", "given", "offset", "." ]
python
train
acsone/git-aggregator
git_aggregator/repo.py
https://github.com/acsone/git-aggregator/blob/8631b0e64f9e8ce1857b21adeddb890ebd8469a6/git_aggregator/repo.py#L313-L357
def collect_prs_info(self): """Collect all pending merge PRs info. :returns: mapping of PRs by state """ REPO_RE = re.compile( '^(https://github.com/|git@github.com:)' '(?P<owner>.*?)/(?P<repo>.*?)(.git)?$') PULL_RE = re.compile( '^(refs/)?pul...
[ "def", "collect_prs_info", "(", "self", ")", ":", "REPO_RE", "=", "re", ".", "compile", "(", "'^(https://github.com/|git@github.com:)'", "'(?P<owner>.*?)/(?P<repo>.*?)(.git)?$'", ")", "PULL_RE", "=", "re", ".", "compile", "(", "'^(refs/)?pull/(?P<pr>[0-9]+)/head$'", ")", ...
Collect all pending merge PRs info. :returns: mapping of PRs by state
[ "Collect", "all", "pending", "merge", "PRs", "info", "." ]
python
train
MisterWil/abodepy
abodepy/socketio.py
https://github.com/MisterWil/abodepy/blob/6f84bb428fd1da98855f55083cd427bebbcc57ae/abodepy/socketio.py#L110-L118
def start(self): """Start a thread to handle SocketIO notifications.""" if not self._thread: _LOGGER.info("Starting SocketIO thread...") self._thread = threading.Thread(target=self._run_socketio_thread, name='SocketIOThread') ...
[ "def", "start", "(", "self", ")", ":", "if", "not", "self", ".", "_thread", ":", "_LOGGER", ".", "info", "(", "\"Starting SocketIO thread...\"", ")", "self", ".", "_thread", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "_run_socketio_t...
Start a thread to handle SocketIO notifications.
[ "Start", "a", "thread", "to", "handle", "SocketIO", "notifications", "." ]
python
train
walter426/Python_GoogleMapsApi
GoogleMapsApi/geocode.py
https://github.com/walter426/Python_GoogleMapsApi/blob/4832b293a0027446941a5f00ecc66256f92ddbce/GoogleMapsApi/geocode.py#L34-L63
def geocode(self, string, bounds=None, region=None, language=None, sensor=False): '''Geocode an address. Pls refer to the Google Maps Web API for the details of the parameters ''' if isinstance(string, unicode): string = string.encode('utf-8') params ...
[ "def", "geocode", "(", "self", ",", "string", ",", "bounds", "=", "None", ",", "region", "=", "None", ",", "language", "=", "None", ",", "sensor", "=", "False", ")", ":", "if", "isinstance", "(", "string", ",", "unicode", ")", ":", "string", "=", "...
Geocode an address. Pls refer to the Google Maps Web API for the details of the parameters
[ "Geocode", "an", "address", ".", "Pls", "refer", "to", "the", "Google", "Maps", "Web", "API", "for", "the", "details", "of", "the", "parameters" ]
python
train
pymoca/pymoca
src/pymoca/backends/casadi/api.py
https://github.com/pymoca/pymoca/blob/14b5eb7425e96689de6cc5c10f400895d586a978/src/pymoca/backends/casadi/api.py#L246-L416
def load_model(model_folder: str, model_name: str, compiler_options: Dict[str, str]) -> CachedModel: """ Loads a precompiled CasADi model into a CachedModel instance. :param model_folder: Folder where the precompiled CasADi model is located. :param model_name: Name of the model. :param compiler_opt...
[ "def", "load_model", "(", "model_folder", ":", "str", ",", "model_name", ":", "str", ",", "compiler_options", ":", "Dict", "[", "str", ",", "str", "]", ")", "->", "CachedModel", ":", "db_file", "=", "os", ".", "path", ".", "join", "(", "model_folder", ...
Loads a precompiled CasADi model into a CachedModel instance. :param model_folder: Folder where the precompiled CasADi model is located. :param model_name: Name of the model. :param compiler_options: Dictionary of compiler options. :returns: CachedModel instance.
[ "Loads", "a", "precompiled", "CasADi", "model", "into", "a", "CachedModel", "instance", "." ]
python
train
twisted/mantissa
xmantissa/_webutil.py
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/_webutil.py#L65-L82
def wrapModel(self, model): """ Converts application-provided model objects to L{IResource} providers. """ res = IResource(model, None) if res is None: frag = INavigableFragment(model) fragmentName = getattr(frag, 'fragmentName', None) if fragm...
[ "def", "wrapModel", "(", "self", ",", "model", ")", ":", "res", "=", "IResource", "(", "model", ",", "None", ")", "if", "res", "is", "None", ":", "frag", "=", "INavigableFragment", "(", "model", ")", "fragmentName", "=", "getattr", "(", "frag", ",", ...
Converts application-provided model objects to L{IResource} providers.
[ "Converts", "application", "-", "provided", "model", "objects", "to", "L", "{", "IResource", "}", "providers", "." ]
python
train
atmos-python/atmos
atmos/util.py
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/util.py#L143-L158
def parse_derivative_string(string, quantity_dict): ''' Assuming the string is of the form d(var1)d(var2), returns var1, var2. Raises ValueError if the string is not of this form, or if the vars are not keys in the quantity_dict, or if var2 is not a coordinate-like variable. ''' match = deri...
[ "def", "parse_derivative_string", "(", "string", ",", "quantity_dict", ")", ":", "match", "=", "derivative_prog", ".", "match", "(", "string", ")", "if", "match", "is", "None", ":", "raise", "ValueError", "(", "'string is not in the form of a derivative'", ")", "v...
Assuming the string is of the form d(var1)d(var2), returns var1, var2. Raises ValueError if the string is not of this form, or if the vars are not keys in the quantity_dict, or if var2 is not a coordinate-like variable.
[ "Assuming", "the", "string", "is", "of", "the", "form", "d", "(", "var1", ")", "d", "(", "var2", ")", "returns", "var1", "var2", ".", "Raises", "ValueError", "if", "the", "string", "is", "not", "of", "this", "form", "or", "if", "the", "vars", "are", ...
python
train
devassistant/devassistant
devassistant/dapi/dapicli.py
https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/dapicli.py#L95-L99
def data(link): '''Returns a dictionary from requested link''' link = _remove_api_url_from_link(link) req = _get_from_dapi_or_mirror(link) return _process_req(req)
[ "def", "data", "(", "link", ")", ":", "link", "=", "_remove_api_url_from_link", "(", "link", ")", "req", "=", "_get_from_dapi_or_mirror", "(", "link", ")", "return", "_process_req", "(", "req", ")" ]
Returns a dictionary from requested link
[ "Returns", "a", "dictionary", "from", "requested", "link" ]
python
train
Scoppio/RagnarokEngine3
RagnarokEngine3/RE3.py
https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L1365-L1369
def load_texture(self, file_path): """Generate our sprite's surface by loading the specified image from disk. Note that this automatically centers the origin.""" self.image = pygame.image.load(file_path) self.apply_texture(self.image)
[ "def", "load_texture", "(", "self", ",", "file_path", ")", ":", "self", ".", "image", "=", "pygame", ".", "image", ".", "load", "(", "file_path", ")", "self", ".", "apply_texture", "(", "self", ".", "image", ")" ]
Generate our sprite's surface by loading the specified image from disk. Note that this automatically centers the origin.
[ "Generate", "our", "sprite", "s", "surface", "by", "loading", "the", "specified", "image", "from", "disk", ".", "Note", "that", "this", "automatically", "centers", "the", "origin", "." ]
python
train
facelessuser/pyspelling
pyspelling/filters/xml.py
https://github.com/facelessuser/pyspelling/blob/c25d5292cc2687ad65891a12ead43f7182ca8bb3/pyspelling/filters/xml.py#L250-L253
def sfilter(self, source): """Filter.""" return self._filter(source.text, source.context, source.encoding)
[ "def", "sfilter", "(", "self", ",", "source", ")", ":", "return", "self", ".", "_filter", "(", "source", ".", "text", ",", "source", ".", "context", ",", "source", ".", "encoding", ")" ]
Filter.
[ "Filter", "." ]
python
train
SatelliteQE/nailgun
nailgun/entities.py
https://github.com/SatelliteQE/nailgun/blob/c36d8c20862e87bf6975bd48ac1ca40a9e634eaa/nailgun/entities.py#L1439-L1445
def update_payload(self, fields=None): """Wrap submitted data within an extra dict.""" payload = super(ConfigTemplate, self).update_payload(fields) if 'template_combinations' in payload: payload['template_combinations_attributes'] = payload.pop( 'template_combinations...
[ "def", "update_payload", "(", "self", ",", "fields", "=", "None", ")", ":", "payload", "=", "super", "(", "ConfigTemplate", ",", "self", ")", ".", "update_payload", "(", "fields", ")", "if", "'template_combinations'", "in", "payload", ":", "payload", "[", ...
Wrap submitted data within an extra dict.
[ "Wrap", "submitted", "data", "within", "an", "extra", "dict", "." ]
python
train
Yubico/python-yubico
yubico/yubikey_neo_usb_hid.py
https://github.com/Yubico/python-yubico/blob/a72e8eddb90da6ee96e29f60912ca1f2872c9aea/yubico/yubikey_neo_usb_hid.py#L269-L277
def _encode_ndef_text_params(self, data): """ Prepend language and enconding information to data, according to nfcforum-ts-rtd-text-1-0.pdf """ status = len(self.ndef_text_lang) if self.ndef_text_enc == 'UTF16': status = status & 0b10000000 return yubi...
[ "def", "_encode_ndef_text_params", "(", "self", ",", "data", ")", ":", "status", "=", "len", "(", "self", ".", "ndef_text_lang", ")", "if", "self", ".", "ndef_text_enc", "==", "'UTF16'", ":", "status", "=", "status", "&", "0b10000000", "return", "yubico_util...
Prepend language and enconding information to data, according to nfcforum-ts-rtd-text-1-0.pdf
[ "Prepend", "language", "and", "enconding", "information", "to", "data", "according", "to", "nfcforum", "-", "ts", "-", "rtd", "-", "text", "-", "1", "-", "0", ".", "pdf" ]
python
train
keon/algorithms
algorithms/strings/text_justification.py
https://github.com/keon/algorithms/blob/4d6569464a62a75c1357acc97e2dd32ee2f9f4a3/algorithms/strings/text_justification.py#L34-L89
def text_justification(words, max_width): ''' :type words: list :type max_width: int :rtype: list ''' ret = [] # return value row_len = 0 # current length of strs in a row row_words = [] # current words in a row index = 0 # the index of current word in words is_first_word = T...
[ "def", "text_justification", "(", "words", ",", "max_width", ")", ":", "ret", "=", "[", "]", "# return value", "row_len", "=", "0", "# current length of strs in a row", "row_words", "=", "[", "]", "# current words in a row", "index", "=", "0", "# the index of curren...
:type words: list :type max_width: int :rtype: list
[ ":", "type", "words", ":", "list", ":", "type", "max_width", ":", "int", ":", "rtype", ":", "list" ]
python
train
inveniosoftware/invenio-theme
invenio_theme/bundles.py
https://github.com/inveniosoftware/invenio-theme/blob/4e07607b1a40805df1d8e4ab9cc2afd728579ca9/invenio_theme/bundles.py#L33-L38
def _get_contents(self): """Create strings from lazy strings.""" return [ str(value) if is_lazy_string(value) else value for value in super(LazyNpmBundle, self)._get_contents() ]
[ "def", "_get_contents", "(", "self", ")", ":", "return", "[", "str", "(", "value", ")", "if", "is_lazy_string", "(", "value", ")", "else", "value", "for", "value", "in", "super", "(", "LazyNpmBundle", ",", "self", ")", ".", "_get_contents", "(", ")", "...
Create strings from lazy strings.
[ "Create", "strings", "from", "lazy", "strings", "." ]
python
train
nabetama/slacky
slacky/rest/rest.py
https://github.com/nabetama/slacky/blob/dde62ce49af9b8f581729c36d2ac790310b570e4/slacky/rest/rest.py#L504-L512
def kick(self, group_name, user): """ https://api.slack.com/methods/groups.kick """ group_id = self.get_group_id(group_name) self.params.update({ 'channel': group_id, 'user': user, }) return FromUrl('https://slack.com/api/groups.kick', self....
[ "def", "kick", "(", "self", ",", "group_name", ",", "user", ")", ":", "group_id", "=", "self", ".", "get_group_id", "(", "group_name", ")", "self", ".", "params", ".", "update", "(", "{", "'channel'", ":", "group_id", ",", "'user'", ":", "user", ",", ...
https://api.slack.com/methods/groups.kick
[ "https", ":", "//", "api", ".", "slack", ".", "com", "/", "methods", "/", "groups", ".", "kick" ]
python
train
Chilipp/psyplot
psyplot/data.py
https://github.com/Chilipp/psyplot/blob/75a0a15a9a1dd018e79d2df270d56c4bf5f311d5/psyplot/data.py#L2192-L2223
def _register_update(self, replot=False, fmt={}, force=False, todefault=False): """ Register new formatoptions for updating Parameters ---------- replot: bool Boolean that determines whether the data specific formatoptions shall b...
[ "def", "_register_update", "(", "self", ",", "replot", "=", "False", ",", "fmt", "=", "{", "}", ",", "force", "=", "False", ",", "todefault", "=", "False", ")", ":", "self", ".", "replot", "=", "self", ".", "replot", "or", "replot", "if", "self", "...
Register new formatoptions for updating Parameters ---------- replot: bool Boolean that determines whether the data specific formatoptions shall be updated in any case or not. Note, if `dims` is not empty or any coordinate keyword is in ``**kwargs``, this wil...
[ "Register", "new", "formatoptions", "for", "updating" ]
python
train
pandas-dev/pandas
pandas/core/computation/align.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/computation/align.py#L114-L132
def _align(terms): """Align a set of terms""" try: # flatten the parse tree (a nested list, really) terms = list(com.flatten(terms)) except TypeError: # can't iterate so it must just be a constant or single variable if isinstance(terms.value, pd.core.generic.NDFrame): ...
[ "def", "_align", "(", "terms", ")", ":", "try", ":", "# flatten the parse tree (a nested list, really)", "terms", "=", "list", "(", "com", ".", "flatten", "(", "terms", ")", ")", "except", "TypeError", ":", "# can't iterate so it must just be a constant or single variab...
Align a set of terms
[ "Align", "a", "set", "of", "terms" ]
python
train
awslabs/sockeye
sockeye/encoder.py
https://github.com/awslabs/sockeye/blob/5d64a1ee1ef3cbba17c6d1d94bc061020c43f6ab/sockeye/encoder.py#L747-L753
def get_max_seq_len(self) -> Optional[int]: """ :return: The maximum length supported by the encoder if such a restriction exists. """ max_seq_len = min((encoder.get_max_seq_len() for encoder in self.encoders if encoder.get_max_seq_len() is not None), default=N...
[ "def", "get_max_seq_len", "(", "self", ")", "->", "Optional", "[", "int", "]", ":", "max_seq_len", "=", "min", "(", "(", "encoder", ".", "get_max_seq_len", "(", ")", "for", "encoder", "in", "self", ".", "encoders", "if", "encoder", ".", "get_max_seq_len", ...
:return: The maximum length supported by the encoder if such a restriction exists.
[ ":", "return", ":", "The", "maximum", "length", "supported", "by", "the", "encoder", "if", "such", "a", "restriction", "exists", "." ]
python
train
autokey/autokey
lib/autokey/scripting.py
https://github.com/autokey/autokey/blob/35decb72f286ce68cd2a1f09ace8891a520b58d1/lib/autokey/scripting.py#L384-L400
def open_file(self, title="Open File", initialDir="~", fileTypes="*|All Files", rememberAs=None, **kwargs): """ Show an Open File dialog Usage: C{dialog.open_file(title="Open File", initialDir="~", fileTypes="*|All Files", rememberAs=None, **kwargs)} @param title: windo...
[ "def", "open_file", "(", "self", ",", "title", "=", "\"Open File\"", ",", "initialDir", "=", "\"~\"", ",", "fileTypes", "=", "\"*|All Files\"", ",", "rememberAs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "rememberAs", "is", "not", "None", ":...
Show an Open File dialog Usage: C{dialog.open_file(title="Open File", initialDir="~", fileTypes="*|All Files", rememberAs=None, **kwargs)} @param title: window title for the dialog @param initialDir: starting directory for the file dialog @param fileTypes: file type fil...
[ "Show", "an", "Open", "File", "dialog", "Usage", ":", "C", "{", "dialog", ".", "open_file", "(", "title", "=", "Open", "File", "initialDir", "=", "~", "fileTypes", "=", "*", "|All", "Files", "rememberAs", "=", "None", "**", "kwargs", ")", "}" ]
python
train
ClericPy/torequests
torequests/main.py
https://github.com/ClericPy/torequests/blob/1793261688d7a47e1c3a0830d83f8552f5e3e5d9/torequests/main.py#L357-L364
def callback_result(self): """Block the main thead until future finish, return the future.callback_result.""" if self._state in [PENDING, RUNNING]: self.x if self._user_callbacks: return self._callback_result else: return self.x
[ "def", "callback_result", "(", "self", ")", ":", "if", "self", ".", "_state", "in", "[", "PENDING", ",", "RUNNING", "]", ":", "self", ".", "x", "if", "self", ".", "_user_callbacks", ":", "return", "self", ".", "_callback_result", "else", ":", "return", ...
Block the main thead until future finish, return the future.callback_result.
[ "Block", "the", "main", "thead", "until", "future", "finish", "return", "the", "future", ".", "callback_result", "." ]
python
train
MacHu-GWU/pathlib_mate-project
pathlib_mate/mate_path_filters.py
https://github.com/MacHu-GWU/pathlib_mate-project/blob/f9fb99dd7cc9ea05d1bec8b9ce8f659e8d97b0f1/pathlib_mate/mate_path_filters.py#L132-L141
def n_subfile(self): """ Count how many files in this directory (doesn't include files in sub folders). """ self.assert_is_dir_and_exists() n = 0 for _ in self.select_file(recursive=False): n += 1 return n
[ "def", "n_subfile", "(", "self", ")", ":", "self", ".", "assert_is_dir_and_exists", "(", ")", "n", "=", "0", "for", "_", "in", "self", ".", "select_file", "(", "recursive", "=", "False", ")", ":", "n", "+=", "1", "return", "n" ]
Count how many files in this directory (doesn't include files in sub folders).
[ "Count", "how", "many", "files", "in", "this", "directory", "(", "doesn", "t", "include", "files", "in", "sub", "folders", ")", "." ]
python
valid
materialsproject/pymatgen-db
matgendb/util.py
https://github.com/materialsproject/pymatgen-db/blob/02e4351c2cea431407644f49193e8bf43ed39b9a/matgendb/util.py#L72-L86
def collection_keys(coll, sep='.'): """Get a list of all (including nested) keys in a collection. Examines the first document in the collection. :param sep: Separator for nested keys :return: List of str """ def _keys(x, pre=''): for k in x: yield (pre + k) if is...
[ "def", "collection_keys", "(", "coll", ",", "sep", "=", "'.'", ")", ":", "def", "_keys", "(", "x", ",", "pre", "=", "''", ")", ":", "for", "k", "in", "x", ":", "yield", "(", "pre", "+", "k", ")", "if", "isinstance", "(", "x", "[", "k", "]", ...
Get a list of all (including nested) keys in a collection. Examines the first document in the collection. :param sep: Separator for nested keys :return: List of str
[ "Get", "a", "list", "of", "all", "(", "including", "nested", ")", "keys", "in", "a", "collection", ".", "Examines", "the", "first", "document", "in", "the", "collection", "." ]
python
train
awickert/gFlex
gflex/f2d.py
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/f2d.py#L1503-L1544
def fd_solve(self): """ w = fd_solve() Sparse flexural response calculation. Can be performed by direct factorization with UMFpack (defuault) or by an iterative minimum residual technique These are both the fastest of the standard Scipy builtin techniques in their respective classes R...
[ "def", "fd_solve", "(", "self", ")", ":", "if", "self", ".", "Debug", ":", "try", ":", "# Will fail if scalar", "print", "(", "\"self.Te\"", ",", "self", ".", "Te", ".", "shape", ")", "except", ":", "pass", "print", "(", "\"self.qs\"", ",", "self", "."...
w = fd_solve() Sparse flexural response calculation. Can be performed by direct factorization with UMFpack (defuault) or by an iterative minimum residual technique These are both the fastest of the standard Scipy builtin techniques in their respective classes Requires the coefficient matrix f...
[ "w", "=", "fd_solve", "()", "Sparse", "flexural", "response", "calculation", ".", "Can", "be", "performed", "by", "direct", "factorization", "with", "UMFpack", "(", "defuault", ")", "or", "by", "an", "iterative", "minimum", "residual", "technique", "These", "a...
python
train
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_firmware.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_firmware.py#L1001-L1014
def logical_chassis_fwdl_status_output_cluster_fwdl_entries_fwdl_entries_blade_app(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") logical_chassis_fwdl_status = ET.Element("logical_chassis_fwdl_status") config = logical_chassis_fwdl_status output...
[ "def", "logical_chassis_fwdl_status_output_cluster_fwdl_entries_fwdl_entries_blade_app", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "logical_chassis_fwdl_status", "=", "ET", ".", "Element", "(", "\"logi...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train