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
marazt/object-mapper
mapper/object_mapper.py
https://github.com/marazt/object-mapper/blob/b02c6d68c5bf86462aa8080aff3e93b133afd43e/mapper/object_mapper.py#L84-L108
def create_map(self, type_from, type_to, mapping=None): """Method for adding mapping definitions :param type_from: source type :param type_to: target type :param mapping: dictionary of mapping definitions in a form {'target_property_name', lambda function f...
[ "def", "create_map", "(", "self", ",", "type_from", ",", "type_to", ",", "mapping", "=", "None", ")", ":", "key_from", "=", "type_from", ".", "__name__", "key_to", "=", "type_to", ".", "__name__", "if", "mapping", "is", "None", ":", "mapping", "=", "{", ...
Method for adding mapping definitions :param type_from: source type :param type_to: target type :param mapping: dictionary of mapping definitions in a form {'target_property_name', lambda function from rhe source} :return: None
[ "Method", "for", "adding", "mapping", "definitions", ":", "param", "type_from", ":", "source", "type", ":", "param", "type_to", ":", "target", "type", ":", "param", "mapping", ":", "dictionary", "of", "mapping", "definitions", "in", "a", "form", "{", "target...
python
valid
dpgaspar/Flask-AppBuilder
flask_appbuilder/forms.py
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/forms.py#L236-L277
def create_form(self, label_columns=None, inc_columns=None, description_columns=None, validators_columns=None, extra_fields=None, filter_rel_fields=None): """ Converts a model to a form given :param label_columns: A dictionary with...
[ "def", "create_form", "(", "self", ",", "label_columns", "=", "None", ",", "inc_columns", "=", "None", ",", "description_columns", "=", "None", ",", "validators_columns", "=", "None", ",", "extra_fields", "=", "None", ",", "filter_rel_fields", "=", "None", ")"...
Converts a model to a form given :param label_columns: A dictionary with the column's labels. :param inc_columns: A list with the columns to include :param description_columns: A dictionary with a description for cols. :par...
[ "Converts", "a", "model", "to", "a", "form", "given" ]
python
train
PmagPy/PmagPy
pmagpy/contribution_builder.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/contribution_builder.py#L1646-L1652
def delete_row(self, ind): """ remove self.df row at ind inplace """ self.df = pd.concat([self.df[:ind], self.df[ind+1:]], sort=True) return self.df
[ "def", "delete_row", "(", "self", ",", "ind", ")", ":", "self", ".", "df", "=", "pd", ".", "concat", "(", "[", "self", ".", "df", "[", ":", "ind", "]", ",", "self", ".", "df", "[", "ind", "+", "1", ":", "]", "]", ",", "sort", "=", "True", ...
remove self.df row at ind inplace
[ "remove", "self", ".", "df", "row", "at", "ind", "inplace" ]
python
train
opengridcc/opengrid
opengrid/library/regression.py
https://github.com/opengridcc/opengrid/blob/69b8da3c8fcea9300226c45ef0628cd6d4307651/opengrid/library/regression.py#L459-L473
def _modeldesc_to_dict(self, md): """Return a string representation of a patsy ModelDesc object""" d = {'lhs_termlist': [md.lhs_termlist[0].factors[0].name()]} rhs_termlist = [] # add other terms, if any for term in md.rhs_termlist[:]: if len(term.factors) == 0: ...
[ "def", "_modeldesc_to_dict", "(", "self", ",", "md", ")", ":", "d", "=", "{", "'lhs_termlist'", ":", "[", "md", ".", "lhs_termlist", "[", "0", "]", ".", "factors", "[", "0", "]", ".", "name", "(", ")", "]", "}", "rhs_termlist", "=", "[", "]", "# ...
Return a string representation of a patsy ModelDesc object
[ "Return", "a", "string", "representation", "of", "a", "patsy", "ModelDesc", "object" ]
python
train
apache/incubator-mxnet
example/ssd/symbol/legacy_vgg16_ssd_300.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/example/ssd/symbol/legacy_vgg16_ssd_300.py#L175-L207
def get_symbol(num_classes=20, nms_thresh=0.5, force_suppress=False, nms_topk=400, **kwargs): """ Single-shot multi-box detection with VGG 16 layers ConvNet This is a modified version, with fc6/fc7 layers replaced by conv layers And the network is slightly smaller than original VGG 16 net...
[ "def", "get_symbol", "(", "num_classes", "=", "20", ",", "nms_thresh", "=", "0.5", ",", "force_suppress", "=", "False", ",", "nms_topk", "=", "400", ",", "*", "*", "kwargs", ")", ":", "net", "=", "get_symbol_train", "(", "num_classes", ")", "cls_preds", ...
Single-shot multi-box detection with VGG 16 layers ConvNet This is a modified version, with fc6/fc7 layers replaced by conv layers And the network is slightly smaller than original VGG 16 network This is the detection network Parameters: ---------- num_classes: int number of object clas...
[ "Single", "-", "shot", "multi", "-", "box", "detection", "with", "VGG", "16", "layers", "ConvNet", "This", "is", "a", "modified", "version", "with", "fc6", "/", "fc7", "layers", "replaced", "by", "conv", "layers", "And", "the", "network", "is", "slightly",...
python
train
tensorflow/probability
tensorflow_probability/python/distributions/distribution.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/distribution.py#L1392-L1411
def _recursively_replace_dict_for_pretty_dict(x): """Recursively replace `dict`s with `_PrettyDict`.""" # We use "PrettyDict" because collections.OrderedDict repr/str has the word # "OrderedDict" in it. We only want to print "OrderedDict" if in fact the # input really is an OrderedDict. if isinstance(x, dict)...
[ "def", "_recursively_replace_dict_for_pretty_dict", "(", "x", ")", ":", "# We use \"PrettyDict\" because collections.OrderedDict repr/str has the word", "# \"OrderedDict\" in it. We only want to print \"OrderedDict\" if in fact the", "# input really is an OrderedDict.", "if", "isinstance", "("...
Recursively replace `dict`s with `_PrettyDict`.
[ "Recursively", "replace", "dict", "s", "with", "_PrettyDict", "." ]
python
test
bcbio/bcbio-nextgen
bcbio/variation/mutect2.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/mutect2.py#L70-L76
def _prep_inputs(align_bams, ref_file, items): """Ensure inputs to calling are indexed as expected. """ broad_runner = broad.runner_from_path("picard", items[0]["config"]) broad_runner.run_fn("picard_index_ref", ref_file) for x in align_bams: bam.index(x, items[0]["config"])
[ "def", "_prep_inputs", "(", "align_bams", ",", "ref_file", ",", "items", ")", ":", "broad_runner", "=", "broad", ".", "runner_from_path", "(", "\"picard\"", ",", "items", "[", "0", "]", "[", "\"config\"", "]", ")", "broad_runner", ".", "run_fn", "(", "\"pi...
Ensure inputs to calling are indexed as expected.
[ "Ensure", "inputs", "to", "calling", "are", "indexed", "as", "expected", "." ]
python
train
bioidiap/gridtk
gridtk/tools.py
https://github.com/bioidiap/gridtk/blob/9e3291b8b50388682908927231b2730db1da147d/gridtk/tools.py#L316-L336
def qdel(jobid, context='grid'): """Halts a given job. Keyword parameters: jobid The job identifier as returned by qsub() context The setshell context in which we should try a 'qsub'. Normally you don't need to change the default. This variable can also be set to a context dictionary in which...
[ "def", "qdel", "(", "jobid", ",", "context", "=", "'grid'", ")", ":", "scmd", "=", "[", "'qdel'", ",", "'%d'", "%", "jobid", "]", "logger", ".", "debug", "(", "\"Qdel command '%s'\"", ",", "' '", ".", "join", "(", "scmd", ")", ")", "from", ".", "se...
Halts a given job. Keyword parameters: jobid The job identifier as returned by qsub() context The setshell context in which we should try a 'qsub'. Normally you don't need to change the default. This variable can also be set to a context dictionary in which case we just setup using that context...
[ "Halts", "a", "given", "job", "." ]
python
train
contains-io/rcli
rcli/dispatcher.py
https://github.com/contains-io/rcli/blob/cdd6191a0e0a19bc767f84921650835d099349cf/rcli/dispatcher.py#L81-L104
def _run_command(argv): # type: (typing.List[str]) -> typing.Any """Run the command with the given CLI options and exit. Command functions are expected to have a __doc__ string that is parseable by docopt. Args: argv: The list of command line arguments supplied for a command. The ...
[ "def", "_run_command", "(", "argv", ")", ":", "# type: (typing.List[str]) -> typing.Any", "command_name", ",", "argv", "=", "_get_command_and_argv", "(", "argv", ")", "_LOGGER", ".", "info", "(", "'Running command \"%s %s\" with args: %s'", ",", "settings", ".", "comman...
Run the command with the given CLI options and exit. Command functions are expected to have a __doc__ string that is parseable by docopt. Args: argv: The list of command line arguments supplied for a command. The first argument is expected to be the name of the command to be run. ...
[ "Run", "the", "command", "with", "the", "given", "CLI", "options", "and", "exit", "." ]
python
train
twisted/twistedchecker
twistedchecker/checkers/pycodestyleformat.py
https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/checkers/pycodestyleformat.py#L218-L306
def modifiedBlankLines(logical_line, blank_lines, indent_level, line_number, blank_before, previous_logical, previous_indent_level): """ This function is copied from a modified pycodestyle checker for Twisted. See https://github.com/cyli/TwistySublime/blob/master/twisted_pycodestyle.p...
[ "def", "modifiedBlankLines", "(", "logical_line", ",", "blank_lines", ",", "indent_level", ",", "line_number", ",", "blank_before", ",", "previous_logical", ",", "previous_indent_level", ")", ":", "def", "isClassDefDecorator", "(", "thing", ")", ":", "return", "(", ...
This function is copied from a modified pycodestyle checker for Twisted. See https://github.com/cyli/TwistySublime/blob/master/twisted_pycodestyle.py Twisted Coding Standard: Separate top-level function and class definitions with three blank lines. Method definitions inside a class are separated by two...
[ "This", "function", "is", "copied", "from", "a", "modified", "pycodestyle", "checker", "for", "Twisted", ".", "See", "https", ":", "//", "github", ".", "com", "/", "cyli", "/", "TwistySublime", "/", "blob", "/", "master", "/", "twisted_pycodestyle", ".", "...
python
train
ynop/audiomate
audiomate/processing/pipeline/base.py
https://github.com/ynop/audiomate/blob/61727920b23a708293c3d526fa3000d4de9c6c21/audiomate/processing/pipeline/base.py#L372-L387
def _create_buffers(self): """ Create a buffer for every step in the pipeline. """ self.buffers = {} for step in self.graph.nodes(): num_buffers = 1 if isinstance(step, Reduction): num_buffers = len(step.parents) self.buffer...
[ "def", "_create_buffers", "(", "self", ")", ":", "self", ".", "buffers", "=", "{", "}", "for", "step", "in", "self", ".", "graph", ".", "nodes", "(", ")", ":", "num_buffers", "=", "1", "if", "isinstance", "(", "step", ",", "Reduction", ")", ":", "n...
Create a buffer for every step in the pipeline.
[ "Create", "a", "buffer", "for", "every", "step", "in", "the", "pipeline", "." ]
python
train
biolink/ontobio
ontobio/neo/scigraph_ontology.py
https://github.com/biolink/ontobio/blob/4e512a7831cfe6bc1b32f2c3be2ba41bc5cf7345/ontobio/neo/scigraph_ontology.py#L89-L96
def _neighbors_graph(self, **params) -> Dict: """ Get neighbors of a node parameters are directly passed through to SciGraph: e.g. depth, relationshipType """ response = self._get_response("graph/neighbors", format="json", **params) return response.json()
[ "def", "_neighbors_graph", "(", "self", ",", "*", "*", "params", ")", "->", "Dict", ":", "response", "=", "self", ".", "_get_response", "(", "\"graph/neighbors\"", ",", "format", "=", "\"json\"", ",", "*", "*", "params", ")", "return", "response", ".", "...
Get neighbors of a node parameters are directly passed through to SciGraph: e.g. depth, relationshipType
[ "Get", "neighbors", "of", "a", "node" ]
python
train
oceanprotocol/squid-py
squid_py/agreements/register_service_agreement.py
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/agreements/register_service_agreement.py#L174-L215
def execute_pending_service_agreements(storage_path, account, actor_type, did_resolver_fn): """ Iterates over pending service agreements recorded in the local storage, fetches their service definitions, and subscribes to service agreement events. :param storage_path: storage path for the internal db, ...
[ "def", "execute_pending_service_agreements", "(", "storage_path", ",", "account", ",", "actor_type", ",", "did_resolver_fn", ")", ":", "keeper", "=", "Keeper", ".", "get_instance", "(", ")", "# service_agreement_id, did, service_definition_id, price, files, start_time, status",...
Iterates over pending service agreements recorded in the local storage, fetches their service definitions, and subscribes to service agreement events. :param storage_path: storage path for the internal db, str :param account: :param actor_type: :param did_resolver_fn: :return:
[ "Iterates", "over", "pending", "service", "agreements", "recorded", "in", "the", "local", "storage", "fetches", "their", "service", "definitions", "and", "subscribes", "to", "service", "agreement", "events", "." ]
python
train
obulpathi/cdn-fastly-python
fastly/__init__.py
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L715-L718
def list_domains_by_service(self, service_id): """List the domains within a service.""" content = self._fetch("/service/%s/domain" % service_id, method="GET") return map(lambda x: FastlyDomain(self, x), content)
[ "def", "list_domains_by_service", "(", "self", ",", "service_id", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/domain\"", "%", "service_id", ",", "method", "=", "\"GET\"", ")", "return", "map", "(", "lambda", "x", ":", "FastlyDomain", ...
List the domains within a service.
[ "List", "the", "domains", "within", "a", "service", "." ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_netconf_ext.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_netconf_ext.py#L53-L65
def get_netconf_client_capabilities_output_session_vendor(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_netconf_client_capabilities = ET.Element("get_netconf_client_capabilities") config = get_netconf_client_capabilities output = ET.SubElem...
[ "def", "get_netconf_client_capabilities_output_session_vendor", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "get_netconf_client_capabilities", "=", "ET", ".", "Element", "(", "\"get_netconf_client_capabi...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
allianceauth/allianceauth
allianceauth/eveonline/autogroups/models.py
https://github.com/allianceauth/allianceauth/blob/6585b07e96571a99a4d6dc03cc03f9b8c8f690ca/allianceauth/eveonline/autogroups/models.py#L32-L47
def update_groups_for_user(self, user: User, state: State = None): """ Update the Group memberships for the given users state :param user: User to update for :param state: State to update user for :return: """ if state is None: state = user.profile.sta...
[ "def", "update_groups_for_user", "(", "self", ",", "user", ":", "User", ",", "state", ":", "State", "=", "None", ")", ":", "if", "state", "is", "None", ":", "state", "=", "user", ".", "profile", ".", "state", "for", "config", "in", "self", ".", "filt...
Update the Group memberships for the given users state :param user: User to update for :param state: State to update user for :return:
[ "Update", "the", "Group", "memberships", "for", "the", "given", "users", "state", ":", "param", "user", ":", "User", "to", "update", "for", ":", "param", "state", ":", "State", "to", "update", "user", "for", ":", "return", ":" ]
python
train
pycontribs/pyrax
pyrax/cloudnetworks.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudnetworks.py#L149-L168
def create(self, label=None, name=None, cidr=None): """ Wraps the basic create() call to handle specific failures. """ try: return super(CloudNetworkClient, self).create(label=label, name=name, cidr=cidr) except exc.BadRequest as e: msg...
[ "def", "create", "(", "self", ",", "label", "=", "None", ",", "name", "=", "None", ",", "cidr", "=", "None", ")", ":", "try", ":", "return", "super", "(", "CloudNetworkClient", ",", "self", ")", ".", "create", "(", "label", "=", "label", ",", "name...
Wraps the basic create() call to handle specific failures.
[ "Wraps", "the", "basic", "create", "()", "call", "to", "handle", "specific", "failures", "." ]
python
train
pycampers/ampy
ampy/files.py
https://github.com/pycampers/ampy/blob/6851f8b177c334f5ff7bd43bf07307a437433ba2/ampy/files.py#L83-L174
def ls(self, directory="/", long_format=True, recursive=False): """List the contents of the specified directory (or root if none is specified). Returns a list of strings with the names of files in the specified directory. If long_format is True then a list of 2-tuples with the name and...
[ "def", "ls", "(", "self", ",", "directory", "=", "\"/\"", ",", "long_format", "=", "True", ",", "recursive", "=", "False", ")", ":", "# Disabling for now, see https://github.com/adafruit/ampy/issues/55.", "# # Make sure directory ends in a slash.", "# if not directory.endswit...
List the contents of the specified directory (or root if none is specified). Returns a list of strings with the names of files in the specified directory. If long_format is True then a list of 2-tuples with the name and size (in bytes) of the item is returned. Note that it appears the...
[ "List", "the", "contents", "of", "the", "specified", "directory", "(", "or", "root", "if", "none", "is", "specified", ")", ".", "Returns", "a", "list", "of", "strings", "with", "the", "names", "of", "files", "in", "the", "specified", "directory", ".", "I...
python
train
usc-isi-i2/etk
etk/knowledge_graph_schema.py
https://github.com/usc-isi-i2/etk/blob/aab077c984ea20f5e8ae33af622fe11d3c4df866/etk/knowledge_graph_schema.py#L80-L103
def iso_date(d) -> str: """ Return iso format of a date Args: d: Returns: str """ if isinstance(d, datetime): return d.isoformat() elif isinstance(d, date): return datetime.combine(d, datetime.min.time()).isoformat() e...
[ "def", "iso_date", "(", "d", ")", "->", "str", ":", "if", "isinstance", "(", "d", ",", "datetime", ")", ":", "return", "d", ".", "isoformat", "(", ")", "elif", "isinstance", "(", "d", ",", "date", ")", ":", "return", "datetime", ".", "combine", "("...
Return iso format of a date Args: d: Returns: str
[ "Return", "iso", "format", "of", "a", "date" ]
python
train
gem/oq-engine
openquake/hazardlib/geo/point.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/point.py#L160-L186
def distance_to_mesh(self, mesh, with_depths=True): """ Compute distance (in km) between this point and each point of ``mesh``. :param mesh: :class:`~openquake.hazardlib.geo.mesh.Mesh` of points to calculate distance to. :param with_depths: If ``True`...
[ "def", "distance_to_mesh", "(", "self", ",", "mesh", ",", "with_depths", "=", "True", ")", ":", "if", "with_depths", ":", "if", "mesh", ".", "depths", "is", "None", ":", "mesh_depths", "=", "numpy", ".", "zeros_like", "(", "mesh", ".", "lons", ")", "el...
Compute distance (in km) between this point and each point of ``mesh``. :param mesh: :class:`~openquake.hazardlib.geo.mesh.Mesh` of points to calculate distance to. :param with_depths: If ``True`` (by default), distance is calculated between actual point ...
[ "Compute", "distance", "(", "in", "km", ")", "between", "this", "point", "and", "each", "point", "of", "mesh", "." ]
python
train
wavefrontHQ/python-client
wavefront_api_client/api/alert_api.py
https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/api/alert_api.py#L911-L931
def hide_alert(self, id, **kwargs): # noqa: E501 """Hide a specific integration alert # 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.hide_alert(id, async_re...
[ "def", "hide_alert", "(", "self", ",", "id", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "hide_alert_with_h...
Hide a specific integration alert # 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.hide_alert(id, async_req=True) >>> result = thread.get() :param asy...
[ "Hide", "a", "specific", "integration", "alert", "#", "noqa", ":", "E501" ]
python
train
cox-labs/perseuspy
perseuspy/parameters.py
https://github.com/cox-labs/perseuspy/blob/3809c1bd46512605f9e7ca7f97e026e4940ed604/perseuspy/parameters.py#L42-L49
def boolParam(parameters, name): """ boolean parameter value. :param parameters: the parameters tree. :param name: the name of the parameter. """ value = _simple_string_value(parameters, 'BoolParam', name) if value not in {'true', 'false'}: raise ValueError('BoolParam Value has to be either...
[ "def", "boolParam", "(", "parameters", ",", "name", ")", ":", "value", "=", "_simple_string_value", "(", "parameters", ",", "'BoolParam'", ",", "name", ")", "if", "value", "not", "in", "{", "'true'", ",", "'false'", "}", ":", "raise", "ValueError", "(", ...
boolean parameter value. :param parameters: the parameters tree. :param name: the name of the parameter.
[ "boolean", "parameter", "value", ".", ":", "param", "parameters", ":", "the", "parameters", "tree", ".", ":", "param", "name", ":", "the", "name", "of", "the", "parameter", "." ]
python
train
gmr/tinman
tinman/handlers/base.py
https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/handlers/base.py#L305-L310
def _set_session_cookie(self): """Set the session data cookie.""" LOGGER.debug('Setting session cookie for %s', self.session.id) self.set_secure_cookie(name=self._session_cookie_name, value=self.session.id, expires=self._cookie_expira...
[ "def", "_set_session_cookie", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "'Setting session cookie for %s'", ",", "self", ".", "session", ".", "id", ")", "self", ".", "set_secure_cookie", "(", "name", "=", "self", ".", "_session_cookie_name", ",", "val...
Set the session data cookie.
[ "Set", "the", "session", "data", "cookie", "." ]
python
train
materialsproject/pymatgen
pymatgen/core/structure.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/structure.py#L495-L520
def extract_cluster(self, target_sites, **kwargs): """ Extracts a cluster of atoms based on bond lengths Args: target_sites ([Site]): List of initial sites to nucleate cluster. \\*\\*kwargs: kwargs passed through to CovalentBond.is_bonded. Returns: [...
[ "def", "extract_cluster", "(", "self", ",", "target_sites", ",", "*", "*", "kwargs", ")", ":", "cluster", "=", "list", "(", "target_sites", ")", "others", "=", "[", "site", "for", "site", "in", "self", "if", "site", "not", "in", "cluster", "]", "size",...
Extracts a cluster of atoms based on bond lengths Args: target_sites ([Site]): List of initial sites to nucleate cluster. \\*\\*kwargs: kwargs passed through to CovalentBond.is_bonded. Returns: [Site/PeriodicSite] Cluster of atoms.
[ "Extracts", "a", "cluster", "of", "atoms", "based", "on", "bond", "lengths" ]
python
train
astroduff/commah
commah/commah.py
https://github.com/astroduff/commah/blob/3ec70338c5123a053c79ddcf2cb3beac26bc9137/commah/commah.py#L147-L172
def _delta_sigma(**cosmo): """ Perturb best-fit constant of proportionality Ascaling for rho_crit - rho_2 relation for unknown cosmology (Correa et al 2015c) Parameters ---------- cosmo : dict Dictionary of cosmological parameters, similar in format to: {'N_nu': 0,'Y_He': 0.24, ...
[ "def", "_delta_sigma", "(", "*", "*", "cosmo", ")", ":", "M8_cosmo", "=", "cp", ".", "perturbation", ".", "radius_to_mass", "(", "8", ",", "*", "*", "cosmo", ")", "perturbed_A", "=", "(", "0.796", "/", "cosmo", "[", "'sigma_8'", "]", ")", "*", "(", ...
Perturb best-fit constant of proportionality Ascaling for rho_crit - rho_2 relation for unknown cosmology (Correa et al 2015c) Parameters ---------- cosmo : dict Dictionary of cosmological parameters, similar in format to: {'N_nu': 0,'Y_He': 0.24, 'h': 0.702, 'n': 0.963,'omega_M_0':...
[ "Perturb", "best", "-", "fit", "constant", "of", "proportionality", "Ascaling", "for", "rho_crit", "-", "rho_2", "relation", "for", "unknown", "cosmology", "(", "Correa", "et", "al", "2015c", ")" ]
python
train
Esri/ArcREST
src/arcrest/manageags/_usagereports.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_usagereports.py#L110-L140
def editUsageReportSettings(self, samplingInterval, enabled=True, maxHistory=0): """ The usage reports settings are applied to the entire site. A POST request updates the usage reports settings. Inputs: samplingInterval - Defines the duration (...
[ "def", "editUsageReportSettings", "(", "self", ",", "samplingInterval", ",", "enabled", "=", "True", ",", "maxHistory", "=", "0", ")", ":", "params", "=", "{", "\"f\"", ":", "\"json\"", ",", "\"maxHistory\"", ":", "maxHistory", ",", "\"enabled\"", ":", "enab...
The usage reports settings are applied to the entire site. A POST request updates the usage reports settings. Inputs: samplingInterval - Defines the duration (in minutes) for which the usage statistics are aggregated or sampled, in-memory, before being written out t...
[ "The", "usage", "reports", "settings", "are", "applied", "to", "the", "entire", "site", ".", "A", "POST", "request", "updates", "the", "usage", "reports", "settings", "." ]
python
train
JdeRobot/base
src/drivers/drone/cmdvel.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/drone/cmdvel.py#L92-L102
def publish (self): ''' Function to publish cmdvel. ''' #print(self) #self.using_event.wait() self.lock.acquire() msg = cmdvel2PosTarget(self.vel) self.lock.release() self.pub.publish(msg)
[ "def", "publish", "(", "self", ")", ":", "#print(self)", "#self.using_event.wait()", "self", ".", "lock", ".", "acquire", "(", ")", "msg", "=", "cmdvel2PosTarget", "(", "self", ".", "vel", ")", "self", ".", "lock", ".", "release", "(", ")", "self", ".", ...
Function to publish cmdvel.
[ "Function", "to", "publish", "cmdvel", "." ]
python
train
potash/drain
drain/data.py
https://github.com/potash/drain/blob/ddd62081cb9317beb5d21f86c8b4bb196ca3d222/drain/data.py#L299-L311
def expand_counts(df, column, values=None): """ expand a column containing value:count dictionaries """ d = counts_to_dicts(df, column) if len(d) > 0: if values is None: values = set(np.concatenate(d.apply(lambda c: c.keys()).values)) for value in values: name...
[ "def", "expand_counts", "(", "df", ",", "column", ",", "values", "=", "None", ")", ":", "d", "=", "counts_to_dicts", "(", "df", ",", "column", ")", "if", "len", "(", "d", ")", ">", "0", ":", "if", "values", "is", "None", ":", "values", "=", "set"...
expand a column containing value:count dictionaries
[ "expand", "a", "column", "containing", "value", ":", "count", "dictionaries" ]
python
train
tanghaibao/goatools
goatools/evidence_codes.py
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/evidence_codes.py#L156-L163
def get_grp2code2nt(self): """Return ordered dict for group to namedtuple""" grp2code2nt = cx.OrderedDict([(g, []) for g in self.grps]) for code, ntd in self.code2nt.items(): grp2code2nt[ntd.group].append((code, ntd)) for grp, nts in grp2code2nt.items(): grp2code2...
[ "def", "get_grp2code2nt", "(", "self", ")", ":", "grp2code2nt", "=", "cx", ".", "OrderedDict", "(", "[", "(", "g", ",", "[", "]", ")", "for", "g", "in", "self", ".", "grps", "]", ")", "for", "code", ",", "ntd", "in", "self", ".", "code2nt", ".", ...
Return ordered dict for group to namedtuple
[ "Return", "ordered", "dict", "for", "group", "to", "namedtuple" ]
python
train
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/visualise.py
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/visualise.py#L762-L799
def opensignals_kwargs(obj): """ ----- Brief ----- Function used to automatically apply the OpenSignals graphical style to the toolbar of Bokeh grid plots. ----------- Description ----------- Bokeh grid plots have numerous options in order to personalise the visual aspect and functi...
[ "def", "opensignals_kwargs", "(", "obj", ")", ":", "out", "=", "None", "if", "obj", "==", "\"figure\"", ":", "out", "=", "{", "}", "elif", "obj", "==", "\"gridplot\"", ":", "out", "=", "{", "\"toolbar_options\"", ":", "{", "\"logo\"", ":", "None", "}",...
----- Brief ----- Function used to automatically apply the OpenSignals graphical style to the toolbar of Bokeh grid plots. ----------- Description ----------- Bokeh grid plots have numerous options in order to personalise the visual aspect and functionalities of plots. OpenSignals uses ...
[ "-----", "Brief", "-----", "Function", "used", "to", "automatically", "apply", "the", "OpenSignals", "graphical", "style", "to", "the", "toolbar", "of", "Bokeh", "grid", "plots", "." ]
python
train
azraq27/neural
neural/dsets.py
https://github.com/azraq27/neural/blob/fe91bfeecbf73ad99708cf5dca66cb61fcd529f5/neural/dsets.py#L287-L299
def ijk_to_xyz(dset,ijk): '''convert the dset indices ``ijk`` to RAI coordinates ``xyz``''' i = nl.dset_info(dset) orient_codes = [int(x) for x in nl.run(['@AfniOrient2RAImap',i.orient]).output.split()] orient_is = [abs(x)-1 for x in orient_codes] rai = [] for rai_i in xrange(3): ijk_i ...
[ "def", "ijk_to_xyz", "(", "dset", ",", "ijk", ")", ":", "i", "=", "nl", ".", "dset_info", "(", "dset", ")", "orient_codes", "=", "[", "int", "(", "x", ")", "for", "x", "in", "nl", ".", "run", "(", "[", "'@AfniOrient2RAImap'", ",", "i", ".", "orie...
convert the dset indices ``ijk`` to RAI coordinates ``xyz``
[ "convert", "the", "dset", "indices", "ijk", "to", "RAI", "coordinates", "xyz" ]
python
train
ewels/MultiQC
multiqc/modules/cutadapt/cutadapt.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/cutadapt/cutadapt.py#L176-L200
def cutadapt_length_trimmed_plot (self): """ Generate the trimming length plot """ description = 'This plot shows the number of reads with certain lengths of adapter trimmed. \n\ Obs/Exp shows the raw counts divided by the number expected due to sequencing errors. A defined peak \n\ may...
[ "def", "cutadapt_length_trimmed_plot", "(", "self", ")", ":", "description", "=", "'This plot shows the number of reads with certain lengths of adapter trimmed. \\n\\\n Obs/Exp shows the raw counts divided by the number expected due to sequencing errors. A defined peak \\n\\\n may be r...
Generate the trimming length plot
[ "Generate", "the", "trimming", "length", "plot" ]
python
train
stan-dev/pystan
pystan/misc.py
https://github.com/stan-dev/pystan/blob/57bdccea11888157e7aaafba083003080a934805/pystan/misc.py#L159-L167
def _format_number_si(num, n_signif_figures): """Format a number using scientific notation to given significant figures""" if math.isnan(num) or math.isinf(num): return str(num) leading, exp = '{:E}'.format(num).split('E') leading = round(float(leading), n_signif_figures - 1) exp = exp[:1] +...
[ "def", "_format_number_si", "(", "num", ",", "n_signif_figures", ")", ":", "if", "math", ".", "isnan", "(", "num", ")", "or", "math", ".", "isinf", "(", "num", ")", ":", "return", "str", "(", "num", ")", "leading", ",", "exp", "=", "'{:E}'", ".", "...
Format a number using scientific notation to given significant figures
[ "Format", "a", "number", "using", "scientific", "notation", "to", "given", "significant", "figures" ]
python
train
secdev/scapy
scapy/arch/windows/structures.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/arch/windows/structures.py#L166-L172
def GetIcmpStatistics(): """Return all Windows ICMP stats from iphlpapi""" statistics = MIB_ICMP() _GetIcmpStatistics(byref(statistics)) results = _struct_to_dict(statistics) del(statistics) return results
[ "def", "GetIcmpStatistics", "(", ")", ":", "statistics", "=", "MIB_ICMP", "(", ")", "_GetIcmpStatistics", "(", "byref", "(", "statistics", ")", ")", "results", "=", "_struct_to_dict", "(", "statistics", ")", "del", "(", "statistics", ")", "return", "results" ]
Return all Windows ICMP stats from iphlpapi
[ "Return", "all", "Windows", "ICMP", "stats", "from", "iphlpapi" ]
python
train
frigg/frigg-coverage
frigg_coverage/__init__.py
https://github.com/frigg/frigg-coverage/blob/ae7d29a8d94f3fe5405d5882cd4c4726ed638e97/frigg_coverage/__init__.py#L7-L19
def parse_coverage(coverage_report, parser): """ :param coverage_report: A string with the contents of a coverage file :type coverage_report: String :param parser: A string with name of the parser to use :type parser: String :return: Total coverage """ if parser in PARSERS: if co...
[ "def", "parse_coverage", "(", "coverage_report", ",", "parser", ")", ":", "if", "parser", "in", "PARSERS", ":", "if", "coverage_report", ":", "return", "PARSERS", "[", "parser", "]", ".", "parse_coverage_report", "(", "coverage_report", ")", "return", "None", ...
:param coverage_report: A string with the contents of a coverage file :type coverage_report: String :param parser: A string with name of the parser to use :type parser: String :return: Total coverage
[ ":", "param", "coverage_report", ":", "A", "string", "with", "the", "contents", "of", "a", "coverage", "file", ":", "type", "coverage_report", ":", "String", ":", "param", "parser", ":", "A", "string", "with", "name", "of", "the", "parser", "to", "use", ...
python
train
vtkiorg/vtki
vtki/ipy_tools.py
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/ipy_tools.py#L133-L151
def _get_scalar_names(self, limit=None): """Only give scalar options that have a varying range""" names = [] if limit == 'point': inpnames = list(self.input_dataset.point_arrays.keys()) elif limit == 'cell': inpnames = list(self.input_dataset.cell_arrays.keys()) ...
[ "def", "_get_scalar_names", "(", "self", ",", "limit", "=", "None", ")", ":", "names", "=", "[", "]", "if", "limit", "==", "'point'", ":", "inpnames", "=", "list", "(", "self", ".", "input_dataset", ".", "point_arrays", ".", "keys", "(", ")", ")", "e...
Only give scalar options that have a varying range
[ "Only", "give", "scalar", "options", "that", "have", "a", "varying", "range" ]
python
train
tanghaibao/goatools
goatools/evidence_codes.py
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/evidence_codes.py#L173-L178
def get_grp2codes(self): """Get dict of group name to namedtuples.""" grp2codes = cx.defaultdict(set) for code, ntd in self.code2nt.items(): grp2codes[ntd.group].add(code) return dict(grp2codes)
[ "def", "get_grp2codes", "(", "self", ")", ":", "grp2codes", "=", "cx", ".", "defaultdict", "(", "set", ")", "for", "code", ",", "ntd", "in", "self", ".", "code2nt", ".", "items", "(", ")", ":", "grp2codes", "[", "ntd", ".", "group", "]", ".", "add"...
Get dict of group name to namedtuples.
[ "Get", "dict", "of", "group", "name", "to", "namedtuples", "." ]
python
train
raviparekh/webapp-error-handler
app_error_handler/application_error_handler.py
https://github.com/raviparekh/webapp-error-handler/blob/11e20bea464331e254034b02661c53fb19102d4a/app_error_handler/application_error_handler.py#L9-L39
def register_app_for_error_handling(wsgi_app, app_name, app_logger, custom_logging_service=None): """Wraps a WSGI app and handles uncaught exceptions and defined exception and outputs a the exception in a structured format. Parameters: - wsgi_app is the app.wsgi_app of flask, - app_name should in co...
[ "def", "register_app_for_error_handling", "(", "wsgi_app", ",", "app_name", ",", "app_logger", ",", "custom_logging_service", "=", "None", ")", ":", "logging_service", "=", "LoggingService", "(", "app_logger", ")", "if", "custom_logging_service", "is", "None", "else",...
Wraps a WSGI app and handles uncaught exceptions and defined exception and outputs a the exception in a structured format. Parameters: - wsgi_app is the app.wsgi_app of flask, - app_name should in correct format e.g. APP_NAME_1, - app_logger is the logger object
[ "Wraps", "a", "WSGI", "app", "and", "handles", "uncaught", "exceptions", "and", "defined", "exception", "and", "outputs", "a", "the", "exception", "in", "a", "structured", "format", ".", "Parameters", ":", "-", "wsgi_app", "is", "the", "app", ".", "wsgi_app"...
python
test
dwavesystems/dwave_networkx
dwave_networkx/algorithms/elimination_ordering.py
https://github.com/dwavesystems/dwave_networkx/blob/9ea1223ddbc7e86db2f90b8b23e250e6642c3d68/dwave_networkx/algorithms/elimination_ordering.py#L730-L747
def _theorem6p1(): """See Theorem 6.1 in paper.""" pruning_set = set() def _prune(x): if len(x) <= 2: return False # this is faster than tuple(x[-3:]) key = (tuple(x[:-2]), x[-2], x[-1]) return key in pruning_set def _explored(x): if len(x) >= 3: ...
[ "def", "_theorem6p1", "(", ")", ":", "pruning_set", "=", "set", "(", ")", "def", "_prune", "(", "x", ")", ":", "if", "len", "(", "x", ")", "<=", "2", ":", "return", "False", "# this is faster than tuple(x[-3:])", "key", "=", "(", "tuple", "(", "x", "...
See Theorem 6.1 in paper.
[ "See", "Theorem", "6", ".", "1", "in", "paper", "." ]
python
train
blockstack/blockstack-core
blockstack/lib/nameset/db.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/db.py#L929-L960
def namedb_op_sanity_check( opcode, op_data, record ): """ Sanity checks over operation and state graph data: * opcode and op_data must be consistent * record must have an opcode * the given opcode must be reachable from it. """ assert 'address' in record, "BUG: current record has no 'addre...
[ "def", "namedb_op_sanity_check", "(", "opcode", ",", "op_data", ",", "record", ")", ":", "assert", "'address'", "in", "record", ",", "\"BUG: current record has no 'address' field\"", "assert", "op_data", ".", "has_key", "(", "'op'", ")", ",", "\"BUG: operation data is...
Sanity checks over operation and state graph data: * opcode and op_data must be consistent * record must have an opcode * the given opcode must be reachable from it.
[ "Sanity", "checks", "over", "operation", "and", "state", "graph", "data", ":", "*", "opcode", "and", "op_data", "must", "be", "consistent", "*", "record", "must", "have", "an", "opcode", "*", "the", "given", "opcode", "must", "be", "reachable", "from", "it...
python
train
awslabs/sockeye
sockeye/rnn_attention.py
https://github.com/awslabs/sockeye/blob/5d64a1ee1ef3cbba17c6d1d94bc061020c43f6ab/sockeye/rnn_attention.py#L91-L106
def get_attention(config: AttentionConfig, max_seq_len: int, prefix: str = C.ATTENTION_PREFIX) -> 'Attention': """ Returns an Attention instance based on attention_type. :param config: Attention configuration. :param max_seq_len: Maximum length of source sequences. :param prefix: Name prefix. :...
[ "def", "get_attention", "(", "config", ":", "AttentionConfig", ",", "max_seq_len", ":", "int", ",", "prefix", ":", "str", "=", "C", ".", "ATTENTION_PREFIX", ")", "->", "'Attention'", ":", "att_cls", "=", "Attention", ".", "get_attention_cls", "(", "config", ...
Returns an Attention instance based on attention_type. :param config: Attention configuration. :param max_seq_len: Maximum length of source sequences. :param prefix: Name prefix. :return: Instance of Attention.
[ "Returns", "an", "Attention", "instance", "based", "on", "attention_type", "." ]
python
train
Commonists/CommonsDownloader
commonsdownloader/commonsdownloader.py
https://github.com/Commonists/CommonsDownloader/blob/ac8147432b31ce3cdee5f7a75d0c48b788ee4666/commonsdownloader/commonsdownloader.py#L27-L31
def download_from_category(category_name, output_path, width): """Download files of a given category.""" file_names = get_category_files_from_api(category_name) files_to_download = izip_longest(file_names, [], fillvalue=width) download_files_if_not_in_manifest(files_to_download, output_path)
[ "def", "download_from_category", "(", "category_name", ",", "output_path", ",", "width", ")", ":", "file_names", "=", "get_category_files_from_api", "(", "category_name", ")", "files_to_download", "=", "izip_longest", "(", "file_names", ",", "[", "]", ",", "fillvalu...
Download files of a given category.
[ "Download", "files", "of", "a", "given", "category", "." ]
python
train
neurosynth/neurosynth
neurosynth/base/imageutils.py
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/imageutils.py#L98-L152
def create_grid(image, scale=4, apply_mask=True, save_file=None): """ Creates an image containing labeled cells in a 3D grid. Args: image: String or nibabel image. The image used to define the grid dimensions. Also used to define the mask to apply to the grid. Only voxels with no...
[ "def", "create_grid", "(", "image", ",", "scale", "=", "4", ",", "apply_mask", "=", "True", ",", "save_file", "=", "None", ")", ":", "if", "isinstance", "(", "image", ",", "string_types", ")", ":", "image", "=", "nb", ".", "load", "(", "image", ")", ...
Creates an image containing labeled cells in a 3D grid. Args: image: String or nibabel image. The image used to define the grid dimensions. Also used to define the mask to apply to the grid. Only voxels with non-zero values in the mask will be retained; all other voxels w...
[ "Creates", "an", "image", "containing", "labeled", "cells", "in", "a", "3D", "grid", ".", "Args", ":", "image", ":", "String", "or", "nibabel", "image", ".", "The", "image", "used", "to", "define", "the", "grid", "dimensions", ".", "Also", "used", "to", ...
python
test
IdentityPython/pysaml2
src/saml2/attribute_converter.py
https://github.com/IdentityPython/pysaml2/blob/d3aa78eeb7d37c12688f783cb4db1c7263a14ad6/src/saml2/attribute_converter.py#L236-L257
def from_dict(self, mapdict): """ Import the attribute map from a dictionary :param mapdict: The dictionary """ self.name_format = mapdict["identifier"] try: self._fro = dict( [(k.lower(), v) for k, v in mapdict["fro"].items()]) except KeyEr...
[ "def", "from_dict", "(", "self", ",", "mapdict", ")", ":", "self", ".", "name_format", "=", "mapdict", "[", "\"identifier\"", "]", "try", ":", "self", ".", "_fro", "=", "dict", "(", "[", "(", "k", ".", "lower", "(", ")", ",", "v", ")", "for", "k"...
Import the attribute map from a dictionary :param mapdict: The dictionary
[ "Import", "the", "attribute", "map", "from", "a", "dictionary" ]
python
train
danielfrg/datasciencebox
datasciencebox/salt/_modules/conda.py
https://github.com/danielfrg/datasciencebox/blob/6b7aa642c6616a46547035fcb815acc1de605a6f/datasciencebox/salt/_modules/conda.py#L115-L124
def _create_conda_cmd(conda_cmd, args=None, env=None, user=None): """ Utility to create a valid conda command """ cmd = [_get_conda_path(user=user), conda_cmd] if env: cmd.extend(['-n', env]) if args is not None and isinstance(args, list) and args != []: cmd.extend(args) retu...
[ "def", "_create_conda_cmd", "(", "conda_cmd", ",", "args", "=", "None", ",", "env", "=", "None", ",", "user", "=", "None", ")", ":", "cmd", "=", "[", "_get_conda_path", "(", "user", "=", "user", ")", ",", "conda_cmd", "]", "if", "env", ":", "cmd", ...
Utility to create a valid conda command
[ "Utility", "to", "create", "a", "valid", "conda", "command" ]
python
train
mayfield/shellish
shellish/layout/table.py
https://github.com/mayfield/shellish/blob/df0f0e4612d138c34d8cb99b66ab5b8e47f1414a/shellish/layout/table.py#L1018-L1041
def tabulate(data, header=True, headers=None, accessors=None, **table_options): """ Shortcut function to produce tabular output of data without the need to create and configure a Table instance directly. The function does however return a table instance when it's done for any further use by...
[ "def", "tabulate", "(", "data", ",", "header", "=", "True", ",", "headers", "=", "None", ",", "accessors", "=", "None", ",", "*", "*", "table_options", ")", ":", "if", "header", "and", "not", "headers", ":", "data", "=", "iter", "(", "data", ")", "...
Shortcut function to produce tabular output of data without the need to create and configure a Table instance directly. The function does however return a table instance when it's done for any further use by the user.
[ "Shortcut", "function", "to", "produce", "tabular", "output", "of", "data", "without", "the", "need", "to", "create", "and", "configure", "a", "Table", "instance", "directly", ".", "The", "function", "does", "however", "return", "a", "table", "instance", "when...
python
train
broadinstitute/fiss
firecloud/fiss.py
https://github.com/broadinstitute/fiss/blob/dddf91547479506dbbafb69ec84d44dcc4a94ab4/firecloud/fiss.py#L85-L91
def space_lock(args): """ Lock a workspace """ r = fapi.lock_workspace(args.project, args.workspace) fapi._check_response_code(r, 204) if fcconfig.verbosity: eprint('Locked workspace {0}/{1}'.format(args.project, args.workspace)) return 0
[ "def", "space_lock", "(", "args", ")", ":", "r", "=", "fapi", ".", "lock_workspace", "(", "args", ".", "project", ",", "args", ".", "workspace", ")", "fapi", ".", "_check_response_code", "(", "r", ",", "204", ")", "if", "fcconfig", ".", "verbosity", ":...
Lock a workspace
[ "Lock", "a", "workspace" ]
python
train
saltstack/salt
salt/pillar/__init__.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/pillar/__init__.py#L463-L470
def __gather_avail(self): ''' Gather the lists of available sls data from the master ''' avail = {} for saltenv in self._get_envs(): avail[saltenv] = self.client.list_states(saltenv) return avail
[ "def", "__gather_avail", "(", "self", ")", ":", "avail", "=", "{", "}", "for", "saltenv", "in", "self", ".", "_get_envs", "(", ")", ":", "avail", "[", "saltenv", "]", "=", "self", ".", "client", ".", "list_states", "(", "saltenv", ")", "return", "ava...
Gather the lists of available sls data from the master
[ "Gather", "the", "lists", "of", "available", "sls", "data", "from", "the", "master" ]
python
train
jfinkels/birkhoff
birkhoff.py
https://github.com/jfinkels/birkhoff/blob/86fff692c9cfb7217e51e25868230f4e0b53caa0/birkhoff.py#L123-L237
def birkhoff_von_neumann_decomposition(D): """Returns the Birkhoff--von Neumann decomposition of the doubly stochastic matrix `D`. The input `D` must be a square NumPy array representing a doubly stochastic matrix (that is, a matrix whose entries are nonnegative reals and whose row sums and column ...
[ "def", "birkhoff_von_neumann_decomposition", "(", "D", ")", ":", "m", ",", "n", "=", "D", ".", "shape", "if", "m", "!=", "n", ":", "raise", "ValueError", "(", "'Input matrix must be square ({} x {})'", ".", "format", "(", "m", ",", "n", ")", ")", "indices"...
Returns the Birkhoff--von Neumann decomposition of the doubly stochastic matrix `D`. The input `D` must be a square NumPy array representing a doubly stochastic matrix (that is, a matrix whose entries are nonnegative reals and whose row sums and column sums are all 1). Each doubly stochastic matrix...
[ "Returns", "the", "Birkhoff", "--", "von", "Neumann", "decomposition", "of", "the", "doubly", "stochastic", "matrix", "D", "." ]
python
valid
stevearc/dynamo3
dynamo3/rate.py
https://github.com/stevearc/dynamo3/blob/f897c40ece28586272dbcab8f0d99a14a1831dda/dynamo3/rate.py#L27-L31
def add(self, now, num): """ Add a timestamp and date to the data """ if num == 0: return self.points.append((now, num))
[ "def", "add", "(", "self", ",", "now", ",", "num", ")", ":", "if", "num", "==", "0", ":", "return", "self", ".", "points", ".", "append", "(", "(", "now", ",", "num", ")", ")" ]
Add a timestamp and date to the data
[ "Add", "a", "timestamp", "and", "date", "to", "the", "data" ]
python
train
saltstack/salt
salt/modules/netbox.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L224-L256
def create_device_type(model, manufacturer): ''' .. versionadded:: 2019.2.0 Create a device type. If the manufacturer doesn't exist, create a new manufacturer. model String of device model, e.g., ``MX480`` manufacturer String of device manufacturer, e.g., ``Juniper`` CLI Examp...
[ "def", "create_device_type", "(", "model", ",", "manufacturer", ")", ":", "nb_type", "=", "get_", "(", "'dcim'", ",", "'device-types'", ",", "model", "=", "model", ")", "if", "nb_type", ":", "return", "False", "nb_man", "=", "get_", "(", "'dcim'", ",", "...
.. versionadded:: 2019.2.0 Create a device type. If the manufacturer doesn't exist, create a new manufacturer. model String of device model, e.g., ``MX480`` manufacturer String of device manufacturer, e.g., ``Juniper`` CLI Example: .. code-block:: bash salt myminion netb...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
python
train
googleapis/google-cloud-python
redis/google/cloud/redis_v1beta1/gapic/cloud_redis_client.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/redis/google/cloud/redis_v1beta1/gapic/cloud_redis_client.py#L310-L366
def get_instance( self, name, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Gets the details of a specific Redis instance. Example: >>> from google.cloud import redis_...
[ "def", "get_instance", "(", "self", ",", "name", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "metadata"...
Gets the details of a specific Redis instance. Example: >>> from google.cloud import redis_v1beta1 >>> >>> client = redis_v1beta1.CloudRedisClient() >>> >>> name = client.instance_path('[PROJECT]', '[LOCATION]', '[INSTANCE]') >>> ...
[ "Gets", "the", "details", "of", "a", "specific", "Redis", "instance", "." ]
python
train
noirbizarre/django-eztables
eztables/views.py
https://github.com/noirbizarre/django-eztables/blob/347e74dcc08121d20f4cf942181d873dbe33b995/eztables/views.py#L35-L48
def get_real_field(model, field_name): ''' Get the real field from a model given its name. Handle nested models recursively (aka. ``__`` lookups) ''' parts = field_name.split('__') field = model._meta.get_field(parts[0]) if len(parts) == 1: return model._meta.get_field(field_name) ...
[ "def", "get_real_field", "(", "model", ",", "field_name", ")", ":", "parts", "=", "field_name", ".", "split", "(", "'__'", ")", "field", "=", "model", ".", "_meta", ".", "get_field", "(", "parts", "[", "0", "]", ")", "if", "len", "(", "parts", ")", ...
Get the real field from a model given its name. Handle nested models recursively (aka. ``__`` lookups)
[ "Get", "the", "real", "field", "from", "a", "model", "given", "its", "name", "." ]
python
train
vxgmichel/aiostream
aiostream/stream/create.py
https://github.com/vxgmichel/aiostream/blob/43bdf04ab19108a3f1b5a472062e1392a26cbcf8/aiostream/stream/create.py#L111-L118
def range(*args, interval=0): """Generate a given range of numbers. It supports the same arguments as the builtin function. An optional interval can be given to space the values out. """ agen = from_iterable.raw(builtins.range(*args)) return time.spaceout.raw(agen, interval) if interval else ag...
[ "def", "range", "(", "*", "args", ",", "interval", "=", "0", ")", ":", "agen", "=", "from_iterable", ".", "raw", "(", "builtins", ".", "range", "(", "*", "args", ")", ")", "return", "time", ".", "spaceout", ".", "raw", "(", "agen", ",", "interval",...
Generate a given range of numbers. It supports the same arguments as the builtin function. An optional interval can be given to space the values out.
[ "Generate", "a", "given", "range", "of", "numbers", "." ]
python
train
sepandhaghighi/pycm
pycm/pycm_overall_func.py
https://github.com/sepandhaghighi/pycm/blob/cb03258afd6a821d10acba73c965aaac174bedcd/pycm/pycm_overall_func.py#L108-L133
def overall_MCC_calc(classes, table, TOP, P): """ Calculate Overall_MCC. :param classes: classes :type classes : list :param table: input matrix :type table : dict :param TOP: test outcome positive :type TOP : dict :param P: condition positive :type P : dict :return: Overal...
[ "def", "overall_MCC_calc", "(", "classes", ",", "table", ",", "TOP", ",", "P", ")", ":", "try", ":", "cov_x_y", "=", "0", "cov_x_x", "=", "0", "cov_y_y", "=", "0", "matrix_sum", "=", "sum", "(", "list", "(", "TOP", ".", "values", "(", ")", ")", "...
Calculate Overall_MCC. :param classes: classes :type classes : list :param table: input matrix :type table : dict :param TOP: test outcome positive :type TOP : dict :param P: condition positive :type P : dict :return: Overall_MCC as float
[ "Calculate", "Overall_MCC", "." ]
python
train
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L7370-L7374
def xpathRegisterNs(self, prefix, ns_uri): """Register a new namespace. If @ns_uri is None it unregisters the namespace """ ret = libxml2mod.xmlXPathRegisterNs(self._o, prefix, ns_uri) return ret
[ "def", "xpathRegisterNs", "(", "self", ",", "prefix", ",", "ns_uri", ")", ":", "ret", "=", "libxml2mod", ".", "xmlXPathRegisterNs", "(", "self", ".", "_o", ",", "prefix", ",", "ns_uri", ")", "return", "ret" ]
Register a new namespace. If @ns_uri is None it unregisters the namespace
[ "Register", "a", "new", "namespace", ".", "If" ]
python
train
gitpython-developers/smmap
smmap/util.py
https://github.com/gitpython-developers/smmap/blob/48e9e30b0ef3c24ac7ed88e6e3bfa37dc945bf4c/smmap/util.py#L32-L43
def align_to_mmap(num, round_up): """ Align the given integer number to the closest page offset, which usually is 4096 bytes. :param round_up: if True, the next higher multiple of page size is used, otherwise the lower page_size will be used (i.e. if True, 1 becomes 4096, otherwise it becomes 0) ...
[ "def", "align_to_mmap", "(", "num", ",", "round_up", ")", ":", "res", "=", "(", "num", "//", "ALLOCATIONGRANULARITY", ")", "*", "ALLOCATIONGRANULARITY", "if", "round_up", "and", "(", "res", "!=", "num", ")", ":", "res", "+=", "ALLOCATIONGRANULARITY", "# END ...
Align the given integer number to the closest page offset, which usually is 4096 bytes. :param round_up: if True, the next higher multiple of page size is used, otherwise the lower page_size will be used (i.e. if True, 1 becomes 4096, otherwise it becomes 0) :return: num rounded to closest page
[ "Align", "the", "given", "integer", "number", "to", "the", "closest", "page", "offset", "which", "usually", "is", "4096", "bytes", "." ]
python
train
mcs07/PubChemPy
pubchempy.py
https://github.com/mcs07/PubChemPy/blob/e3c4f4a9b6120433e5cc3383464c7a79e9b2b86e/pubchempy.py#L695-L714
def _setup_bonds(self): """Derive Bond objects from the record.""" self._bonds = {} if 'bonds' not in self.record: return # Create bonds aid1s = self.record['bonds']['aid1'] aid2s = self.record['bonds']['aid2'] orders = self.record['bonds']['order'] ...
[ "def", "_setup_bonds", "(", "self", ")", ":", "self", ".", "_bonds", "=", "{", "}", "if", "'bonds'", "not", "in", "self", ".", "record", ":", "return", "# Create bonds", "aid1s", "=", "self", ".", "record", "[", "'bonds'", "]", "[", "'aid1'", "]", "a...
Derive Bond objects from the record.
[ "Derive", "Bond", "objects", "from", "the", "record", "." ]
python
train
h2oai/h2o-3
scripts/extractGLRMRuntimeJavaLog.py
https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/scripts/extractGLRMRuntimeJavaLog.py#L31-L112
def extractRunInto(javaLogText): """ This function will extract the various operation time for GLRM model building iterations. :param javaLogText: :return: """ global g_initialXY global g_reguarlize_Y global g_regularize_X_objective global g_updateX global g_updateY global g...
[ "def", "extractRunInto", "(", "javaLogText", ")", ":", "global", "g_initialXY", "global", "g_reguarlize_Y", "global", "g_regularize_X_objective", "global", "g_updateX", "global", "g_updateY", "global", "g_objective", "global", "g_stepsize", "global", "g_history", "if", ...
This function will extract the various operation time for GLRM model building iterations. :param javaLogText: :return:
[ "This", "function", "will", "extract", "the", "various", "operation", "time", "for", "GLRM", "model", "building", "iterations", "." ]
python
test
opennode/waldur-core
waldur_core/logging/elasticsearch_client.py
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/logging/elasticsearch_client.py#L89-L94
def _execute_if_not_empty(func): """ Execute function only if one of input parameters is not empty """ def wrapper(*args, **kwargs): if any(args[1:]) or any(kwargs.items()): return func(*args, **kwargs) return wrapper
[ "def", "_execute_if_not_empty", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "any", "(", "args", "[", "1", ":", "]", ")", "or", "any", "(", "kwargs", ".", "items", "(", ")", ")", ":", "retu...
Execute function only if one of input parameters is not empty
[ "Execute", "function", "only", "if", "one", "of", "input", "parameters", "is", "not", "empty" ]
python
train
python-fedex-devs/python-fedex
fedex/services/ship_service.py
https://github.com/python-fedex-devs/python-fedex/blob/7ea2ca80c362f5dbbc8d959ab47648c7a4ab24eb/fedex/services/ship_service.py#L191-L198
def _prepare_wsdl_objects(self): """ Preps the WSDL data structures for the user. """ self.DeletionControlType = self.client.factory.create('DeletionControlType') self.TrackingId = self.client.factory.create('TrackingId') self.TrackingId.TrackingIdType = self.client.fact...
[ "def", "_prepare_wsdl_objects", "(", "self", ")", ":", "self", ".", "DeletionControlType", "=", "self", ".", "client", ".", "factory", ".", "create", "(", "'DeletionControlType'", ")", "self", ".", "TrackingId", "=", "self", ".", "client", ".", "factory", "....
Preps the WSDL data structures for the user.
[ "Preps", "the", "WSDL", "data", "structures", "for", "the", "user", "." ]
python
train
saltstack/salt
salt/modules/lxd.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/lxd.py#L3354-L3397
def snapshots_get(container, name, remote_addr=None, cert=None, key=None, verify_cert=True): ''' Get information about snapshot for a container container : The name of the container to get. name : The name of the snapshot. remote_addr : An URL to a remote...
[ "def", "snapshots_get", "(", "container", ",", "name", ",", "remote_addr", "=", "None", ",", "cert", "=", "None", ",", "key", "=", "None", ",", "verify_cert", "=", "True", ")", ":", "container", "=", "container_get", "(", "container", ",", "remote_addr", ...
Get information about snapshot for a container container : The name of the container to get. name : The name of the snapshot. remote_addr : An URL to a remote server. The 'cert' and 'key' fields must also be provided if 'remote_addr' is defined. Examples: ...
[ "Get", "information", "about", "snapshot", "for", "a", "container" ]
python
train
onelogin/python3-saml
src/onelogin/saml2/response.py
https://github.com/onelogin/python3-saml/blob/064b7275fba1e5f39a9116ba1cdcc5d01fc34daa/src/onelogin/saml2/response.py#L590-L657
def process_signed_elements(self): """ Verifies the signature nodes: - Checks that are Response or Assertion - Check that IDs and reference URI are unique and consistent. :returns: The signed elements tag names :rtype: list """ sign_nodes = self.__query...
[ "def", "process_signed_elements", "(", "self", ")", ":", "sign_nodes", "=", "self", ".", "__query", "(", "'//ds:Signature'", ")", "signed_elements", "=", "[", "]", "verified_seis", "=", "[", "]", "verified_ids", "=", "[", "]", "response_tag", "=", "'{%s}Respon...
Verifies the signature nodes: - Checks that are Response or Assertion - Check that IDs and reference URI are unique and consistent. :returns: The signed elements tag names :rtype: list
[ "Verifies", "the", "signature", "nodes", ":", "-", "Checks", "that", "are", "Response", "or", "Assertion", "-", "Check", "that", "IDs", "and", "reference", "URI", "are", "unique", "and", "consistent", "." ]
python
train
acutesoftware/virtual-AI-simulator
scripts/recipe_finder.py
https://github.com/acutesoftware/virtual-AI-simulator/blob/57de679a5b1a58c38fefe6aea58af1f3a7e79c58/scripts/recipe_finder.py#L32-L55
def main(): """ script to find a list of recipes for a group of people with specific likes and dislikes. Output of script best ingred = ['Tea', 'Tofu', 'Cheese', 'Cucumber', 'Salad', 'Chocolate'] worst ingred = ['Fish', 'Lamb', 'Pie', 'Asparagus', 'Chicken', 'Turnips'] ...
[ "def", "main", "(", ")", ":", "s", "=", "rawdata", ".", "content", ".", "DataFiles", "(", ")", "all_ingredients", "=", "list", "(", "s", ".", "get_collist_by_name", "(", "data_files", "[", "1", "]", "[", "'file'", "]", ",", "data_files", "[", "1", "]...
script to find a list of recipes for a group of people with specific likes and dislikes. Output of script best ingred = ['Tea', 'Tofu', 'Cheese', 'Cucumber', 'Salad', 'Chocolate'] worst ingred = ['Fish', 'Lamb', 'Pie', 'Asparagus', 'Chicken', 'Turnips'] Use this = Tofu ...
[ "script", "to", "find", "a", "list", "of", "recipes", "for", "a", "group", "of", "people", "with", "specific", "likes", "and", "dislikes", ".", "Output", "of", "script" ]
python
train
fprimex/zdesk
zdesk/zdesk_api.py
https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L929-L932
def community_topic_create(self, data, **kwargs): "https://developer.zendesk.com/rest_api/docs/help_center/topics#create-topic" api_path = "/api/v2/community/topics.json" return self.call(api_path, method="POST", data=data, **kwargs)
[ "def", "community_topic_create", "(", "self", ",", "data", ",", "*", "*", "kwargs", ")", ":", "api_path", "=", "\"/api/v2/community/topics.json\"", "return", "self", ".", "call", "(", "api_path", ",", "method", "=", "\"POST\"", ",", "data", "=", "data", ",",...
https://developer.zendesk.com/rest_api/docs/help_center/topics#create-topic
[ "https", ":", "//", "developer", ".", "zendesk", ".", "com", "/", "rest_api", "/", "docs", "/", "help_center", "/", "topics#create", "-", "topic" ]
python
train
SBRG/ssbio
ssbio/databases/pdb.py
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/pdb.py#L287-L346
def map_uniprot_resnum_to_pdb(uniprot_resnum, chain_id, sifts_file): """Map a UniProt residue number to its corresponding PDB residue number. This function requires that the SIFTS file be downloaded, and also a chain ID (as different chains may have different mappings). Args: uniprot_resnum (i...
[ "def", "map_uniprot_resnum_to_pdb", "(", "uniprot_resnum", ",", "chain_id", ",", "sifts_file", ")", ":", "# Load the xml with lxml", "parser", "=", "etree", ".", "XMLParser", "(", "ns_clean", "=", "True", ")", "tree", "=", "etree", ".", "parse", "(", "sifts_file...
Map a UniProt residue number to its corresponding PDB residue number. This function requires that the SIFTS file be downloaded, and also a chain ID (as different chains may have different mappings). Args: uniprot_resnum (int): integer of the residue number you'd like to map chain_id (str):...
[ "Map", "a", "UniProt", "residue", "number", "to", "its", "corresponding", "PDB", "residue", "number", "." ]
python
train
zabertech/python-izaber
izaber/date.py
https://github.com/zabertech/python-izaber/blob/729bf9ef637e084c8ab3cc16c34cf659d3a79ee4/izaber/date.py#L340-L348
def daily_hours(self,local=False): """ This returns a number from 0 to 24 that describes the number of hours passed in a day. This is very useful for hr.attendances """ data = self.get(local) daily_hours = (data.hour + data.minute / 60.0 + ...
[ "def", "daily_hours", "(", "self", ",", "local", "=", "False", ")", ":", "data", "=", "self", ".", "get", "(", "local", ")", "daily_hours", "=", "(", "data", ".", "hour", "+", "data", ".", "minute", "/", "60.0", "+", "data", ".", "second", "/", "...
This returns a number from 0 to 24 that describes the number of hours passed in a day. This is very useful for hr.attendances
[ "This", "returns", "a", "number", "from", "0", "to", "24", "that", "describes", "the", "number", "of", "hours", "passed", "in", "a", "day", ".", "This", "is", "very", "useful", "for", "hr", ".", "attendances" ]
python
train
tensorflow/tensor2tensor
tensor2tensor/models/research/moe_experiments.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/moe_experiments.py#L503-L512
def denoise_v1_m15(): """Denoising experiment.""" hparams = xmoe2_v1() # no local attention # TODO(noam): non-masked version of local-attention hparams.decoder_layers = [ "att" if l == "local_att" else l for l in hparams.decoder_layers] hparams.decoder_type = "denoising" hparams.noising_spec_train =...
[ "def", "denoise_v1_m15", "(", ")", ":", "hparams", "=", "xmoe2_v1", "(", ")", "# no local attention", "# TODO(noam): non-masked version of local-attention", "hparams", ".", "decoder_layers", "=", "[", "\"att\"", "if", "l", "==", "\"local_att\"", "else", "l", "for", ...
Denoising experiment.
[ "Denoising", "experiment", "." ]
python
train
fishtown-analytics/dbt
core/dbt/adapters/cache.py
https://github.com/fishtown-analytics/dbt/blob/aa4f771df28b307af0cf9fe2fc24432f10a8236b/core/dbt/adapters/cache.py#L188-L197
def remove_schema(self, database, schema): """Remove a schema from the set of known schemas (case-insensitive) If the schema does not exist, it will be ignored - it could just be a temporary table. :param str database: The database name to remove. :param str schema: The schema ...
[ "def", "remove_schema", "(", "self", ",", "database", ",", "schema", ")", ":", "self", ".", "schemas", ".", "discard", "(", "(", "_lower", "(", "database", ")", ",", "_lower", "(", "schema", ")", ")", ")" ]
Remove a schema from the set of known schemas (case-insensitive) If the schema does not exist, it will be ignored - it could just be a temporary table. :param str database: The database name to remove. :param str schema: The schema name to remove.
[ "Remove", "a", "schema", "from", "the", "set", "of", "known", "schemas", "(", "case", "-", "insensitive", ")" ]
python
train
log2timeline/plaso
plaso/lib/timelib.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/lib/timelib.py#L356-L362
def RoundToSeconds(cls, timestamp): """Takes a timestamp value and rounds it to a second precision.""" leftovers = timestamp % definitions.MICROSECONDS_PER_SECOND scrubbed = timestamp - leftovers rounded = round(float(leftovers) / definitions.MICROSECONDS_PER_SECOND) return int(scrubbed + rounded *...
[ "def", "RoundToSeconds", "(", "cls", ",", "timestamp", ")", ":", "leftovers", "=", "timestamp", "%", "definitions", ".", "MICROSECONDS_PER_SECOND", "scrubbed", "=", "timestamp", "-", "leftovers", "rounded", "=", "round", "(", "float", "(", "leftovers", ")", "/...
Takes a timestamp value and rounds it to a second precision.
[ "Takes", "a", "timestamp", "value", "and", "rounds", "it", "to", "a", "second", "precision", "." ]
python
train
saltstack/salt
salt/states/keystone.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/keystone.py#L402-L429
def tenant_absent(name, profile=None, **connection_args): ''' Ensure that the keystone tenant is absent. name The name of the tenant that should not exist ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': 'Tenant / project "{0}" is already a...
[ "def", "tenant_absent", "(", "name", ",", "profile", "=", "None", ",", "*", "*", "connection_args", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "'Tenant / proje...
Ensure that the keystone tenant is absent. name The name of the tenant that should not exist
[ "Ensure", "that", "the", "keystone", "tenant", "is", "absent", "." ]
python
train
sethmlarson/virtualbox-python
virtualbox/library.py
https://github.com/sethmlarson/virtualbox-python/blob/706c8e3f6e3aee17eb06458e73cbb4bc2d37878b/virtualbox/library.py#L10621-L10639
def authenticate_external(self, auth_params): """Verify credentials using the external auth library. in auth_params of type str The auth parameters, credentials, etc. out result of type str The authentification result. """ if not isinstance(auth_params,...
[ "def", "authenticate_external", "(", "self", ",", "auth_params", ")", ":", "if", "not", "isinstance", "(", "auth_params", ",", "list", ")", ":", "raise", "TypeError", "(", "\"auth_params can only be an instance of type list\"", ")", "for", "a", "in", "auth_params", ...
Verify credentials using the external auth library. in auth_params of type str The auth parameters, credentials, etc. out result of type str The authentification result.
[ "Verify", "credentials", "using", "the", "external", "auth", "library", "." ]
python
train
junaruga/rpm-py-installer
install.py
https://github.com/junaruga/rpm-py-installer/blob/12f45feb0ba533dec8d0d16ef1e9b7fb8cfbd4ed/install.py#L28-L54
def run(self): """Run install process.""" try: self.linux.verify_system_status() except InstallSkipError: Log.info('Install skipped.') return work_dir = tempfile.mkdtemp(suffix='-rpm-py-installer') Log.info("Created working directory '{0}'".fo...
[ "def", "run", "(", "self", ")", ":", "try", ":", "self", ".", "linux", ".", "verify_system_status", "(", ")", "except", "InstallSkipError", ":", "Log", ".", "info", "(", "'Install skipped.'", ")", "return", "work_dir", "=", "tempfile", ".", "mkdtemp", "(",...
Run install process.
[ "Run", "install", "process", "." ]
python
train
inveniosoftware/invenio-files-rest
invenio_files_rest/views.py
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/views.py#L244-L253
def pass_bucket(f): """Decorate to retrieve a bucket.""" @wraps(f) def decorate(*args, **kwargs): bucket_id = kwargs.pop('bucket_id') bucket = Bucket.get(as_uuid(bucket_id)) if not bucket: abort(404, 'Bucket does not exist.') return f(bucket=bucket, *args, **kwarg...
[ "def", "pass_bucket", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "decorate", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "bucket_id", "=", "kwargs", ".", "pop", "(", "'bucket_id'", ")", "bucket", "=", "Bucket", ".", "get", "...
Decorate to retrieve a bucket.
[ "Decorate", "to", "retrieve", "a", "bucket", "." ]
python
train
nfcpy/nfcpy
src/nfc/ndef/handover.py
https://github.com/nfcpy/nfcpy/blob/6649146d1afdd5e82b2b6b1ea00aa58d50785117/src/nfc/ndef/handover.py#L739-L745
def type(self): """The alternative carrier type name, equivalent to :attr:`Carrier.record.type` or :attr:`Carrier.record.carrier_type` if the carrier is specified as a :class:`HandoverCarrierRecord`.""" return self.record.type if self.record.type != "urn:nfc:wkt:Hc" \ ...
[ "def", "type", "(", "self", ")", ":", "return", "self", ".", "record", ".", "type", "if", "self", ".", "record", ".", "type", "!=", "\"urn:nfc:wkt:Hc\"", "else", "self", ".", "record", ".", "carrier_type" ]
The alternative carrier type name, equivalent to :attr:`Carrier.record.type` or :attr:`Carrier.record.carrier_type` if the carrier is specified as a :class:`HandoverCarrierRecord`.
[ "The", "alternative", "carrier", "type", "name", "equivalent", "to", ":", "attr", ":", "Carrier", ".", "record", ".", "type", "or", ":", "attr", ":", "Carrier", ".", "record", ".", "carrier_type", "if", "the", "carrier", "is", "specified", "as", "a", ":"...
python
train
santosjorge/cufflinks
cufflinks/tools.py
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/tools.py#L579-L595
def get_base_layout(figs): """ Generates a layout with the union of all properties of multiple figures' layouts Parameters: ----------- fig : list(Figures) List of Plotly Figures """ layout={} for fig in figs: if not isinstance(fig,dict): fig=fig.to_dict() for k,v in list(fig['layout'].items()): ...
[ "def", "get_base_layout", "(", "figs", ")", ":", "layout", "=", "{", "}", "for", "fig", "in", "figs", ":", "if", "not", "isinstance", "(", "fig", ",", "dict", ")", ":", "fig", "=", "fig", ".", "to_dict", "(", ")", "for", "k", ",", "v", "in", "l...
Generates a layout with the union of all properties of multiple figures' layouts Parameters: ----------- fig : list(Figures) List of Plotly Figures
[ "Generates", "a", "layout", "with", "the", "union", "of", "all", "properties", "of", "multiple", "figures", "layouts" ]
python
train
BDNYC/astrodbkit
astrodbkit/astrodb.py
https://github.com/BDNYC/astrodbkit/blob/02c03c5e91aa7c7b0f3b5fa95bcf71e33ffcee09/astrodbkit/astrodb.py#L36-L69
def create_database(dbpath, schema='', overwrite=True): """ Create a new database at the given dbpath Parameters ---------- dbpath: str The full path for the new database, including the filename and .db file extension. schema: str The path to the .sql schema for the database ...
[ "def", "create_database", "(", "dbpath", ",", "schema", "=", "''", ",", "overwrite", "=", "True", ")", ":", "if", "dbpath", ".", "endswith", "(", "'.db'", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "dbpath", ")", "and", "overwrite", ":", ...
Create a new database at the given dbpath Parameters ---------- dbpath: str The full path for the new database, including the filename and .db file extension. schema: str The path to the .sql schema for the database overwrite: bool Overwrite dbpath if it already exists
[ "Create", "a", "new", "database", "at", "the", "given", "dbpath" ]
python
train
INM-6/hybridLFPy
hybridLFPy/gdf.py
https://github.com/INM-6/hybridLFPy/blob/c38bdf38982c4624c2f70caeb50c40f1d5980abd/hybridLFPy/gdf.py#L318-L341
def neurons(self): """ Return list of neuron indices. Parameters ---------- None Returns ------- list list of neuron indices See also -------- sqlite3.connect.cursor """ ...
[ "def", "neurons", "(", "self", ")", ":", "self", ".", "cursor", ".", "execute", "(", "'SELECT DISTINCT neuron FROM spikes ORDER BY neuron'", ")", "sel", "=", "self", ".", "cursor", ".", "fetchall", "(", ")", "return", "np", ".", "array", "(", "sel", ")", "...
Return list of neuron indices. Parameters ---------- None Returns ------- list list of neuron indices See also -------- sqlite3.connect.cursor
[ "Return", "list", "of", "neuron", "indices", "." ]
python
train
awslabs/aws-cfn-template-flip
cfn_flip/main.py
https://github.com/awslabs/aws-cfn-template-flip/blob/837576bea243e3f5efb0a20b84802371272e2d33/cfn_flip/main.py#L31-L65
def main(ctx, **kwargs): """ AWS CloudFormation Template Flip is a tool that converts AWS CloudFormation templates between JSON and YAML formats, making use of the YAML format's short function syntax where possible. """ in_format = kwargs.pop('in_format') out_format = kwargs.pop('out_format'...
[ "def", "main", "(", "ctx", ",", "*", "*", "kwargs", ")", ":", "in_format", "=", "kwargs", ".", "pop", "(", "'in_format'", ")", "out_format", "=", "kwargs", ".", "pop", "(", "'out_format'", ")", "or", "kwargs", ".", "pop", "(", "'out_flag'", ")", "no_...
AWS CloudFormation Template Flip is a tool that converts AWS CloudFormation templates between JSON and YAML formats, making use of the YAML format's short function syntax where possible.
[ "AWS", "CloudFormation", "Template", "Flip", "is", "a", "tool", "that", "converts", "AWS", "CloudFormation", "templates", "between", "JSON", "and", "YAML", "formats", "making", "use", "of", "the", "YAML", "format", "s", "short", "function", "syntax", "where", ...
python
train
chaoss/grimoirelab-cereslib
cereslib/enrich/enrich.py
https://github.com/chaoss/grimoirelab-cereslib/blob/5110e6ca490a4f24bec3124286ebf51fd4e08bdd/cereslib/enrich/enrich.py#L452-L467
def __remove_surrogates(self, s, method='replace'): """ Remove surrogates in the specified string """ if type(s) == list and len(s) == 1: if self.__is_surrogate_escaped(s[0]): return s[0].encode('utf-8', method).decode('utf-8') else: retur...
[ "def", "__remove_surrogates", "(", "self", ",", "s", ",", "method", "=", "'replace'", ")", ":", "if", "type", "(", "s", ")", "==", "list", "and", "len", "(", "s", ")", "==", "1", ":", "if", "self", ".", "__is_surrogate_escaped", "(", "s", "[", "0",...
Remove surrogates in the specified string
[ "Remove", "surrogates", "in", "the", "specified", "string" ]
python
train
greenape/mktheapidocs
mktheapidocs/mkapi.py
https://github.com/greenape/mktheapidocs/blob/a45e8b43ddd80ed360fe1e98d4f73dc11c4e7bf7/mktheapidocs/mkapi.py#L635-L666
def attributes_section(thing, doc, header_level): """ Generate an attributes section for classes. Prefers type annotations, if they are present. Parameters ---------- thing : class Class to document doc : dict Numpydoc output header_level : int Number of `#`s to...
[ "def", "attributes_section", "(", "thing", ",", "doc", ",", "header_level", ")", ":", "# Get Attributes", "if", "not", "inspect", ".", "isclass", "(", "thing", ")", ":", "return", "[", "]", "props", ",", "class_doc", "=", "_split_props", "(", "thing", ",",...
Generate an attributes section for classes. Prefers type annotations, if they are present. Parameters ---------- thing : class Class to document doc : dict Numpydoc output header_level : int Number of `#`s to use for header Returns ------- list of str ...
[ "Generate", "an", "attributes", "section", "for", "classes", "." ]
python
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/turntable.py#L111-L123
def orbit(self, azim, elev): """ Orbits the camera around the center position. Parameters ---------- azim : float Angle in degrees to rotate horizontally around the center point. elev : float Angle in degrees to rotate vertically around the center point. ...
[ "def", "orbit", "(", "self", ",", "azim", ",", "elev", ")", ":", "self", ".", "azimuth", "+=", "azim", "self", ".", "elevation", "=", "np", ".", "clip", "(", "self", ".", "elevation", "+", "elev", ",", "-", "90", ",", "90", ")", "self", ".", "v...
Orbits the camera around the center position. Parameters ---------- azim : float Angle in degrees to rotate horizontally around the center point. elev : float Angle in degrees to rotate vertically around the center point.
[ "Orbits", "the", "camera", "around", "the", "center", "position", "." ]
python
train
Netflix-Skunkworks/cloudaux
cloudaux/gcp/auth.py
https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/gcp/auth.py#L101-L107
def get_gcp_client(**kwargs): """Public GCP client builder.""" return _gcp_client(project=kwargs['project'], mod_name=kwargs['mod_name'], pkg_name=kwargs.get('pkg_name', 'google.cloud'), key_file=kwargs.get('key_file', None), http_auth=kwargs....
[ "def", "get_gcp_client", "(", "*", "*", "kwargs", ")", ":", "return", "_gcp_client", "(", "project", "=", "kwargs", "[", "'project'", "]", ",", "mod_name", "=", "kwargs", "[", "'mod_name'", "]", ",", "pkg_name", "=", "kwargs", ".", "get", "(", "'pkg_name...
Public GCP client builder.
[ "Public", "GCP", "client", "builder", "." ]
python
valid
nuagenetworks/bambou
bambou/nurest_request.py
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_request.py#L120-L127
def set_header(self, header, value): """ Set header value """ # requests>=2.11 only accepts `str` or `bytes` header values # raising an exception here, instead of leaving it to `requests` makes # it easy to know where we passed a wrong header type in the code. if not isinstance(v...
[ "def", "set_header", "(", "self", ",", "header", ",", "value", ")", ":", "# requests>=2.11 only accepts `str` or `bytes` header values", "# raising an exception here, instead of leaving it to `requests` makes", "# it easy to know where we passed a wrong header type in the code.", "if", "...
Set header value
[ "Set", "header", "value" ]
python
train
worstcase/blockade
blockade/state.py
https://github.com/worstcase/blockade/blob/3dc6ad803f0b0d56586dec9542a6a06aa06cf569/blockade/state.py#L108-L121
def load(self): '''Try to load a blockade state file in the current directory''' try: with open(self._state_file) as f: state = yaml.safe_load(f) self._containers = state['containers'] except (IOError, OSError) as err: if err.errno == errno...
[ "def", "load", "(", "self", ")", ":", "try", ":", "with", "open", "(", "self", ".", "_state_file", ")", "as", "f", ":", "state", "=", "yaml", ".", "safe_load", "(", "f", ")", "self", ".", "_containers", "=", "state", "[", "'containers'", "]", "exce...
Try to load a blockade state file in the current directory
[ "Try", "to", "load", "a", "blockade", "state", "file", "in", "the", "current", "directory" ]
python
valid
goose3/goose3
goose3/extractors/content.py
https://github.com/goose3/goose3/blob/e6994b1b1826af2720a091d1bff5ca15594f558d/goose3/extractors/content.py#L321-L332
def nodes_to_check(self, docs): """\ returns a list of nodes we want to search on like paragraphs and tables """ nodes_to_check = [] for doc in docs: for tag in ['p', 'pre', 'td']: items = self.parser.getElementsByTag(doc, tag=tag) ...
[ "def", "nodes_to_check", "(", "self", ",", "docs", ")", ":", "nodes_to_check", "=", "[", "]", "for", "doc", "in", "docs", ":", "for", "tag", "in", "[", "'p'", ",", "'pre'", ",", "'td'", "]", ":", "items", "=", "self", ".", "parser", ".", "getElemen...
\ returns a list of nodes we want to search on like paragraphs and tables
[ "\\", "returns", "a", "list", "of", "nodes", "we", "want", "to", "search", "on", "like", "paragraphs", "and", "tables" ]
python
valid
markovmodel/msmtools
msmtools/analysis/dense/fingerprints.py
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/fingerprints.py#L151-L168
def expectation(P, obs): r"""Equilibrium expectation of given observable. Parameters ---------- P : (M, M) ndarray Transition matrix obs : (M,) ndarray Observable, represented as vector on state space Returns ------- x : float Expectation value """ pi =...
[ "def", "expectation", "(", "P", ",", "obs", ")", ":", "pi", "=", "statdist", "(", "P", ")", "return", "np", ".", "dot", "(", "pi", ",", "obs", ")" ]
r"""Equilibrium expectation of given observable. Parameters ---------- P : (M, M) ndarray Transition matrix obs : (M,) ndarray Observable, represented as vector on state space Returns ------- x : float Expectation value
[ "r", "Equilibrium", "expectation", "of", "given", "observable", "." ]
python
train
IRC-SPHERE/HyperStream
hyperstream/factor/factor.py
https://github.com/IRC-SPHERE/HyperStream/blob/98478f4d31ed938f4aa7c958ed0d4c3ffcb2e780/hyperstream/factor/factor.py#L324-L388
def execute(self, time_interval): """ Execute the factor over the given time interval. Note that this is normally done by the workflow, but can also be done on the factor directly :param time_interval: The time interval :return: self (for chaining) """ logging.in...
[ "def", "execute", "(", "self", ",", "time_interval", ")", ":", "logging", ".", "info", "(", "'{} running from {} to {}'", ".", "format", "(", "self", ".", "tool", ".", "__class__", ".", "__name__", ",", "time_interval", ".", "start", ",", "time_interval", "....
Execute the factor over the given time interval. Note that this is normally done by the workflow, but can also be done on the factor directly :param time_interval: The time interval :return: self (for chaining)
[ "Execute", "the", "factor", "over", "the", "given", "time", "interval", ".", "Note", "that", "this", "is", "normally", "done", "by", "the", "workflow", "but", "can", "also", "be", "done", "on", "the", "factor", "directly" ]
python
train
blockstack/blockstack-core
blockstack/lib/nameset/namedb.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L921-L929
def get_namespace_at( self, namespace_id, block_number ): """ Generate and return the sequence of states a namespace record was in at a particular block number. Includes expired namespaces by default. """ cur = self.db.cursor() return namedb_get_namespace_at(cur...
[ "def", "get_namespace_at", "(", "self", ",", "namespace_id", ",", "block_number", ")", ":", "cur", "=", "self", ".", "db", ".", "cursor", "(", ")", "return", "namedb_get_namespace_at", "(", "cur", ",", "namespace_id", ",", "block_number", ",", "include_expired...
Generate and return the sequence of states a namespace record was in at a particular block number. Includes expired namespaces by default.
[ "Generate", "and", "return", "the", "sequence", "of", "states", "a", "namespace", "record", "was", "in", "at", "a", "particular", "block", "number", "." ]
python
train
kshlm/gant
gant/utils/gant_docker.py
https://github.com/kshlm/gant/blob/eabaa17ebfd31b1654ee1f27e7026f6d7b370609/gant/utils/gant_docker.py#L189-L201
def ip_cmd(self, name): """ Print ip of given container """ if not self.container_exists(name=name): exit('Unknown container {0}'.format(name)) ip = self.get_container_ip(name) if not ip: exit("Failed to get network address for" "...
[ "def", "ip_cmd", "(", "self", ",", "name", ")", ":", "if", "not", "self", ".", "container_exists", "(", "name", "=", "name", ")", ":", "exit", "(", "'Unknown container {0}'", ".", "format", "(", "name", ")", ")", "ip", "=", "self", ".", "get_container_...
Print ip of given container
[ "Print", "ip", "of", "given", "container" ]
python
train
Min-ops/cruddy
cruddy/__init__.py
https://github.com/Min-ops/cruddy/blob/b9ba3dda1757e1075bc1c62a6f43473eea27de41/cruddy/__init__.py#L332-L348
def update(self, item, encrypt=True, **kwargs): """ Updates the item based on the current values of the dictionary passed in. """ response = self._new_response() if self._check_supported_op('update', response): if self._prototype_handler.check(item, 'update', ...
[ "def", "update", "(", "self", ",", "item", ",", "encrypt", "=", "True", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "_new_response", "(", ")", "if", "self", ".", "_check_supported_op", "(", "'update'", ",", "response", ")", ":", ...
Updates the item based on the current values of the dictionary passed in.
[ "Updates", "the", "item", "based", "on", "the", "current", "values", "of", "the", "dictionary", "passed", "in", "." ]
python
train
theiviaxx/python-perforce
perforce/models.py
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/models.py#L839-L862
def revert(self, unchanged=False): """Reverts any file changes :param unchanged: Only revert if the file is unchanged :type unchanged: bool """ cmd = ['revert'] if unchanged: cmd.append('-a') wasadd = self.action == 'add' cmd.append(self.dep...
[ "def", "revert", "(", "self", ",", "unchanged", "=", "False", ")", ":", "cmd", "=", "[", "'revert'", "]", "if", "unchanged", ":", "cmd", ".", "append", "(", "'-a'", ")", "wasadd", "=", "self", ".", "action", "==", "'add'", "cmd", ".", "append", "("...
Reverts any file changes :param unchanged: Only revert if the file is unchanged :type unchanged: bool
[ "Reverts", "any", "file", "changes" ]
python
train
pebble/libpebble2
libpebble2/services/install.py
https://github.com/pebble/libpebble2/blob/23e2eb92cfc084e6f9e8c718711ac994ef606d18/libpebble2/services/install.py#L54-L70
def install(self, force_install=False): """ Installs an app. Blocks until the installation is complete, or raises :exc:`AppInstallError` if it fails. While this method runs, "progress" events will be emitted regularly with the following signature: :: (sent_this_interval, sent_total,...
[ "def", "install", "(", "self", ",", "force_install", "=", "False", ")", ":", "if", "not", "(", "force_install", "or", "self", ".", "_bundle", ".", "should_permit_install", "(", ")", ")", ":", "raise", "AppInstallError", "(", "\"This pbw is not supported on this ...
Installs an app. Blocks until the installation is complete, or raises :exc:`AppInstallError` if it fails. While this method runs, "progress" events will be emitted regularly with the following signature: :: (sent_this_interval, sent_total, total_size) :param force_install: Install even if ...
[ "Installs", "an", "app", ".", "Blocks", "until", "the", "installation", "is", "complete", "or", "raises", ":", "exc", ":", "AppInstallError", "if", "it", "fails", "." ]
python
train
Josef-Friedrich/phrydy
phrydy/utils.py
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/utils.py#L61-L92
def syspath(path, prefix=True): """Convert a path for use by the operating system. In particular, paths on Windows must receive a magic prefix and must be converted to Unicode before they are sent to the OS. To disable the magic prefix on Windows, set `prefix` to False---but only do this if you *rea...
[ "def", "syspath", "(", "path", ",", "prefix", "=", "True", ")", ":", "# Don't do anything if we're not on windows", "if", "os", ".", "path", ".", "__name__", "!=", "'ntpath'", ":", "return", "path", "if", "not", "isinstance", "(", "path", ",", "six", ".", ...
Convert a path for use by the operating system. In particular, paths on Windows must receive a magic prefix and must be converted to Unicode before they are sent to the OS. To disable the magic prefix on Windows, set `prefix` to False---but only do this if you *really* know what you're doing.
[ "Convert", "a", "path", "for", "use", "by", "the", "operating", "system", ".", "In", "particular", "paths", "on", "Windows", "must", "receive", "a", "magic", "prefix", "and", "must", "be", "converted", "to", "Unicode", "before", "they", "are", "sent", "to"...
python
train
dossier/dossier.web
dossier/web/routes.py
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/routes.py#L483-L495
def v1_folder_delete(request, response, kvlclient, fid, sfid=None, cid=None, subid=None): '''Deletes a folder, subfolder or item. The routes for this endpoint are: * ``DELETE /dossier/v1/folder/<fid>`` * ``DELETE /dossier/v1/folder/<fid>/subfolder/<sfid>`` * ``DELETE /dossier/...
[ "def", "v1_folder_delete", "(", "request", ",", "response", ",", "kvlclient", ",", "fid", ",", "sfid", "=", "None", ",", "cid", "=", "None", ",", "subid", "=", "None", ")", ":", "new_folders", "(", "kvlclient", ",", "request", ")", ".", "delete", "(", ...
Deletes a folder, subfolder or item. The routes for this endpoint are: * ``DELETE /dossier/v1/folder/<fid>`` * ``DELETE /dossier/v1/folder/<fid>/subfolder/<sfid>`` * ``DELETE /dossier/v1/folder/<fid>/subfolder/<sfid>/<cid>`` * ``DELETE /dossier/v1/folder/<fid>/subfolder/<sfid>/<cid>/<subid>``
[ "Deletes", "a", "folder", "subfolder", "or", "item", "." ]
python
train
gboeing/osmnx
osmnx/pois.py
https://github.com/gboeing/osmnx/blob/be59fd313bcb68af8fc79242c56194f1247e26e2/osmnx/pois.py#L135-L166
def parse_polygonal_poi(coords, response): """ Parse areal POI way polygons from OSM node coords. Parameters ---------- coords : dict dict of node IDs and their lat, lon coordinates Returns ------- dict of POIs containing each's nodes, polygon geometry, and osmid """ i...
[ "def", "parse_polygonal_poi", "(", "coords", ",", "response", ")", ":", "if", "'type'", "in", "response", "and", "response", "[", "'type'", "]", "==", "'way'", ":", "nodes", "=", "response", "[", "'nodes'", "]", "try", ":", "polygon", "=", "Polygon", "("...
Parse areal POI way polygons from OSM node coords. Parameters ---------- coords : dict dict of node IDs and their lat, lon coordinates Returns ------- dict of POIs containing each's nodes, polygon geometry, and osmid
[ "Parse", "areal", "POI", "way", "polygons", "from", "OSM", "node", "coords", "." ]
python
train
ray-project/ray
python/ray/tune/automlboard/backend/collector.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/automlboard/backend/collector.py#L117-L131
def _initialize(self): """Initialize collector worker thread, Log path will be checked first. Records in DB backend will be cleared. """ if not os.path.exists(self._logdir): raise CollectorError("Log directory %s not exists" % self._logdir) self.logger.info("Collect...
[ "def", "_initialize", "(", "self", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "_logdir", ")", ":", "raise", "CollectorError", "(", "\"Log directory %s not exists\"", "%", "self", ".", "_logdir", ")", "self", ".", "logger", ...
Initialize collector worker thread, Log path will be checked first. Records in DB backend will be cleared.
[ "Initialize", "collector", "worker", "thread", "Log", "path", "will", "be", "checked", "first", "." ]
python
train
numenta/nupic
src/nupic/encoders/adaptive_scalar.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/encoders/adaptive_scalar.py#L169-L182
def encodeIntoArray(self, input, output,learn=None): """ [overrides nupic.encoders.scalar.ScalarEncoder.encodeIntoArray] """ self.recordNum +=1 if learn is None: learn = self._learningEnabled if input == SENTINEL_VALUE_FOR_MISSING_DATA: output[0:self.n] = 0 elif not math.isnan...
[ "def", "encodeIntoArray", "(", "self", ",", "input", ",", "output", ",", "learn", "=", "None", ")", ":", "self", ".", "recordNum", "+=", "1", "if", "learn", "is", "None", ":", "learn", "=", "self", ".", "_learningEnabled", "if", "input", "==", "SENTINE...
[overrides nupic.encoders.scalar.ScalarEncoder.encodeIntoArray]
[ "[", "overrides", "nupic", ".", "encoders", ".", "scalar", ".", "ScalarEncoder", ".", "encodeIntoArray", "]" ]
python
valid
cbclab/MOT
mot/library_functions/__init__.py
https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/library_functions/__init__.py#L605-L614
def get_kernel_data(self): """Get the kernel data needed for this optimization routine to work.""" return { 'scratch_mot_float_type': LocalMemory( 'mot_float_type', 8 + 2 * self._var_replace_dict['NMR_OBSERVATIONS'] + ...
[ "def", "get_kernel_data", "(", "self", ")", ":", "return", "{", "'scratch_mot_float_type'", ":", "LocalMemory", "(", "'mot_float_type'", ",", "8", "+", "2", "*", "self", ".", "_var_replace_dict", "[", "'NMR_OBSERVATIONS'", "]", "+", "5", "*", "self", ".", "_...
Get the kernel data needed for this optimization routine to work.
[ "Get", "the", "kernel", "data", "needed", "for", "this", "optimization", "routine", "to", "work", "." ]
python
train
derpferd/little-python
littlepython/parser.py
https://github.com/derpferd/little-python/blob/3f89c74cffb6532c12c5b40843bd8ff8605638ba/littlepython/parser.py#L118-L139
def loop(self): """ loop : 'for' init; ctrl; inc block """ self.eat(TokenTypes.FOR_LOOP) init = NoOp() if self.cur_token.type != TokenTypes.SEMI_COLON: init = self.assign_statement() else: self.eat(TokenTypes.SEMI_COLON) ctrl...
[ "def", "loop", "(", "self", ")", ":", "self", ".", "eat", "(", "TokenTypes", ".", "FOR_LOOP", ")", "init", "=", "NoOp", "(", ")", "if", "self", ".", "cur_token", ".", "type", "!=", "TokenTypes", ".", "SEMI_COLON", ":", "init", "=", "self", ".", "as...
loop : 'for' init; ctrl; inc block
[ "loop", ":", "for", "init", ";", "ctrl", ";", "inc", "block" ]
python
train