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
barrust/mediawiki
mediawiki/mediawikipage.py
https://github.com/barrust/mediawiki/blob/292e0be6c752409062dceed325d74839caf16a9b/mediawiki/mediawikipage.py#L552-L578
def _handle_redirect(self, redirect, preload, query, page): """ handle redirect """ if redirect: redirects = query["redirects"][0] if "normalized" in query: normalized = query["normalized"][0] if normalized["from"] != self.title: ...
[ "def", "_handle_redirect", "(", "self", ",", "redirect", ",", "preload", ",", "query", ",", "page", ")", ":", "if", "redirect", ":", "redirects", "=", "query", "[", "\"redirects\"", "]", "[", "0", "]", "if", "\"normalized\"", "in", "query", ":", "normali...
handle redirect
[ "handle", "redirect" ]
python
train
productml/blurr
blurr/core/base.py
https://github.com/productml/blurr/blob/1b688b2c4a9bbbb2139c58bf0682ddc05a6c24fa/blurr/core/base.py#L147-L154
def _needs_evaluation(self) -> bool: """ Returns True when: 1. Where clause is not specified 2. Where WHERE clause is specified and it evaluates to True Returns false if a where clause is specified and it evaluates to False """ return self._schema.when is ...
[ "def", "_needs_evaluation", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_schema", ".", "when", "is", "None", "or", "self", ".", "_schema", ".", "when", ".", "evaluate", "(", "self", ".", "_evaluation_context", ")" ]
Returns True when: 1. Where clause is not specified 2. Where WHERE clause is specified and it evaluates to True Returns false if a where clause is specified and it evaluates to False
[ "Returns", "True", "when", ":", "1", ".", "Where", "clause", "is", "not", "specified", "2", ".", "Where", "WHERE", "clause", "is", "specified", "and", "it", "evaluates", "to", "True", "Returns", "false", "if", "a", "where", "clause", "is", "specified", "...
python
train
apache/incubator-mxnet
tools/diagnose.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/tools/diagnose.py#L33-L48
def parse_args(): """Parse arguments.""" parser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter, description='Diagnose script for checking the current system.') choices = ['python', 'pip', 'mxnet', 'os', 'hardware', 'network'] for choice in choices: ...
[ "def", "parse_args", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "formatter_class", "=", "argparse", ".", "ArgumentDefaultsHelpFormatter", ",", "description", "=", "'Diagnose script for checking the current system.'", ")", "choices", "=", "[", ...
Parse arguments.
[ "Parse", "arguments", "." ]
python
train
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/_config_db_redis.py#L152-L177
def _load_dict_hierarchical(self, db_key: str) -> dict: """Load a dictionary stored hierarchically at db_key.""" db_keys = self._db.keys(pattern=db_key + '*') my_dict = {} for _db_key in db_keys: if self._db.type(_db_key) == 'list': db_values = self._db.lrange...
[ "def", "_load_dict_hierarchical", "(", "self", ",", "db_key", ":", "str", ")", "->", "dict", ":", "db_keys", "=", "self", ".", "_db", ".", "keys", "(", "pattern", "=", "db_key", "+", "'*'", ")", "my_dict", "=", "{", "}", "for", "_db_key", "in", "db_k...
Load a dictionary stored hierarchically at db_key.
[ "Load", "a", "dictionary", "stored", "hierarchically", "at", "db_key", "." ]
python
train
pantsbuild/pex
pex/package.py
https://github.com/pantsbuild/pex/blob/87b2129d860250d3b9edce75b9cb62f9789ee521/pex/package.py#L107-L125
def split_fragment(cls, fragment): """A heuristic used to split a string into version name/fragment: >>> SourcePackage.split_fragment('pysolr-2.1.0-beta') ('pysolr', '2.1.0-beta') >>> SourcePackage.split_fragment('cElementTree-1.0.5-20051216') ('cElementTree', '1.0.5-20051216') >...
[ "def", "split_fragment", "(", "cls", ",", "fragment", ")", ":", "def", "likely_version_component", "(", "enumerated_fragment", ")", ":", "return", "sum", "(", "bool", "(", "v", "and", "v", "[", "0", "]", ".", "isdigit", "(", ")", ")", "for", "v", "in",...
A heuristic used to split a string into version name/fragment: >>> SourcePackage.split_fragment('pysolr-2.1.0-beta') ('pysolr', '2.1.0-beta') >>> SourcePackage.split_fragment('cElementTree-1.0.5-20051216') ('cElementTree', '1.0.5-20051216') >>> SourcePackage.split_fragment('pil-1.1.7...
[ "A", "heuristic", "used", "to", "split", "a", "string", "into", "version", "name", "/", "fragment", ":" ]
python
train
cons3rt/pycons3rt
pycons3rt/deployment.py
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/deployment.py#L527-L534
def set_deployment_run_name(self): """Sets the deployment run name from deployment properties :return: None """ log = logging.getLogger(self.cls_logger + '.set_deployment_run_name') self.deployment_run_name = self.get_value('cons3rt.deploymentRun.name') log.info('Found d...
[ "def", "set_deployment_run_name", "(", "self", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "self", ".", "cls_logger", "+", "'.set_deployment_run_name'", ")", "self", ".", "deployment_run_name", "=", "self", ".", "get_value", "(", "'cons3rt.deploymentRu...
Sets the deployment run name from deployment properties :return: None
[ "Sets", "the", "deployment", "run", "name", "from", "deployment", "properties" ]
python
train
merll/docker-fabric
dockerfabric/utils/users.py
https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/utils/users.py#L101-L122
def get_or_create_group(groupname, gid_preset, system=False, id_dependent=True): """ Returns the id for the given group, and creates it first in case it does not exist. :param groupname: Group name. :type groupname: unicode :param gid_preset: Group id to set if a new group is created. :type gid...
[ "def", "get_or_create_group", "(", "groupname", ",", "gid_preset", ",", "system", "=", "False", ",", "id_dependent", "=", "True", ")", ":", "gid", "=", "get_group_id", "(", "groupname", ")", "if", "gid", "is", "None", ":", "create_group", "(", "groupname", ...
Returns the id for the given group, and creates it first in case it does not exist. :param groupname: Group name. :type groupname: unicode :param gid_preset: Group id to set if a new group is created. :type gid_preset: int or unicode :param system: Create a system group. :type system: bool ...
[ "Returns", "the", "id", "for", "the", "given", "group", "and", "creates", "it", "first", "in", "case", "it", "does", "not", "exist", "." ]
python
train
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Parser.py
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L527-L539
def containsUid(self, uid): ''' Check if #uid is found anywhere within this element tree @param uid <uuid.UUID> - Uid @return <bool> - If #uid is found within this tree ''' for rootNode in self.getRootNodes(): if rootNode.containsUid(uid): ...
[ "def", "containsUid", "(", "self", ",", "uid", ")", ":", "for", "rootNode", "in", "self", ".", "getRootNodes", "(", ")", ":", "if", "rootNode", ".", "containsUid", "(", "uid", ")", ":", "return", "True", "return", "False" ]
Check if #uid is found anywhere within this element tree @param uid <uuid.UUID> - Uid @return <bool> - If #uid is found within this tree
[ "Check", "if", "#uid", "is", "found", "anywhere", "within", "this", "element", "tree" ]
python
train
SpotlightData/preprocessing
preprocessing/text.py
https://github.com/SpotlightData/preprocessing/blob/180c6472bc2642afbd7a1ece08d0b0d14968a708/preprocessing/text.py#L75-L98
def correct_spelling(text_string): ''' Splits string and converts words not found within a pre-built dictionary to their most likely actual word based on a relative probability dictionary. Returns edited string as type str. Keyword argument: - text_string: string instance Exceptions raise...
[ "def", "correct_spelling", "(", "text_string", ")", ":", "if", "text_string", "is", "None", "or", "text_string", "==", "\"\"", ":", "return", "\"\"", "elif", "isinstance", "(", "text_string", ",", "str", ")", ":", "word_list", "=", "text_string", ".", "split...
Splits string and converts words not found within a pre-built dictionary to their most likely actual word based on a relative probability dictionary. Returns edited string as type str. Keyword argument: - text_string: string instance Exceptions raised: - InputError: occurs should a string or...
[ "Splits", "string", "and", "converts", "words", "not", "found", "within", "a", "pre", "-", "built", "dictionary", "to", "their", "most", "likely", "actual", "word", "based", "on", "a", "relative", "probability", "dictionary", ".", "Returns", "edited", "string"...
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/ietf_netconf_notifications.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/ietf_netconf_notifications.py#L256-L265
def netconf_confirmed_commit_session_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") netconf_confirmed_commit = ET.SubElement(config, "netconf-confirmed-commit", xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-notifications") session_id = ET.SubElemen...
[ "def", "netconf_confirmed_commit_session_id", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "netconf_confirmed_commit", "=", "ET", ".", "SubElement", "(", "config", ",", "\"netconf-confirmed-commit\"",...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
boriel/zxbasic
asmparse.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/asmparse.py#L377-L383
def set_org(self, value, lineno): """ Sets a new ORG value """ if value < 0 or value > MAX_MEM: error(lineno, "Memory ORG out of range [0 .. 65535]. Current value: %i" % value) self.index = self.ORG = value
[ "def", "set_org", "(", "self", ",", "value", ",", "lineno", ")", ":", "if", "value", "<", "0", "or", "value", ">", "MAX_MEM", ":", "error", "(", "lineno", ",", "\"Memory ORG out of range [0 .. 65535]. Current value: %i\"", "%", "value", ")", "self", ".", "in...
Sets a new ORG value
[ "Sets", "a", "new", "ORG", "value" ]
python
train
twilio/twilio-python
twilio/rest/studio/v1/flow/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/studio/v1/flow/__init__.py#L239-L248
def engagements(self): """ Access the engagements :returns: twilio.rest.studio.v1.flow.engagement.EngagementList :rtype: twilio.rest.studio.v1.flow.engagement.EngagementList """ if self._engagements is None: self._engagements = EngagementList(self._version, f...
[ "def", "engagements", "(", "self", ")", ":", "if", "self", ".", "_engagements", "is", "None", ":", "self", ".", "_engagements", "=", "EngagementList", "(", "self", ".", "_version", ",", "flow_sid", "=", "self", ".", "_solution", "[", "'sid'", "]", ",", ...
Access the engagements :returns: twilio.rest.studio.v1.flow.engagement.EngagementList :rtype: twilio.rest.studio.v1.flow.engagement.EngagementList
[ "Access", "the", "engagements" ]
python
train
pkgw/pwkit
pwkit/__init__.py
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/__init__.py#L205-L211
def copy(self): """Return a shallow copy of this object. """ new = self.__class__() new.__dict__ = dict(self.__dict__) return new
[ "def", "copy", "(", "self", ")", ":", "new", "=", "self", ".", "__class__", "(", ")", "new", ".", "__dict__", "=", "dict", "(", "self", ".", "__dict__", ")", "return", "new" ]
Return a shallow copy of this object.
[ "Return", "a", "shallow", "copy", "of", "this", "object", "." ]
python
train
BenDoan/perform
perform.py
https://github.com/BenDoan/perform/blob/3434c5c68fb7661d74f03404c71bb5fbebe1900f/perform.py#L157-L164
def refresh_listing(): """Refreshes the list of programs attached to the perform module from the path""" for program in get_programs(): if re.match(r'^[a-zA-Z_][a-zA-Z_0-9]*$', program) is not None: globals()[program] = partial(_run_program, program) globals()["_"] = _underscore_run...
[ "def", "refresh_listing", "(", ")", ":", "for", "program", "in", "get_programs", "(", ")", ":", "if", "re", ".", "match", "(", "r'^[a-zA-Z_][a-zA-Z_0-9]*$'", ",", "program", ")", "is", "not", "None", ":", "globals", "(", ")", "[", "program", "]", "=", ...
Refreshes the list of programs attached to the perform module from the path
[ "Refreshes", "the", "list", "of", "programs", "attached", "to", "the", "perform", "module", "from", "the", "path" ]
python
train
ebu/PlugIt
plugit_proxy/views.py
https://github.com/ebu/PlugIt/blob/de5f1e870f67caaef7a4a58e4bb1ed54d9c5dc53/plugit_proxy/views.py#L654-L679
def get_current_orga(request, hproject, availableOrga): """Return the current orga to use""" # If nothing available return 404 if len(availableOrga) == 0: raise Http404 # Find the current orga currentOrgaId = request.session.get('plugit-orgapk-' + str(hproject.pk), None) # If we don't...
[ "def", "get_current_orga", "(", "request", ",", "hproject", ",", "availableOrga", ")", ":", "# If nothing available return 404", "if", "len", "(", "availableOrga", ")", "==", "0", ":", "raise", "Http404", "# Find the current orga", "currentOrgaId", "=", "request", "...
Return the current orga to use
[ "Return", "the", "current", "orga", "to", "use" ]
python
train
Rapptz/discord.py
discord/ext/commands/core.py
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L277-L284
def update(self, **kwargs): """Updates :class:`Command` instance with updated attribute. This works similarly to the :func:`.command` decorator in terms of parameters in that they are passed to the :class:`Command` or subclass constructors, sans the name and callback. """ ...
[ "def", "update", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "__init__", "(", "self", ".", "callback", ",", "*", "*", "dict", "(", "self", ".", "__original_kwargs__", ",", "*", "*", "kwargs", ")", ")" ]
Updates :class:`Command` instance with updated attribute. This works similarly to the :func:`.command` decorator in terms of parameters in that they are passed to the :class:`Command` or subclass constructors, sans the name and callback.
[ "Updates", ":", "class", ":", "Command", "instance", "with", "updated", "attribute", "." ]
python
train
bdastur/rex
rex.py
https://github.com/bdastur/rex/blob/e45173aa93f05a1d2ee65746e6f6cc6d829daf60/rex.py#L338-L380
def parse_tabular_string(search_string, header_keys, delimiter=None, merge_list=None): ''' Given a string in a tabular format, parse it and return a dictionary @args: search_string: This is a string in tabular format (e.g...
[ "def", "parse_tabular_string", "(", "search_string", ",", "header_keys", ",", "delimiter", "=", "None", ",", "merge_list", "=", "None", ")", ":", "first_line", "=", "True", "parsed_results", "=", "[", "]", "for", "line", "in", "search_string", ".", "splitlines...
Given a string in a tabular format, parse it and return a dictionary @args: search_string: This is a string in tabular format (e.g.: output of df command) header_keys: This is a list of strings for the headers. delimiter(optional): Default is None, which translates to spaces ...
[ "Given", "a", "string", "in", "a", "tabular", "format", "parse", "it", "and", "return", "a", "dictionary" ]
python
train
nerox8664/pytorch2keras
pytorch2keras/normalization_layers.py
https://github.com/nerox8664/pytorch2keras/blob/750eaf747323580e6732d0c5ba9f2f39cb096764/pytorch2keras/normalization_layers.py#L115-L138
def convert_dropout(params, w_name, scope_name, inputs, layers, weights, names): """ Convert dropout. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with k...
[ "def", "convert_dropout", "(", "params", ",", "w_name", ",", "scope_name", ",", "inputs", ",", "layers", ",", "weights", ",", "names", ")", ":", "print", "(", "'Converting dropout ...'", ")", "if", "names", "==", "'short'", ":", "tf_name", "=", "'DO'", "+"...
Convert dropout. Args: params: dictionary with layer parameters w_name: name prefix in state_dict scope_name: pytorch scope name inputs: pytorch node inputs layers: dictionary with keras tensors weights: pytorch state_dict names: use short names for keras lay...
[ "Convert", "dropout", "." ]
python
valid
saulpw/visidata
visidata/vdtui.py
https://github.com/saulpw/visidata/blob/32771e0cea6c24fc7902683d14558391395c591f/visidata/vdtui.py#L608-L616
def callHook(self, hookname, *args, **kwargs): 'Call all functions registered with `addHook` for the given hookname.' r = [] for f in self.hooks[hookname]: try: r.append(f(*args, **kwargs)) except Exception as e: exceptionCaught(e) ...
[ "def", "callHook", "(", "self", ",", "hookname", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "r", "=", "[", "]", "for", "f", "in", "self", ".", "hooks", "[", "hookname", "]", ":", "try", ":", "r", ".", "append", "(", "f", "(", "*", ...
Call all functions registered with `addHook` for the given hookname.
[ "Call", "all", "functions", "registered", "with", "addHook", "for", "the", "given", "hookname", "." ]
python
train
google/prettytensor
prettytensor/pretty_tensor_sparse_methods.py
https://github.com/google/prettytensor/blob/75daa0b11252590f548da5647addc0ea610c4c45/prettytensor/pretty_tensor_sparse_methods.py#L22-L61
def to_dense_one_hot(labels, class_count): """Converts a vector that specified one-hot per batch into a dense version. Args: labels: The labels input. class_count: The number of classes as an int. Returns: One dense vector for each item in the batch. Raises: ValueError: If labels is not rank 1....
[ "def", "to_dense_one_hot", "(", "labels", ",", "class_count", ")", ":", "if", "not", "isinstance", "(", "class_count", ",", "tf", ".", "compat", ".", "integral_types", ")", ":", "raise", "TypeError", "(", "'class_count must be an integer type.'", ")", "if", "lab...
Converts a vector that specified one-hot per batch into a dense version. Args: labels: The labels input. class_count: The number of classes as an int. Returns: One dense vector for each item in the batch. Raises: ValueError: If labels is not rank 1. TypeError: If class_count is not an integer...
[ "Converts", "a", "vector", "that", "specified", "one", "-", "hot", "per", "batch", "into", "a", "dense", "version", "." ]
python
train
QuantEcon/QuantEcon.py
quantecon/robustlq.py
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/robustlq.py#L359-L402
def evaluate_F(self, F): """ Given a fixed policy F, with the interpretation :math:`u = -F x`, this function computes the matrix :math:`P_F` and constant :math:`d_F` associated with discounted cost :math:`J_F(x) = x' P_F x + d_F` Parameters ---------- F : array_l...
[ "def", "evaluate_F", "(", "self", ",", "F", ")", ":", "# == Simplify names == #", "Q", ",", "R", ",", "A", ",", "B", ",", "C", "=", "self", ".", "Q", ",", "self", ".", "R", ",", "self", ".", "A", ",", "self", ".", "B", ",", "self", ".", "C", ...
Given a fixed policy F, with the interpretation :math:`u = -F x`, this function computes the matrix :math:`P_F` and constant :math:`d_F` associated with discounted cost :math:`J_F(x) = x' P_F x + d_F` Parameters ---------- F : array_like(float, ndim=2) The policy fun...
[ "Given", "a", "fixed", "policy", "F", "with", "the", "interpretation", ":", "math", ":", "u", "=", "-", "F", "x", "this", "function", "computes", "the", "matrix", ":", "math", ":", "P_F", "and", "constant", ":", "math", ":", "d_F", "associated", "with"...
python
train
inspirehep/refextract
refextract/documents/pdf.py
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/documents/pdf.py#L434-L449
def replace_undesirable_characters(line): """ Replace certain bad characters in a text line. @param line: (string) the text line in which bad characters are to be replaced. @return: (string) the text line after the bad characters have been replaced. """ # T...
[ "def", "replace_undesirable_characters", "(", "line", ")", ":", "# These are separate because we want a particular order", "for", "bad_string", ",", "replacement", "in", "UNDESIRABLE_STRING_REPLACEMENTS", ":", "line", "=", "line", ".", "replace", "(", "bad_string", ",", "...
Replace certain bad characters in a text line. @param line: (string) the text line in which bad characters are to be replaced. @return: (string) the text line after the bad characters have been replaced.
[ "Replace", "certain", "bad", "characters", "in", "a", "text", "line", "." ]
python
train
thunder-project/thunder
thunder/series/series.py
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L292-L348
def select(self, crit): """ Select subset of values that match a given index criterion. Parameters ---------- crit : function, list, str, int Criterion function to map to indices, specific index value, or list of indices. """ import types ...
[ "def", "select", "(", "self", ",", "crit", ")", ":", "import", "types", "# handle lists, strings, and ints", "if", "not", "isinstance", "(", "crit", ",", "types", ".", "FunctionType", ")", ":", "# set(\"foo\") -> {\"f\", \"o\"}; wrap in list to prevent:", "if", "isins...
Select subset of values that match a given index criterion. Parameters ---------- crit : function, list, str, int Criterion function to map to indices, specific index value, or list of indices.
[ "Select", "subset", "of", "values", "that", "match", "a", "given", "index", "criterion", "." ]
python
train
klavinslab/coral
coral/analysis/_sequencing/sanger.py
https://github.com/klavinslab/coral/blob/17f59591211562a59a051f474cd6cecba4829df9/coral/analysis/_sequencing/sanger.py#L72-L80
def nonmatches(self): '''Report mismatches, indels, and coverage.''' # For every result, keep a dictionary of mismatches, insertions, and # deletions report = [] for result in self.aligned_results: report.append(self._analyze_single(self.aligned_reference, result)) ...
[ "def", "nonmatches", "(", "self", ")", ":", "# For every result, keep a dictionary of mismatches, insertions, and", "# deletions", "report", "=", "[", "]", "for", "result", "in", "self", ".", "aligned_results", ":", "report", ".", "append", "(", "self", ".", "_analy...
Report mismatches, indels, and coverage.
[ "Report", "mismatches", "indels", "and", "coverage", "." ]
python
train
gatkin/declxml
declxml.py
https://github.com/gatkin/declxml/blob/3a2324b43aee943e82a04587fbb68932c6f392ba/declxml.py#L476-L499
def dictionary( element_name, # type: Text children, # type: List[Processor] required=True, # type: bool alias=None, # type: Optional[Text] hooks=None # type: Optional[Hooks] ): # type: (...) -> RootProcessor """ Create a processor for dictionary values. :pa...
[ "def", "dictionary", "(", "element_name", ",", "# type: Text", "children", ",", "# type: List[Processor]", "required", "=", "True", ",", "# type: bool", "alias", "=", "None", ",", "# type: Optional[Text]", "hooks", "=", "None", "# type: Optional[Hooks]", ")", ":", "...
Create a processor for dictionary values. :param element_name: Name of the XML element containing the dictionary value. Can also be specified using supported XPath syntax. :param children: List of declxml processor objects for processing the children contained within the dictionary. :param ...
[ "Create", "a", "processor", "for", "dictionary", "values", "." ]
python
train
spacetelescope/drizzlepac
drizzlepac/imgclasses.py
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/imgclasses.py#L1613-L1672
def _estimate_2dhist_shift(imgxy, refxy, searchrad=3.0): """ Create a 2D matrix-histogram which contains the delta between each XY position and each UV position. Then estimate initial offset between catalogs. """ print("Computing initial guess for X and Y shifts...") # create ZP matrix ...
[ "def", "_estimate_2dhist_shift", "(", "imgxy", ",", "refxy", ",", "searchrad", "=", "3.0", ")", ":", "print", "(", "\"Computing initial guess for X and Y shifts...\"", ")", "# create ZP matrix", "zpmat", "=", "_xy_2dhist", "(", "imgxy", ",", "refxy", ",", "r", "="...
Create a 2D matrix-histogram which contains the delta between each XY position and each UV position. Then estimate initial offset between catalogs.
[ "Create", "a", "2D", "matrix", "-", "histogram", "which", "contains", "the", "delta", "between", "each", "XY", "position", "and", "each", "UV", "position", ".", "Then", "estimate", "initial", "offset", "between", "catalogs", "." ]
python
train
ebu/PlugIt
examples/simple_service_proxy_mode/server.py
https://github.com/ebu/PlugIt/blob/de5f1e870f67caaef7a4a58e4bb1ed54d9c5dc53/examples/simple_service_proxy_mode/server.py#L10-L21
def get_ebuio_headers(request): """Return a dict with ebuio headers""" retour = {} for (key, value) in request.headers: if key.startswith('X-Plugit-'): key = key[9:] retour[key] = value return retour
[ "def", "get_ebuio_headers", "(", "request", ")", ":", "retour", "=", "{", "}", "for", "(", "key", ",", "value", ")", "in", "request", ".", "headers", ":", "if", "key", ".", "startswith", "(", "'X-Plugit-'", ")", ":", "key", "=", "key", "[", "9", ":...
Return a dict with ebuio headers
[ "Return", "a", "dict", "with", "ebuio", "headers" ]
python
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L2040-L2048
def remove_envelope(self, component=None, **kwargs): """ [NOT SUPPORTED] [NOT IMPLEMENTED] Shortcut to :meth:`remove_component` but with kind='envelope' """ kwargs.setdefault('kind', 'envelope') return self.remove_component(component, **kwargs)
[ "def", "remove_envelope", "(", "self", ",", "component", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'kind'", ",", "'envelope'", ")", "return", "self", ".", "remove_component", "(", "component", ",", "*", "*", "kwar...
[NOT SUPPORTED] [NOT IMPLEMENTED] Shortcut to :meth:`remove_component` but with kind='envelope'
[ "[", "NOT", "SUPPORTED", "]", "[", "NOT", "IMPLEMENTED", "]" ]
python
train
cqparts/cqparts
src/cqparts/codec/gltf.py
https://github.com/cqparts/cqparts/blob/018e87e14c2c4d1d40b4bfe6a7e22bcf9baf0a53/src/cqparts/codec/gltf.py#L187-L195
def add_poly_index(self, i, j, k): """ Add 3 ``SCALAR`` of ``uint`` to the ``idx_data`` buffer. """ self.idx_data.write( struct.pack(self.idx_fmt, i) + struct.pack(self.idx_fmt, j) + struct.pack(self.idx_fmt, k) )
[ "def", "add_poly_index", "(", "self", ",", "i", ",", "j", ",", "k", ")", ":", "self", ".", "idx_data", ".", "write", "(", "struct", ".", "pack", "(", "self", ".", "idx_fmt", ",", "i", ")", "+", "struct", ".", "pack", "(", "self", ".", "idx_fmt", ...
Add 3 ``SCALAR`` of ``uint`` to the ``idx_data`` buffer.
[ "Add", "3", "SCALAR", "of", "uint", "to", "the", "idx_data", "buffer", "." ]
python
train
data-8/datascience
datascience/tables.py
https://github.com/data-8/datascience/blob/4cee38266903ca169cea4a53b8cc39502d85c464/datascience/tables.py#L2831-L2843
def _varargs_labels_as_list(label_list): """Return a list of labels for a list of labels or singleton list of list of labels.""" if len(label_list) == 0: return [] elif not _is_non_string_iterable(label_list[0]): # Assume everything is a label. If not, it'll be caught later. ret...
[ "def", "_varargs_labels_as_list", "(", "label_list", ")", ":", "if", "len", "(", "label_list", ")", "==", "0", ":", "return", "[", "]", "elif", "not", "_is_non_string_iterable", "(", "label_list", "[", "0", "]", ")", ":", "# Assume everything is a label. If not...
Return a list of labels for a list of labels or singleton list of list of labels.
[ "Return", "a", "list", "of", "labels", "for", "a", "list", "of", "labels", "or", "singleton", "list", "of", "list", "of", "labels", "." ]
python
train
3DLIRIOUS/MeshLabXML
meshlabxml/remesh.py
https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/remesh.py#L437-L486
def curvature_flipping(script, angle_threshold=1.0, curve_type=0, selected=False): """ Use the points and normals to build a surface using the Poisson Surface reconstruction approach. Args: script: the FilterScript object or script filename to write the filter...
[ "def", "curvature_flipping", "(", "script", ",", "angle_threshold", "=", "1.0", ",", "curve_type", "=", "0", ",", "selected", "=", "False", ")", ":", "filter_xml", "=", "''", ".", "join", "(", "[", "' <filter name=\"Curvature flipping optimization\">\\n'", ",", ...
Use the points and normals to build a surface using the Poisson Surface reconstruction approach. Args: script: the FilterScript object or script filename to write the filter to. angle_threshold (float): To avoid excessive flipping/swapping we consider only couple of ...
[ "Use", "the", "points", "and", "normals", "to", "build", "a", "surface", "using", "the", "Poisson", "Surface", "reconstruction", "approach", "." ]
python
test
sernst/cauldron
cauldron/cli/__init__.py
https://github.com/sernst/cauldron/blob/4086aec9c038c402ea212c79fe8bd0d27104f9cf/cauldron/cli/__init__.py#L53-L63
def reformat(source: str) -> str: """ Formats the source string to strip newlines on both ends and dedents the the entire string :param source: The string to reformat """ value = source if source else '' return dedent(value.strip('\n')).strip()
[ "def", "reformat", "(", "source", ":", "str", ")", "->", "str", ":", "value", "=", "source", "if", "source", "else", "''", "return", "dedent", "(", "value", ".", "strip", "(", "'\\n'", ")", ")", ".", "strip", "(", ")" ]
Formats the source string to strip newlines on both ends and dedents the the entire string :param source: The string to reformat
[ "Formats", "the", "source", "string", "to", "strip", "newlines", "on", "both", "ends", "and", "dedents", "the", "the", "entire", "string" ]
python
train
ratt-ru/PyMORESANE
pymoresane/iuwt.py
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/iuwt.py#L17-L41
def iuwt_decomposition(in1, scale_count, scale_adjust=0, mode='ser', core_count=2, store_smoothed=False, store_on_gpu=False): """ This function serves as a handler for the different implementations of the IUWT decomposition. It allows the different methods to be used almost interchang...
[ "def", "iuwt_decomposition", "(", "in1", ",", "scale_count", ",", "scale_adjust", "=", "0", ",", "mode", "=", "'ser'", ",", "core_count", "=", "2", ",", "store_smoothed", "=", "False", ",", "store_on_gpu", "=", "False", ")", ":", "if", "mode", "==", "'se...
This function serves as a handler for the different implementations of the IUWT decomposition. It allows the different methods to be used almost interchangeably. INPUTS: in1 (no default): Array on which the decomposition is to be performed. scale_count (no default): ...
[ "This", "function", "serves", "as", "a", "handler", "for", "the", "different", "implementations", "of", "the", "IUWT", "decomposition", ".", "It", "allows", "the", "different", "methods", "to", "be", "used", "almost", "interchangeably", "." ]
python
train
libyal/dtfabric
dtfabric/runtime/data_maps.py
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/data_maps.py#L1584-L1686
def _CompositeMapByteStream( self, byte_stream, byte_offset=0, context=None, **unused_kwargs): """Maps a sequence of composite data types on a byte stream. Args: byte_stream (bytes): byte stream. byte_offset (Optional[int]): offset into the byte stream where to start. context (Optional[...
[ "def", "_CompositeMapByteStream", "(", "self", ",", "byte_stream", ",", "byte_offset", "=", "0", ",", "context", "=", "None", ",", "*", "*", "unused_kwargs", ")", ":", "context_state", "=", "getattr", "(", "context", ",", "'state'", ",", "{", "}", ")", "...
Maps a sequence of composite data types on a byte stream. Args: byte_stream (bytes): byte stream. byte_offset (Optional[int]): offset into the byte stream where to start. context (Optional[DataTypeMapContext]): data type map context. Returns: object: mapped value. Raises: Ma...
[ "Maps", "a", "sequence", "of", "composite", "data", "types", "on", "a", "byte", "stream", "." ]
python
train
saltstack/salt
salt/cli/support/collector.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/support/collector.py#L421-L434
def _cleanup(self): ''' Cleanup if crash/exception :return: ''' if (hasattr(self, 'config') and self.config.get('support_archive') and os.path.exists(self.config['support_archive'])): self.out.warning('Terminated earlier, cleaning up') ...
[ "def", "_cleanup", "(", "self", ")", ":", "if", "(", "hasattr", "(", "self", ",", "'config'", ")", "and", "self", ".", "config", ".", "get", "(", "'support_archive'", ")", "and", "os", ".", "path", ".", "exists", "(", "self", ".", "config", "[", "'...
Cleanup if crash/exception :return:
[ "Cleanup", "if", "crash", "/", "exception", ":", "return", ":" ]
python
train
msmbuilder/msmbuilder
msmbuilder/msm/core.py
https://github.com/msmbuilder/msmbuilder/blob/556a93a170782f47be53f4a1e9d740fb1c8272b3/msmbuilder/msm/core.py#L311-L356
def _solve_ratemat_eigensystem(theta, k, n): """Find the dominant eigenpairs of a reversible rate matrix (master equation) Parameters ---------- theta : ndarray, shape=(n_params,) The free parameters of the rate matrix k : int The number of eigenpairs to find n : int ...
[ "def", "_solve_ratemat_eigensystem", "(", "theta", ",", "k", ",", "n", ")", ":", "S", "=", "np", ".", "zeros", "(", "(", "n", ",", "n", ")", ")", "pi", "=", "np", ".", "exp", "(", "theta", "[", "-", "n", ":", "]", ")", "pi", "=", "pi", "/",...
Find the dominant eigenpairs of a reversible rate matrix (master equation) Parameters ---------- theta : ndarray, shape=(n_params,) The free parameters of the rate matrix k : int The number of eigenpairs to find n : int The number of states Notes ----- Norma...
[ "Find", "the", "dominant", "eigenpairs", "of", "a", "reversible", "rate", "matrix", "(", "master", "equation", ")" ]
python
train
mitsei/dlkit
dlkit/json_/osid/objects.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/objects.py#L1425-L1440
def set_sequestered(self, sequestered): """Sets the sequestered flag. arg: sequestered (boolean): the new sequestered flag raise: InvalidArgument - ``sequestered`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must ...
[ "def", "set_sequestered", "(", "self", ",", "sequestered", ")", ":", "if", "sequestered", "is", "None", ":", "raise", "errors", ".", "NullArgument", "(", ")", "if", "self", ".", "get_sequestered_metadata", "(", ")", ".", "is_read_only", "(", ")", ":", "rai...
Sets the sequestered flag. arg: sequestered (boolean): the new sequestered flag raise: InvalidArgument - ``sequestered`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.*
[ "Sets", "the", "sequestered", "flag", "." ]
python
train
dustinmm80/healthy
pylint_runner.py
https://github.com/dustinmm80/healthy/blob/b59016c3f578ca45b6ce857a2d5c4584b8542288/pylint_runner.py#L22-L44
def score(package_path): """ Runs pylint on a package and returns a score Lower score is better :param package_path: path of the package to score :return: number of score """ python_files = find_files(package_path, '*.py') total_counter = Counter() for python_file in python_files:...
[ "def", "score", "(", "package_path", ")", ":", "python_files", "=", "find_files", "(", "package_path", ",", "'*.py'", ")", "total_counter", "=", "Counter", "(", ")", "for", "python_file", "in", "python_files", ":", "output", "=", "run_pylint", "(", "python_fil...
Runs pylint on a package and returns a score Lower score is better :param package_path: path of the package to score :return: number of score
[ "Runs", "pylint", "on", "a", "package", "and", "returns", "a", "score", "Lower", "score", "is", "better" ]
python
train
bitesofcode/projexui
projexui/widgets/xganttwidget/xganttscene.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xganttwidget/xganttscene.py#L224-L250
def drawBackground(self, painter, rect): """ Draws the background for this scene. :param painter | <QPainter> rect | <QRect> """ if self._dirty: self.rebuild() # draw the alternating rects gantt ...
[ "def", "drawBackground", "(", "self", ",", "painter", ",", "rect", ")", ":", "if", "self", ".", "_dirty", ":", "self", ".", "rebuild", "(", ")", "# draw the alternating rects\r", "gantt", "=", "self", ".", "ganttWidget", "(", ")", "# draw the alternating rects...
Draws the background for this scene. :param painter | <QPainter> rect | <QRect>
[ "Draws", "the", "background", "for", "this", "scene", ".", ":", "param", "painter", "|", "<QPainter", ">", "rect", "|", "<QRect", ">" ]
python
train
polyaxon/polyaxon
polyaxon/k8s_events_handlers/tasks/statuses.py
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/k8s_events_handlers/tasks/statuses.py#L71-L100
def k8s_events_handle_job_statuses(self: 'celery_app.task', payload: Dict) -> None: """Project jobs statuses""" details = payload['details'] job_uuid = details['labels']['job_uuid'] job_name = details['labels']['job_name'] project_name = details['labels'].get('project_name') logger.debug('handli...
[ "def", "k8s_events_handle_job_statuses", "(", "self", ":", "'celery_app.task'", ",", "payload", ":", "Dict", ")", "->", "None", ":", "details", "=", "payload", "[", "'details'", "]", "job_uuid", "=", "details", "[", "'labels'", "]", "[", "'job_uuid'", "]", "...
Project jobs statuses
[ "Project", "jobs", "statuses" ]
python
train
jaraco/tempora
tempora/__init__.py
https://github.com/jaraco/tempora/blob/f0a9ab636103fe829aa9b495c93f5249aac5f2b8/tempora/__init__.py#L467-L481
def divide_timedelta(td1, td2): """ Get the ratio of two timedeltas >>> one_day = datetime.timedelta(days=1) >>> one_hour = datetime.timedelta(hours=1) >>> divide_timedelta(one_hour, one_day) == 1 / 24 True """ try: return td1 / td2 except TypeError: # Python 3.2 gets division # http://bugs.python.org/i...
[ "def", "divide_timedelta", "(", "td1", ",", "td2", ")", ":", "try", ":", "return", "td1", "/", "td2", "except", "TypeError", ":", "# Python 3.2 gets division", "# http://bugs.python.org/issue2706", "return", "td1", ".", "total_seconds", "(", ")", "/", "td2", "."...
Get the ratio of two timedeltas >>> one_day = datetime.timedelta(days=1) >>> one_hour = datetime.timedelta(hours=1) >>> divide_timedelta(one_hour, one_day) == 1 / 24 True
[ "Get", "the", "ratio", "of", "two", "timedeltas" ]
python
valid
sorgerlab/indra
indra/preassembler/ontology_mapper.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/ontology_mapper.py#L45-L74
def map_statements(self): """Run the ontology mapping on the statements.""" for stmt in self.statements: for agent in stmt.agent_list(): if agent is None: continue all_mappings = [] for db_name, db_id in agent.db_refs.items(...
[ "def", "map_statements", "(", "self", ")", ":", "for", "stmt", "in", "self", ".", "statements", ":", "for", "agent", "in", "stmt", ".", "agent_list", "(", ")", ":", "if", "agent", "is", "None", ":", "continue", "all_mappings", "=", "[", "]", "for", "...
Run the ontology mapping on the statements.
[ "Run", "the", "ontology", "mapping", "on", "the", "statements", "." ]
python
train
google/grr
grr/client/grr_response_client/client_actions/file_finder.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/file_finder.py#L28-L55
def FileFinderOSFromClient(args): """This function expands paths from the args and returns related stat entries. Args: args: An `rdf_file_finder.FileFinderArgs` object. Yields: `rdf_paths.PathSpec` instances. """ stat_cache = filesystem.StatCache() opts = args.action.stat for path in GetExpand...
[ "def", "FileFinderOSFromClient", "(", "args", ")", ":", "stat_cache", "=", "filesystem", ".", "StatCache", "(", ")", "opts", "=", "args", ".", "action", ".", "stat", "for", "path", "in", "GetExpandedPaths", "(", "args", ")", ":", "try", ":", "content_condi...
This function expands paths from the args and returns related stat entries. Args: args: An `rdf_file_finder.FileFinderArgs` object. Yields: `rdf_paths.PathSpec` instances.
[ "This", "function", "expands", "paths", "from", "the", "args", "and", "returns", "related", "stat", "entries", "." ]
python
train
jilljenn/tryalgo
tryalgo/three_partition.py
https://github.com/jilljenn/tryalgo/blob/89a4dd9655e7b6b0a176f72b4c60d0196420dfe1/tryalgo/three_partition.py#L8-L23
def three_partition(x): """partition a set of integers in 3 parts of same total value :param x: table of non negative values :returns: triplet of the integers encoding the sets, or None otherwise :complexity: :math:`O(2^{2n})` """ f = [0] * (1 << len(x)) for i in range(len(x)): for ...
[ "def", "three_partition", "(", "x", ")", ":", "f", "=", "[", "0", "]", "*", "(", "1", "<<", "len", "(", "x", ")", ")", "for", "i", "in", "range", "(", "len", "(", "x", ")", ")", ":", "for", "S", "in", "range", "(", "1", "<<", "i", ")", ...
partition a set of integers in 3 parts of same total value :param x: table of non negative values :returns: triplet of the integers encoding the sets, or None otherwise :complexity: :math:`O(2^{2n})`
[ "partition", "a", "set", "of", "integers", "in", "3", "parts", "of", "same", "total", "value" ]
python
train
RJT1990/pyflux
pyflux/ssm/llm.py
https://github.com/RJT1990/pyflux/blob/297f2afc2095acd97c12e827dd500e8ea5da0c0f/pyflux/ssm/llm.py#L179-L262
def plot_predict(self, h=5, past_values=20, intervals=True, **kwargs): """ Makes forecast with the estimated model Parameters ---------- h : int (default : 5) How many steps ahead would you like to forecast? past_values : int (default : 20) How man...
[ "def", "plot_predict", "(", "self", ",", "h", "=", "5", ",", "past_values", "=", "20", ",", "intervals", "=", "True", ",", "*", "*", "kwargs", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "import", "seaborn", "as", "sns", "figsize", ...
Makes forecast with the estimated model Parameters ---------- h : int (default : 5) How many steps ahead would you like to forecast? past_values : int (default : 20) How many past observations to show on the forecast graph? intervals : Boolean ...
[ "Makes", "forecast", "with", "the", "estimated", "model" ]
python
train
edeposit/edeposit.amqp.ftp
src/edeposit/amqp/ftp/decoders/validator.py
https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/src/edeposit/amqp/ftp/decoders/validator.py#L158-L169
def process(self, key, val): """ Try to look for `key` in all required and optional fields. If found, set the `val`. """ for field in self.fields: if field.check(key, val): return for field in self.optional: if field.check(key, val...
[ "def", "process", "(", "self", ",", "key", ",", "val", ")", ":", "for", "field", "in", "self", ".", "fields", ":", "if", "field", ".", "check", "(", "key", ",", "val", ")", ":", "return", "for", "field", "in", "self", ".", "optional", ":", "if", ...
Try to look for `key` in all required and optional fields. If found, set the `val`.
[ "Try", "to", "look", "for", "key", "in", "all", "required", "and", "optional", "fields", ".", "If", "found", "set", "the", "val", "." ]
python
train
gwww/elkm1
elkm1_lib/areas.py
https://github.com/gwww/elkm1/blob/078d0de30840c3fab46f1f8534d98df557931e91/elkm1_lib/areas.py#L20-L22
def arm(self, level, code): """(Helper) Arm system at specified level (away, vacation, etc)""" self._elk.send(al_encode(level, self._index, code))
[ "def", "arm", "(", "self", ",", "level", ",", "code", ")", ":", "self", ".", "_elk", ".", "send", "(", "al_encode", "(", "level", ",", "self", ".", "_index", ",", "code", ")", ")" ]
(Helper) Arm system at specified level (away, vacation, etc)
[ "(", "Helper", ")", "Arm", "system", "at", "specified", "level", "(", "away", "vacation", "etc", ")" ]
python
train
mattja/nsim
nsim/analyses1/epochs.py
https://github.com/mattja/nsim/blob/ed62c41cd56b918fd97e09f7ad73c12c76a8c3e0/nsim/analyses1/epochs.py#L187-L273
def epochs(ts, variability=None, threshold=0.0, minlength=1.0, plot=True): """Identify "stationary" epochs within a time series, based on a continuous measure of variability. Epochs are defined to contain the points of minimal variability, and to extend as wide as possible with variability not exceedi...
[ "def", "epochs", "(", "ts", ",", "variability", "=", "None", ",", "threshold", "=", "0.0", ",", "minlength", "=", "1.0", ",", "plot", "=", "True", ")", ":", "if", "variability", "is", "None", ":", "variability", "=", "ts", ".", "variability_fp", "(", ...
Identify "stationary" epochs within a time series, based on a continuous measure of variability. Epochs are defined to contain the points of minimal variability, and to extend as wide as possible with variability not exceeding the threshold. Args: ts Timeseries of m variables, shape (n, m). ...
[ "Identify", "stationary", "epochs", "within", "a", "time", "series", "based", "on", "a", "continuous", "measure", "of", "variability", ".", "Epochs", "are", "defined", "to", "contain", "the", "points", "of", "minimal", "variability", "and", "to", "extend", "as...
python
train
koriakin/binflakes
binflakes/types/word.py
https://github.com/koriakin/binflakes/blob/f059cecadf1c605802a713c62375b5bd5606d53f/binflakes/types/word.py#L328-L333
def sge(self, other): """Compares two equal-sized BinWords, treating them as signed integers, and returning True if the first is bigger or equal. """ self._check_match(other) return self.to_sint() >= other.to_sint()
[ "def", "sge", "(", "self", ",", "other", ")", ":", "self", ".", "_check_match", "(", "other", ")", "return", "self", ".", "to_sint", "(", ")", ">=", "other", ".", "to_sint", "(", ")" ]
Compares two equal-sized BinWords, treating them as signed integers, and returning True if the first is bigger or equal.
[ "Compares", "two", "equal", "-", "sized", "BinWords", "treating", "them", "as", "signed", "integers", "and", "returning", "True", "if", "the", "first", "is", "bigger", "or", "equal", "." ]
python
train
gem/oq-engine
openquake/hazardlib/gsim/campbell_bozorgnia_2014.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/campbell_bozorgnia_2014.py#L161-L166
def _get_geometric_attenuation_term(self, C, mag, rrup): """ Returns the geometric attenuation term defined in equation 3 """ return (C["c5"] + C["c6"] * mag) * np.log(np.sqrt((rrup ** 2.) + (C["c7"] ** 2.)))
[ "def", "_get_geometric_attenuation_term", "(", "self", ",", "C", ",", "mag", ",", "rrup", ")", ":", "return", "(", "C", "[", "\"c5\"", "]", "+", "C", "[", "\"c6\"", "]", "*", "mag", ")", "*", "np", ".", "log", "(", "np", ".", "sqrt", "(", "(", ...
Returns the geometric attenuation term defined in equation 3
[ "Returns", "the", "geometric", "attenuation", "term", "defined", "in", "equation", "3" ]
python
train
pyQode/pyqode.core
pyqode/core/widgets/tabs.py
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/widgets/tabs.py#L349-L366
def removeTab(self, index): """ Removes tab at index ``index``. This method will emits tab_closed for the removed tab. :param index: index of the tab to remove. """ widget = self.widget(index) try: self._widgets.remove(widget) except ValueErr...
[ "def", "removeTab", "(", "self", ",", "index", ")", ":", "widget", "=", "self", ".", "widget", "(", "index", ")", "try", ":", "self", ".", "_widgets", ".", "remove", "(", "widget", ")", "except", "ValueError", ":", "pass", "self", ".", "tab_closed", ...
Removes tab at index ``index``. This method will emits tab_closed for the removed tab. :param index: index of the tab to remove.
[ "Removes", "tab", "at", "index", "index", "." ]
python
train
manns/pyspread
pyspread/src/lib/_grid_cairo_renderer.py
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1051-L1061
def get_right_key_rect(self): """Returns tuple key rect of right cell""" key_right = self.row, self.col + 1, self.tab border_width_right = \ float(self.cell_attributes[self.key]["borderwidth_right"]) / 2.0 rect_right = (self.x+self.width, self.y, bord...
[ "def", "get_right_key_rect", "(", "self", ")", ":", "key_right", "=", "self", ".", "row", ",", "self", ".", "col", "+", "1", ",", "self", ".", "tab", "border_width_right", "=", "float", "(", "self", ".", "cell_attributes", "[", "self", ".", "key", "]",...
Returns tuple key rect of right cell
[ "Returns", "tuple", "key", "rect", "of", "right", "cell" ]
python
train
thunder-project/thunder
thunder/blocks/blocks.py
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/blocks/blocks.py#L75-L87
def toimages(self): """ Convert blocks to images. """ from thunder.images.images import Images if self.mode == 'spark': values = self.values.values_to_keys((0,)).unchunk() if self.mode == 'local': values = self.values.unchunk() return Im...
[ "def", "toimages", "(", "self", ")", ":", "from", "thunder", ".", "images", ".", "images", "import", "Images", "if", "self", ".", "mode", "==", "'spark'", ":", "values", "=", "self", ".", "values", ".", "values_to_keys", "(", "(", "0", ",", ")", ")",...
Convert blocks to images.
[ "Convert", "blocks", "to", "images", "." ]
python
train
bovee/Aston
aston/spectra/isotopes.py
https://github.com/bovee/Aston/blob/007630fdf074690373d03398fe818260d3d3cf5a/aston/spectra/isotopes.py#L34-L74
def delta13c_craig(r45sam, r46sam, d13cstd, r45std, r46std, ks='Craig', d18ostd=23.5): """ Algorithm from Craig 1957. From the original Craig paper, we can set up a pair of equations and solve for d13C and d18O simultaneously: d45 * r45 = r13 * d13 + 0.5 * ...
[ "def", "delta13c_craig", "(", "r45sam", ",", "r46sam", ",", "d13cstd", ",", "r45std", ",", "r46std", ",", "ks", "=", "'Craig'", ",", "d18ostd", "=", "23.5", ")", ":", "# the constants for the calculations", "# originally r13, r17, r18 = 1123.72e-5, 759.9e-6, 415.8e-5", ...
Algorithm from Craig 1957. From the original Craig paper, we can set up a pair of equations and solve for d13C and d18O simultaneously: d45 * r45 = r13 * d13 + 0.5 * r17 * d18 d46 = r13 * ((r17**2 + r17 - r18) / a) * d13 + 1 - 0.5 * r17 * ((r13**2 + r13 - r18) / a...
[ "Algorithm", "from", "Craig", "1957", "." ]
python
train
newville/asteval
asteval/asteval.py
https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L535-L539
def on_slice(self, node): # ():('lower', 'upper', 'step') """Simple slice.""" return slice(self.run(node.lower), self.run(node.upper), self.run(node.step))
[ "def", "on_slice", "(", "self", ",", "node", ")", ":", "# ():('lower', 'upper', 'step')", "return", "slice", "(", "self", ".", "run", "(", "node", ".", "lower", ")", ",", "self", ".", "run", "(", "node", ".", "upper", ")", ",", "self", ".", "run", "(...
Simple slice.
[ "Simple", "slice", "." ]
python
train
Devoxin/Lavalink.py
lavalink/Client.py
https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/lavalink/Client.py#L173-L177
def destroy(self): """ Destroys the Lavalink client. """ self.ws.destroy() self.bot.remove_listener(self.on_socket_response) self.hooks.clear()
[ "def", "destroy", "(", "self", ")", ":", "self", ".", "ws", ".", "destroy", "(", ")", "self", ".", "bot", ".", "remove_listener", "(", "self", ".", "on_socket_response", ")", "self", ".", "hooks", ".", "clear", "(", ")" ]
Destroys the Lavalink client.
[ "Destroys", "the", "Lavalink", "client", "." ]
python
valid
b3j0f/schema
b3j0f/schema/lang/python.py
https://github.com/b3j0f/schema/blob/1c88c23337f5fef50254e65bd407112c43396dd9/b3j0f/schema/lang/python.py#L303-L462
def _getparams_rtype(cls, function): """Get function params from input function and rtype. :return: OrderedDict, rtype, vargs and kwargs. :rtype: tuple """ try: args, vargs, kwargs, default = getargspec(function) except TypeError: args, vargs, kw...
[ "def", "_getparams_rtype", "(", "cls", ",", "function", ")", ":", "try", ":", "args", ",", "vargs", ",", "kwargs", ",", "default", "=", "getargspec", "(", "function", ")", "except", "TypeError", ":", "args", ",", "vargs", ",", "kwargs", ",", "default", ...
Get function params from input function and rtype. :return: OrderedDict, rtype, vargs and kwargs. :rtype: tuple
[ "Get", "function", "params", "from", "input", "function", "and", "rtype", "." ]
python
train
pywbem/pywbem
attic/cim_provider2.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/attic/cim_provider2.py#L562-L590
def MI_createInstance(self, env, instance): # pylint: disable=invalid-name """Create a CIM instance, and return its instance name Implements the WBEM operation CreateInstance in terms of the set_instance method. A derived class will n...
[ "def", "MI_createInstance", "(", "self", ",", "env", ",", "instance", ")", ":", "# pylint: disable=invalid-name", "logger", "=", "env", ".", "get_logger", "(", ")", "logger", ".", "log_debug", "(", "'CIMProvider2 MI_createInstance called...'", ")", "rval", "=", "N...
Create a CIM instance, and return its instance name Implements the WBEM operation CreateInstance in terms of the set_instance method. A derived class will not normally override this method.
[ "Create", "a", "CIM", "instance", "and", "return", "its", "instance", "name" ]
python
train
kalbhor/MusicNow
musicnow/repair.py
https://github.com/kalbhor/MusicNow/blob/12ff1ed2ea2bb7dbbfd925d7998b3ea1e20de291/musicnow/repair.py#L106-L130
def get_lyrics_genius(song_title): ''' Scrapes the lyrics from Genius.com ''' base_url = "http://api.genius.com" headers = {'Authorization': 'Bearer %s' %(GENIUS_KEY)} search_url = base_url + "/search" data = {'q': song_title} response = requests.get(search_url, data=data, headers=heade...
[ "def", "get_lyrics_genius", "(", "song_title", ")", ":", "base_url", "=", "\"http://api.genius.com\"", "headers", "=", "{", "'Authorization'", ":", "'Bearer %s'", "%", "(", "GENIUS_KEY", ")", "}", "search_url", "=", "base_url", "+", "\"/search\"", "data", "=", "...
Scrapes the lyrics from Genius.com
[ "Scrapes", "the", "lyrics", "from", "Genius", ".", "com" ]
python
train
xolox/python-coloredlogs
coloredlogs/demo.py
https://github.com/xolox/python-coloredlogs/blob/1cbf0c6bbee400c6ddbc43008143809934ec3e79/coloredlogs/demo.py#L29-L49
def demonstrate_colored_logging(): """Interactively demonstrate the :mod:`coloredlogs` package.""" # Determine the available logging levels and order them by numeric value. decorated_levels = [] defined_levels = coloredlogs.find_defined_levels() normalizer = coloredlogs.NameNormalizer() for name...
[ "def", "demonstrate_colored_logging", "(", ")", ":", "# Determine the available logging levels and order them by numeric value.", "decorated_levels", "=", "[", "]", "defined_levels", "=", "coloredlogs", ".", "find_defined_levels", "(", ")", "normalizer", "=", "coloredlogs", "...
Interactively demonstrate the :mod:`coloredlogs` package.
[ "Interactively", "demonstrate", "the", ":", "mod", ":", "coloredlogs", "package", "." ]
python
train
inveniosoftware/invenio-i18n
invenio_i18n/ext.py
https://github.com/inveniosoftware/invenio-i18n/blob/3119bb7db3369b8ae0aecce5d7d7c79f807e2763/invenio_i18n/ext.py#L32-L46
def get_lazystring_encoder(app): """Return a JSONEncoder for handling lazy strings from Babel. Installed on Flask application by default by :class:`InvenioI18N`. """ from speaklater import _LazyString class JSONEncoder(app.json_encoder): def default(self, o): if isinstance(o, ...
[ "def", "get_lazystring_encoder", "(", "app", ")", ":", "from", "speaklater", "import", "_LazyString", "class", "JSONEncoder", "(", "app", ".", "json_encoder", ")", ":", "def", "default", "(", "self", ",", "o", ")", ":", "if", "isinstance", "(", "o", ",", ...
Return a JSONEncoder for handling lazy strings from Babel. Installed on Flask application by default by :class:`InvenioI18N`.
[ "Return", "a", "JSONEncoder", "for", "handling", "lazy", "strings", "from", "Babel", "." ]
python
train
twisted/mantissa
xmantissa/publicweb.py
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/publicweb.py#L841-L858
def fromRequest(cls, store, request): """ Return a L{LoginPage} which will present the user with a login prompt. @type store: L{Store} @param store: A I{site} store. @type request: L{nevow.inevow.IRequest} @param request: The HTTP request which encountered a need for ...
[ "def", "fromRequest", "(", "cls", ",", "store", ",", "request", ")", ":", "location", "=", "URL", ".", "fromRequest", "(", "request", ")", "segments", "=", "location", ".", "pathList", "(", "unquote", "=", "True", ",", "copy", "=", "False", ")", "segme...
Return a L{LoginPage} which will present the user with a login prompt. @type store: L{Store} @param store: A I{site} store. @type request: L{nevow.inevow.IRequest} @param request: The HTTP request which encountered a need for authentication. This will be effectively re-iss...
[ "Return", "a", "L", "{", "LoginPage", "}", "which", "will", "present", "the", "user", "with", "a", "login", "prompt", "." ]
python
train
tamasgal/km3pipe
km3pipe/math.py
https://github.com/tamasgal/km3pipe/blob/7a9b59ac899a28775b5bdc5d391d9a5340d08040/km3pipe/math.py#L494-L536
def intersect_3d(p1, p2): """Find the closes point for a given set of lines in 3D. Parameters ---------- p1 : (M, N) array_like Starting points p2 : (M, N) array_like End points. Returns ------- x : (N,) ndarray Least-squares solution - the closest point of the ...
[ "def", "intersect_3d", "(", "p1", ",", "p2", ")", ":", "v", "=", "p2", "-", "p1", "normed_v", "=", "unit_vector", "(", "v", ")", "nx", "=", "normed_v", "[", ":", ",", "0", "]", "ny", "=", "normed_v", "[", ":", ",", "1", "]", "nz", "=", "norme...
Find the closes point for a given set of lines in 3D. Parameters ---------- p1 : (M, N) array_like Starting points p2 : (M, N) array_like End points. Returns ------- x : (N,) ndarray Least-squares solution - the closest point of the intersections. Raises --...
[ "Find", "the", "closes", "point", "for", "a", "given", "set", "of", "lines", "in", "3D", "." ]
python
train
hfaran/Tornado-JSON
tornado_json/schema.py
https://github.com/hfaran/Tornado-JSON/blob/8d8b35ff77f13cb3ab1a606bd2083b26cc69c54f/tornado_json/schema.py#L82-L201
def validate(input_schema=None, output_schema=None, input_example=None, output_example=None, validator_cls=None, format_checker=None, on_empty_404=False, use_defaults=False): """Parameterized decorator for schema validation :type validator_cls: IValidator cla...
[ "def", "validate", "(", "input_schema", "=", "None", ",", "output_schema", "=", "None", ",", "input_example", "=", "None", ",", "output_example", "=", "None", ",", "validator_cls", "=", "None", ",", "format_checker", "=", "None", ",", "on_empty_404", "=", "F...
Parameterized decorator for schema validation :type validator_cls: IValidator class :type format_checker: jsonschema.FormatChecker or None :type on_empty_404: bool :param on_empty_404: If this is set, and the result from the decorated method is a falsy value, a 404 will be raised. :type use...
[ "Parameterized", "decorator", "for", "schema", "validation" ]
python
train
pjuren/pyokit
src/pyokit/interface/cli.py
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/interface/cli.py#L231-L242
def getOption(self, name): """ Get the the Option object associated with the given name. :param name: the name of the option to retrieve; can be short or long name. :raise InterfaceException: if the named option doesn't exist. """ name = name.strip() for o in self.options: if o.short ...
[ "def", "getOption", "(", "self", ",", "name", ")", ":", "name", "=", "name", ".", "strip", "(", ")", "for", "o", "in", "self", ".", "options", ":", "if", "o", ".", "short", "==", "name", "or", "o", ".", "long", "==", "name", ":", "return", "o",...
Get the the Option object associated with the given name. :param name: the name of the option to retrieve; can be short or long name. :raise InterfaceException: if the named option doesn't exist.
[ "Get", "the", "the", "Option", "object", "associated", "with", "the", "given", "name", "." ]
python
train
MaT1g3R/option
option/result.py
https://github.com/MaT1g3R/option/blob/37c954e6e74273d48649b3236bc881a1286107d6/option/result.py#L255-L276
def unwrap_or(self, optb: T) -> T: """ Returns the success value in the :class:`Result` or ``optb``. Args: optb: The default return value. Returns: The success value in the :class:`Result` if it is a :meth:`Result.Ok` value, otherwise ``optb``. ...
[ "def", "unwrap_or", "(", "self", ",", "optb", ":", "T", ")", "->", "T", ":", "return", "cast", "(", "T", ",", "self", ".", "_val", ")", "if", "self", ".", "_is_ok", "else", "optb" ]
Returns the success value in the :class:`Result` or ``optb``. Args: optb: The default return value. Returns: The success value in the :class:`Result` if it is a :meth:`Result.Ok` value, otherwise ``optb``. Notes: If you wish to use a result of a...
[ "Returns", "the", "success", "value", "in", "the", ":", "class", ":", "Result", "or", "optb", "." ]
python
train
ipazc/mtcnn
mtcnn/mtcnn.py
https://github.com/ipazc/mtcnn/blob/17029fe453a435f50c472ae2fd1c493341b5ede3/mtcnn/mtcnn.py#L549-L613
def __stage3(self, img, total_boxes, stage_status: StageStatus): """ Third stage of the MTCNN. :param img: :param total_boxes: :param stage_status: :return: """ num_boxes = total_boxes.shape[0] if num_boxes == 0: return total_boxes, np...
[ "def", "__stage3", "(", "self", ",", "img", ",", "total_boxes", ",", "stage_status", ":", "StageStatus", ")", ":", "num_boxes", "=", "total_boxes", ".", "shape", "[", "0", "]", "if", "num_boxes", "==", "0", ":", "return", "total_boxes", ",", "np", ".", ...
Third stage of the MTCNN. :param img: :param total_boxes: :param stage_status: :return:
[ "Third", "stage", "of", "the", "MTCNN", "." ]
python
train
NaPs/Kolekto
kolekto/profiles/__init__.py
https://github.com/NaPs/Kolekto/blob/29c5469da8782780a06bf9a76c59414bb6fd8fe3/kolekto/profiles/__init__.py#L19-L32
def load_commands(self, parser): """ Load commands of this profile. :param parser: argparse parser on which to add commands """ entrypoints = self._get_entrypoints() already_loaded = set() for entrypoint in entrypoints: if entrypoint.name not in already_loa...
[ "def", "load_commands", "(", "self", ",", "parser", ")", ":", "entrypoints", "=", "self", ".", "_get_entrypoints", "(", ")", "already_loaded", "=", "set", "(", ")", "for", "entrypoint", "in", "entrypoints", ":", "if", "entrypoint", ".", "name", "not", "in"...
Load commands of this profile. :param parser: argparse parser on which to add commands
[ "Load", "commands", "of", "this", "profile", "." ]
python
train
google/grr
grr/core/grr_response_core/lib/rdfvalues/paths.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/rdfvalues/paths.py#L281-L284
def Validate(self): """GlobExpression is valid.""" if len(self.RECURSION_REGEX.findall(self._value)) > 1: raise ValueError("Only one ** is permitted per path: %s." % self._value)
[ "def", "Validate", "(", "self", ")", ":", "if", "len", "(", "self", ".", "RECURSION_REGEX", ".", "findall", "(", "self", ".", "_value", ")", ")", ">", "1", ":", "raise", "ValueError", "(", "\"Only one ** is permitted per path: %s.\"", "%", "self", ".", "_v...
GlobExpression is valid.
[ "GlobExpression", "is", "valid", "." ]
python
train
NiklasRosenstein-Python/nr-deprecated
nr/path.py
https://github.com/NiklasRosenstein-Python/nr-deprecated/blob/f9f8b89ea1b084841a8ab65784eaf68852686b2a/nr/path.py#L246-L254
def rmvsuffix(subject): """ Remove the suffix from *subject*. """ index = subject.rfind('.') if index > subject.replace('\\', '/').rfind('/'): subject = subject[:index] return subject
[ "def", "rmvsuffix", "(", "subject", ")", ":", "index", "=", "subject", ".", "rfind", "(", "'.'", ")", "if", "index", ">", "subject", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ".", "rfind", "(", "'/'", ")", ":", "subject", "=", "subject", "[",...
Remove the suffix from *subject*.
[ "Remove", "the", "suffix", "from", "*", "subject", "*", "." ]
python
train
tanghaibao/jcvi
jcvi/apps/biomart.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/apps/biomart.py#L297-L324
def bed(args): """ %prog bed genes.ids Get gene bed from phytozome. `genes.ids` contains the list of gene you want to pull from Phytozome. Write output to .bed file. """ p = OptionParser(bed.__doc__) opts, args = p.parse_args(args) if len(args) != 1: sys.exit(not p.print_help()...
[ "def", "bed", "(", "args", ")", ":", "p", "=", "OptionParser", "(", "bed", ".", "__doc__", ")", "opts", ",", "args", "=", "p", ".", "parse_args", "(", "args", ")", "if", "len", "(", "args", ")", "!=", "1", ":", "sys", ".", "exit", "(", "not", ...
%prog bed genes.ids Get gene bed from phytozome. `genes.ids` contains the list of gene you want to pull from Phytozome. Write output to .bed file.
[ "%prog", "bed", "genes", ".", "ids" ]
python
train
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/interactive.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/interactive.py#L2012-L2050
def do_register(self, arg): """ [~thread] r - print(the value of all registers [~thread] r <register> - print(the value of a register [~thread] r <register>=<value> - change the value of a register [~thread] register - print(the value of all registers [~thread] register <...
[ "def", "do_register", "(", "self", ",", "arg", ")", ":", "arg", "=", "arg", ".", "strip", "(", ")", "if", "not", "arg", ":", "self", ".", "print_current_location", "(", ")", "else", ":", "equ", "=", "arg", ".", "find", "(", "'='", ")", "if", "equ...
[~thread] r - print(the value of all registers [~thread] r <register> - print(the value of a register [~thread] r <register>=<value> - change the value of a register [~thread] register - print(the value of all registers [~thread] register <register> - print(the value of a register ...
[ "[", "~thread", "]", "r", "-", "print", "(", "the", "value", "of", "all", "registers", "[", "~thread", "]", "r", "<register", ">", "-", "print", "(", "the", "value", "of", "a", "register", "[", "~thread", "]", "r", "<register", ">", "=", "<value", ...
python
train
sbuss/pypercube
pypercube/metric.py
https://github.com/sbuss/pypercube/blob/e9d2cca9c004b8bad6d1e0b68b080f887a186a22/pypercube/metric.py#L25-L48
def from_json(cls, json_obj): """Build a MetricResponse from JSON. :param json_obj: JSON data representing a Cube Metric. :type json_obj: `String` or `json` :throws: `InvalidMetricError` when any of {type,time,data} fields are not present in json_obj. """ if isin...
[ "def", "from_json", "(", "cls", ",", "json_obj", ")", ":", "if", "isinstance", "(", "json_obj", ",", "str", ")", ":", "json_obj", "=", "json", ".", "loads", "(", "json_obj", ")", "time", "=", "None", "value", "=", "None", "if", "cls", ".", "TIME_FIEL...
Build a MetricResponse from JSON. :param json_obj: JSON data representing a Cube Metric. :type json_obj: `String` or `json` :throws: `InvalidMetricError` when any of {type,time,data} fields are not present in json_obj.
[ "Build", "a", "MetricResponse", "from", "JSON", "." ]
python
train
HttpRunner/HttpRunner
httprunner/client.py
https://github.com/HttpRunner/HttpRunner/blob/f259551bf9c8ba905eae5c1afcf2efea20ae0871/httprunner/client.py#L64-L126
def get_req_resp_record(self, resp_obj): """ get request and response info from Response() object. """ def log_print(req_resp_dict, r_type): msg = "\n================== {} details ==================\n".format(r_type) for key, value in req_resp_dict[r_type].items(): ...
[ "def", "get_req_resp_record", "(", "self", ",", "resp_obj", ")", ":", "def", "log_print", "(", "req_resp_dict", ",", "r_type", ")", ":", "msg", "=", "\"\\n================== {} details ==================\\n\"", ".", "format", "(", "r_type", ")", "for", "key", ",",...
get request and response info from Response() object.
[ "get", "request", "and", "response", "info", "from", "Response", "()", "object", "." ]
python
train
RI-imaging/qpsphere
qpsphere/models/mod_rytov.py
https://github.com/RI-imaging/qpsphere/blob/3cfa0e9fb8e81be8c820abbeccd47242e7972ac1/qpsphere/models/mod_rytov.py#L108-L238
def sphere_prop_fslice_bessel(radius, sphere_index, medium_index, wavelength=550e-9, pixel_size=1e-7, grid_size=(80, 80), lD=0, approx="rytov", zeropad=5, oversample=1 ): """Compute the projection...
[ "def", "sphere_prop_fslice_bessel", "(", "radius", ",", "sphere_index", ",", "medium_index", ",", "wavelength", "=", "550e-9", ",", "pixel_size", "=", "1e-7", ",", "grid_size", "=", "(", "80", ",", "80", ")", ",", "lD", "=", "0", ",", "approx", "=", "\"r...
Compute the projection of a disc using the Fourier slice theorem and the Bessel function of the first kind of order 1. Parameters ---------- radius: float Radius of the sphere [m] sphere_index: float Refractive index of the sphere medium_index: float Refractive index of ...
[ "Compute", "the", "projection", "of", "a", "disc", "using", "the", "Fourier", "slice", "theorem", "and", "the", "Bessel", "function", "of", "the", "first", "kind", "of", "order", "1", "." ]
python
train
keon/algorithms
algorithms/sort/top_sort.py
https://github.com/keon/algorithms/blob/4d6569464a62a75c1357acc97e2dd32ee2f9f4a3/algorithms/sort/top_sort.py#L26-L66
def top_sort(graph): """ Time complexity is the same as DFS, which is O(V + E) Space complexity: O(V) """ order, enter, state = [], set(graph), {} def is_ready(node): lst = graph.get(node, ()) if len(lst) == 0: return True for k in lst: sk = s...
[ "def", "top_sort", "(", "graph", ")", ":", "order", ",", "enter", ",", "state", "=", "[", "]", ",", "set", "(", "graph", ")", ",", "{", "}", "def", "is_ready", "(", "node", ")", ":", "lst", "=", "graph", ".", "get", "(", "node", ",", "(", ")"...
Time complexity is the same as DFS, which is O(V + E) Space complexity: O(V)
[ "Time", "complexity", "is", "the", "same", "as", "DFS", "which", "is", "O", "(", "V", "+", "E", ")", "Space", "complexity", ":", "O", "(", "V", ")" ]
python
train
dj-stripe/dj-stripe
djstripe/models/core.py
https://github.com/dj-stripe/dj-stripe/blob/a5308a3808cd6e2baba49482f7a699f3a8992518/djstripe/models/core.py#L303-L321
def refund(self, amount=None, reason=None): """ Initiate a refund. If amount is not provided, then this will be a full refund. :param amount: A positive decimal amount representing how much of this charge to refund. Can only refund up to the unrefunded amount remaining of the charge. :trye amount: Decimal ...
[ "def", "refund", "(", "self", ",", "amount", "=", "None", ",", "reason", "=", "None", ")", ":", "charge_obj", "=", "self", ".", "api_retrieve", "(", ")", ".", "refund", "(", "amount", "=", "self", ".", "_calculate_refund_amount", "(", "amount", "=", "a...
Initiate a refund. If amount is not provided, then this will be a full refund. :param amount: A positive decimal amount representing how much of this charge to refund. Can only refund up to the unrefunded amount remaining of the charge. :trye amount: Decimal :param reason: String indicating the reason for the...
[ "Initiate", "a", "refund", ".", "If", "amount", "is", "not", "provided", "then", "this", "will", "be", "a", "full", "refund", "." ]
python
train
Aluriak/bubble-tools
bubbletools/utils.py
https://github.com/Aluriak/bubble-tools/blob/f014f4a1986abefc80dc418feaa05ed258c2221a/bubbletools/utils.py#L19-L22
def infer_format(filename:str) -> str: """Return extension identifying format of given filename""" _, ext = os.path.splitext(filename) return ext
[ "def", "infer_format", "(", "filename", ":", "str", ")", "->", "str", ":", "_", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "return", "ext" ]
Return extension identifying format of given filename
[ "Return", "extension", "identifying", "format", "of", "given", "filename" ]
python
train
ArangoDB-Community/pyArango
pyArango/collection.py
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L498-L528
def bulkSave(self, docs, onDuplicate="error", **params) : """Parameter docs must be either an iterrable of documents or dictionnaries. This function will return the number of documents, created and updated, and will raise an UpdateError exception if there's at least one error. params are any par...
[ "def", "bulkSave", "(", "self", ",", "docs", ",", "onDuplicate", "=", "\"error\"", ",", "*", "*", "params", ")", ":", "payload", "=", "[", "]", "for", "d", "in", "docs", ":", "if", "type", "(", "d", ")", "is", "dict", ":", "payload", ".", "append...
Parameter docs must be either an iterrable of documents or dictionnaries. This function will return the number of documents, created and updated, and will raise an UpdateError exception if there's at least one error. params are any parameters from arango's documentation
[ "Parameter", "docs", "must", "be", "either", "an", "iterrable", "of", "documents", "or", "dictionnaries", ".", "This", "function", "will", "return", "the", "number", "of", "documents", "created", "and", "updated", "and", "will", "raise", "an", "UpdateError", "...
python
train
gem/oq-engine
openquake/hazardlib/sourcewriter.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/sourcewriter.py#L442-L467
def build_rupture_node(rupt, probs_occur): """ :param rupt: a hazardlib rupture object :param probs_occur: a list of floats with sum 1 """ s = sum(probs_occur) if abs(s - 1) > pmf.PRECISION: raise ValueError('The sum of %s is not 1: %s' % (probs_occur, s)) h = rupt.hypocenter hp_...
[ "def", "build_rupture_node", "(", "rupt", ",", "probs_occur", ")", ":", "s", "=", "sum", "(", "probs_occur", ")", "if", "abs", "(", "s", "-", "1", ")", ">", "pmf", ".", "PRECISION", ":", "raise", "ValueError", "(", "'The sum of %s is not 1: %s'", "%", "(...
:param rupt: a hazardlib rupture object :param probs_occur: a list of floats with sum 1
[ ":", "param", "rupt", ":", "a", "hazardlib", "rupture", "object", ":", "param", "probs_occur", ":", "a", "list", "of", "floats", "with", "sum", "1" ]
python
train
FNNDSC/pfmisc
pfmisc/C_snode.py
https://github.com/FNNDSC/pfmisc/blob/960b4d6135fcc50bed0a8e55db2ab1ddad9b99d8/pfmisc/C_snode.py#L644-L660
def paths_update(self, al_branchNodes): """ Add each node in <al_branchNodes> to the self.ml_cwd and append the combined list to ml_allPaths. This method is typically not called by a user, but by other methods in this module. Returns the list of a...
[ "def", "paths_update", "(", "self", ",", "al_branchNodes", ")", ":", "for", "node", "in", "al_branchNodes", ":", "#print \"appending %s\" % node", "l_pwd", "=", "self", ".", "l_cwd", "[", ":", "]", "l_pwd", ".", "append", "(", "node", ")", "#print \"l_pwd: %s\...
Add each node in <al_branchNodes> to the self.ml_cwd and append the combined list to ml_allPaths. This method is typically not called by a user, but by other methods in this module. Returns the list of all paths.
[ "Add", "each", "node", "in", "<al_branchNodes", ">", "to", "the", "self", ".", "ml_cwd", "and", "append", "the", "combined", "list", "to", "ml_allPaths", ".", "This", "method", "is", "typically", "not", "called", "by", "a", "user", "but", "by", "other", ...
python
train
rohankapoorcom/zm-py
zoneminder/monitor.py
https://github.com/rohankapoorcom/zm-py/blob/bd3a9f6b2f7b84b37589e2939f628b479a5531bf/zoneminder/monitor.py#L41-L49
def get_time_period(value): """Get the corresponding TimePeriod from the value. Example values: 'all', 'hour', 'day', 'week', or 'month'. """ for time_period in TimePeriod: if time_period.period == value: return time_period raise ValueError('{} is not...
[ "def", "get_time_period", "(", "value", ")", ":", "for", "time_period", "in", "TimePeriod", ":", "if", "time_period", ".", "period", "==", "value", ":", "return", "time_period", "raise", "ValueError", "(", "'{} is not a valid TimePeriod'", ".", "format", "(", "v...
Get the corresponding TimePeriod from the value. Example values: 'all', 'hour', 'day', 'week', or 'month'.
[ "Get", "the", "corresponding", "TimePeriod", "from", "the", "value", "." ]
python
train
Unidata/MetPy
metpy/interpolate/grid.py
https://github.com/Unidata/MetPy/blob/16f68a94919b9a82dcf9cada2169cf039129e67b/metpy/interpolate/grid.py#L67-L84
def get_xy_range(bbox): r"""Return x and y ranges in meters based on bounding box. bbox: dictionary dictionary containing coordinates for corners of study area Returns ------- x_range: float Range in meters in x dimension. y_range: float Range in meters in y dimension. ...
[ "def", "get_xy_range", "(", "bbox", ")", ":", "x_range", "=", "bbox", "[", "'east'", "]", "-", "bbox", "[", "'west'", "]", "y_range", "=", "bbox", "[", "'north'", "]", "-", "bbox", "[", "'south'", "]", "return", "x_range", ",", "y_range" ]
r"""Return x and y ranges in meters based on bounding box. bbox: dictionary dictionary containing coordinates for corners of study area Returns ------- x_range: float Range in meters in x dimension. y_range: float Range in meters in y dimension.
[ "r", "Return", "x", "and", "y", "ranges", "in", "meters", "based", "on", "bounding", "box", "." ]
python
train
dwavesystems/dwave-cloud-client
dwave/cloud/config.py
https://github.com/dwavesystems/dwave-cloud-client/blob/df3221a8385dc0c04d7b4d84f740bf3ad6706230/dwave/cloud/config.py#L239-L304
def get_configfile_paths(system=True, user=True, local=True, only_existing=True): """Return a list of local configuration file paths. Search paths for configuration files on the local system are based on homebase_ and depend on operating system; for example, for Linux systems these might include ``dwav...
[ "def", "get_configfile_paths", "(", "system", "=", "True", ",", "user", "=", "True", ",", "local", "=", "True", ",", "only_existing", "=", "True", ")", ":", "candidates", "=", "[", "]", "# system-wide has the lowest priority, `/etc/dwave/dwave.conf`", "if", "syste...
Return a list of local configuration file paths. Search paths for configuration files on the local system are based on homebase_ and depend on operating system; for example, for Linux systems these might include ``dwave.conf`` in the current working directory (CWD), user-local ``.config/dwave/``, and s...
[ "Return", "a", "list", "of", "local", "configuration", "file", "paths", "." ]
python
train
atdt/afraid
afraid/__init__.py
https://github.com/atdt/afraid/blob/d74b2d4e41ed14e420da2793a89bef5d9b26ea26/afraid/__init__.py#L106-L114
def update_continuously(records, update_interval=600): """Update `records` every `update_interval` seconds""" while True: for record in records: try: record.update() except (ApiError, RequestException): pass time.sleep(update_interval)
[ "def", "update_continuously", "(", "records", ",", "update_interval", "=", "600", ")", ":", "while", "True", ":", "for", "record", "in", "records", ":", "try", ":", "record", ".", "update", "(", ")", "except", "(", "ApiError", ",", "RequestException", ")",...
Update `records` every `update_interval` seconds
[ "Update", "records", "every", "update_interval", "seconds" ]
python
train
geophysics-ubonn/crtomo_tools
lib/crtomo/eitManager.py
https://github.com/geophysics-ubonn/crtomo_tools/blob/27c3e21a557f8df1c12455b96c4c2e00e08a5b4a/lib/crtomo/eitManager.py#L220-L271
def load_data_crt_files(self, data_dict): """Load sEIT data from .ctr files (volt.dat files readable by CRTomo, produced by CRMod) Parameters ---------- data_dict : dict Data files that are imported. See example down below Examples -------- ...
[ "def", "load_data_crt_files", "(", "self", ",", "data_dict", ")", ":", "if", "isinstance", "(", "data_dict", ",", "str", ")", ":", "raise", "Exception", "(", "'Parameter must be a dict!'", ")", "frequency_data", "=", "data_dict", "[", "'frequencies'", "]", "if",...
Load sEIT data from .ctr files (volt.dat files readable by CRTomo, produced by CRMod) Parameters ---------- data_dict : dict Data files that are imported. See example down below Examples -------- >>> import glob data_files = {} ...
[ "Load", "sEIT", "data", "from", ".", "ctr", "files", "(", "volt", ".", "dat", "files", "readable", "by", "CRTomo", "produced", "by", "CRMod", ")" ]
python
train
pycontribs/pyrax
pyrax/clouddatabases.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L649-L653
def revoke_user_access(self, db_names, strict=True): """ Revokes access to the databases listed in `db_names` for the user. """ return self.manager.revoke_user_access(self, db_names, strict=strict)
[ "def", "revoke_user_access", "(", "self", ",", "db_names", ",", "strict", "=", "True", ")", ":", "return", "self", ".", "manager", ".", "revoke_user_access", "(", "self", ",", "db_names", ",", "strict", "=", "strict", ")" ]
Revokes access to the databases listed in `db_names` for the user.
[ "Revokes", "access", "to", "the", "databases", "listed", "in", "db_names", "for", "the", "user", "." ]
python
train
tensorpack/tensorpack
tensorpack/tfutils/varmanip.py
https://github.com/tensorpack/tensorpack/blob/d7a13cb74c9066bc791d7aafc3b744b60ee79a9f/tensorpack/tfutils/varmanip.py#L18-L35
def get_savename_from_varname( varname, varname_prefix=None, savename_prefix=None): """ Args: varname(str): a variable name in the graph varname_prefix(str): an optional prefix that may need to be removed in varname savename_prefix(str): an optional prefix to append to al...
[ "def", "get_savename_from_varname", "(", "varname", ",", "varname_prefix", "=", "None", ",", "savename_prefix", "=", "None", ")", ":", "name", "=", "varname", "if", "varname_prefix", "is", "not", "None", "and", "name", ".", "startswith", "(", "varname_prefix", ...
Args: varname(str): a variable name in the graph varname_prefix(str): an optional prefix that may need to be removed in varname savename_prefix(str): an optional prefix to append to all savename Returns: str: the name used to save the variable
[ "Args", ":", "varname", "(", "str", ")", ":", "a", "variable", "name", "in", "the", "graph", "varname_prefix", "(", "str", ")", ":", "an", "optional", "prefix", "that", "may", "need", "to", "be", "removed", "in", "varname", "savename_prefix", "(", "str",...
python
train
wbond/asn1crypto
asn1crypto/core.py
https://github.com/wbond/asn1crypto/blob/ecda20176f55d37021cbca1f6da9083a8e491197/asn1crypto/core.py#L4671-L4690
def set(self, value): """ Sets the value of the object :param value: A unicode string or a datetime.datetime object :raises: ValueError - when an invalid value is passed """ if isinstance(value, datetime): value = value.strftime('%y%...
[ "def", "set", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "datetime", ")", ":", "value", "=", "value", ".", "strftime", "(", "'%y%m%d%H%M%SZ'", ")", "if", "_PY2", ":", "value", "=", "value", ".", "decode", "(", "'ascii...
Sets the value of the object :param value: A unicode string or a datetime.datetime object :raises: ValueError - when an invalid value is passed
[ "Sets", "the", "value", "of", "the", "object" ]
python
train
wonambi-python/wonambi
wonambi/widgets/notes.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/notes.py#L1078-L1089
def set_quality_index(self): """Set the current signal quality in combobox.""" window_start = self.parent.value('window_start') window_length = self.parent.value('window_length') qual = self.annot.get_stage_for_epoch(window_start, window_length, ...
[ "def", "set_quality_index", "(", "self", ")", ":", "window_start", "=", "self", ".", "parent", ".", "value", "(", "'window_start'", ")", "window_length", "=", "self", ".", "parent", ".", "value", "(", "'window_length'", ")", "qual", "=", "self", ".", "anno...
Set the current signal quality in combobox.
[ "Set", "the", "current", "signal", "quality", "in", "combobox", "." ]
python
train
OSSOS/MOP
src/ossos/core/ossos/plant.py
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/plant.py#L114-L124
def next(self): """ :return: a set of values that can be used for an planted object builder. """ # x y mag pix rate angle ''/h rate id # 912.48 991.06 22.01 57.32 -45.23 10.60 0 self._n -= 1 if self._n...
[ "def", "next", "(", "self", ")", ":", "# x y mag pix rate angle ''/h rate id", "# 912.48 991.06 22.01 57.32 -45.23 10.60 0", "self", ".", "_n", "-=", "1", "if", "self", ".", "_n", "<", "0", ":", "raise", "StopIt...
:return: a set of values that can be used for an planted object builder.
[ ":", "return", ":", "a", "set", "of", "values", "that", "can", "be", "used", "for", "an", "planted", "object", "builder", "." ]
python
train
chaoss/grimoirelab-sirmordred
sirmordred/eclipse_projects_lib.py
https://github.com/chaoss/grimoirelab-sirmordred/blob/d6ac94d28d707fae23170064d078f1edf937d13e/sirmordred/eclipse_projects_lib.py#L134-L149
def compose_github(projects, data): """ Compose projects.json for github :param projects: projects.json :param data: eclipse JSON :return: projects.json with github """ for p in [project for project in data if len(data[project]['github_repos']) > 0]: if 'github' not in projects[p]: ...
[ "def", "compose_github", "(", "projects", ",", "data", ")", ":", "for", "p", "in", "[", "project", "for", "project", "in", "data", "if", "len", "(", "data", "[", "project", "]", "[", "'github_repos'", "]", ")", ">", "0", "]", ":", "if", "'github'", ...
Compose projects.json for github :param projects: projects.json :param data: eclipse JSON :return: projects.json with github
[ "Compose", "projects", ".", "json", "for", "github" ]
python
valid
SoCo/SoCo
soco/data_structures.py
https://github.com/SoCo/SoCo/blob/671937e07d7973b78c0cbee153d4f3ad68ec48c6/soco/data_structures.py#L591-L617
def to_dict(self, remove_nones=False): """Return the dict representation of the instance. Args: remove_nones (bool, optional): Optionally remove dictionary elements when their value is `None`. Returns: dict: a dict representation of the `DidlObject`. ...
[ "def", "to_dict", "(", "self", ",", "remove_nones", "=", "False", ")", ":", "content", "=", "{", "}", "# Get the value of each attribute listed in _translation, and add it", "# to the content dict", "for", "key", "in", "self", ".", "_translation", ":", "if", "hasattr"...
Return the dict representation of the instance. Args: remove_nones (bool, optional): Optionally remove dictionary elements when their value is `None`. Returns: dict: a dict representation of the `DidlObject`.
[ "Return", "the", "dict", "representation", "of", "the", "instance", "." ]
python
train
benmontet/f3
f3/photometry.py
https://github.com/benmontet/f3/blob/b2e1dc250e4e3e884a54c501cd35cf02d5b8719e/f3/photometry.py#L301-L329
def do_photometry(self): """ Does photometry and estimates uncertainties by calculating the scatter around a linear fit to the data in each orientation. This function is called by other functions and generally the user will not need to interact with it directly. """ ...
[ "def", "do_photometry", "(", "self", ")", ":", "std_f", "=", "np", ".", "zeros", "(", "4", ")", "data_save", "=", "np", ".", "zeros_like", "(", "self", ".", "postcard", ")", "self", ".", "obs_flux", "=", "np", ".", "zeros_like", "(", "self", ".", "...
Does photometry and estimates uncertainties by calculating the scatter around a linear fit to the data in each orientation. This function is called by other functions and generally the user will not need to interact with it directly.
[ "Does", "photometry", "and", "estimates", "uncertainties", "by", "calculating", "the", "scatter", "around", "a", "linear", "fit", "to", "the", "data", "in", "each", "orientation", ".", "This", "function", "is", "called", "by", "other", "functions", "and", "gen...
python
valid
sosy-lab/benchexec
benchexec/util.py
https://github.com/sosy-lab/benchexec/blob/44428f67f41384c03aea13e7e25f884764653617/benchexec/util.py#L84-L95
def is_code(filename): """ This function returns True, if a line of the file contains bracket '{'. """ with open(filename, "r") as file: for line in file: # ignore comments and empty lines if not is_comment(line) \ and '{' in line: # <-- simple indica...
[ "def", "is_code", "(", "filename", ")", ":", "with", "open", "(", "filename", ",", "\"r\"", ")", "as", "file", ":", "for", "line", "in", "file", ":", "# ignore comments and empty lines", "if", "not", "is_comment", "(", "line", ")", "and", "'{'", "in", "l...
This function returns True, if a line of the file contains bracket '{'.
[ "This", "function", "returns", "True", "if", "a", "line", "of", "the", "file", "contains", "bracket", "{", "." ]
python
train
pypa/pipenv
pipenv/patched/notpip/_vendor/ipaddress.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_vendor/ipaddress.py#L480-L502
def get_mixed_type_key(obj): """Return a key suitable for sorting between networks and addresses. Address and Network objects are not sortable by default; they're fundamentally different so the expression IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24') doesn't make any sense. There a...
[ "def", "get_mixed_type_key", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "_BaseNetwork", ")", ":", "return", "obj", ".", "_get_networks_key", "(", ")", "elif", "isinstance", "(", "obj", ",", "_BaseAddress", ")", ":", "return", "obj", ".", ...
Return a key suitable for sorting between networks and addresses. Address and Network objects are not sortable by default; they're fundamentally different so the expression IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24') doesn't make any sense. There are some times however, where you may...
[ "Return", "a", "key", "suitable", "for", "sorting", "between", "networks", "and", "addresses", "." ]
python
train
readbeyond/aeneas
aeneas/tools/run_sd.py
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/tools/run_sd.py#L171-L203
def print_result(self, audio_len, start, end): """ Print result of SD. :param audio_len: the length of the entire audio file, in seconds :type audio_len: float :param start: the start position of the spoken text :type start: float :param end: the end position o...
[ "def", "print_result", "(", "self", ",", "audio_len", ",", "start", ",", "end", ")", ":", "msg", "=", "[", "]", "zero", "=", "0", "head_len", "=", "start", "text_len", "=", "end", "-", "start", "tail_len", "=", "audio_len", "-", "end", "msg", ".", ...
Print result of SD. :param audio_len: the length of the entire audio file, in seconds :type audio_len: float :param start: the start position of the spoken text :type start: float :param end: the end position of the spoken text :type end: float
[ "Print", "result", "of", "SD", "." ]
python
train
DLR-RM/RAFCON
source/rafcon/gui/controllers/state_machines_editor.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_machines_editor.py#L134-L141
def register_view(self, view): """Called when the View was registered""" super(StateMachinesEditorController, self).register_view(view) self.view['notebook'].connect('switch-page', self.on_switch_page) # Add all already open state machines for state_machine in self.model.state_m...
[ "def", "register_view", "(", "self", ",", "view", ")", ":", "super", "(", "StateMachinesEditorController", ",", "self", ")", ".", "register_view", "(", "view", ")", "self", ".", "view", "[", "'notebook'", "]", ".", "connect", "(", "'switch-page'", ",", "se...
Called when the View was registered
[ "Called", "when", "the", "View", "was", "registered" ]
python
train
TomAugspurger/engarde
docs/sphinxext/ipython_directive.py
https://github.com/TomAugspurger/engarde/blob/e7ea040cf0d20aee7ca4375b8c27caa2d9e43945/docs/sphinxext/ipython_directive.py#L386-L499
def process_input(self, data, input_prompt, lineno): """ Process data block for INPUT token. """ decorator, input, rest = data image_file = None image_directive = None is_verbatim = decorator=='@verbatim' or self.is_verbatim is_doctest = (decorator is no...
[ "def", "process_input", "(", "self", ",", "data", ",", "input_prompt", ",", "lineno", ")", ":", "decorator", ",", "input", ",", "rest", "=", "data", "image_file", "=", "None", "image_directive", "=", "None", "is_verbatim", "=", "decorator", "==", "'@verbatim...
Process data block for INPUT token.
[ "Process", "data", "block", "for", "INPUT", "token", "." ]
python
train
jtwhite79/pyemu
pyemu/en.py
https://github.com/jtwhite79/pyemu/blob/c504d8e7a4097cec07655a6318d275739bd8148a/pyemu/en.py#L478-L494
def from_binary(cls,pst,filename): """instantiate an observation obsemble from a jco-type file Parameters ---------- pst : pyemu.Pst a Pst instance filename : str the binary file name Returns ------- oe : ObservationEnsemble ...
[ "def", "from_binary", "(", "cls", ",", "pst", ",", "filename", ")", ":", "m", "=", "Matrix", ".", "from_binary", "(", "filename", ")", "return", "ObservationEnsemble", "(", "data", "=", "m", ".", "x", ",", "pst", "=", "pst", ",", "index", "=", "m", ...
instantiate an observation obsemble from a jco-type file Parameters ---------- pst : pyemu.Pst a Pst instance filename : str the binary file name Returns ------- oe : ObservationEnsemble
[ "instantiate", "an", "observation", "obsemble", "from", "a", "jco", "-", "type", "file" ]
python
train