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
alimanfoo/csvvalidator
csvvalidator.py
https://github.com/alimanfoo/csvvalidator/blob/50a86eefdc549c48f65a91a5c0a66099010ee65d/csvvalidator.py#L958-L971
def search_pattern(regex): """ Return a value check function which raises a ValueError if the supplied regular expression does not match anywhere in the value, see also `re.search`. """ prog = re.compile(regex) def checker(v): result = prog.search(v) if result is None: ...
[ "def", "search_pattern", "(", "regex", ")", ":", "prog", "=", "re", ".", "compile", "(", "regex", ")", "def", "checker", "(", "v", ")", ":", "result", "=", "prog", ".", "search", "(", "v", ")", "if", "result", "is", "None", ":", "raise", "ValueErro...
Return a value check function which raises a ValueError if the supplied regular expression does not match anywhere in the value, see also `re.search`.
[ "Return", "a", "value", "check", "function", "which", "raises", "a", "ValueError", "if", "the", "supplied", "regular", "expression", "does", "not", "match", "anywhere", "in", "the", "value", "see", "also", "re", ".", "search", "." ]
python
valid
ChrisCummins/labm8
labtypes.py
https://github.com/ChrisCummins/labm8/blob/dd10d67a757aefb180cb508f86696f99440c94f5/labtypes.py#L85-L103
def dict_values(src): """ Recursively get values in dict. Unlike the builtin dict.values() function, this method will descend into nested dicts, returning all nested values. Arguments: src (dict): Source dict. Returns: list: List of values. """ for v in src.values(): ...
[ "def", "dict_values", "(", "src", ")", ":", "for", "v", "in", "src", ".", "values", "(", ")", ":", "if", "isinstance", "(", "v", ",", "dict", ")", ":", "for", "v", "in", "dict_values", "(", "v", ")", ":", "yield", "v", "else", ":", "yield", "v"...
Recursively get values in dict. Unlike the builtin dict.values() function, this method will descend into nested dicts, returning all nested values. Arguments: src (dict): Source dict. Returns: list: List of values.
[ "Recursively", "get", "values", "in", "dict", "." ]
python
train
coded-by-hand/mass
env/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg/pip/index.py
https://github.com/coded-by-hand/mass/blob/59005479efed3cd8598a8f0c66791a4482071899/env/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg/pip/index.py#L628-L635
def get_requirement_from_url(url): """Get a requirement from the URL, if possible. This looks for #egg in the URL""" link = Link(url) egg_info = link.egg_fragment if not egg_info: egg_info = splitext(link.filename)[0] return package_to_requirement(egg_info)
[ "def", "get_requirement_from_url", "(", "url", ")", ":", "link", "=", "Link", "(", "url", ")", "egg_info", "=", "link", ".", "egg_fragment", "if", "not", "egg_info", ":", "egg_info", "=", "splitext", "(", "link", ".", "filename", ")", "[", "0", "]", "r...
Get a requirement from the URL, if possible. This looks for #egg in the URL
[ "Get", "a", "requirement", "from", "the", "URL", "if", "possible", ".", "This", "looks", "for", "#egg", "in", "the", "URL" ]
python
train
PyCQA/astroid
astroid/scoped_nodes.py
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/scoped_nodes.py#L2113-L2162
def scope_lookup(self, node, name, offset=0): """Lookup where the given name is assigned. :param node: The node to look for assignments up to. Any assignments after the given node are ignored. :type node: NodeNG :param name: The name to find assignments for. :type n...
[ "def", "scope_lookup", "(", "self", ",", "node", ",", "name", ",", "offset", "=", "0", ")", ":", "# If the name looks like a builtin name, just try to look", "# into the upper scope of this class. We might have a", "# decorator that it's poorly named after a builtin object", "# ins...
Lookup where the given name is assigned. :param node: The node to look for assignments up to. Any assignments after the given node are ignored. :type node: NodeNG :param name: The name to find assignments for. :type name: str :param offset: The line offset to filte...
[ "Lookup", "where", "the", "given", "name", "is", "assigned", "." ]
python
train
samuelcolvin/pydantic
pydantic/validators.py
https://github.com/samuelcolvin/pydantic/blob/bff8a1789dfde2c38928cced6640887b53615aa3/pydantic/validators.py#L252-L263
def ip_v6_network_validator(v: Any) -> IPv6Network: """ Assume IPv6Network initialised with a default ``strict`` argument See more: https://docs.python.org/library/ipaddress.html#ipaddress.IPv6Network """ if isinstance(v, IPv6Network): return v with change_exception(errors.IPv6Netw...
[ "def", "ip_v6_network_validator", "(", "v", ":", "Any", ")", "->", "IPv6Network", ":", "if", "isinstance", "(", "v", ",", "IPv6Network", ")", ":", "return", "v", "with", "change_exception", "(", "errors", ".", "IPv6NetworkError", ",", "ValueError", ")", ":",...
Assume IPv6Network initialised with a default ``strict`` argument See more: https://docs.python.org/library/ipaddress.html#ipaddress.IPv6Network
[ "Assume", "IPv6Network", "initialised", "with", "a", "default", "strict", "argument" ]
python
train
BerkeleyAutomation/autolab_core
autolab_core/data_stream_recorder.py
https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/data_stream_recorder.py#L193-L202
def _flush(self): """ Returns a list of all current data """ if self._recording: raise Exception("Cannot flush data queue while recording!") if self._saving_cache: logging.warn("Flush when using cache means unsaved data will be lost and not returned!") self._c...
[ "def", "_flush", "(", "self", ")", ":", "if", "self", ".", "_recording", ":", "raise", "Exception", "(", "\"Cannot flush data queue while recording!\"", ")", "if", "self", ".", "_saving_cache", ":", "logging", ".", "warn", "(", "\"Flush when using cache means unsave...
Returns a list of all current data
[ "Returns", "a", "list", "of", "all", "current", "data" ]
python
train
Peter-Slump/python-keycloak-client
src/keycloak/client.py
https://github.com/Peter-Slump/python-keycloak-client/blob/379ae58f3c65892327b0c98c06d4982aa83f357e/src/keycloak/client.py#L45-L56
def session(self): """ Get session object to benefit from connection pooling. http://docs.python-requests.org/en/master/user/advanced/#session-objects :rtype: requests.Session """ if self._session is None: self._session = requests.Session() self....
[ "def", "session", "(", "self", ")", ":", "if", "self", ".", "_session", "is", "None", ":", "self", ".", "_session", "=", "requests", ".", "Session", "(", ")", "self", ".", "_session", ".", "headers", ".", "update", "(", "self", ".", "_headers", ")", ...
Get session object to benefit from connection pooling. http://docs.python-requests.org/en/master/user/advanced/#session-objects :rtype: requests.Session
[ "Get", "session", "object", "to", "benefit", "from", "connection", "pooling", "." ]
python
train
senaite/senaite.core
bika/lims/browser/analyses/view.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/browser/analyses/view.py#L830-L865
def _folder_item_instrument(self, analysis_brain, item): """Fills the analysis' instrument to the item passed in. :param analysis_brain: Brain that represents an analysis :param item: analysis' dictionary counterpart that represents a row """ item['Instrument'] = '' if n...
[ "def", "_folder_item_instrument", "(", "self", ",", "analysis_brain", ",", "item", ")", ":", "item", "[", "'Instrument'", "]", "=", "''", "if", "not", "analysis_brain", ".", "getInstrumentEntryOfResults", ":", "# Manual entry of results, instrument is not allowed", "ite...
Fills the analysis' instrument to the item passed in. :param analysis_brain: Brain that represents an analysis :param item: analysis' dictionary counterpart that represents a row
[ "Fills", "the", "analysis", "instrument", "to", "the", "item", "passed", "in", "." ]
python
train
NaPs/Kolekto
kolekto/commands/importer.py
https://github.com/NaPs/Kolekto/blob/29c5469da8782780a06bf9a76c59414bb6fd8fe3/kolekto/commands/importer.py#L88-L98
def list_attachments(fullname): """ List attachment for the specified fullname. """ parent, filename = os.path.split(fullname) filename_without_ext, ext = os.path.splitext(filename) attachments = [] for found_filename in os.listdir(parent): found_filename_without_ext, _ = os.path.splitex...
[ "def", "list_attachments", "(", "fullname", ")", ":", "parent", ",", "filename", "=", "os", ".", "path", ".", "split", "(", "fullname", ")", "filename_without_ext", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "attachments", ...
List attachment for the specified fullname.
[ "List", "attachment", "for", "the", "specified", "fullname", "." ]
python
train
google/grr
grr/server/grr_response_server/databases/mem_hunts.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L114-L119
def ReadHuntObject(self, hunt_id): """Reads a hunt object from the database.""" try: return self._DeepCopy(self.hunts[hunt_id]) except KeyError: raise db.UnknownHuntError(hunt_id)
[ "def", "ReadHuntObject", "(", "self", ",", "hunt_id", ")", ":", "try", ":", "return", "self", ".", "_DeepCopy", "(", "self", ".", "hunts", "[", "hunt_id", "]", ")", "except", "KeyError", ":", "raise", "db", ".", "UnknownHuntError", "(", "hunt_id", ")" ]
Reads a hunt object from the database.
[ "Reads", "a", "hunt", "object", "from", "the", "database", "." ]
python
train
carpedm20/ndrive
ndrive/models.py
https://github.com/carpedm20/ndrive/blob/ac58eaf8a8d46292ad752bb38047f65838b8ad2b/ndrive/models.py#L426-L519
def getList(self, dummy = 56184, orgresource = '/', type = 1, dept = 0, sort = 'name', order = 'asc', startnum = 0, pagingrow = 1000): """GetList Args: dummy: ??? orgresource: Directory path to get the file list ex) /Picture/ type: 1 => only director...
[ "def", "getList", "(", "self", ",", "dummy", "=", "56184", ",", "orgresource", "=", "'/'", ",", "type", "=", "1", ",", "dept", "=", "0", ",", "sort", "=", "'name'", ",", "order", "=", "'asc'", ",", "startnum", "=", "0", ",", "pagingrow", "=", "10...
GetList Args: dummy: ??? orgresource: Directory path to get the file list ex) /Picture/ type: 1 => only directories with idxfolder property 2 => only files 3 => directories and files with thumbnail info ...
[ "GetList" ]
python
train
locationlabs/mockredis
mockredis/client.py
https://github.com/locationlabs/mockredis/blob/fd4e3117066ff0c24e86ebca007853a8092e3254/mockredis/client.py#L1019-L1026
def sismember(self, name, value): """Emulate sismember.""" redis_set = self._get_set(name, 'SISMEMBER') if not redis_set: return 0 result = self._encode(value) in redis_set return 1 if result else 0
[ "def", "sismember", "(", "self", ",", "name", ",", "value", ")", ":", "redis_set", "=", "self", ".", "_get_set", "(", "name", ",", "'SISMEMBER'", ")", "if", "not", "redis_set", ":", "return", "0", "result", "=", "self", ".", "_encode", "(", "value", ...
Emulate sismember.
[ "Emulate", "sismember", "." ]
python
train
crackinglandia/pype32
pype32/utils.py
https://github.com/crackinglandia/pype32/blob/192fd14dfc0dd36d953739a81c17fbaf5e3d6076/pype32/utils.py#L266-L282
def readAlignedString(self, align = 4): """ Reads an ASCII string aligned to the next align-bytes boundary. @type align: int @param align: (Optional) The value we want the ASCII string to be aligned. @rtype: str @return: A 4-bytes aligned (default) ASCI...
[ "def", "readAlignedString", "(", "self", ",", "align", "=", "4", ")", ":", "s", "=", "self", ".", "readString", "(", ")", "r", "=", "align", "-", "len", "(", "s", ")", "%", "align", "while", "r", ":", "s", "+=", "self", ".", "data", "[", "self"...
Reads an ASCII string aligned to the next align-bytes boundary. @type align: int @param align: (Optional) The value we want the ASCII string to be aligned. @rtype: str @return: A 4-bytes aligned (default) ASCII string.
[ "Reads", "an", "ASCII", "string", "aligned", "to", "the", "next", "align", "-", "bytes", "boundary", "." ]
python
train
google/grr
grr/server/grr_response_server/artifact_registry.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/artifact_registry.py#L68-L80
def AddDatastore(self, urn): """Adds a datastore URN as a source. Args: urn: an RDF URN value of the datastore. Returns: True if the datastore is not an already existing source. """ if urn not in self._datastores: self._datastores.add(urn) return True return False
[ "def", "AddDatastore", "(", "self", ",", "urn", ")", ":", "if", "urn", "not", "in", "self", ".", "_datastores", ":", "self", ".", "_datastores", ".", "add", "(", "urn", ")", "return", "True", "return", "False" ]
Adds a datastore URN as a source. Args: urn: an RDF URN value of the datastore. Returns: True if the datastore is not an already existing source.
[ "Adds", "a", "datastore", "URN", "as", "a", "source", "." ]
python
train
arne-cl/discoursegraphs
src/discoursegraphs/relabel.py
https://github.com/arne-cl/discoursegraphs/blob/842f0068a3190be2c75905754521b176b25a54fb/src/discoursegraphs/relabel.py#L25-L93
def relabel_nodes(G, mapping, copy=True): """Relabel the nodes of the graph G. Parameters ---------- G : graph A NetworkX graph mapping : dictionary A dictionary with the old labels as keys and new labels as values. A partial mapping is allowed. copy : bool (optional, def...
[ "def", "relabel_nodes", "(", "G", ",", "mapping", ",", "copy", "=", "True", ")", ":", "# you can pass a function f(old_label)->new_label", "# but we'll just make a dictionary here regardless", "if", "not", "hasattr", "(", "mapping", ",", "\"__getitem__\"", ")", ":", "m"...
Relabel the nodes of the graph G. Parameters ---------- G : graph A NetworkX graph mapping : dictionary A dictionary with the old labels as keys and new labels as values. A partial mapping is allowed. copy : bool (optional, default=True) If True return a copy, or if Fa...
[ "Relabel", "the", "nodes", "of", "the", "graph", "G", "." ]
python
train
Azure/azure-uamqp-python
uamqp/connection.py
https://github.com/Azure/azure-uamqp-python/blob/b67e4fcaf2e8a337636947523570239c10a58ae2/uamqp/connection.py#L158-L188
def _state_changed(self, previous_state, new_state): """Callback called whenever the underlying Connection undergoes a change of state. This function wraps the states as Enums for logging purposes. :param previous_state: The previous Connection state. :type previous_state: int ...
[ "def", "_state_changed", "(", "self", ",", "previous_state", ",", "new_state", ")", ":", "try", ":", "try", ":", "_previous_state", "=", "c_uamqp", ".", "ConnectionState", "(", "previous_state", ")", "except", "ValueError", ":", "_previous_state", "=", "c_uamqp"...
Callback called whenever the underlying Connection undergoes a change of state. This function wraps the states as Enums for logging purposes. :param previous_state: The previous Connection state. :type previous_state: int :param new_state: The new Connection state. :type ...
[ "Callback", "called", "whenever", "the", "underlying", "Connection", "undergoes", "a", "change", "of", "state", ".", "This", "function", "wraps", "the", "states", "as", "Enums", "for", "logging", "purposes", ".", ":", "param", "previous_state", ":", "The", "pr...
python
train
xtuml/pyxtuml
bridgepoint/oal.py
https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/bridgepoint/oal.py#L1254-L1258
def p_port_invocation_assignment_statement(self, p): '''statement : SEND variable_access EQUAL implicit_invocation''' p[4].__class__ = PortInvocationNode p[0] = AssignmentNode(variable_access=p[2], expression=p[4])
[ "def", "p_port_invocation_assignment_statement", "(", "self", ",", "p", ")", ":", "p", "[", "4", "]", ".", "__class__", "=", "PortInvocationNode", "p", "[", "0", "]", "=", "AssignmentNode", "(", "variable_access", "=", "p", "[", "2", "]", ",", "expression"...
statement : SEND variable_access EQUAL implicit_invocation
[ "statement", ":", "SEND", "variable_access", "EQUAL", "implicit_invocation" ]
python
test
chaoss/grimoirelab-perceval
perceval/backends/core/jira.py
https://github.com/chaoss/grimoirelab-perceval/blob/41c908605e88b7ebc3a536c643fa0f212eaf9e0e/perceval/backends/core/jira.py#L221-L234
def parse_issues(raw_page): """Parse a JIRA API raw response. The method parses the API response retrieving the issues from the received items :param items: items from where to parse the issues :returns: a generator of issues """ raw_issues = json.loads(raw_pag...
[ "def", "parse_issues", "(", "raw_page", ")", ":", "raw_issues", "=", "json", ".", "loads", "(", "raw_page", ")", "issues", "=", "raw_issues", "[", "'issues'", "]", "for", "issue", "in", "issues", ":", "yield", "issue" ]
Parse a JIRA API raw response. The method parses the API response retrieving the issues from the received items :param items: items from where to parse the issues :returns: a generator of issues
[ "Parse", "a", "JIRA", "API", "raw", "response", "." ]
python
test
kkujawinski/git-pre-push-hook
src/git_pre_push_hook/engine.py
https://github.com/kkujawinski/git-pre-push-hook/blob/b62f4199150de2d6ec3f6f383ad69b0dddf9948d/src/git_pre_push_hook/engine.py#L103-L136
def get_user_modified_lines(self): """ Output: {file_path: [(line_a_start, line_a_end), (line_b_start, line_b_end)]} Lines ranges are sorted and not overlapping """ # I assume that git diff: # - doesn't mix diffs from different files, # - diffs are not overlappin...
[ "def", "get_user_modified_lines", "(", "self", ")", ":", "# I assume that git diff:", "# - doesn't mix diffs from different files,", "# - diffs are not overlapping", "# - diffs are sorted based on line numbers", "output", "=", "{", "}", "FILE_NAME_RE", "=", "r'^\\+\\+\\+ (.+)$'", "...
Output: {file_path: [(line_a_start, line_a_end), (line_b_start, line_b_end)]} Lines ranges are sorted and not overlapping
[ "Output", ":", "{", "file_path", ":", "[", "(", "line_a_start", "line_a_end", ")", "(", "line_b_start", "line_b_end", ")", "]", "}" ]
python
train
Qiskit/qiskit-terra
qiskit/transpiler/passmanager.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/transpiler/passmanager.py#L237-L247
def remove_flow_controller(cls, name): """ Removes a flow controller. Args: name (string): Name of the controller to remove. Raises: KeyError: If the controller to remove was not registered. """ if name not in cls.registered_controllers: ...
[ "def", "remove_flow_controller", "(", "cls", ",", "name", ")", ":", "if", "name", "not", "in", "cls", ".", "registered_controllers", ":", "raise", "KeyError", "(", "\"Flow controller not found: %s\"", "%", "name", ")", "del", "cls", ".", "registered_controllers", ...
Removes a flow controller. Args: name (string): Name of the controller to remove. Raises: KeyError: If the controller to remove was not registered.
[ "Removes", "a", "flow", "controller", ".", "Args", ":", "name", "(", "string", ")", ":", "Name", "of", "the", "controller", "to", "remove", ".", "Raises", ":", "KeyError", ":", "If", "the", "controller", "to", "remove", "was", "not", "registered", "." ]
python
test
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_0/work/work_client.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_0/work/work_client.py#L165-L201
def get_board_mapping_parent_items(self, team_context, child_backlog_context_category_ref_name, workitem_ids): """GetBoardMappingParentItems. [Preview API] Returns the list of parent field filter model for the given list of workitem ids :param :class:`<TeamContext> <azure.devops.v5_0.work.models...
[ "def", "get_board_mapping_parent_items", "(", "self", ",", "team_context", ",", "child_backlog_context_category_ref_name", ",", "workitem_ids", ")", ":", "project", "=", "None", "team", "=", "None", "if", "team_context", "is", "not", "None", ":", "if", "team_context...
GetBoardMappingParentItems. [Preview API] Returns the list of parent field filter model for the given list of workitem ids :param :class:`<TeamContext> <azure.devops.v5_0.work.models.TeamContext>` team_context: The team context for the operation :param str child_backlog_context_category_ref_name...
[ "GetBoardMappingParentItems", ".", "[", "Preview", "API", "]", "Returns", "the", "list", "of", "parent", "field", "filter", "model", "for", "the", "given", "list", "of", "workitem", "ids", ":", "param", ":", "class", ":", "<TeamContext", ">", "<azure", ".", ...
python
train
tjcsl/ion
intranet/apps/dashboard/views.py
https://github.com/tjcsl/ion/blob/5d722b0725d572039bb0929fd5715a4070c82c72/intranet/apps/dashboard/views.py#L25-L37
def get_fcps_emerg(request): """Return FCPS emergency information.""" try: emerg = get_emerg() except Exception: logger.info("Unable to fetch FCPS emergency info") emerg = {"status": False} if emerg["status"] or ("show_emerg" in request.GET): msg = emerg["message"] ...
[ "def", "get_fcps_emerg", "(", "request", ")", ":", "try", ":", "emerg", "=", "get_emerg", "(", ")", "except", "Exception", ":", "logger", ".", "info", "(", "\"Unable to fetch FCPS emergency info\"", ")", "emerg", "=", "{", "\"status\"", ":", "False", "}", "i...
Return FCPS emergency information.
[ "Return", "FCPS", "emergency", "information", "." ]
python
train
troeger/opensubmit
web/opensubmit/models/submission.py
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/models/submission.py#L276-L280
def author_list(self): ''' The list of authors als text, for admin submission list overview.''' author_list = [self.submitter] + \ [author for author in self.authors.all().exclude(pk=self.submitter.pk)] return ",\n".join([author.get_full_name() for author in author_list])
[ "def", "author_list", "(", "self", ")", ":", "author_list", "=", "[", "self", ".", "submitter", "]", "+", "[", "author", "for", "author", "in", "self", ".", "authors", ".", "all", "(", ")", ".", "exclude", "(", "pk", "=", "self", ".", "submitter", ...
The list of authors als text, for admin submission list overview.
[ "The", "list", "of", "authors", "als", "text", "for", "admin", "submission", "list", "overview", "." ]
python
train
ehansis/ozelot
examples/eurominder/eurominder/pipeline.py
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/examples/eurominder/eurominder/pipeline.py#L659-L701
def load(self): """Load the climate data as a map Returns: dict: {data: masked 3D numpy array containing climate data per month (first axis), lat_idx: function converting a latitude to the (fractional) row index in the map, lon_idx: function converting ...
[ "def", "load", "(", "self", ")", ":", "from", "scipy", ".", "io", "import", "netcdf_file", "from", "scipy", "import", "interpolate", "import", "numpy", "as", "np", "# load file", "f", "=", "netcdf_file", "(", "self", ".", "input_file", ")", "# extract data, ...
Load the climate data as a map Returns: dict: {data: masked 3D numpy array containing climate data per month (first axis), lat_idx: function converting a latitude to the (fractional) row index in the map, lon_idx: function converting a longitude to the (fractio...
[ "Load", "the", "climate", "data", "as", "a", "map" ]
python
train
google/grr
grr/client_builder/grr_response_client_builder/client_build.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client_builder/grr_response_client_builder/client_build.py#L387-L400
def GetClientConfig(filename): """Write client config to filename.""" config_lib.SetPlatformArchContext() config_lib.ParseConfigCommandLine() context = list(grr_config.CONFIG.context) context.append("Client Context") deployer = build.ClientRepacker() # Disable timestamping so we can get a reproducible and...
[ "def", "GetClientConfig", "(", "filename", ")", ":", "config_lib", ".", "SetPlatformArchContext", "(", ")", "config_lib", ".", "ParseConfigCommandLine", "(", ")", "context", "=", "list", "(", "grr_config", ".", "CONFIG", ".", "context", ")", "context", ".", "a...
Write client config to filename.
[ "Write", "client", "config", "to", "filename", "." ]
python
train
tgbugs/pyontutils
ilxutils/ilxutils/simple_scicrunch_client.py
https://github.com/tgbugs/pyontutils/blob/3d913db29c177db39151592909a4f56170ef8b35/ilxutils/ilxutils/simple_scicrunch_client.py#L47-L51
def superclasses_bug_fix(data): ''' PHP returns "id" in superclass but only accepts superclass_tid ''' for i, value in enumerate(data['superclasses']): data['superclasses'][i]['superclass_tid'] = data['superclasses'][i].pop('id') return data
[ "def", "superclasses_bug_fix", "(", "data", ")", ":", "for", "i", ",", "value", "in", "enumerate", "(", "data", "[", "'superclasses'", "]", ")", ":", "data", "[", "'superclasses'", "]", "[", "i", "]", "[", "'superclass_tid'", "]", "=", "data", "[", "'s...
PHP returns "id" in superclass but only accepts superclass_tid
[ "PHP", "returns", "id", "in", "superclass", "but", "only", "accepts", "superclass_tid" ]
python
train
FNNDSC/pfmisc
pfmisc/C_snode.py
https://github.com/FNNDSC/pfmisc/blob/960b4d6135fcc50bed0a8e55db2ab1ddad9b99d8/pfmisc/C_snode.py#L68-L75
def pre(self, *args): """ Get / set the str_pre """ if len(args): self.str_pre = args[0] else: return self.str_pre
[ "def", "pre", "(", "self", ",", "*", "args", ")", ":", "if", "len", "(", "args", ")", ":", "self", ".", "str_pre", "=", "args", "[", "0", "]", "else", ":", "return", "self", ".", "str_pre" ]
Get / set the str_pre
[ "Get", "/", "set", "the", "str_pre" ]
python
train
Yubico/python-pyhsm
examples/yhsm-password-auth.py
https://github.com/Yubico/python-pyhsm/blob/b6e2744d1ea15c352a0fc1d6ebc5950026b71311/examples/yhsm-password-auth.py#L47-L106
def parse_args(): """ Parse the command line arguments """ global default_device parser = argparse.ArgumentParser(description = "Generate password AEAD using YubiHSM", add_help=True ) parser.add_argument('-D', '--device',...
[ "def", "parse_args", "(", ")", ":", "global", "default_device", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Generate password AEAD using YubiHSM\"", ",", "add_help", "=", "True", ")", "parser", ".", "add_argument", "(", "'-D'", ",...
Parse the command line arguments
[ "Parse", "the", "command", "line", "arguments" ]
python
train
softlayer/softlayer-python
SoftLayer/CLI/ticket/upload.py
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/ticket/upload.py#L19-L37
def cli(env, identifier, path, name): """Adds an attachment to an existing ticket.""" mgr = SoftLayer.TicketManager(env.client) ticket_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'ticket') if path is None: raise exceptions.ArgumentError("Missing argument --path") if not os.path.e...
[ "def", "cli", "(", "env", ",", "identifier", ",", "path", ",", "name", ")", ":", "mgr", "=", "SoftLayer", ".", "TicketManager", "(", "env", ".", "client", ")", "ticket_id", "=", "helpers", ".", "resolve_id", "(", "mgr", ".", "resolve_ids", ",", "identi...
Adds an attachment to an existing ticket.
[ "Adds", "an", "attachment", "to", "an", "existing", "ticket", "." ]
python
train
SheffieldML/GPy
GPy/util/mocap.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/mocap.py#L313-L325
def load_skel(self, file_name): """ Loads an ASF file into a skeleton structure. :param file_name: The file name to load in. """ fid = open(file_name, 'r') self.read_skel(fid) fid.close() self.name = file_name
[ "def", "load_skel", "(", "self", ",", "file_name", ")", ":", "fid", "=", "open", "(", "file_name", ",", "'r'", ")", "self", ".", "read_skel", "(", "fid", ")", "fid", ".", "close", "(", ")", "self", ".", "name", "=", "file_name" ]
Loads an ASF file into a skeleton structure. :param file_name: The file name to load in.
[ "Loads", "an", "ASF", "file", "into", "a", "skeleton", "structure", "." ]
python
train
ChristopherRabotin/bungiesearch
bungiesearch/__init__.py
https://github.com/ChristopherRabotin/bungiesearch/blob/13768342bc2698b214eb0003c2d113b6e273c30d/bungiesearch/__init__.py#L111-L122
def get_model_index(cls, model, default=True): ''' Returns the default model index for the given model, or the list of indices if default is False. :param model: model name as a string. :raise KeyError: If the provided model does not have any index associated. ''' try: ...
[ "def", "get_model_index", "(", "cls", ",", "model", ",", "default", "=", "True", ")", ":", "try", ":", "if", "default", ":", "return", "cls", ".", "_model_name_to_default_index", "[", "model", "]", "return", "cls", ".", "_model_name_to_model_idx", "[", "mode...
Returns the default model index for the given model, or the list of indices if default is False. :param model: model name as a string. :raise KeyError: If the provided model does not have any index associated.
[ "Returns", "the", "default", "model", "index", "for", "the", "given", "model", "or", "the", "list", "of", "indices", "if", "default", "is", "False", ".", ":", "param", "model", ":", "model", "name", "as", "a", "string", ".", ":", "raise", "KeyError", "...
python
train
mrstephenneal/mysql-toolkit
mysql/toolkit/components/operations/clone.py
https://github.com/mrstephenneal/mysql-toolkit/blob/6964f718f4b72eb30f2259adfcfaf3090526c53d/mysql/toolkit/components/operations/clone.py#L90-L101
def copy_database_structure(self, source, destination, tables=None): """Copy multiple tables from one database to another.""" # Change database to source self.change_db(source) if tables is None: tables = self.tables # Change database to destination self.cha...
[ "def", "copy_database_structure", "(", "self", ",", "source", ",", "destination", ",", "tables", "=", "None", ")", ":", "# Change database to source", "self", ".", "change_db", "(", "source", ")", "if", "tables", "is", "None", ":", "tables", "=", "self", "."...
Copy multiple tables from one database to another.
[ "Copy", "multiple", "tables", "from", "one", "database", "to", "another", "." ]
python
train
aws/aws-iot-device-sdk-python
AWSIoTPythonSDK/core/protocol/paho/client.py
https://github.com/aws/aws-iot-device-sdk-python/blob/f0aa2ce34b21dd2e44f4fb7e1d058656aaf2fc62/AWSIoTPythonSDK/core/protocol/paho/client.py#L526-L535
def configIAMCredentials(self, srcAWSAccessKeyID, srcAWSSecretAccessKey, srcAWSSessionToken): """ Make custom settings for IAM credentials for websocket connection srcAWSAccessKeyID - AWS IAM access key srcAWSSecretAccessKey - AWS IAM secret key srcAWSSessionToken - AWS Session T...
[ "def", "configIAMCredentials", "(", "self", ",", "srcAWSAccessKeyID", ",", "srcAWSSecretAccessKey", ",", "srcAWSSessionToken", ")", ":", "self", ".", "_AWSAccessKeyIDCustomConfig", "=", "srcAWSAccessKeyID", "self", ".", "_AWSSecretAccessKeyCustomConfig", "=", "srcAWSSecretA...
Make custom settings for IAM credentials for websocket connection srcAWSAccessKeyID - AWS IAM access key srcAWSSecretAccessKey - AWS IAM secret key srcAWSSessionToken - AWS Session Token
[ "Make", "custom", "settings", "for", "IAM", "credentials", "for", "websocket", "connection", "srcAWSAccessKeyID", "-", "AWS", "IAM", "access", "key", "srcAWSSecretAccessKey", "-", "AWS", "IAM", "secret", "key", "srcAWSSessionToken", "-", "AWS", "Session", "Token" ]
python
train
brainiak/brainiak
brainiak/funcalign/sssrm.py
https://github.com/brainiak/brainiak/blob/408f12dec2ff56559a26873a848a09e4c8facfeb/brainiak/funcalign/sssrm.py#L691-L731
def _loss_lr_subject(self, data, labels, w, theta, bias): """Compute the Loss MLR for a single subject (without regularization) Parameters ---------- data : array, shape=[voxels, samples] The fMRI data of subject i for the classification task. labels : array of int...
[ "def", "_loss_lr_subject", "(", "self", ",", "data", ",", "labels", ",", "w", ",", "theta", ",", "bias", ")", ":", "if", "data", "is", "None", ":", "return", "0.0", "samples", "=", "data", ".", "shape", "[", "1", "]", "thetaT_wi_zi_plus_bias", "=", "...
Compute the Loss MLR for a single subject (without regularization) Parameters ---------- data : array, shape=[voxels, samples] The fMRI data of subject i for the classification task. labels : array of int, shape=[samples] The labels for the data samples in data...
[ "Compute", "the", "Loss", "MLR", "for", "a", "single", "subject", "(", "without", "regularization", ")" ]
python
train
rpcope1/PythonConfluenceAPI
PythonConfluenceAPI/cfapi.py
https://github.com/rpcope1/PythonConfluenceAPI/blob/b7f0ca2a390f964715fdf3a60b5b0c5ef7116d40/PythonConfluenceAPI/cfapi.py#L16-L33
def request_patch(self, *args, **kwargs): """Maintains the existing api for Session.request. Used by all of the higher level methods, e.g. Session.get. The background_callback param allows you to do some processing on the response in the background, e.g. call resp.json() so that json parsing happens...
[ "def", "request_patch", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "func", "=", "sup", "=", "super", "(", "FuturesSession", ",", "self", ")", ".", "request", "background_callback", "=", "kwargs", ".", "pop", "(", "'background_callb...
Maintains the existing api for Session.request. Used by all of the higher level methods, e.g. Session.get. The background_callback param allows you to do some processing on the response in the background, e.g. call resp.json() so that json parsing happens in the background thread.
[ "Maintains", "the", "existing", "api", "for", "Session", ".", "request", ".", "Used", "by", "all", "of", "the", "higher", "level", "methods", "e", ".", "g", ".", "Session", ".", "get", ".", "The", "background_callback", "param", "allows", "you", "to", "d...
python
train
GeorgeArgyros/symautomata
symautomata/flex2fst.py
https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/flex2fst.py#L50-L104
def _read_transitions(self): """ Read DFA transitions from flex compiled file Args: None Returns: list: The list of states and the destination for a character """ states = [] i = 0 regex = re.compile('[ \t\n\r:,]+') found = ...
[ "def", "_read_transitions", "(", "self", ")", ":", "states", "=", "[", "]", "i", "=", "0", "regex", "=", "re", ".", "compile", "(", "'[ \\t\\n\\r:,]+'", ")", "found", "=", "0", "# For maintaining the state of yy_nxt declaration", "state", "=", "0", "# For main...
Read DFA transitions from flex compiled file Args: None Returns: list: The list of states and the destination for a character
[ "Read", "DFA", "transitions", "from", "flex", "compiled", "file", "Args", ":", "None", "Returns", ":", "list", ":", "The", "list", "of", "states", "and", "the", "destination", "for", "a", "character" ]
python
train
SteveMcGrath/pySecurityCenter
securitycenter/sc4.py
https://github.com/SteveMcGrath/pySecurityCenter/blob/f0b10b1bcd4fd23a8d4d09ca6774cdf5e1cfd880/securitycenter/sc4.py#L736-L769
def scan_list(self, start_time=None, end_time=None, **kwargs): """List scans stored in Security Center in a given time range. Time is given in UNIX timestamps, assumed to be UTC. If a `datetime` is passed it is converted. If `end_time` is not specified it is NOW. If `start_time` is not ...
[ "def", "scan_list", "(", "self", ",", "start_time", "=", "None", ",", "end_time", "=", "None", ",", "*", "*", "kwargs", ")", ":", "try", ":", "end_time", "=", "datetime", ".", "utcfromtimestamp", "(", "int", "(", "end_time", ")", ")", "except", "TypeEr...
List scans stored in Security Center in a given time range. Time is given in UNIX timestamps, assumed to be UTC. If a `datetime` is passed it is converted. If `end_time` is not specified it is NOW. If `start_time` is not specified it is 30 days previous from `end_time`. :param start_ti...
[ "List", "scans", "stored", "in", "Security", "Center", "in", "a", "given", "time", "range", "." ]
python
train
linkedin/naarad
src/naarad/metrics/innotop_metric.py
https://github.com/linkedin/naarad/blob/261e2c0760fd6a6b0ee59064180bd8e3674311fe/src/naarad/metrics/innotop_metric.py#L184-L263
def parse_innotop_mode_m(self): """ Special parsing method for Innotop "Replication Status" results (innotop --mode M)""" with open(self.infile, 'r') as infh: # Pre processing to figure out different headers max_row_quot = 0 valrow = -1 thisrowcolumns = {} data = {} last_ts =...
[ "def", "parse_innotop_mode_m", "(", "self", ")", ":", "with", "open", "(", "self", ".", "infile", ",", "'r'", ")", "as", "infh", ":", "# Pre processing to figure out different headers", "max_row_quot", "=", "0", "valrow", "=", "-", "1", "thisrowcolumns", "=", ...
Special parsing method for Innotop "Replication Status" results (innotop --mode M)
[ "Special", "parsing", "method", "for", "Innotop", "Replication", "Status", "results", "(", "innotop", "--", "mode", "M", ")" ]
python
valid
twilio/twilio-python
twilio/rest/autopilot/v1/assistant/task/field.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/autopilot/v1/assistant/task/field.py#L120-L143
def create(self, field_type, unique_name): """ Create a new FieldInstance :param unicode field_type: The Field Type of this field :param unicode unique_name: An application-defined string that uniquely identifies the new resource :returns: Newly created FieldInstance :r...
[ "def", "create", "(", "self", ",", "field_type", ",", "unique_name", ")", ":", "data", "=", "values", ".", "of", "(", "{", "'FieldType'", ":", "field_type", ",", "'UniqueName'", ":", "unique_name", ",", "}", ")", "payload", "=", "self", ".", "_version", ...
Create a new FieldInstance :param unicode field_type: The Field Type of this field :param unicode unique_name: An application-defined string that uniquely identifies the new resource :returns: Newly created FieldInstance :rtype: twilio.rest.autopilot.v1.assistant.task.field.FieldInstan...
[ "Create", "a", "new", "FieldInstance" ]
python
train
nikhilkumarsingh/content-downloader
ctdl/ctdl.py
https://github.com/nikhilkumarsingh/content-downloader/blob/8b14af3a6eadcc43581e0425dc1d218208de12df/ctdl/ctdl.py#L43-L52
def get_duckduckgo_links(limit, params, headers): """ function to fetch links equal to limit duckduckgo pagination is not static, so there is a limit on maximum number of links that can be scraped """ resp = s.get('https://duckduckgo.com/html', params = params, headers = headers) links = scrape_links(resp.conte...
[ "def", "get_duckduckgo_links", "(", "limit", ",", "params", ",", "headers", ")", ":", "resp", "=", "s", ".", "get", "(", "'https://duckduckgo.com/html'", ",", "params", "=", "params", ",", "headers", "=", "headers", ")", "links", "=", "scrape_links", "(", ...
function to fetch links equal to limit duckduckgo pagination is not static, so there is a limit on maximum number of links that can be scraped
[ "function", "to", "fetch", "links", "equal", "to", "limit" ]
python
train
PaulHancock/Aegean
AegeanTools/msq2.py
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/msq2.py#L114-L157
def walk_perimeter(self, startx, starty): """ Starting at a point on the perimeter of a region, 'walk' the perimeter to return to the starting point. Record the path taken. Parameters ---------- startx, starty : int The starting location. Assumed to be on the...
[ "def", "walk_perimeter", "(", "self", ",", "startx", ",", "starty", ")", ":", "# checks", "startx", "=", "max", "(", "startx", ",", "0", ")", "startx", "=", "min", "(", "startx", ",", "self", ".", "xsize", ")", "starty", "=", "max", "(", "starty", ...
Starting at a point on the perimeter of a region, 'walk' the perimeter to return to the starting point. Record the path taken. Parameters ---------- startx, starty : int The starting location. Assumed to be on the perimeter of a region. Returns ------- ...
[ "Starting", "at", "a", "point", "on", "the", "perimeter", "of", "a", "region", "walk", "the", "perimeter", "to", "return", "to", "the", "starting", "point", ".", "Record", "the", "path", "taken", "." ]
python
train
iron-io/iron_mq_python
iron_mq.py
https://github.com/iron-io/iron_mq_python/blob/d6a293f0d54b4ca2dca1c335f9867cd2310f6fc7/iron_mq.py#L63-L82
def delete(self, message_id, reservation_id=None, subscriber_name=None): """Execute an HTTP request to delete a message from queue. Arguments: message_id -- The ID of the message to be deleted. reservation_id -- Reservation Id of the message. Reserved message could not be deleted witho...
[ "def", "delete", "(", "self", ",", "message_id", ",", "reservation_id", "=", "None", ",", "subscriber_name", "=", "None", ")", ":", "url", "=", "\"queues/%s/messages/%s\"", "%", "(", "self", ".", "name", ",", "message_id", ")", "qitems", "=", "{", "}", "...
Execute an HTTP request to delete a message from queue. Arguments: message_id -- The ID of the message to be deleted. reservation_id -- Reservation Id of the message. Reserved message could not be deleted without reservation Id. subscriber_name -- This is required to acknowledge push af...
[ "Execute", "an", "HTTP", "request", "to", "delete", "a", "message", "from", "queue", "." ]
python
train
pingali/dgit
dgitcore/vendor/pluginbase/pluginbase.py
https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/vendor/pluginbase/pluginbase.py#L274-L296
def open_resource(self, plugin, filename): """This function locates a resource inside the plugin and returns a byte stream to the contents of it. If the resource cannot be loaded an :exc:`IOError` will be raised. Only plugins that are real Python packages can contain resources. Plain ...
[ "def", "open_resource", "(", "self", ",", "plugin", ",", "filename", ")", ":", "mod", "=", "self", ".", "load_plugin", "(", "plugin", ")", "fn", "=", "getattr", "(", "mod", ",", "'__file__'", ",", "None", ")", "if", "fn", "is", "not", "None", ":", ...
This function locates a resource inside the plugin and returns a byte stream to the contents of it. If the resource cannot be loaded an :exc:`IOError` will be raised. Only plugins that are real Python packages can contain resources. Plain old Python modules do not allow this for obvio...
[ "This", "function", "locates", "a", "resource", "inside", "the", "plugin", "and", "returns", "a", "byte", "stream", "to", "the", "contents", "of", "it", ".", "If", "the", "resource", "cannot", "be", "loaded", "an", ":", "exc", ":", "IOError", "will", "be...
python
valid
codelv/enaml-native
src/enamlnative/android/app.py
https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/android/app.py#L210-L233
def show_view(self): """ Show the current `app.view`. This will fade out the previous with the new view. """ if not self.build_info: def on_build_info(info): """ Make sure the build info is ready before we display the view ...
[ "def", "show_view", "(", "self", ")", ":", "if", "not", "self", ".", "build_info", ":", "def", "on_build_info", "(", "info", ")", ":", "\"\"\" Make sure the build info is ready before we \n display the view \n \n \"\"\"", "self", "...
Show the current `app.view`. This will fade out the previous with the new view.
[ "Show", "the", "current", "app", ".", "view", ".", "This", "will", "fade", "out", "the", "previous", "with", "the", "new", "view", "." ]
python
train
totalgood/pugnlp
src/pugnlp/util.py
https://github.com/totalgood/pugnlp/blob/c43445b14afddfdeadc5f3076675c9e8fc1ee67c/src/pugnlp/util.py#L2295-L2364
def get_words(s, splitter_regex=rex.word_sep_except_external_appostrophe, preprocessor=strip_HTML, postprocessor=strip_edge_punc, min_len=None, max_len=None, blacklist=None, whitelist=None, lower=False, filter_fun=None, str_type=str): r"""Segment words (tokens), returning a...
[ "def", "get_words", "(", "s", ",", "splitter_regex", "=", "rex", ".", "word_sep_except_external_appostrophe", ",", "preprocessor", "=", "strip_HTML", ",", "postprocessor", "=", "strip_edge_punc", ",", "min_len", "=", "None", ",", "max_len", "=", "None", ",", "bl...
r"""Segment words (tokens), returning a list of all tokens Does not return any separating whitespace or punctuation marks. Attempts to return external apostrophes at the end of words. Comparable to `nltk.word_toeknize`. Arguments: splitter_regex (str or re): compiled or uncompiled regular expres...
[ "r", "Segment", "words", "(", "tokens", ")", "returning", "a", "list", "of", "all", "tokens" ]
python
train
google/grr
grr/server/grr_response_server/aff4_objects/user_managers.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/aff4_objects/user_managers.py#L318-L323
def _HasAccessToClient(self, subject, token): """Checks if user has access to a client under given URN.""" client_id, _ = rdfvalue.RDFURN(subject).Split(2) client_urn = rdf_client.ClientURN(client_id) return self.CheckClientAccess(token, client_urn)
[ "def", "_HasAccessToClient", "(", "self", ",", "subject", ",", "token", ")", ":", "client_id", ",", "_", "=", "rdfvalue", ".", "RDFURN", "(", "subject", ")", ".", "Split", "(", "2", ")", "client_urn", "=", "rdf_client", ".", "ClientURN", "(", "client_id"...
Checks if user has access to a client under given URN.
[ "Checks", "if", "user", "has", "access", "to", "a", "client", "under", "given", "URN", "." ]
python
train
Utagai/spice
spice_api/spice.py
https://github.com/Utagai/spice/blob/00b2c9e80ef338f4daef7643d99e8c7a0750b57c/spice_api/spice.py#L223-L230
def delete(data, id, medium, credentials): """Deletes the [medium] with the given id and data from the user's [medium]List. :param data The data for the [medium] to delete. :param id The id of the data to delete. :param medium Anime or manga (tokens.Medium.ANIME or tokens.Medium.MANGA). :raise...
[ "def", "delete", "(", "data", ",", "id", ",", "medium", ",", "credentials", ")", ":", "_op", "(", "data", ",", "id", ",", "medium", ",", "tokens", ".", "Operations", ".", "DElETE", ",", "credentials", ")" ]
Deletes the [medium] with the given id and data from the user's [medium]List. :param data The data for the [medium] to delete. :param id The id of the data to delete. :param medium Anime or manga (tokens.Medium.ANIME or tokens.Medium.MANGA). :raise ValueError For bad arguments.
[ "Deletes", "the", "[", "medium", "]", "with", "the", "given", "id", "and", "data", "from", "the", "user", "s", "[", "medium", "]", "List", ".", ":", "param", "data", "The", "data", "for", "the", "[", "medium", "]", "to", "delete", ".", ":", "param"...
python
train
trailofbits/manticore
manticore/platforms/evm.py
https://github.com/trailofbits/manticore/blob/54c5a15b1119c523ae54c09972413e8b97f11629/manticore/platforms/evm.py#L2338-L2346
def new_address(self, sender=None, nonce=None): """Create a fresh 160bit address""" if sender is not None and nonce is None: nonce = self.get_nonce(sender) new_address = self.calculate_new_address(sender, nonce) if sender is None and new_address in self: return s...
[ "def", "new_address", "(", "self", ",", "sender", "=", "None", ",", "nonce", "=", "None", ")", ":", "if", "sender", "is", "not", "None", "and", "nonce", "is", "None", ":", "nonce", "=", "self", ".", "get_nonce", "(", "sender", ")", "new_address", "="...
Create a fresh 160bit address
[ "Create", "a", "fresh", "160bit", "address" ]
python
valid
databio/pypiper
pypiper/manager.py
https://github.com/databio/pypiper/blob/00e6c2b94033c4187d47ff14c5580bbfc2ff097f/pypiper/manager.py#L517-L541
def _set_status_flag(self, status): """ Configure state and files on disk to match current processing status. :param str status: Name of new status designation for pipeline. """ # Remove previous status flag file. flag_file_path = self._flag_file_path() try: ...
[ "def", "_set_status_flag", "(", "self", ",", "status", ")", ":", "# Remove previous status flag file.", "flag_file_path", "=", "self", ".", "_flag_file_path", "(", ")", "try", ":", "os", ".", "remove", "(", "flag_file_path", ")", "except", ":", "# Print message on...
Configure state and files on disk to match current processing status. :param str status: Name of new status designation for pipeline.
[ "Configure", "state", "and", "files", "on", "disk", "to", "match", "current", "processing", "status", "." ]
python
train
ndf-zz/asfv1
asfv1.py
https://github.com/ndf-zz/asfv1/blob/c18f940d7ee86b14e6b201e6d8a4b71e3a57c34a/asfv1.py#L138-L169
def bintoihex(buf, spos=0x0000): """Convert binary buffer to ihex and return as string.""" c = 0 olen = len(buf) ret = "" # 16 byte lines while (c+0x10) <= olen: adr = c + spos l = ':10{0:04X}00'.format(adr) sum = 0x10+((adr>>8)&M8)+(adr&M8) for j in range(0,0x10)...
[ "def", "bintoihex", "(", "buf", ",", "spos", "=", "0x0000", ")", ":", "c", "=", "0", "olen", "=", "len", "(", "buf", ")", "ret", "=", "\"\"", "# 16 byte lines", "while", "(", "c", "+", "0x10", ")", "<=", "olen", ":", "adr", "=", "c", "+", "spos...
Convert binary buffer to ihex and return as string.
[ "Convert", "binary", "buffer", "to", "ihex", "and", "return", "as", "string", "." ]
python
train
elyase/masstable
masstable/masstable.py
https://github.com/elyase/masstable/blob/3eb72b22cd3337bc5c6bb95bb7bb73fdbe6ae9e2/masstable/masstable.py#L489-L496
def ds2n(self): """Calculates the derivative of the neutron separation energies: ds2n(Z,A) = s2n(Z,A) - s2n(Z,A+2) """ idx = [(x[0] + 0, x[1] + 2) for x in self.df.index] values = self.s2n.values - self.s2n.loc[idx].values return Table(df=pd.Series(values, index=self.df....
[ "def", "ds2n", "(", "self", ")", ":", "idx", "=", "[", "(", "x", "[", "0", "]", "+", "0", ",", "x", "[", "1", "]", "+", "2", ")", "for", "x", "in", "self", ".", "df", ".", "index", "]", "values", "=", "self", ".", "s2n", ".", "values", ...
Calculates the derivative of the neutron separation energies: ds2n(Z,A) = s2n(Z,A) - s2n(Z,A+2)
[ "Calculates", "the", "derivative", "of", "the", "neutron", "separation", "energies", ":" ]
python
test
python-diamond/Diamond
src/collectors/onewire/onewire.py
https://github.com/python-diamond/Diamond/blob/0f3eb04327d6d3ed5e53a9967d6c9d2c09714a47/src/collectors/onewire/onewire.py#L68-L94
def read_values(self, oid, files, metrics): """ Reads values from owfs/oid/{files} and update metrics with format [oid.alias] = value """ oid_path = os.path.join(self.config['owfs'], oid) oid = oid.replace('.', '_') for fn, alias in files.iteritems(): ...
[ "def", "read_values", "(", "self", ",", "oid", ",", "files", ",", "metrics", ")", ":", "oid_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "config", "[", "'owfs'", "]", ",", "oid", ")", "oid", "=", "oid", ".", "replace", "(", "'.'"...
Reads values from owfs/oid/{files} and update metrics with format [oid.alias] = value
[ "Reads", "values", "from", "owfs", "/", "oid", "/", "{", "files", "}", "and", "update", "metrics", "with", "format", "[", "oid", ".", "alias", "]", "=", "value" ]
python
train
obilaniu/Nauka
src/nauka/exp/experiment.py
https://github.com/obilaniu/Nauka/blob/1492a4f9d204a868c1a8a1d327bd108490b856b4/src/nauka/exp/experiment.py#L215-L217
def strategyLastK(kls, n, k=10): """Return the directory names to preserve under the LastK purge strategy.""" return set(map(str, filter(lambda x:x>=0, range(n, n-k, -1))))
[ "def", "strategyLastK", "(", "kls", ",", "n", ",", "k", "=", "10", ")", ":", "return", "set", "(", "map", "(", "str", ",", "filter", "(", "lambda", "x", ":", "x", ">=", "0", ",", "range", "(", "n", ",", "n", "-", "k", ",", "-", "1", ")", ...
Return the directory names to preserve under the LastK purge strategy.
[ "Return", "the", "directory", "names", "to", "preserve", "under", "the", "LastK", "purge", "strategy", "." ]
python
train
maximtrp/scikit-posthocs
scikit_posthocs/_posthocs.py
https://github.com/maximtrp/scikit-posthocs/blob/5476b09e2a325cd4e31c0b0bc6906ab5cd77fc5d/scikit_posthocs/_posthocs.py#L1900-L1991
def posthoc_mannwhitney(a, val_col=None, group_col=None, use_continuity=True, alternative='two-sided', p_adjust=None, sort=True): '''Pairwise comparisons with Mann-Whitney rank test. Parameters ---------- a : array_like or pandas DataFrame object An array, any object exposing the array interfa...
[ "def", "posthoc_mannwhitney", "(", "a", ",", "val_col", "=", "None", ",", "group_col", "=", "None", ",", "use_continuity", "=", "True", ",", "alternative", "=", "'two-sided'", ",", "p_adjust", "=", "None", ",", "sort", "=", "True", ")", ":", "x", ",", ...
Pairwise comparisons with Mann-Whitney rank test. Parameters ---------- a : array_like or pandas DataFrame object An array, any object exposing the array interface or a pandas DataFrame. Array must be two-dimensional. val_col : str, optional Name of a DataFrame column that cont...
[ "Pairwise", "comparisons", "with", "Mann", "-", "Whitney", "rank", "test", "." ]
python
train
PolicyStat/docx2html
docx2html/core.py
https://github.com/PolicyStat/docx2html/blob/2dc4afd1e3a3f2f0b357d0bff903eb58bcc94429/docx2html/core.py#L393-L406
def get_v_merge(tc): """ vMerge is what docx uses to denote that a table cell is part of a rowspan. The first cell to have a vMerge is the start of the rowspan, and the vMerge will be denoted with 'restart'. If it is anything other than restart then it is a continuation of another rowspan. """ ...
[ "def", "get_v_merge", "(", "tc", ")", ":", "if", "tc", "is", "None", ":", "return", "None", "v_merges", "=", "tc", ".", "xpath", "(", "'.//w:vMerge'", ",", "namespaces", "=", "tc", ".", "nsmap", ")", "if", "len", "(", "v_merges", ")", "!=", "1", ":...
vMerge is what docx uses to denote that a table cell is part of a rowspan. The first cell to have a vMerge is the start of the rowspan, and the vMerge will be denoted with 'restart'. If it is anything other than restart then it is a continuation of another rowspan.
[ "vMerge", "is", "what", "docx", "uses", "to", "denote", "that", "a", "table", "cell", "is", "part", "of", "a", "rowspan", ".", "The", "first", "cell", "to", "have", "a", "vMerge", "is", "the", "start", "of", "the", "rowspan", "and", "the", "vMerge", ...
python
test
kislyuk/aegea
aegea/packages/github3/pulls.py
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L246-L252
def is_merged(self): """Checks to see if the pull request was merged. :returns: bool """ url = self._build_url('merge', base_url=self._api) return self._boolean(self._get(url), 204, 404)
[ "def", "is_merged", "(", "self", ")", ":", "url", "=", "self", ".", "_build_url", "(", "'merge'", ",", "base_url", "=", "self", ".", "_api", ")", "return", "self", ".", "_boolean", "(", "self", ".", "_get", "(", "url", ")", ",", "204", ",", "404", ...
Checks to see if the pull request was merged. :returns: bool
[ "Checks", "to", "see", "if", "the", "pull", "request", "was", "merged", "." ]
python
train
dw/mitogen
mitogen/core.py
https://github.com/dw/mitogen/blob/a7fdb55e1300a7e0a5e404b09eb730cf9a525da7/mitogen/core.py#L743-L748
def dead(cls, reason=None, **kwargs): """ Syntax helper to construct a dead message. """ kwargs['data'], _ = UTF8_CODEC.encode(reason or u'') return cls(reply_to=IS_DEAD, **kwargs)
[ "def", "dead", "(", "cls", ",", "reason", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'data'", "]", ",", "_", "=", "UTF8_CODEC", ".", "encode", "(", "reason", "or", "u''", ")", "return", "cls", "(", "reply_to", "=", "IS_DEAD", ...
Syntax helper to construct a dead message.
[ "Syntax", "helper", "to", "construct", "a", "dead", "message", "." ]
python
train
matousc89/padasip
padasip/detection/elbnd.py
https://github.com/matousc89/padasip/blob/c969eadd7fa181a84da0554d737fc13c6450d16f/padasip/detection/elbnd.py#L93-L138
def ELBND(w, e, function="max"): """ This function estimates Error and Learning Based Novelty Detection measure from given data. **Args:** * `w` : history of adaptive parameters of an adaptive model (2d array), every row represents parameters in given time index. * `e` : error of adapti...
[ "def", "ELBND", "(", "w", ",", "e", ",", "function", "=", "\"max\"", ")", ":", "# check if the function is known", "if", "not", "function", "in", "[", "\"max\"", ",", "\"sum\"", "]", ":", "raise", "ValueError", "(", "'Unknown output function'", ")", "# get len...
This function estimates Error and Learning Based Novelty Detection measure from given data. **Args:** * `w` : history of adaptive parameters of an adaptive model (2d array), every row represents parameters in given time index. * `e` : error of adaptive model (1d array) **Kwargs:** * `...
[ "This", "function", "estimates", "Error", "and", "Learning", "Based", "Novelty", "Detection", "measure", "from", "given", "data", "." ]
python
train
mitsei/dlkit
dlkit/json_/assessment/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/sessions.py#L5704-L5746
def get_assessments_offered_by_query(self, assessment_offered_query): """Gets a list of ``AssessmentOffered`` elements matching the given assessment offered query. arg: assessment_offered_query (osid.assessment.AssessmentOfferedQuery): the assessment offered query ...
[ "def", "get_assessments_offered_by_query", "(", "self", ",", "assessment_offered_query", ")", ":", "# Implemented from template for", "# osid.resource.ResourceQuerySession.get_resources_by_query", "and_list", "=", "list", "(", ")", "or_list", "=", "list", "(", ")", "for", "...
Gets a list of ``AssessmentOffered`` elements matching the given assessment offered query. arg: assessment_offered_query (osid.assessment.AssessmentOfferedQuery): the assessment offered query return: (osid.assessment.AssessmentOfferedList) - the returned ...
[ "Gets", "a", "list", "of", "AssessmentOffered", "elements", "matching", "the", "given", "assessment", "offered", "query", "." ]
python
train
etingof/pysnmp
pysnmp/proto/rfc1902.py
https://github.com/etingof/pysnmp/blob/cde062dd42f67dfd2d7686286a322d40e9c3a4b7/pysnmp/proto/rfc1902.py#L93-L102
def withValues(cls, *values): """Creates a subclass with discreet values constraint. """ class X(cls): subtypeSpec = cls.subtypeSpec + constraint.SingleValueConstraint( *values) X.__name__ = cls.__name__ return X
[ "def", "withValues", "(", "cls", ",", "*", "values", ")", ":", "class", "X", "(", "cls", ")", ":", "subtypeSpec", "=", "cls", ".", "subtypeSpec", "+", "constraint", ".", "SingleValueConstraint", "(", "*", "values", ")", "X", ".", "__name__", "=", "cls"...
Creates a subclass with discreet values constraint.
[ "Creates", "a", "subclass", "with", "discreet", "values", "constraint", "." ]
python
train
hydrosquall/tiingo-python
tools/api_key_tool.py
https://github.com/hydrosquall/tiingo-python/blob/9bb98ca9d24f2e4db651cf0590e4b47184546482/tools/api_key_tool.py#L31-L41
def remove_api_key(file_name): """ Change the api key in the Token object to 40*'0'. See issue #86. :param file: path-to-file to change """ with open(file_name, 'r') as fp: text = fp.read() text = re.sub(real_api_regex, zero_token_string, text) with open(file_name, 'w') as fp: ...
[ "def", "remove_api_key", "(", "file_name", ")", ":", "with", "open", "(", "file_name", ",", "'r'", ")", "as", "fp", ":", "text", "=", "fp", ".", "read", "(", ")", "text", "=", "re", ".", "sub", "(", "real_api_regex", ",", "zero_token_string", ",", "t...
Change the api key in the Token object to 40*'0'. See issue #86. :param file: path-to-file to change
[ "Change", "the", "api", "key", "in", "the", "Token", "object", "to", "40", "*", "0", ".", "See", "issue", "#86", ".", ":", "param", "file", ":", "path", "-", "to", "-", "file", "to", "change" ]
python
test
anlutro/diay.py
diay/__init__.py
https://github.com/anlutro/diay.py/blob/78cfd2b53c8dca3dbac468d620eaa0bb7af08275/diay/__init__.py#L55-L75
def inject(*args, **kwargs): """ Mark a class or function for injection, meaning that a DI container knows that it should inject dependencies into it. Normally you won't need this as the injector will inject the required arguments anyway, but it can be used to inject properties into a class wit...
[ "def", "inject", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "wrapper", "(", "obj", ")", ":", "if", "inspect", ".", "isclass", "(", "obj", ")", "or", "callable", "(", "obj", ")", ":", "_inject_object", "(", "obj", ",", "*", "args"...
Mark a class or function for injection, meaning that a DI container knows that it should inject dependencies into it. Normally you won't need this as the injector will inject the required arguments anyway, but it can be used to inject properties into a class without having to specify it in the construc...
[ "Mark", "a", "class", "or", "function", "for", "injection", "meaning", "that", "a", "DI", "container", "knows", "that", "it", "should", "inject", "dependencies", "into", "it", "." ]
python
train
reportportal/client-Python
reportportal_client/service.py
https://github.com/reportportal/client-Python/blob/8d22445d0de73f46fb23d0c0e49ac309335173ce/reportportal_client/service.py#L250-L312
def log_batch(self, log_data): """Logs batch of messages with attachment. Args: log_data: list of log records. log record is a dict of; time, message, level, attachment attachment is a dict of: name: name of attachment ...
[ "def", "log_batch", "(", "self", ",", "log_data", ")", ":", "url", "=", "uri_join", "(", "self", ".", "base_url", ",", "\"log\"", ")", "attachments", "=", "[", "]", "for", "log_item", "in", "log_data", ":", "log_item", "[", "\"item_id\"", "]", "=", "se...
Logs batch of messages with attachment. Args: log_data: list of log records. log record is a dict of; time, message, level, attachment attachment is a dict of: name: name of attachment data: fileobj or content ...
[ "Logs", "batch", "of", "messages", "with", "attachment", "." ]
python
train
moonso/loqusdb
loqusdb/utils/profiling.py
https://github.com/moonso/loqusdb/blob/792dcd0d461aff5adc703c49eebf58964913a513/loqusdb/utils/profiling.py#L78-L124
def profile_match(adapter, profiles, hard_threshold=0.95, soft_threshold=0.9): """ given a dict of profiles, searches through all the samples in the DB for a match. If a matching sample is found an exception is raised, and the variants will not be loaded into the database. Args: ...
[ "def", "profile_match", "(", "adapter", ",", "profiles", ",", "hard_threshold", "=", "0.95", ",", "soft_threshold", "=", "0.9", ")", ":", "matches", "=", "{", "sample", ":", "[", "]", "for", "sample", "in", "profiles", ".", "keys", "(", ")", "}", "for"...
given a dict of profiles, searches through all the samples in the DB for a match. If a matching sample is found an exception is raised, and the variants will not be loaded into the database. Args: adapter (MongoAdapter): Adapter to mongodb profiles (dict(str)): The profi...
[ "given", "a", "dict", "of", "profiles", "searches", "through", "all", "the", "samples", "in", "the", "DB", "for", "a", "match", ".", "If", "a", "matching", "sample", "is", "found", "an", "exception", "is", "raised", "and", "the", "variants", "will", "not...
python
train
idlesign/django-sitecats
sitecats/toolbox.py
https://github.com/idlesign/django-sitecats/blob/9b45e91fc0dcb63a0011780437fe28145e3ecce9/sitecats/toolbox.py#L16-L26
def get_category_aliases_under(parent_alias=None): """Returns a list of category aliases under the given parent. Could be useful to pass to `ModelWithCategory.enable_category_lists_editor` in `additional_parents_aliases` parameter. :param str|None parent_alias: Parent alias or None to categories under...
[ "def", "get_category_aliases_under", "(", "parent_alias", "=", "None", ")", ":", "return", "[", "ch", ".", "alias", "for", "ch", "in", "get_cache", "(", ")", ".", "get_children_for", "(", "parent_alias", ",", "only_with_aliases", "=", "True", ")", "]" ]
Returns a list of category aliases under the given parent. Could be useful to pass to `ModelWithCategory.enable_category_lists_editor` in `additional_parents_aliases` parameter. :param str|None parent_alias: Parent alias or None to categories under root :rtype: list :return: a list of category ali...
[ "Returns", "a", "list", "of", "category", "aliases", "under", "the", "given", "parent", "." ]
python
train
hsolbrig/PyShEx
pyshex/shape_expressions_language/p3_terminology.py
https://github.com/hsolbrig/PyShEx/blob/9d659cc36e808afd66d4a6d60e8ea21cb12eb744/pyshex/shape_expressions_language/p3_terminology.py#L23-L25
def predicatesOut(G: Graph, n: Node) -> Set[TriplePredicate]: """ predicatesOut(G, n) is the set of predicates in arcsOut(G, n). """ return {p for p, _ in G.predicate_objects(n)}
[ "def", "predicatesOut", "(", "G", ":", "Graph", ",", "n", ":", "Node", ")", "->", "Set", "[", "TriplePredicate", "]", ":", "return", "{", "p", "for", "p", ",", "_", "in", "G", ".", "predicate_objects", "(", "n", ")", "}" ]
predicatesOut(G, n) is the set of predicates in arcsOut(G, n).
[ "predicatesOut", "(", "G", "n", ")", "is", "the", "set", "of", "predicates", "in", "arcsOut", "(", "G", "n", ")", "." ]
python
train
KelSolaar/Umbra
umbra/ui/common.py
https://github.com/KelSolaar/Umbra/blob/66f45f08d9d723787f1191989f8b0dda84b412ce/umbra/ui/common.py#L143-L167
def get_resource_path(name, raise_exception=False): """ Returns the resource file path matching the given name. :param name: Resource name. :type name: unicode :param raise_exception: Raise the exception. :type raise_exception: bool :return: Resource path. :rtype: unicode """ i...
[ "def", "get_resource_path", "(", "name", ",", "raise_exception", "=", "False", ")", ":", "if", "not", "RuntimeGlobals", ".", "resources_directories", ":", "RuntimeGlobals", ".", "resources_directories", ".", "append", "(", "os", ".", "path", ".", "normpath", "("...
Returns the resource file path matching the given name. :param name: Resource name. :type name: unicode :param raise_exception: Raise the exception. :type raise_exception: bool :return: Resource path. :rtype: unicode
[ "Returns", "the", "resource", "file", "path", "matching", "the", "given", "name", "." ]
python
train
odlgroup/odl
odl/tomo/geometry/parallel.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/tomo/geometry/parallel.py#L1471-L1587
def parallel_beam_geometry(space, num_angles=None, det_shape=None): r"""Create default parallel beam geometry from ``space``. This is intended for simple test cases where users do not need the full flexibility of the geometries, but simply want a geometry that works. This default geometry gives a full...
[ "def", "parallel_beam_geometry", "(", "space", ",", "num_angles", "=", "None", ",", "det_shape", "=", "None", ")", ":", "# Find maximum distance from rotation axis", "corners", "=", "space", ".", "domain", ".", "corners", "(", ")", "[", ":", ",", ":", "2", "...
r"""Create default parallel beam geometry from ``space``. This is intended for simple test cases where users do not need the full flexibility of the geometries, but simply want a geometry that works. This default geometry gives a fully sampled sinogram according to the Nyquist criterion, which in gene...
[ "r", "Create", "default", "parallel", "beam", "geometry", "from", "space", "." ]
python
train
softwarefactory-project/distroinfo
scripts/di.py
https://github.com/softwarefactory-project/distroinfo/blob/86a7419232a3376157c06e70528ec627e03ff82a/scripts/di.py#L95-L132
def distroinfo(cargs, version=__version__): """ distroinfo Command-Line Interface """ code = 1 args = docopt(__doc__, argv=cargs) try: if args['--version']: if not version: version = 'N/A' print(version) code = 0 elif args['fet...
[ "def", "distroinfo", "(", "cargs", ",", "version", "=", "__version__", ")", ":", "code", "=", "1", "args", "=", "docopt", "(", "__doc__", ",", "argv", "=", "cargs", ")", "try", ":", "if", "args", "[", "'--version'", "]", ":", "if", "not", "version", ...
distroinfo Command-Line Interface
[ "distroinfo", "Command", "-", "Line", "Interface" ]
python
train
samastur/pyimagediet
pyimagediet/cli.py
https://github.com/samastur/pyimagediet/blob/480c6e171577df36e166590b031bc8891b3c9e7b/pyimagediet/cli.py#L22-L26
def diet(file, configuration, check): """Simple program that either print config customisations for your environment or compresses file FILE.""" config = process.read_yaml_configuration(configuration) process.diet(file, config)
[ "def", "diet", "(", "file", ",", "configuration", ",", "check", ")", ":", "config", "=", "process", ".", "read_yaml_configuration", "(", "configuration", ")", "process", ".", "diet", "(", "file", ",", "config", ")" ]
Simple program that either print config customisations for your environment or compresses file FILE.
[ "Simple", "program", "that", "either", "print", "config", "customisations", "for", "your", "environment", "or", "compresses", "file", "FILE", "." ]
python
train
jenanwise/codequality
codequality/checkers.py
https://github.com/jenanwise/codequality/blob/8a2bd767fd73091c49a5318fdbfb2b4fff77533d/codequality/checkers.py#L40-L57
def check(self, paths): """ Return list of error dicts for all found errors in paths. The default implementation expects `tool`, and `tool_err_re` to be defined. tool: external binary to use for checking. tool_err_re: regexp that can match output of `tool` -- must provi...
[ "def", "check", "(", "self", ",", "paths", ")", ":", "if", "not", "paths", ":", "return", "(", ")", "cmd_pieces", "=", "[", "self", ".", "tool", "]", "cmd_pieces", ".", "extend", "(", "self", ".", "tool_args", ")", "return", "self", ".", "_check_std"...
Return list of error dicts for all found errors in paths. The default implementation expects `tool`, and `tool_err_re` to be defined. tool: external binary to use for checking. tool_err_re: regexp that can match output of `tool` -- must provide a groupdict with at least "fi...
[ "Return", "list", "of", "error", "dicts", "for", "all", "found", "errors", "in", "paths", "." ]
python
train
iamteem/redisco
redisco/models/base.py
https://github.com/iamteem/redisco/blob/a7ba19ff3c38061d6d8bc0c10fa754baadcfeb91/redisco/models/base.py#L415-L418
def _add_to_indices(self, pipeline): """Adds the base64 encoded values of the indices.""" for att in self.indices: self._add_to_index(att, pipeline=pipeline)
[ "def", "_add_to_indices", "(", "self", ",", "pipeline", ")", ":", "for", "att", "in", "self", ".", "indices", ":", "self", ".", "_add_to_index", "(", "att", ",", "pipeline", "=", "pipeline", ")" ]
Adds the base64 encoded values of the indices.
[ "Adds", "the", "base64", "encoded", "values", "of", "the", "indices", "." ]
python
train
angr/angr
angr/analyses/cfg/cfg_fast.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/cfg_fast.py#L1286-L1311
def _scan_block(self, cfg_job): """ Scan a basic block starting at a specific address :param CFGJob cfg_job: The CFGJob instance. :return: a list of successors :rtype: list """ addr = cfg_job.addr current_func_addr = cfg_job.func_addr # Fix the ...
[ "def", "_scan_block", "(", "self", ",", "cfg_job", ")", ":", "addr", "=", "cfg_job", ".", "addr", "current_func_addr", "=", "cfg_job", ".", "func_addr", "# Fix the function address", "# This is for rare cases where we cannot successfully determine the end boundary of a previous...
Scan a basic block starting at a specific address :param CFGJob cfg_job: The CFGJob instance. :return: a list of successors :rtype: list
[ "Scan", "a", "basic", "block", "starting", "at", "a", "specific", "address" ]
python
train
inasafe/inasafe
safe/gui/tools/wizard/step_fc90_analysis.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_fc90_analysis.py#L321-L346
def progress_callback(self, current_value, maximum_value, message=None): """GUI based callback implementation for showing progress. :param current_value: Current progress. :type current_value: int :param maximum_value: Maximum range (point at which task is complete. :type maxim...
[ "def", "progress_callback", "(", "self", ",", "current_value", ",", "maximum_value", ",", "message", "=", "None", ")", ":", "report", "=", "m", ".", "Message", "(", ")", "report", ".", "add", "(", "LOGO_ELEMENT", ")", "report", ".", "add", "(", "m", "....
GUI based callback implementation for showing progress. :param current_value: Current progress. :type current_value: int :param maximum_value: Maximum range (point at which task is complete. :type maximum_value: int :param message: Optional message dictionary to containing con...
[ "GUI", "based", "callback", "implementation", "for", "showing", "progress", "." ]
python
train
KelSolaar/Umbra
umbra/components/factory/script_editor/editor.py
https://github.com/KelSolaar/Umbra/blob/66f45f08d9d723787f1191989f8b0dda84b412ce/umbra/components/factory/script_editor/editor.py#L496-L517
def load_document(self, document, file=None, language=None): """ Loads given document into the editor. :param document: Document to load. :type document: QTextDocument :param file: File. :type file: unicode :param language: Editor language. :type language...
[ "def", "load_document", "(", "self", ",", "document", ",", "file", "=", "None", ",", "language", "=", "None", ")", ":", "document", ".", "setDocumentLayout", "(", "QPlainTextDocumentLayout", "(", "document", ")", ")", "self", ".", "setDocument", "(", "docume...
Loads given document into the editor. :param document: Document to load. :type document: QTextDocument :param file: File. :type file: unicode :param language: Editor language. :type language: unicode :return: Method success. :rtype: bool
[ "Loads", "given", "document", "into", "the", "editor", "." ]
python
train
Toilal/rebulk
rebulk/match.py
https://github.com/Toilal/rebulk/blob/7511a4671f2fd9493e3df1e5177b7656789069e8/rebulk/match.py#L379-L433
def holes(self, start=0, end=None, formatter=None, ignore=None, seps=None, predicate=None, index=None): # pylint: disable=too-many-branches,too-many-locals """ Retrieves a set of Match objects that are not defined in given range. :param start: :type start: :param e...
[ "def", "holes", "(", "self", ",", "start", "=", "0", ",", "end", "=", "None", ",", "formatter", "=", "None", ",", "ignore", "=", "None", ",", "seps", "=", "None", ",", "predicate", "=", "None", ",", "index", "=", "None", ")", ":", "# pylint: disabl...
Retrieves a set of Match objects that are not defined in given range. :param start: :type start: :param end: :type end: :param formatter: :type formatter: :param ignore: :type ignore: :param seps: :type seps: :param predicate: ...
[ "Retrieves", "a", "set", "of", "Match", "objects", "that", "are", "not", "defined", "in", "given", "range", ".", ":", "param", "start", ":", ":", "type", "start", ":", ":", "param", "end", ":", ":", "type", "end", ":", ":", "param", "formatter", ":",...
python
train
quantumlib/Cirq
cirq/google/programs.py
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/google/programs.py#L171-L190
def schedule_from_proto_dicts( device: 'xmon_device.XmonDevice', ops: Iterable[Dict], ) -> Schedule: """Convert proto dictionaries into a Schedule for the given device.""" scheduled_ops = [] last_time_picos = 0 for op in ops: delay_picos = 0 if 'incremental_delay_picoseco...
[ "def", "schedule_from_proto_dicts", "(", "device", ":", "'xmon_device.XmonDevice'", ",", "ops", ":", "Iterable", "[", "Dict", "]", ",", ")", "->", "Schedule", ":", "scheduled_ops", "=", "[", "]", "last_time_picos", "=", "0", "for", "op", "in", "ops", ":", ...
Convert proto dictionaries into a Schedule for the given device.
[ "Convert", "proto", "dictionaries", "into", "a", "Schedule", "for", "the", "given", "device", "." ]
python
train
hydpy-dev/hydpy
hydpy/models/arma/arma_model.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/arma/arma_model.py#L390-L423
def calc_qout_v1(self): """Sum up the results of the different response functions. Required derived parameter: |Nmb| Required flux sequences: |QPOut| Calculated flux sequence: |QOut| Examples: Initialize an arma model with three different response functions: >...
[ "def", "calc_qout_v1", "(", "self", ")", ":", "der", "=", "self", ".", "parameters", ".", "derived", ".", "fastaccess", "flu", "=", "self", ".", "sequences", ".", "fluxes", ".", "fastaccess", "flu", ".", "qout", "=", "0.", "for", "idx", "in", "range", ...
Sum up the results of the different response functions. Required derived parameter: |Nmb| Required flux sequences: |QPOut| Calculated flux sequence: |QOut| Examples: Initialize an arma model with three different response functions: >>> from hydpy.models.arma impor...
[ "Sum", "up", "the", "results", "of", "the", "different", "response", "functions", "." ]
python
train
moonlitesolutions/SolrClient
SolrClient/solrresp.py
https://github.com/moonlitesolutions/SolrClient/blob/19c5280c9f8e97ee104d22ae883c4ccfd7c4f43b/SolrClient/solrresp.py#L182-L207
def get_facet_pivot(self): ''' Parses facet pivot response. Example:: >>> res = solr.query('SolrClient_unittest',{ 'q':'*:*', 'fq':'price:[50 TO *]', 'facet':True, 'facet.pivot':'facet_test,price' #Note how there is no space between fields. The...
[ "def", "get_facet_pivot", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'facet_pivot'", ")", ":", "self", ".", "facet_pivot", "=", "{", "}", "if", "'facet_counts'", "in", "self", ".", "data", ".", "keys", "(", ")", ":", "pivots", ...
Parses facet pivot response. Example:: >>> res = solr.query('SolrClient_unittest',{ 'q':'*:*', 'fq':'price:[50 TO *]', 'facet':True, 'facet.pivot':'facet_test,price' #Note how there is no space between fields. They are just separated by commas }) ...
[ "Parses", "facet", "pivot", "response", ".", "Example", "::", ">>>", "res", "=", "solr", ".", "query", "(", "SolrClient_unittest", "{", "q", ":", "*", ":", "*", "fq", ":", "price", ":", "[", "50", "TO", "*", "]", "facet", ":", "True", "facet", ".",...
python
train
typemytype/booleanOperations
Lib/booleanOperations/flatten.py
https://github.com/typemytype/booleanOperations/blob/b7d9fc95c155824662f4a0020e653c77b7723d24/Lib/booleanOperations/flatten.py#L211-L237
def split(self, tValues): """ Split the segment according the t values """ if self.segmentType == "curve": on1 = self.previousOnCurve off1 = self.points[0].coordinates off2 = self.points[1].coordinates on2 = self.points[2].coordinates ...
[ "def", "split", "(", "self", ",", "tValues", ")", ":", "if", "self", ".", "segmentType", "==", "\"curve\"", ":", "on1", "=", "self", ".", "previousOnCurve", "off1", "=", "self", ".", "points", "[", "0", "]", ".", "coordinates", "off2", "=", "self", "...
Split the segment according the t values
[ "Split", "the", "segment", "according", "the", "t", "values" ]
python
train
obriencj/python-javatools
javatools/report.py
https://github.com/obriencj/python-javatools/blob/9e2332b452ddc508bed0615937dddcb2cf051557/javatools/report.py#L106-L120
def subreporter(self, subpath, entry): """ create a reporter for a sub-report, with updated breadcrumbs and the same output formats """ newbase = join(self.basedir, subpath) r = Reporter(newbase, entry, self.options) crumbs = list(self.breadcrumbs) crumb...
[ "def", "subreporter", "(", "self", ",", "subpath", ",", "entry", ")", ":", "newbase", "=", "join", "(", "self", ".", "basedir", ",", "subpath", ")", "r", "=", "Reporter", "(", "newbase", ",", "entry", ",", "self", ".", "options", ")", "crumbs", "=", ...
create a reporter for a sub-report, with updated breadcrumbs and the same output formats
[ "create", "a", "reporter", "for", "a", "sub", "-", "report", "with", "updated", "breadcrumbs", "and", "the", "same", "output", "formats" ]
python
train
resync/resync
resync/resource_container.py
https://github.com/resync/resync/blob/98292c17b2c00f2d6f5191c6ab51fef8c292a018/resync/resource_container.py#L224-L253
def prune_dupes(self): """Remove all but the last entry for a given resource URI. Returns the number of entries removed. Also removes all entries for a given URI where the first entry is a create and the last entry is a delete. """ n = 0 pruned1 = [] seen...
[ "def", "prune_dupes", "(", "self", ")", ":", "n", "=", "0", "pruned1", "=", "[", "]", "seen", "=", "set", "(", ")", "deletes", "=", "{", "}", "for", "r", "in", "reversed", "(", "self", ".", "resources", ")", ":", "if", "(", "r", ".", "uri", "...
Remove all but the last entry for a given resource URI. Returns the number of entries removed. Also removes all entries for a given URI where the first entry is a create and the last entry is a delete.
[ "Remove", "all", "but", "the", "last", "entry", "for", "a", "given", "resource", "URI", "." ]
python
train
quantmind/pulsar
pulsar/apps/http/client.py
https://github.com/quantmind/pulsar/blob/fee44e871954aa6ca36d00bb5a3739abfdb89b26/pulsar/apps/http/client.py#L331-L336
def remove_header(self, header_name): """Remove ``header_name`` from this request. """ val1 = self.headers.pop(header_name, None) val2 = self.unredirected_headers.pop(header_name, None) return val1 or val2
[ "def", "remove_header", "(", "self", ",", "header_name", ")", ":", "val1", "=", "self", ".", "headers", ".", "pop", "(", "header_name", ",", "None", ")", "val2", "=", "self", ".", "unredirected_headers", ".", "pop", "(", "header_name", ",", "None", ")", ...
Remove ``header_name`` from this request.
[ "Remove", "header_name", "from", "this", "request", "." ]
python
train
pallets/werkzeug
src/werkzeug/routing.py
https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/routing.py#L1523-L1541
def is_endpoint_expecting(self, endpoint, *arguments): """Iterate over all rules and check if the endpoint expects the arguments provided. This is for example useful if you have some URLs that expect a language code and others that do not and you want to wrap the builder a bit so that t...
[ "def", "is_endpoint_expecting", "(", "self", ",", "endpoint", ",", "*", "arguments", ")", ":", "self", ".", "update", "(", ")", "arguments", "=", "set", "(", "arguments", ")", "for", "rule", "in", "self", ".", "_rules_by_endpoint", "[", "endpoint", "]", ...
Iterate over all rules and check if the endpoint expects the arguments provided. This is for example useful if you have some URLs that expect a language code and others that do not and you want to wrap the builder a bit so that the current language code is automatically added if not pro...
[ "Iterate", "over", "all", "rules", "and", "check", "if", "the", "endpoint", "expects", "the", "arguments", "provided", ".", "This", "is", "for", "example", "useful", "if", "you", "have", "some", "URLs", "that", "expect", "a", "language", "code", "and", "ot...
python
train
capitalone/giraffez
giraffez/types.py
https://github.com/capitalone/giraffez/blob/6b4d27eb1a1eaf188c6885c7364ef27e92b1b957/giraffez/types.py#L204-L215
def get(self, column_name): """ Retrieve a column from the list with name value :code:`column_name` :param str column_name: The name of the column to get :return: :class:`~giraffez.types.Column` with the specified name, or :code:`None` if it does not exist. """ column_na...
[ "def", "get", "(", "self", ",", "column_name", ")", ":", "column_name", "=", "column_name", ".", "lower", "(", ")", "for", "c", "in", "self", ".", "columns", ":", "if", "c", ".", "name", "==", "column_name", ":", "return", "c", "return", "None" ]
Retrieve a column from the list with name value :code:`column_name` :param str column_name: The name of the column to get :return: :class:`~giraffez.types.Column` with the specified name, or :code:`None` if it does not exist.
[ "Retrieve", "a", "column", "from", "the", "list", "with", "name", "value", ":", "code", ":", "column_name" ]
python
test
jarun/Buku
bukuserver/server.py
https://github.com/jarun/Buku/blob/5f101363cf68f7666d4f5b28f0887ee07e916054/bukuserver/server.py#L42-L52
def get_tags(): """get tags.""" tags = getattr(flask.g, 'bukudb', get_bukudb()).get_tag_all() result = { 'tags': tags[0] } if request.path.startswith('/api/'): res = jsonify(result) else: res = render_template('bukuserver/tags.html', result=result) return res
[ "def", "get_tags", "(", ")", ":", "tags", "=", "getattr", "(", "flask", ".", "g", ",", "'bukudb'", ",", "get_bukudb", "(", ")", ")", ".", "get_tag_all", "(", ")", "result", "=", "{", "'tags'", ":", "tags", "[", "0", "]", "}", "if", "request", "."...
get tags.
[ "get", "tags", "." ]
python
train
lago-project/lago
lago/templates.py
https://github.com/lago-project/lago/blob/5b8970f7687e063e4619066d5b8093ca997678c9/lago/templates.py#L230-L247
def get_metadata(self, handle): """ Returns the associated metadata info for the given handle, the metadata file must exist (``handle + '.metadata'``). If the given handle has an ``.xz`` extension, it will get removed when calculating the handle metadata path Args: ...
[ "def", "get_metadata", "(", "self", ",", "handle", ")", ":", "response", "=", "self", ".", "open_url", "(", "url", "=", "handle", ",", "suffix", "=", "'.metadata'", ")", "try", ":", "return", "json", ".", "load", "(", "response", ")", "finally", ":", ...
Returns the associated metadata info for the given handle, the metadata file must exist (``handle + '.metadata'``). If the given handle has an ``.xz`` extension, it will get removed when calculating the handle metadata path Args: handle (str): Path to the template to get the...
[ "Returns", "the", "associated", "metadata", "info", "for", "the", "given", "handle", "the", "metadata", "file", "must", "exist", "(", "handle", "+", ".", "metadata", ")", ".", "If", "the", "given", "handle", "has", "an", ".", "xz", "extension", "it", "wi...
python
train
spacetelescope/stsci.tools
lib/stsci/tools/fileutil.py
https://github.com/spacetelescope/stsci.tools/blob/9a022503ad24ca54ce83331482dfa3ff6de9f403/lib/stsci/tools/fileutil.py#L1076-L1081
def copyFile(input, output, replace=None): """Copy a file whole from input to output.""" _found = findFile(output) if not _found or (_found and replace): shutil.copy2(input, output)
[ "def", "copyFile", "(", "input", ",", "output", ",", "replace", "=", "None", ")", ":", "_found", "=", "findFile", "(", "output", ")", "if", "not", "_found", "or", "(", "_found", "and", "replace", ")", ":", "shutil", ".", "copy2", "(", "input", ",", ...
Copy a file whole from input to output.
[ "Copy", "a", "file", "whole", "from", "input", "to", "output", "." ]
python
train
Duke-GCB/DukeDSClient
ddsc/cmdparser.py
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L421-L443
def register_deliver_command(self, deliver_func): """ Add 'deliver' command for transferring a project to another user., :param deliver_func: function to run when user choses this option """ description = "Initiate delivery of a project to another user. Removes other user's curre...
[ "def", "register_deliver_command", "(", "self", ",", "deliver_func", ")", ":", "description", "=", "\"Initiate delivery of a project to another user. Removes other user's current permissions. \"", "\"Send message to D4S2 service to send email and allow access to the project once user \"", "\...
Add 'deliver' command for transferring a project to another user., :param deliver_func: function to run when user choses this option
[ "Add", "deliver", "command", "for", "transferring", "a", "project", "to", "another", "user", ".", ":", "param", "deliver_func", ":", "function", "to", "run", "when", "user", "choses", "this", "option" ]
python
train
rorr73/LifeSOSpy
lifesospy/device.py
https://github.com/rorr73/LifeSOSpy/blob/62360fbab2e90bf04d52b547093bdab2d4e389b4/lifesospy/device.py#L374-L376
def current_reading(self) -> Optional[Union[int, float]]: """Current reading for a special sensor.""" return self._get_field_value(SpecialDevice.PROP_CURRENT_READING)
[ "def", "current_reading", "(", "self", ")", "->", "Optional", "[", "Union", "[", "int", ",", "float", "]", "]", ":", "return", "self", ".", "_get_field_value", "(", "SpecialDevice", ".", "PROP_CURRENT_READING", ")" ]
Current reading for a special sensor.
[ "Current", "reading", "for", "a", "special", "sensor", "." ]
python
train
rocky/python3-trepan
trepan/lib/sighandler.py
https://github.com/rocky/python3-trepan/blob/14e91bc0acce090d67be145b1ac040cab92ac5f3/trepan/lib/sighandler.py#L49-L60
def lookup_signum(name): """Find the corresponding signal number for 'name'. Return None if 'name' is invalid.""" uname = name.upper() if (uname.startswith('SIG') and hasattr(signal, uname)): return getattr(signal, uname) else: uname = "SIG"+uname if hasattr(signal, uname): ...
[ "def", "lookup_signum", "(", "name", ")", ":", "uname", "=", "name", ".", "upper", "(", ")", "if", "(", "uname", ".", "startswith", "(", "'SIG'", ")", "and", "hasattr", "(", "signal", ",", "uname", ")", ")", ":", "return", "getattr", "(", "signal", ...
Find the corresponding signal number for 'name'. Return None if 'name' is invalid.
[ "Find", "the", "corresponding", "signal", "number", "for", "name", ".", "Return", "None", "if", "name", "is", "invalid", "." ]
python
test
bcbio/bcbio-nextgen
bcbio/structural/shared.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/structural/shared.py#L270-L283
def get_cur_batch(items): """Retrieve name of the batch shared between all items in a group. """ batches = [] for data in items: batch = tz.get_in(["metadata", "batch"], data, []) batches.append(set(batch) if isinstance(batch, (list, tuple)) else set([batch])) combo_batches = reduce(...
[ "def", "get_cur_batch", "(", "items", ")", ":", "batches", "=", "[", "]", "for", "data", "in", "items", ":", "batch", "=", "tz", ".", "get_in", "(", "[", "\"metadata\"", ",", "\"batch\"", "]", ",", "data", ",", "[", "]", ")", "batches", ".", "appen...
Retrieve name of the batch shared between all items in a group.
[ "Retrieve", "name", "of", "the", "batch", "shared", "between", "all", "items", "in", "a", "group", "." ]
python
train
timothydmorton/isochrones
isochrones/observation.py
https://github.com/timothydmorton/isochrones/blob/d84495573044c66db2fd6b959fe69e370757ea14/isochrones/observation.py#L859-L884
def load_hdf(cls, filename, path='', ic=None): """ Loads stored ObservationTree from file. You can provide the isochrone to use; or it will default to MIST TODO: saving and loading must be fixed! save ic type, bands, etc. """ store = pd.HDFStore(filename) try: ...
[ "def", "load_hdf", "(", "cls", ",", "filename", ",", "path", "=", "''", ",", "ic", "=", "None", ")", ":", "store", "=", "pd", ".", "HDFStore", "(", "filename", ")", "try", ":", "samples", "=", "store", "[", "path", "+", "'/df'", "]", "attrs", "="...
Loads stored ObservationTree from file. You can provide the isochrone to use; or it will default to MIST TODO: saving and loading must be fixed! save ic type, bands, etc.
[ "Loads", "stored", "ObservationTree", "from", "file", "." ]
python
train
rraadd88/rohan
rohan/dandage/align/align_annot.py
https://github.com/rraadd88/rohan/blob/b0643a3582a2fffc0165ace69fb80880d92bfb10/rohan/dandage/align/align_annot.py#L272-L332
def dannots2dalignbed2dannotsagg(cfg): """ Aggregate annotations per query step#8 :param cfg: configuration dict """ datatmpd=cfg['datatmpd'] daannotp=f'{datatmpd}/08_dannot.tsv' cfg['daannotp']=daannotp dannotsaggp=cfg['dannotsaggp'] logging.info(basename(daannotp)) if...
[ "def", "dannots2dalignbed2dannotsagg", "(", "cfg", ")", ":", "datatmpd", "=", "cfg", "[", "'datatmpd'", "]", "daannotp", "=", "f'{datatmpd}/08_dannot.tsv'", "cfg", "[", "'daannotp'", "]", "=", "daannotp", "dannotsaggp", "=", "cfg", "[", "'dannotsaggp'", "]", "lo...
Aggregate annotations per query step#8 :param cfg: configuration dict
[ "Aggregate", "annotations", "per", "query", "step#8" ]
python
train
EelcoHoogendoorn/Numpy_arraysetops_EP
numpy_indexed/funcs.py
https://github.com/EelcoHoogendoorn/Numpy_arraysetops_EP/blob/84dc8114bf8a79c3acb3f7f59128247b9fc97243/numpy_indexed/funcs.py#L19-L39
def count(keys, axis=semantics.axis_default): """count the number of times each key occurs in the input set Arguments --------- keys : indexable object Returns ------- unique : ndarray, [groups, ...] unique keys count : ndarray, [groups], int the number of times each ke...
[ "def", "count", "(", "keys", ",", "axis", "=", "semantics", ".", "axis_default", ")", ":", "index", "=", "as_index", "(", "keys", ",", "axis", ",", "base", "=", "True", ")", "return", "index", ".", "unique", ",", "index", ".", "count" ]
count the number of times each key occurs in the input set Arguments --------- keys : indexable object Returns ------- unique : ndarray, [groups, ...] unique keys count : ndarray, [groups], int the number of times each key occurs in the input set Notes ----- Ca...
[ "count", "the", "number", "of", "times", "each", "key", "occurs", "in", "the", "input", "set" ]
python
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/cyndex2.py
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/cyndex2.py#L85-L99
def updateCurrentNetworkInNdex(self, body, verbose=None): """ Update current network's record in NDEx :param body: Properties required to update a network record in NDEx. :param verbose: print more :returns: 200: successful operation; 404: Network does not exist """ ...
[ "def", "updateCurrentNetworkInNdex", "(", "self", ",", "body", ",", "verbose", "=", "None", ")", ":", "surl", "=", "self", ".", "___url", "sv", "=", "surl", ".", "split", "(", "'/'", ")", "[", "-", "1", "]", "surl", "=", "surl", ".", "rstrip", "(",...
Update current network's record in NDEx :param body: Properties required to update a network record in NDEx. :param verbose: print more :returns: 200: successful operation; 404: Network does not exist
[ "Update", "current", "network", "s", "record", "in", "NDEx" ]
python
train
RedFantom/ttkwidgets
ttkwidgets/font/chooser.py
https://github.com/RedFantom/ttkwidgets/blob/02150322060f867b6e59a175522ef84b09168019/ttkwidgets/font/chooser.py#L127-L142
def font(self): """ Selected font. :return: font tuple (family_name, size, \*options), :class:`~font.Font` object """ if self._family is None: return None, None else: font_tuple = self.__generate_font_tuple() font_obj = font.Fo...
[ "def", "font", "(", "self", ")", ":", "if", "self", ".", "_family", "is", "None", ":", "return", "None", ",", "None", "else", ":", "font_tuple", "=", "self", ".", "__generate_font_tuple", "(", ")", "font_obj", "=", "font", ".", "Font", "(", "family", ...
Selected font. :return: font tuple (family_name, size, \*options), :class:`~font.Font` object
[ "Selected", "font", ".", ":", "return", ":", "font", "tuple", "(", "family_name", "size", "\\", "*", "options", ")", ":", "class", ":", "~font", ".", "Font", "object" ]
python
train
bcbio/bcbio-nextgen
bcbio/pipeline/shared.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/shared.py#L246-L259
def remove_exclude_regions(f): """Remove regions to exclude based on configuration: polyA, LCR, high depth. """ exclude_fns = {"lcr": remove_lcr_regions, "highdepth": remove_highdepth_regions, "polyx": remove_polyx_regions} @functools.wraps(f) def wrapper(variant_regions, region, ...
[ "def", "remove_exclude_regions", "(", "f", ")", ":", "exclude_fns", "=", "{", "\"lcr\"", ":", "remove_lcr_regions", ",", "\"highdepth\"", ":", "remove_highdepth_regions", ",", "\"polyx\"", ":", "remove_polyx_regions", "}", "@", "functools", ".", "wraps", "(", "f",...
Remove regions to exclude based on configuration: polyA, LCR, high depth.
[ "Remove", "regions", "to", "exclude", "based", "on", "configuration", ":", "polyA", "LCR", "high", "depth", "." ]
python
train
Grunny/zap-cli
zapcli/cli.py
https://github.com/Grunny/zap-cli/blob/d58d4850ecfc5467badfac5e5bcc841d064bd419/zapcli/cli.py#L267-L276
def report(zap_helper, output, output_format): """Generate XML, MD or HTML report.""" if output_format == 'html': zap_helper.html_report(output) elif output_format == 'md': zap_helper.md_report(output) else: zap_helper.xml_report(output) console.info('Report saved to "{0}"'....
[ "def", "report", "(", "zap_helper", ",", "output", ",", "output_format", ")", ":", "if", "output_format", "==", "'html'", ":", "zap_helper", ".", "html_report", "(", "output", ")", "elif", "output_format", "==", "'md'", ":", "zap_helper", ".", "md_report", "...
Generate XML, MD or HTML report.
[ "Generate", "XML", "MD", "or", "HTML", "report", "." ]
python
train
pytroll/posttroll
posttroll/message.py
https://github.com/pytroll/posttroll/blob/8e811a0544b5182c4a72aed074b2ff8c4324e94d/posttroll/message.py#L85-L94
def is_valid_data(obj): """Check if data is JSON serializable. """ if obj: try: tmp = json.dumps(obj, default=datetime_encoder) del tmp except (TypeError, UnicodeDecodeError): return False return True
[ "def", "is_valid_data", "(", "obj", ")", ":", "if", "obj", ":", "try", ":", "tmp", "=", "json", ".", "dumps", "(", "obj", ",", "default", "=", "datetime_encoder", ")", "del", "tmp", "except", "(", "TypeError", ",", "UnicodeDecodeError", ")", ":", "retu...
Check if data is JSON serializable.
[ "Check", "if", "data", "is", "JSON", "serializable", "." ]
python
train