repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
SystemRDL/systemrdl-compiler
systemrdl/messages.py
https://github.com/SystemRDL/systemrdl-compiler/blob/6ae64f2bb6ecbbe9db356e20e8ac94e85bdeed3a/systemrdl/messages.py#L108-L171
def derive_coordinates(self): """ Depending on the compilation source, some members of the SourceRef object may be incomplete. Calling this function performs the necessary derivations to complete the object. """ if self._coordinates_resolved: # Coordi...
[ "def", "derive_coordinates", "(", "self", ")", ":", "if", "self", ".", "_coordinates_resolved", ":", "# Coordinates were already resolved. Skip", "return", "if", "self", ".", "seg_map", "is", "not", "None", ":", "# Translate coordinates", "self", ".", "start", ",", ...
Depending on the compilation source, some members of the SourceRef object may be incomplete. Calling this function performs the necessary derivations to complete the object.
[ "Depending", "on", "the", "compilation", "source", "some", "members", "of", "the", "SourceRef", "object", "may", "be", "incomplete", ".", "Calling", "this", "function", "performs", "the", "necessary", "derivations", "to", "complete", "the", "object", "." ]
python
train
34.671875
inveniosoftware/invenio-pidstore
invenio_pidstore/providers/recordid.py
https://github.com/inveniosoftware/invenio-pidstore/blob/8bf35f4e62d5dcaf1a2cfe5803245ba5220a9b78/invenio_pidstore/providers/recordid.py#L37-L55
def create(cls, object_type=None, object_uuid=None, **kwargs): """Create a new record identifier. Note: if the object_type and object_uuid values are passed, then the PID status will be automatically setted to :attr:`invenio_pidstore.models.PIDStatus.REGISTERED`. :param object_...
[ "def", "create", "(", "cls", ",", "object_type", "=", "None", ",", "object_uuid", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Request next integer in recid sequence.", "assert", "'pid_value'", "not", "in", "kwargs", "kwargs", "[", "'pid_value'", "]", "=...
Create a new record identifier. Note: if the object_type and object_uuid values are passed, then the PID status will be automatically setted to :attr:`invenio_pidstore.models.PIDStatus.REGISTERED`. :param object_type: The object type. (Default: None.) :param object_uuid: The ob...
[ "Create", "a", "new", "record", "identifier", "." ]
python
train
47
heitzmann/gdspy
gdspy/__init__.py
https://github.com/heitzmann/gdspy/blob/2c8d1313248c544e2066d19095b7ad7158c79bc9/gdspy/__init__.py#L245-L278
def to_gds(self, multiplier): """ Convert this object to a series of GDSII elements. Parameters ---------- multiplier : number A number that multiplies all dimensions written in the GDSII elements. Returns ------- out : string ...
[ "def", "to_gds", "(", "self", ",", "multiplier", ")", ":", "data", "=", "[", "]", "for", "ii", "in", "range", "(", "len", "(", "self", ".", "polygons", ")", ")", ":", "if", "len", "(", "self", ".", "polygons", "[", "ii", "]", ")", ">", "4094", ...
Convert this object to a series of GDSII elements. Parameters ---------- multiplier : number A number that multiplies all dimensions written in the GDSII elements. Returns ------- out : string The GDSII binary string that represents t...
[ "Convert", "this", "object", "to", "a", "series", "of", "GDSII", "elements", "." ]
python
train
39.411765
pip-services3-python/pip-services3-components-python
pip_services3_components/count/CachedCounters.py
https://github.com/pip-services3-python/pip-services3-components-python/blob/1de9c1bb544cf1891111e9a5f5d67653f62c9b52/pip_services3_components/count/CachedCounters.py#L142-L167
def get(self, name, typ): """ Gets a counter specified by its name. It counter does not exist or its type doesn't match the specified type it creates a new one. :param name: a counter name to retrieve. :param typ: a counter type. :return: an existing or newly c...
[ "def", "get", "(", "self", ",", "name", ",", "typ", ")", ":", "if", "name", "==", "None", "or", "len", "(", "name", ")", "==", "0", ":", "raise", "Exception", "(", "\"Counter name was not set\"", ")", "self", ".", "_lock", ".", "acquire", "(", ")", ...
Gets a counter specified by its name. It counter does not exist or its type doesn't match the specified type it creates a new one. :param name: a counter name to retrieve. :param typ: a counter type. :return: an existing or newly created counter of the specified type.
[ "Gets", "a", "counter", "specified", "by", "its", "name", ".", "It", "counter", "does", "not", "exist", "or", "its", "type", "doesn", "t", "match", "the", "specified", "type", "it", "creates", "a", "new", "one", "." ]
python
train
30.076923
voidpp/python-tools
voidpp_tools/job_delayer.py
https://github.com/voidpp/python-tools/blob/0fc7460c827b02d8914411cedddadc23ccb3cc73/voidpp_tools/job_delayer.py#L25-L32
def start(self): """Starts the delayed execution""" if self._timer: self._timer.cancel() self._timer = Timer(self._timeout, self._fire) self._timer.start()
[ "def", "start", "(", "self", ")", ":", "if", "self", ".", "_timer", ":", "self", ".", "_timer", ".", "cancel", "(", ")", "self", ".", "_timer", "=", "Timer", "(", "self", ".", "_timeout", ",", "self", ".", "_fire", ")", "self", ".", "_timer", "."...
Starts the delayed execution
[ "Starts", "the", "delayed", "execution" ]
python
train
24.25
CamDavidsonPilon/tdigest
tdigest/tdigest.py
https://github.com/CamDavidsonPilon/tdigest/blob/e56db9fd5e6aeb75f3be5f29a62286f4f5fb1246/tdigest/tdigest.py#L159-L189
def percentile(self, p): """ Computes the percentile of a specific value in [0,100]. """ if not (0 <= p <= 100): raise ValueError("p must be between 0 and 100, inclusive.") p = float(p)/100. p *= self.n c_i = None t = 0 if p == 0: ...
[ "def", "percentile", "(", "self", ",", "p", ")", ":", "if", "not", "(", "0", "<=", "p", "<=", "100", ")", ":", "raise", "ValueError", "(", "\"p must be between 0 and 100, inclusive.\"", ")", "p", "=", "float", "(", "p", ")", "/", "100.", "p", "*=", "...
Computes the percentile of a specific value in [0,100].
[ "Computes", "the", "percentile", "of", "a", "specific", "value", "in", "[", "0", "100", "]", "." ]
python
train
26.806452
ibelie/typy
typy/google/protobuf/json_format.py
https://github.com/ibelie/typy/blob/3616845fb91459aacd8df6bf82c5d91f4542bee7/typy/google/protobuf/json_format.py#L487-L494
def _ConvertStructMessage(value, message): """Convert a JSON representation into Struct message.""" if not isinstance(value, dict): raise ParseError( 'Struct must be in a dict which is {0}.'.format(value)) for key in value: _ConvertValueMessage(value[key], message.fields[key]) return
[ "def", "_ConvertStructMessage", "(", "value", ",", "message", ")", ":", "if", "not", "isinstance", "(", "value", ",", "dict", ")", ":", "raise", "ParseError", "(", "'Struct must be in a dict which is {0}.'", ".", "format", "(", "value", ")", ")", "for", "key",...
Convert a JSON representation into Struct message.
[ "Convert", "a", "JSON", "representation", "into", "Struct", "message", "." ]
python
valid
37.625
StagPython/StagPy
stagpy/rprof.py
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/rprof.py#L10-L51
def _plot_rprof_list(sdat, lovs, rprofs, metas, stepstr, rads=None): """Plot requested profiles""" if rads is None: rads = {} for vfig in lovs: fig, axes = plt.subplots(ncols=len(vfig), sharey=True) axes = [axes] if len(vfig) == 1 else axes fname = 'rprof_' for iplt, ...
[ "def", "_plot_rprof_list", "(", "sdat", ",", "lovs", ",", "rprofs", ",", "metas", ",", "stepstr", ",", "rads", "=", "None", ")", ":", "if", "rads", "is", "None", ":", "rads", "=", "{", "}", "for", "vfig", "in", "lovs", ":", "fig", ",", "axes", "=...
Plot requested profiles
[ "Plot", "requested", "profiles" ]
python
train
41.119048
jaraco/keyrings.alt
keyrings/alt/escape.py
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/escape.py#L45-L53
def unescape(value): """ Inverse of escape. """ pattern = ESCAPE_FMT.replace('%02X', '(?P<code>[0-9A-Fa-f]{2})') # the pattern must be bytes to operate on bytes pattern_bytes = pattern.encode('ascii') re_esc = re.compile(pattern_bytes) return re_esc.sub(_unescape_code, value.encode('asci...
[ "def", "unescape", "(", "value", ")", ":", "pattern", "=", "ESCAPE_FMT", ".", "replace", "(", "'%02X'", ",", "'(?P<code>[0-9A-Fa-f]{2})'", ")", "# the pattern must be bytes to operate on bytes", "pattern_bytes", "=", "pattern", ".", "encode", "(", "'ascii'", ")", "r...
Inverse of escape.
[ "Inverse", "of", "escape", "." ]
python
train
36.888889
radjkarl/imgProcessor
imgProcessor/camera/CameraCalibration.py
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/camera/CameraCalibration.py#L37-L49
def _getFromDate(l, date): ''' returns the index of given or best fitting date ''' try: date = _toDate(date) i = _insertDateIndex(date, l) - 1 if i == -1: return l[0] return l[i] except (ValueError, TypeError): # ValueError: date invalid...
[ "def", "_getFromDate", "(", "l", ",", "date", ")", ":", "try", ":", "date", "=", "_toDate", "(", "date", ")", "i", "=", "_insertDateIndex", "(", "date", ",", "l", ")", "-", "1", "if", "i", "==", "-", "1", ":", "return", "l", "[", "0", "]", "r...
returns the index of given or best fitting date
[ "returns", "the", "index", "of", "given", "or", "best", "fitting", "date" ]
python
train
27.230769
cuenca-mx/clabe-python
clabe/__init__.py
https://github.com/cuenca-mx/clabe-python/blob/6a8fe4d306cb3f4f29d30efedabe5d82b442da99/clabe/__init__.py#L24-L32
def validate_clabe(clabe: str) -> bool: """ Validate CLABE according to https://es.wikipedia.org/wiki/CLABE#D.C3.ADgito_control """ return (clabe.isdigit() and len(clabe) == CLABE_LENGTH and clabe[:3] in BANKS.keys() and clabe[-1] == compute_control_digit(clabe))
[ "def", "validate_clabe", "(", "clabe", ":", "str", ")", "->", "bool", ":", "return", "(", "clabe", ".", "isdigit", "(", ")", "and", "len", "(", "clabe", ")", "==", "CLABE_LENGTH", "and", "clabe", "[", ":", "3", "]", "in", "BANKS", ".", "keys", "(",...
Validate CLABE according to https://es.wikipedia.org/wiki/CLABE#D.C3.ADgito_control
[ "Validate", "CLABE", "according", "to", "https", ":", "//", "es", ".", "wikipedia", ".", "org", "/", "wiki", "/", "CLABE#D", ".", "C3", ".", "ADgito_control" ]
python
train
34.555556
androguard/androguard
androguard/core/bytecodes/dvm.py
https://github.com/androguard/androguard/blob/984c0d981be2950cf0451e484f7b0d4d53bc4911/androguard/core/bytecodes/dvm.py#L4049-L4059
def get_kind(self): """ Return the 'kind' argument of the instruction :rtype: int """ if self.OP > 0xff: if self.OP >= 0xf2ff: return DALVIK_OPCODES_OPTIMIZED[self.OP][1][1] return DALVIK_OPCODES_EXTENDED_WIDTH[self.OP][1][1] retur...
[ "def", "get_kind", "(", "self", ")", ":", "if", "self", ".", "OP", ">", "0xff", ":", "if", "self", ".", "OP", ">=", "0xf2ff", ":", "return", "DALVIK_OPCODES_OPTIMIZED", "[", "self", ".", "OP", "]", "[", "1", "]", "[", "1", "]", "return", "DALVIK_OP...
Return the 'kind' argument of the instruction :rtype: int
[ "Return", "the", "kind", "argument", "of", "the", "instruction" ]
python
train
31.636364
Parsl/libsubmit
libsubmit/providers/local/local.py
https://github.com/Parsl/libsubmit/blob/27a41c16dd6f1c16d830a9ce1c97804920a59f64/libsubmit/providers/local/local.py#L175-L193
def cancel(self, job_ids): ''' Cancels the jobs specified by a list of job ids Args: job_ids : [<job_id> ...] Returns : [True/False...] : If the cancel operation fails the entire list will be False. ''' for job in job_ids: logger.debug("Terminating ...
[ "def", "cancel", "(", "self", ",", "job_ids", ")", ":", "for", "job", "in", "job_ids", ":", "logger", ".", "debug", "(", "\"Terminating job/proc_id : {0}\"", ".", "format", "(", "job", ")", ")", "# Here we are assuming that for local, the job_ids are the process id's"...
Cancels the jobs specified by a list of job ids Args: job_ids : [<job_id> ...] Returns : [True/False...] : If the cancel operation fails the entire list will be False.
[ "Cancels", "the", "jobs", "specified", "by", "a", "list", "of", "job", "ids" ]
python
train
33.684211
mrcagney/gtfstk
gtfstk/stops.py
https://github.com/mrcagney/gtfstk/blob/c91494e6fefc02523889655a0dc92d1c0eee8d03/gtfstk/stops.py#L832-L874
def geometrize_stops(stops: List[str], *, use_utm: bool = False) -> DataFrame: """ Given a stops DataFrame, convert it to a GeoPandas GeoDataFrame and return the result. Parameters ---------- stops : DataFrame A GTFS stops table use_utm : boolean If ``True``, then convert th...
[ "def", "geometrize_stops", "(", "stops", ":", "List", "[", "str", "]", ",", "*", ",", "use_utm", ":", "bool", "=", "False", ")", "->", "DataFrame", ":", "import", "geopandas", "as", "gpd", "g", "=", "(", "stops", ".", "assign", "(", "geometry", "=", ...
Given a stops DataFrame, convert it to a GeoPandas GeoDataFrame and return the result. Parameters ---------- stops : DataFrame A GTFS stops table use_utm : boolean If ``True``, then convert the output to local UTM coordinates; otherwise use WGS84 coordinates Returns ...
[ "Given", "a", "stops", "DataFrame", "convert", "it", "to", "a", "GeoPandas", "GeoDataFrame", "and", "return", "the", "result", "." ]
python
train
25.627907
saltstack/salt
salt/utils/openstack/nova.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/nova.py#L1204-L1217
def floating_ip_pool_list(self): ''' List all floating IP pools .. versionadded:: 2016.3.0 ''' nt_ks = self.compute_conn pools = nt_ks.floating_ip_pools.list() response = {} for pool in pools: response[pool.name] = { 'name': po...
[ "def", "floating_ip_pool_list", "(", "self", ")", ":", "nt_ks", "=", "self", ".", "compute_conn", "pools", "=", "nt_ks", ".", "floating_ip_pools", ".", "list", "(", ")", "response", "=", "{", "}", "for", "pool", "in", "pools", ":", "response", "[", "pool...
List all floating IP pools .. versionadded:: 2016.3.0
[ "List", "all", "floating", "IP", "pools" ]
python
train
25.214286
hozn/stravalib
stravalib/client.py
https://github.com/hozn/stravalib/blob/5500ebc39e0bf4706bb1ca4c27b25e56becaaa5f/stravalib/client.py#L82-L111
def authorization_url(self, client_id, redirect_uri, approval_prompt='auto', scope=None, state=None): """ Get the URL needed to authorize your application to access a Strava user's information. :param client_id: The numeric developer client id. :type client_id:...
[ "def", "authorization_url", "(", "self", ",", "client_id", ",", "redirect_uri", ",", "approval_prompt", "=", "'auto'", ",", "scope", "=", "None", ",", "state", "=", "None", ")", ":", "return", "self", ".", "protocol", ".", "authorization_url", "(", "client_i...
Get the URL needed to authorize your application to access a Strava user's information. :param client_id: The numeric developer client id. :type client_id: int :param redirect_uri: The URL that Strava will redirect to after successful (or failed) authorization. :type redirect_uri: str ...
[ "Get", "the", "URL", "needed", "to", "authorize", "your", "application", "to", "access", "a", "Strava", "user", "s", "information", "." ]
python
train
48.5
helixyte/everest
everest/repositories/rdb/utils.py
https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/repositories/rdb/utils.py#L121-L173
def mapper(class_, local_table=None, id_attribute='id', slug_expression=None, *args, **kwargs): """ Convenience wrapper around the SA mapper which will set up the hybrid "id" and "slug" attributes required by everest after calling the SA mapper. If you (e.g., for testing purposes) want t...
[ "def", "mapper", "(", "class_", ",", "local_table", "=", "None", ",", "id_attribute", "=", "'id'", ",", "slug_expression", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "mpr", "=", "sa_mapper", "(", "class_", ",", "local_table", "="...
Convenience wrapper around the SA mapper which will set up the hybrid "id" and "slug" attributes required by everest after calling the SA mapper. If you (e.g., for testing purposes) want to clear mappers created with this function, use the :func:`clear_mappers` function in this module. :param str ...
[ "Convenience", "wrapper", "around", "the", "SA", "mapper", "which", "will", "set", "up", "the", "hybrid", "id", "and", "slug", "attributes", "required", "by", "everest", "after", "calling", "the", "SA", "mapper", "." ]
python
train
43.245283
ambitioninc/kmatch
kmatch/kmatch.py
https://github.com/ambitioninc/kmatch/blob/22bb5f0c1d86d0e4a69bdf18f092f095934ebb0d/kmatch/kmatch.py#L105-L126
def _match(self, p, value): """ Calls either _match_operator or _match_operand depending on the pattern (p) provided. """ if self._is_operator(p): return self._match_operator(p, value) else: try: if self._is_value_filter(p): ...
[ "def", "_match", "(", "self", ",", "p", ",", "value", ")", ":", "if", "self", ".", "_is_operator", "(", "p", ")", ":", "return", "self", ".", "_match_operator", "(", "p", ",", "value", ")", "else", ":", "try", ":", "if", "self", ".", "_is_value_fil...
Calls either _match_operator or _match_operand depending on the pattern (p) provided.
[ "Calls", "either", "_match_operator", "or", "_match_operand", "depending", "on", "the", "pattern", "(", "p", ")", "provided", "." ]
python
train
34.954545
mjirik/io3d
io3d/dcmreaddata.py
https://github.com/mjirik/io3d/blob/ccaf3e378dcc967f2565d477fc27583fd0f61fcc/io3d/dcmreaddata.py#L444-L452
def get_standard_dicomdir_info(self): """ Read DICOMDIR, crate if necessary. :return: """ dicomdir_filepath = os.path.join(self.dirpath, self.standard_dicomdir_filename) if not os.path.exists(dicomdir_filepath): self.create_standard_dicomdir() return s...
[ "def", "get_standard_dicomdir_info", "(", "self", ")", ":", "dicomdir_filepath", "=", "os", ".", "path", ".", "join", "(", "self", ".", "dirpath", ",", "self", ".", "standard_dicomdir_filename", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "dic...
Read DICOMDIR, crate if necessary. :return:
[ "Read", "DICOMDIR", "crate", "if", "necessary", ".", ":", "return", ":" ]
python
train
38.333333
cihai/cihai
cihai/db.py
https://github.com/cihai/cihai/blob/43b0c2931da18c1ef1ff1cdd71e4b1c5eca24a41/cihai/db.py#L24-L33
def reflect_db(self): """ No-op to reflect db info. This is available as a method so the database can be reflected outside initialization (such bootstrapping unihan during CLI usage). """ self.metadata.reflect(views=True, extend_existing=True) self.base = automap...
[ "def", "reflect_db", "(", "self", ")", ":", "self", ".", "metadata", ".", "reflect", "(", "views", "=", "True", ",", "extend_existing", "=", "True", ")", "self", ".", "base", "=", "automap_base", "(", "metadata", "=", "self", ".", "metadata", ")", "sel...
No-op to reflect db info. This is available as a method so the database can be reflected outside initialization (such bootstrapping unihan during CLI usage).
[ "No", "-", "op", "to", "reflect", "db", "info", "." ]
python
train
36.8
payplug/payplug-python
payplug/__init__.py
https://github.com/payplug/payplug-python/blob/42dec9d6bff420dd0c26e51a84dd000adff04331/payplug/__init__.py#L112-L129
def retrieve(payment, refund_id): """ Retrieve a refund from a payment and the refund id. :param payment: The payment id or the payment object :type payment: resources.Payment|string :param refund_id: The refund id :type refund_id: string :return: The refund res...
[ "def", "retrieve", "(", "payment", ",", "refund_id", ")", ":", "if", "isinstance", "(", "payment", ",", "resources", ".", "Payment", ")", ":", "payment", "=", "payment", ".", "id", "http_client", "=", "HttpClient", "(", ")", "response", ",", "_", "=", ...
Retrieve a refund from a payment and the refund id. :param payment: The payment id or the payment object :type payment: resources.Payment|string :param refund_id: The refund id :type refund_id: string :return: The refund resource :rtype: resources.Refund
[ "Retrieve", "a", "refund", "from", "a", "payment", "and", "the", "refund", "id", "." ]
python
train
35.222222
blockstack/blockstack-core
blockstack/lib/subdomains.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/subdomains.py#L570-L605
def make_new_subdomain_history(self, cursor, subdomain_rec): """ Recalculate the history for this subdomain from genesis up until this record. Returns the list of subdomain records we need to save. """ # what's the subdomain's history up until this subdomain record? hist ...
[ "def", "make_new_subdomain_history", "(", "self", ",", "cursor", ",", "subdomain_rec", ")", ":", "# what's the subdomain's history up until this subdomain record?", "hist", "=", "self", ".", "subdomain_db", ".", "get_subdomain_history", "(", "subdomain_rec", ".", "get_fqn",...
Recalculate the history for this subdomain from genesis up until this record. Returns the list of subdomain records we need to save.
[ "Recalculate", "the", "history", "for", "this", "subdomain", "from", "genesis", "up", "until", "this", "record", ".", "Returns", "the", "list", "of", "subdomain", "records", "we", "need", "to", "save", "." ]
python
train
44.916667
gwastro/pycbc-glue
pycbc_glue/ligolw/utils/segments.py
https://github.com/gwastro/pycbc-glue/blob/a3e906bae59fbfd707c3ff82e5d008d939ec5e24/pycbc_glue/ligolw/utils/segments.py#L504-L517
def has_segment_tables(xmldoc, name = None): """ Return True if the document contains a complete set of segment tables. Returns False otherwise. If name is given and not None then the return value is True only if the document's segment tables, if present, contain a segment list by that name. """ try: names =...
[ "def", "has_segment_tables", "(", "xmldoc", ",", "name", "=", "None", ")", ":", "try", ":", "names", "=", "lsctables", ".", "SegmentDefTable", ".", "get_table", "(", "xmldoc", ")", ".", "getColumnByName", "(", "\"name\"", ")", "lsctables", ".", "SegmentTable...
Return True if the document contains a complete set of segment tables. Returns False otherwise. If name is given and not None then the return value is True only if the document's segment tables, if present, contain a segment list by that name.
[ "Return", "True", "if", "the", "document", "contains", "a", "complete", "set", "of", "segment", "tables", ".", "Returns", "False", "otherwise", ".", "If", "name", "is", "given", "and", "not", "None", "then", "the", "return", "value", "is", "True", "only", ...
python
train
39.214286
SheffieldML/GPy
GPy/models/state_space_main.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L615-L882
def kalman_filter(cls, p_A, p_Q, p_H, p_R, Y, index=None, m_init=None, P_init=None, p_kalman_filter_type='regular', calc_log_likelihood=False, calc_grad_log_likelihood=False, grad_params_no=None, grad_calc_params=None): """ ...
[ "def", "kalman_filter", "(", "cls", ",", "p_A", ",", "p_Q", ",", "p_H", ",", "p_R", ",", "Y", ",", "index", "=", "None", ",", "m_init", "=", "None", ",", "P_init", "=", "None", ",", "p_kalman_filter_type", "=", "'regular'", ",", "calc_log_likelihood", ...
This function implements the basic Kalman Filter algorithm These notations for the State-Space model are assumed: x_{k} = A_{k} * x_{k-1} + q_{k-1}; q_{k-1} ~ N(0, Q_{k-1}) y_{k} = H_{k} * x_{k} + r_{k}; r_{k-1} ~ N(0, R_{k}) Returns estimated filter distributi...
[ "This", "function", "implements", "the", "basic", "Kalman", "Filter", "algorithm", "These", "notations", "for", "the", "State", "-", "Space", "model", "are", "assumed", ":", "x_", "{", "k", "}", "=", "A_", "{", "k", "}", "*", "x_", "{", "k", "-", "1"...
python
train
47.119403
openego/ding0
ding0/grid/mv_grid/util/data_input.py
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/util/data_input.py#L151-L177
def _parse_edge_weight(f, nodes): """Parse TSPLIB EDGE_WEIGHT_SECTION from file f Supports only FULL_MATRIX for now """ matrix = [] n = 0 for line in f: line = strip(line) regex = re.compile(r'\s+') row = regex.split(line) matrix.append(row) n = n +...
[ "def", "_parse_edge_weight", "(", "f", ",", "nodes", ")", ":", "matrix", "=", "[", "]", "n", "=", "0", "for", "line", "in", "f", ":", "line", "=", "strip", "(", "line", ")", "regex", "=", "re", ".", "compile", "(", "r'\\s+'", ")", "row", "=", "...
Parse TSPLIB EDGE_WEIGHT_SECTION from file f Supports only FULL_MATRIX for now
[ "Parse", "TSPLIB", "EDGE_WEIGHT_SECTION", "from", "file", "f" ]
python
train
18.074074
MasoniteFramework/masonite
app/http/middleware/VerifyEmailMiddleware.py
https://github.com/MasoniteFramework/masonite/blob/c9bcca8f59169934c2accd8cecb2b996bb5e1a0d/app/http/middleware/VerifyEmailMiddleware.py#L17-L22
def before(self): """Run This Middleware Before The Route Executes.""" user = self.request.user() if user and user.verified_at is None: self.request.redirect('/email/verify')
[ "def", "before", "(", "self", ")", ":", "user", "=", "self", ".", "request", ".", "user", "(", ")", "if", "user", "and", "user", ".", "verified_at", "is", "None", ":", "self", ".", "request", ".", "redirect", "(", "'/email/verify'", ")" ]
Run This Middleware Before The Route Executes.
[ "Run", "This", "Middleware", "Before", "The", "Route", "Executes", "." ]
python
train
34.333333
guaix-ucm/numina
numina/array/display/logging_from_debugplot.py
https://github.com/guaix-ucm/numina/blob/6c829495df8937f77c2de9383c1038ffb3e713e3/numina/array/display/logging_from_debugplot.py#L26-L42
def logging_from_debugplot(debugplot): """Set debugging level based on debugplot value. Parameters ---------- debugplot : int Debugging level for messages and plots. For details see 'numina.array.display.pause_debugplot.py'. """ if isinstance(debugplot, int): if...
[ "def", "logging_from_debugplot", "(", "debugplot", ")", ":", "if", "isinstance", "(", "debugplot", ",", "int", ")", ":", "if", "abs", "(", "debugplot", ")", ">=", "10", ":", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "DEBUG", ")", ...
Set debugging level based on debugplot value. Parameters ---------- debugplot : int Debugging level for messages and plots. For details see 'numina.array.display.pause_debugplot.py'.
[ "Set", "debugging", "level", "based", "on", "debugplot", "value", "." ]
python
train
30.705882
common-workflow-language/cwltool
cwltool/checker.py
https://github.com/common-workflow-language/cwltool/blob/cb81b22abc52838823da9945f04d06739ab32fda/cwltool/checker.py#L137-L221
def static_checker(workflow_inputs, workflow_outputs, step_inputs, step_outputs, param_to_step): # type: (List[Dict[Text, Any]], List[Dict[Text, Any]], List[Dict[Text, Any]], List[Dict[Text, Any]], Dict[Text, Dict[Text, Any]]) -> None """Check if all source and sink types of a workflow are compatible before run...
[ "def", "static_checker", "(", "workflow_inputs", ",", "workflow_outputs", ",", "step_inputs", ",", "step_outputs", ",", "param_to_step", ")", ":", "# type: (List[Dict[Text, Any]], List[Dict[Text, Any]], List[Dict[Text, Any]], List[Dict[Text, Any]], Dict[Text, Dict[Text, Any]]) -> None", ...
Check if all source and sink types of a workflow are compatible before run time.
[ "Check", "if", "all", "source", "and", "sink", "types", "of", "a", "workflow", "are", "compatible", "before", "run", "time", "." ]
python
train
52.435294
ciena/afkak
afkak/kafkacodec.py
https://github.com/ciena/afkak/blob/6f5e05ba6f135ea3c29cdb80efda009f7845569a/afkak/kafkacodec.py#L610-L621
def create_snappy_message(message_set): """ Construct a Snappy-compressed message containing multiple messages The given messages will be encoded, compressed, and sent as a single atomic message to Kafka. :param list message_set: a list of :class:`Message` instances """ encoded_message_set...
[ "def", "create_snappy_message", "(", "message_set", ")", ":", "encoded_message_set", "=", "KafkaCodec", ".", "_encode_message_set", "(", "message_set", ")", "snapped", "=", "snappy_encode", "(", "encoded_message_set", ")", "return", "Message", "(", "0", ",", "CODEC_...
Construct a Snappy-compressed message containing multiple messages The given messages will be encoded, compressed, and sent as a single atomic message to Kafka. :param list message_set: a list of :class:`Message` instances
[ "Construct", "a", "Snappy", "-", "compressed", "message", "containing", "multiple", "messages" ]
python
train
37.916667
thespacedoctor/polyglot
polyglot/ebook.py
https://github.com/thespacedoctor/polyglot/blob/98038d746aa67e343b73b3ccee1e02d31dab81ec/polyglot/ebook.py#L246-L282
def _tmp_html_file( self, content): """*create a tmp html file with some content used for the header or footer of the ebook* **Key Arguments:** - ``content`` -- the content to include in the HTML file. """ self.log.debug('starting the ``_tmp_html_file...
[ "def", "_tmp_html_file", "(", "self", ",", "content", ")", ":", "self", ".", "log", ".", "debug", "(", "'starting the ``_tmp_html_file`` method'", ")", "content", "=", "\"\"\"\n\n<hr>\n<div style=\"text-align: center\">\n%(content)s\n</div>\n<hr>\n\n\"\"\"", "%", "locals", ...
*create a tmp html file with some content used for the header or footer of the ebook* **Key Arguments:** - ``content`` -- the content to include in the HTML file.
[ "*", "create", "a", "tmp", "html", "file", "with", "some", "content", "used", "for", "the", "header", "or", "footer", "of", "the", "ebook", "*" ]
python
train
29.189189
aiidateam/aiida-codtools
aiida_codtools/workflows/functions/primitive_structure_from_cif.py
https://github.com/aiidateam/aiida-codtools/blob/da5e4259b7a2e86cf0cc3f997e11dd36d445fa94/aiida_codtools/workflows/functions/primitive_structure_from_cif.py#L14-L62
def primitive_structure_from_cif(cif, parse_engine, symprec, site_tolerance): """ This calcfunction will take a CifData node, attempt to create a StructureData object from it using the 'parse_engine' and pass it through SeeKpath to try and get the primitive cell. Finally, it will store several keys from...
[ "def", "primitive_structure_from_cif", "(", "cif", ",", "parse_engine", ",", "symprec", ",", "site_tolerance", ")", ":", "CifCleanWorkChain", "=", "WorkflowFactory", "(", "'codtools.cif_clean'", ")", "# pylint: disable=invalid-name", "try", ":", "structure", "=", "cif",...
This calcfunction will take a CifData node, attempt to create a StructureData object from it using the 'parse_engine' and pass it through SeeKpath to try and get the primitive cell. Finally, it will store several keys from the SeeKpath output parameters dictionary directly on the structure data as attributes, ...
[ "This", "calcfunction", "will", "take", "a", "CifData", "node", "attempt", "to", "create", "a", "StructureData", "object", "from", "it", "using", "the", "parse_engine", "and", "pass", "it", "through", "SeeKpath", "to", "try", "and", "get", "the", "primitive", ...
python
train
54.55102
aleju/imgaug
imgaug/augmentables/heatmaps.py
https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/heatmaps.py#L319-L336
def avg_pool(self, block_size): """ Resize the heatmap(s) array using average pooling of a given block/kernel size. Parameters ---------- block_size : int or tuple of int Size of each block of values to pool, aka kernel size. See :func:`imgaug.pool` for details. ...
[ "def", "avg_pool", "(", "self", ",", "block_size", ")", ":", "arr_0to1_reduced", "=", "ia", ".", "avg_pool", "(", "self", ".", "arr_0to1", ",", "block_size", ",", "cval", "=", "0.0", ")", "return", "HeatmapsOnImage", ".", "from_0to1", "(", "arr_0to1_reduced"...
Resize the heatmap(s) array using average pooling of a given block/kernel size. Parameters ---------- block_size : int or tuple of int Size of each block of values to pool, aka kernel size. See :func:`imgaug.pool` for details. Returns ------- imgaug.Heatmaps...
[ "Resize", "the", "heatmap", "(", "s", ")", "array", "using", "average", "pooling", "of", "a", "given", "block", "/", "kernel", "size", "." ]
python
valid
36.944444
Cognexa/cxflow
cxflow/utils/yaml.py
https://github.com/Cognexa/cxflow/blob/dd609e6b0bd854424a8f86781dd77801a13038f9/cxflow/utils/yaml.py#L11-L19
def load_yaml(yaml_file: str) -> Any: """ Load YAML from file. :param yaml_file: path to YAML file :return: content of the YAML as dict/list """ with open(yaml_file, 'r') as file: return ruamel.yaml.load(file, ruamel.yaml.RoundTripLoader)
[ "def", "load_yaml", "(", "yaml_file", ":", "str", ")", "->", "Any", ":", "with", "open", "(", "yaml_file", ",", "'r'", ")", "as", "file", ":", "return", "ruamel", ".", "yaml", ".", "load", "(", "file", ",", "ruamel", ".", "yaml", ".", "RoundTripLoade...
Load YAML from file. :param yaml_file: path to YAML file :return: content of the YAML as dict/list
[ "Load", "YAML", "from", "file", "." ]
python
train
29.222222
pybel/pybel-tools
src/pybel_tools/summary/edge_summary.py
https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/summary/edge_summary.py#L155-L162
def get_consistent_edges(graph: BELGraph) -> Iterable[Tuple[BaseEntity, BaseEntity]]: """Yield pairs of (source node, target node) for which all of their edges have the same type of relation. :return: An iterator over (source, target) node pairs corresponding to edges with many inconsistent relations """ ...
[ "def", "get_consistent_edges", "(", "graph", ":", "BELGraph", ")", "->", "Iterable", "[", "Tuple", "[", "BaseEntity", ",", "BaseEntity", "]", "]", ":", "for", "u", ",", "v", "in", "graph", ".", "edges", "(", ")", ":", "if", "pair_is_consistent", "(", "...
Yield pairs of (source node, target node) for which all of their edges have the same type of relation. :return: An iterator over (source, target) node pairs corresponding to edges with many inconsistent relations
[ "Yield", "pairs", "of", "(", "source", "node", "target", "node", ")", "for", "which", "all", "of", "their", "edges", "have", "the", "same", "type", "of", "relation", "." ]
python
valid
51.125
openego/ding0
ding0/core/network/__init__.py
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/network/__init__.py#L131-L226
def graph_draw(self, mode): """ Draws grid graph using networkx This method is for debugging purposes only. Use ding0.tools.plots.plot_mv_topology() for advanced plotting. Parameters ---------- mode : str Mode selection 'MV' or 'LV'. Not...
[ "def", "graph_draw", "(", "self", ",", "mode", ")", ":", "g", "=", "self", ".", "_graph", "if", "mode", "==", "'MV'", ":", "# get draw params from nodes and edges (coordinates, colors, demands, etc.)", "nodes_pos", "=", "{", "}", "demands", "=", "{", "}", "deman...
Draws grid graph using networkx This method is for debugging purposes only. Use ding0.tools.plots.plot_mv_topology() for advanced plotting. Parameters ---------- mode : str Mode selection 'MV' or 'LV'. Notes ----- The geo coords ...
[ "Draws", "grid", "graph", "using", "networkx" ]
python
train
43.25
thieman/dagobah
dagobah/core/core.py
https://github.com/thieman/dagobah/blob/e624180c2291034960302c9e0b818b65b5a7ee11/dagobah/core/core.py#L953-L964
def tail(self, stream='stdout', num_lines=10): """ Tail a specified stream (stdout or stderr) by num_lines. """ target = self._map_string_to_file(stream) if not target: # no current temp file last_run = self.backend.get_latest_run_log(self.parent_job.job_id, ...
[ "def", "tail", "(", "self", ",", "stream", "=", "'stdout'", ",", "num_lines", "=", "10", ")", ":", "target", "=", "self", ".", "_map_string_to_file", "(", "stream", ")", "if", "not", "target", ":", "# no current temp file", "last_run", "=", "self", ".", ...
Tail a specified stream (stdout or stderr) by num_lines.
[ "Tail", "a", "specified", "stream", "(", "stdout", "or", "stderr", ")", "by", "num_lines", "." ]
python
train
50.25
SteveMcGrath/pySecurityCenter
examples/sc4/csv_gen/sccsv/generator.py
https://github.com/SteveMcGrath/pySecurityCenter/blob/f0b10b1bcd4fd23a8d4d09ca6774cdf5e1cfd880/examples/sc4/csv_gen/sccsv/generator.py#L46-L70
def gen_csv(sc, filename, field_list, source, filters): '''csv SecurityCenterObj, AssetListName, CSVFields, EmailAddress ''' # First thing we need to do is initialize the csvfile and build the header # for the file. datafile = open(filename, 'wb') csvfile = csv.writer(datafile) header = [] ...
[ "def", "gen_csv", "(", "sc", ",", "filename", ",", "field_list", ",", "source", ",", "filters", ")", ":", "# First thing we need to do is initialize the csvfile and build the header", "# for the file.", "datafile", "=", "open", "(", "filename", ",", "'wb'", ")", "csvf...
csv SecurityCenterObj, AssetListName, CSVFields, EmailAddress
[ "csv", "SecurityCenterObj", "AssetListName", "CSVFields", "EmailAddress" ]
python
train
40.12
radujica/baloo
baloo/core/indexes/base.py
https://github.com/radujica/baloo/blob/f6e05e35b73a75e8a300754c6bdc575e5f2d53b9/baloo/core/indexes/base.py#L180-L193
def evaluate(self, verbose=False, decode=True, passes=None, num_threads=1, apply_experimental=True): """Evaluates by creating an Index containing evaluated data. See `LazyResult` Returns ------- Index Index with evaluated data. """ evaluated_data = ...
[ "def", "evaluate", "(", "self", ",", "verbose", "=", "False", ",", "decode", "=", "True", ",", "passes", "=", "None", ",", "num_threads", "=", "1", ",", "apply_experimental", "=", "True", ")", ":", "evaluated_data", "=", "super", "(", "Index", ",", "se...
Evaluates by creating an Index containing evaluated data. See `LazyResult` Returns ------- Index Index with evaluated data.
[ "Evaluates", "by", "creating", "an", "Index", "containing", "evaluated", "data", "." ]
python
train
32.357143
amorison/loam
loam/cli.py
https://github.com/amorison/loam/blob/a566c943a75e068a4510099331a1ddfe5bbbdd94/loam/cli.py#L141-L154
def _add_options_to_parser(self, opts_dict, parser): """Add options to a parser.""" store_bool = ('store_true', 'store_false') for opt, sct in opts_dict.items(): meta = self._conf[sct].def_[opt] kwargs = copy.deepcopy(meta.cmd_kwargs) action = kwargs.get('acti...
[ "def", "_add_options_to_parser", "(", "self", ",", "opts_dict", ",", "parser", ")", ":", "store_bool", "=", "(", "'store_true'", ",", "'store_false'", ")", "for", "opt", ",", "sct", "in", "opts_dict", ".", "items", "(", ")", ":", "meta", "=", "self", "."...
Add options to a parser.
[ "Add", "options", "to", "a", "parser", "." ]
python
test
50.285714
sorgerlab/indra
indra/assemblers/pysb/bmi_wrapper.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/bmi_wrapper.py#L74-L85
def initialize(self, cfg_file=None, mode=None): """Initialize the model for simulation, possibly given a config file. Parameters ---------- cfg_file : Optional[str] The name of the configuration file to load, optional. """ self.sim = ScipyOdeSimulator(self.mo...
[ "def", "initialize", "(", "self", ",", "cfg_file", "=", "None", ",", "mode", "=", "None", ")", ":", "self", ".", "sim", "=", "ScipyOdeSimulator", "(", "self", ".", "model", ")", "self", ".", "state", "=", "numpy", ".", "array", "(", "copy", ".", "c...
Initialize the model for simulation, possibly given a config file. Parameters ---------- cfg_file : Optional[str] The name of the configuration file to load, optional.
[ "Initialize", "the", "model", "for", "simulation", "possibly", "given", "a", "config", "file", "." ]
python
train
37.666667
jobovy/galpy
galpy/potential/Potential.py
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/potential/Potential.py#L274-L317
def surfdens(self,R,z,phi=0.,t=0.,forcepoisson=False): """ NAME: surfdens PURPOSE: evaluate the surface density :math:`\\Sigma(R,z,\\phi,t) = \\int_{-z}^{+z} dz' \\rho(R,z',\\phi,t)` INPUT: R - Cylindrical Galactocentric radius (can be Quantity) ...
[ "def", "surfdens", "(", "self", ",", "R", ",", "z", ",", "phi", "=", "0.", ",", "t", "=", "0.", ",", "forcepoisson", "=", "False", ")", ":", "try", ":", "if", "forcepoisson", ":", "raise", "AttributeError", "#Hack!", "return", "self", ".", "_amp", ...
NAME: surfdens PURPOSE: evaluate the surface density :math:`\\Sigma(R,z,\\phi,t) = \\int_{-z}^{+z} dz' \\rho(R,z',\\phi,t)` INPUT: R - Cylindrical Galactocentric radius (can be Quantity) z - vertical height (can be Quantity) phi - azimuth (op...
[ "NAME", ":" ]
python
train
30.25
gamechanger/schemer
schemer/__init__.py
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/__init__.py#L79-L106
def _verify_field_spec(self, spec, path): """Verifies a given field specification is valid, recursing into nested schemas if required.""" # Required should be a boolean if 'required' in spec and not isinstance(spec['required'], bool): raise SchemaFormatException("{} required declara...
[ "def", "_verify_field_spec", "(", "self", ",", "spec", ",", "path", ")", ":", "# Required should be a boolean", "if", "'required'", "in", "spec", "and", "not", "isinstance", "(", "spec", "[", "'required'", "]", ",", "bool", ")", ":", "raise", "SchemaFormatExce...
Verifies a given field specification is valid, recursing into nested schemas if required.
[ "Verifies", "a", "given", "field", "specification", "is", "valid", "recursing", "into", "nested", "schemas", "if", "required", "." ]
python
train
45.785714
Alignak-monitoring/alignak
alignak/objects/service.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/service.py#L1586-L1598
def clean(self): """Remove services without host object linked to Note that this should not happen! :return: None """ to_del = [] for serv in self: if not serv.host: to_del.append(serv.uuid) for service_uuid in to_del: del...
[ "def", "clean", "(", "self", ")", ":", "to_del", "=", "[", "]", "for", "serv", "in", "self", ":", "if", "not", "serv", ".", "host", ":", "to_del", ".", "append", "(", "serv", ".", "uuid", ")", "for", "service_uuid", "in", "to_del", ":", "del", "s...
Remove services without host object linked to Note that this should not happen! :return: None
[ "Remove", "services", "without", "host", "object", "linked", "to" ]
python
train
25.615385
trivago/Protector
protector/__main__.py
https://github.com/trivago/Protector/blob/7ebe7bde965e27737b961a0cb5740724d174fdc7/protector/__main__.py#L16-L30
def main(): """ Setup consumer """ config = loader.load_config() if config.version: show_version() if config.show_rules: show_rules() if not config.configfile and not (hasattr(config, "status") or hasattr(config, "stop")): show_configfile_warning() # Check if we ...
[ "def", "main", "(", ")", ":", "config", "=", "loader", ".", "load_config", "(", ")", "if", "config", ".", "version", ":", "show_version", "(", ")", "if", "config", ".", "show_rules", ":", "show_rules", "(", ")", "if", "not", "config", ".", "configfile"...
Setup consumer
[ "Setup", "consumer" ]
python
valid
27.466667
Jammy2211/PyAutoLens
autolens/data/ccd.py
https://github.com/Jammy2211/PyAutoLens/blob/91e50369c7a9c048c83d217625578b72423cd5a7/autolens/data/ccd.py#L156-L201
def simulate_to_target_signal_to_noise(cls, array, pixel_scale, target_signal_to_noise, exposure_time_map, psf=None, background_sky_map=None, seed=-1): """ Create a realistic simulated image by applying effects to a plain simulated image. Parameters ...
[ "def", "simulate_to_target_signal_to_noise", "(", "cls", ",", "array", ",", "pixel_scale", ",", "target_signal_to_noise", ",", "exposure_time_map", ",", "psf", "=", "None", ",", "background_sky_map", "=", "None", ",", "seed", "=", "-", "1", ")", ":", "max_index"...
Create a realistic simulated image by applying effects to a plain simulated image. Parameters ---------- target_signal_to_noise array : ndarray The image before simulating (e.g. the lens and source galaxies before optics blurring and CCD read-out). pixel_scale: float...
[ "Create", "a", "realistic", "simulated", "image", "by", "applying", "effects", "to", "a", "plain", "simulated", "image", "." ]
python
valid
49.347826
wandb/client
wandb/vendor/prompt_toolkit/key_binding/vi_state.py
https://github.com/wandb/client/blob/7d08954ed5674fee223cd85ed0d8518fe47266b2/wandb/vendor/prompt_toolkit/key_binding/vi_state.py#L52-L61
def reset(self, mode=InputMode.INSERT): """ Reset state, go back to the given mode. INSERT by default. """ # Go back to insert mode. self.input_mode = mode self.waiting_for_digraph = False self.operator_func = None self.operator_arg = None
[ "def", "reset", "(", "self", ",", "mode", "=", "InputMode", ".", "INSERT", ")", ":", "# Go back to insert mode.", "self", ".", "input_mode", "=", "mode", "self", ".", "waiting_for_digraph", "=", "False", "self", ".", "operator_func", "=", "None", "self", "."...
Reset state, go back to the given mode. INSERT by default.
[ "Reset", "state", "go", "back", "to", "the", "given", "mode", ".", "INSERT", "by", "default", "." ]
python
train
29.5
wonambi-python/wonambi
wonambi/widgets/info.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/info.py#L90-L135
def create(self): """Create the widget layout with all the information.""" b0 = QGroupBox('Dataset') form = QFormLayout() b0.setLayout(form) open_rec = QPushButton('Open Dataset...') open_rec.clicked.connect(self.open_dataset) open_rec.setToolTip('Click here to o...
[ "def", "create", "(", "self", ")", ":", "b0", "=", "QGroupBox", "(", "'Dataset'", ")", "form", "=", "QFormLayout", "(", ")", "b0", ".", "setLayout", "(", "form", ")", "open_rec", "=", "QPushButton", "(", "'Open Dataset...'", ")", "open_rec", ".", "clicke...
Create the widget layout with all the information.
[ "Create", "the", "widget", "layout", "with", "all", "the", "information", "." ]
python
train
37.891304
RudolfCardinal/pythonlib
cardinal_pythonlib/nhs.py
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/nhs.py#L138-L168
def generate_nhs_number_from_first_9_digits(first9digits: str) -> Optional[int]: """ Returns a valid NHS number, as an ``int``, given the first 9 digits. The particular purpose is to make NHS numbers that *look* fake (rather than truly random NHS numbers which might accidentally be real). For examp...
[ "def", "generate_nhs_number_from_first_9_digits", "(", "first9digits", ":", "str", ")", "->", "Optional", "[", "int", "]", ":", "if", "len", "(", "first9digits", ")", "!=", "9", ":", "log", ".", "warning", "(", "\"Not 9 digits\"", ")", "return", "None", "try...
Returns a valid NHS number, as an ``int``, given the first 9 digits. The particular purpose is to make NHS numbers that *look* fake (rather than truly random NHS numbers which might accidentally be real). For example: .. code-block:: none 123456789_ : no; checksum 10 987654321_ : yes,...
[ "Returns", "a", "valid", "NHS", "number", "as", "an", "int", "given", "the", "first", "9", "digits", ".", "The", "particular", "purpose", "is", "to", "make", "NHS", "numbers", "that", "*", "look", "*", "fake", "(", "rather", "than", "truly", "random", ...
python
train
36.193548
google/grr
grr/core/grr_response_core/lib/rdfvalues/structs.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/rdfvalues/structs.py#L1102-L1122
def ConvertFromWireFormat(self, value, container=None): """The wire format is an AnyValue message.""" result = AnyValue() ReadIntoObject(value[2], 0, result) if self._type is not None: converted_value = self._type(container) else: converted_value = self._TypeFromAnyValue(result) # I...
[ "def", "ConvertFromWireFormat", "(", "self", ",", "value", ",", "container", "=", "None", ")", ":", "result", "=", "AnyValue", "(", ")", "ReadIntoObject", "(", "value", "[", "2", "]", ",", "0", ",", "result", ")", "if", "self", ".", "_type", "is", "n...
The wire format is an AnyValue message.
[ "The", "wire", "format", "is", "an", "AnyValue", "message", "." ]
python
train
46.714286
kensho-technologies/graphql-compiler
graphql_compiler/compiler/ir_lowering_match/between_lowering.py
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/compiler/ir_lowering_match/between_lowering.py#L36-L70
def _construct_field_operator_expression_dict(expression_list): """Construct a mapping from local fields to specified operators, and corresponding expressions. Args: expression_list: list of expressions to analyze Returns: local_field_to_expressions: dict mapping local field na...
[ "def", "_construct_field_operator_expression_dict", "(", "expression_list", ")", ":", "between_operators", "=", "(", "u'<='", ",", "u'>='", ")", "inverse_operator", "=", "{", "u'>='", ":", "u'<='", ",", "u'<='", ":", "u'>='", "}", "local_field_to_expressions", "=", ...
Construct a mapping from local fields to specified operators, and corresponding expressions. Args: expression_list: list of expressions to analyze Returns: local_field_to_expressions: dict mapping local field names to "operator -> list of BinaryComposition" dictionaries, ...
[ "Construct", "a", "mapping", "from", "local", "fields", "to", "specified", "operators", "and", "corresponding", "expressions", "." ]
python
train
48.6
tensorflow/tensor2tensor
tensor2tensor/trax/models/resnet.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/models/resnet.py#L129-L149
def WideResnet(num_blocks=3, hidden_size=64, num_output_classes=10, mode='train'): """WideResnet from https://arxiv.org/pdf/1605.07146.pdf. Args: num_blocks: int, number of blocks in a group. hidden_size: the size of the first hidden layer (multiplied later). num_output_classes: int, num...
[ "def", "WideResnet", "(", "num_blocks", "=", "3", ",", "hidden_size", "=", "64", ",", "num_output_classes", "=", "10", ",", "mode", "=", "'train'", ")", ":", "del", "mode", "return", "layers", ".", "Serial", "(", "layers", ".", "Conv", "(", "hidden_size"...
WideResnet from https://arxiv.org/pdf/1605.07146.pdf. Args: num_blocks: int, number of blocks in a group. hidden_size: the size of the first hidden layer (multiplied later). num_output_classes: int, number of classes to distinguish. mode: is it training or eval. Returns: The WideResnet model w...
[ "WideResnet", "from", "https", ":", "//", "arxiv", ".", "org", "/", "pdf", "/", "1605", ".", "07146", ".", "pdf", "." ]
python
train
40.714286
nok/sklearn-porter
sklearn_porter/estimator/regressor/MLPRegressor/__init__.py
https://github.com/nok/sklearn-porter/blob/04673f768310bde31f9747a68a5e070592441ef2/sklearn_porter/estimator/regressor/MLPRegressor/__init__.py#L120-L133
def create_method(self): """ Build the estimator method or function. Returns ------- :return : string The built method as string. """ temp_method = self.temp('method', skipping=True, n_indents=1) return temp_method.format(class_name=self.class...
[ "def", "create_method", "(", "self", ")", ":", "temp_method", "=", "self", ".", "temp", "(", "'method'", ",", "skipping", "=", "True", ",", "n_indents", "=", "1", ")", "return", "temp_method", ".", "format", "(", "class_name", "=", "self", ".", "class_na...
Build the estimator method or function. Returns ------- :return : string The built method as string.
[ "Build", "the", "estimator", "method", "or", "function", "." ]
python
train
35.5
pokerregion/poker
poker/room/pokerstars.py
https://github.com/pokerregion/poker/blob/2d8cf208fdf2b26bdc935972dcbe7a983a9e9768/poker/room/pokerstars.py#L377-L380
def replace_note(self, player, text): """Replace note text with text. (Overwrites previous note!)""" note = self._find_note(player) note.text = text
[ "def", "replace_note", "(", "self", ",", "player", ",", "text", ")", ":", "note", "=", "self", ".", "_find_note", "(", "player", ")", "note", ".", "text", "=", "text" ]
Replace note text with text. (Overwrites previous note!)
[ "Replace", "note", "text", "with", "text", ".", "(", "Overwrites", "previous", "note!", ")" ]
python
train
42.25
tanghaibao/goatools
goatools/gosubdag/gosubdag.py
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/gosubdag.py#L120-L126
def get_ns2goids(self, goids): """Group GO IDs by namespace.""" ns2goids = cx.defaultdict(set) go2nt = self.go2nt for goid in goids: ns2goids[go2nt[goid].NS].add(goid) return {ns:gos for ns, gos in ns2goids.items()}
[ "def", "get_ns2goids", "(", "self", ",", "goids", ")", ":", "ns2goids", "=", "cx", ".", "defaultdict", "(", "set", ")", "go2nt", "=", "self", ".", "go2nt", "for", "goid", "in", "goids", ":", "ns2goids", "[", "go2nt", "[", "goid", "]", ".", "NS", "]...
Group GO IDs by namespace.
[ "Group", "GO", "IDs", "by", "namespace", "." ]
python
train
37.285714
mitsei/dlkit
dlkit/handcar/learning/managers.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/learning/managers.py#L3420-L3450
def get_proficiency_query_session_for_objective_bank(self, objective_bank_id, proxy): """Gets the ``OsidSession`` associated with the proficiency query service for the given objective bank. :param objective_bank_id: the ``Id`` of the obective bank :type objective_bank_id: ``osid.id.Id`` ...
[ "def", "get_proficiency_query_session_for_objective_bank", "(", "self", ",", "objective_bank_id", ",", "proxy", ")", ":", "if", "not", "objective_bank_id", ":", "raise", "NullArgument", "if", "not", "self", ".", "supports_proficiency_query", "(", ")", ":", "raise", ...
Gets the ``OsidSession`` associated with the proficiency query service for the given objective bank. :param objective_bank_id: the ``Id`` of the obective bank :type objective_bank_id: ``osid.id.Id`` :param proxy: a proxy :type proxy: ``osid.proxy.Proxy`` :return: a ``Proficiency...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "proficiency", "query", "service", "for", "the", "given", "objective", "bank", "." ]
python
train
48.677419
teepark/greenhouse
greenhouse/util.py
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/util.py#L952-L957
def increment(self): "increment the counter, and wake anyone waiting for the new value" self._count += 1 waiters = self._waiters.pop(self._count, []) if waiters: scheduler.state.awoken_from_events.update(waiters)
[ "def", "increment", "(", "self", ")", ":", "self", ".", "_count", "+=", "1", "waiters", "=", "self", ".", "_waiters", ".", "pop", "(", "self", ".", "_count", ",", "[", "]", ")", "if", "waiters", ":", "scheduler", ".", "state", ".", "awoken_from_event...
increment the counter, and wake anyone waiting for the new value
[ "increment", "the", "counter", "and", "wake", "anyone", "waiting", "for", "the", "new", "value" ]
python
train
41.833333
pyviz/holoviews
holoviews/core/spaces.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/spaces.py#L1894-L1908
def keys(self, full_grid=False): """Returns the keys of the GridSpace Args: full_grid (bool, optional): Return full cross-product of keys Returns: List of keys """ keys = super(GridSpace, self).keys() if self.ndims == 1 or not full_grid: ...
[ "def", "keys", "(", "self", ",", "full_grid", "=", "False", ")", ":", "keys", "=", "super", "(", "GridSpace", ",", "self", ")", ".", "keys", "(", ")", "if", "self", ".", "ndims", "==", "1", "or", "not", "full_grid", ":", "return", "keys", "dim1_key...
Returns the keys of the GridSpace Args: full_grid (bool, optional): Return full cross-product of keys Returns: List of keys
[ "Returns", "the", "keys", "of", "the", "GridSpace" ]
python
train
32.733333
crs4/hl7apy
hl7apy/core.py
https://github.com/crs4/hl7apy/blob/91be488e9274f6ec975519a1d9c17045bc91bf74/hl7apy/core.py#L1261-L1291
def add(self, obj): """ Add an instance of :class:`SubComponent <hl7apy.core.SubComponent>` to the list of children :param obj: an instance of :class:`SubComponent <hl7apy.core.SubComponent>` >>> c = Component('CX_10') >>> s = SubComponent(name='CWE_1', value='EXAMPLE_ID') ...
[ "def", "add", "(", "self", ",", "obj", ")", ":", "# base datatype components can't have more than one child", "if", "self", ".", "name", "and", "is_base_datatype", "(", "self", ".", "datatype", ",", "self", ".", "version", ")", "and", "len", "(", "self", ".", ...
Add an instance of :class:`SubComponent <hl7apy.core.SubComponent>` to the list of children :param obj: an instance of :class:`SubComponent <hl7apy.core.SubComponent>` >>> c = Component('CX_10') >>> s = SubComponent(name='CWE_1', value='EXAMPLE_ID') >>> s2 = SubComponent(name='CWE_4', ...
[ "Add", "an", "instance", "of", ":", "class", ":", "SubComponent", "<hl7apy", ".", "core", ".", "SubComponent", ">", "to", "the", "list", "of", "children" ]
python
train
41.516129
robotframework/Rammbock
src/Rammbock/core.py
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/core.py#L306-L323
def accept_connection(self, name=None, alias=None, timeout=0): """Accepts a connection to server identified by `name` or the latest server if `name` is empty. If given an `alias`, the connection is named and can be later referenced with that name. If `timeout` is > 0, the conne...
[ "def", "accept_connection", "(", "self", ",", "name", "=", "None", ",", "alias", "=", "None", ",", "timeout", "=", "0", ")", ":", "server", "=", "self", ".", "_servers", ".", "get", "(", "name", ")", "server", ".", "accept_connection", "(", "alias", ...
Accepts a connection to server identified by `name` or the latest server if `name` is empty. If given an `alias`, the connection is named and can be later referenced with that name. If `timeout` is > 0, the connection times out after the time specified. `timeout` defaults to 0 ...
[ "Accepts", "a", "connection", "to", "server", "identified", "by", "name", "or", "the", "latest", "server", "if", "name", "is", "empty", "." ]
python
train
41.222222
O365/python-o365
O365/excel.py
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/excel.py#L1581-L1593
def get_range(self, address=None): """ Returns a Range instance from whitin this worksheet :param str address: Optional, the range address you want :return: a Range instance """ url = self.build_url(self._endpoints.get('get_range')) if address is not None: ...
[ "def", "get_range", "(", "self", ",", "address", "=", "None", ")", ":", "url", "=", "self", ".", "build_url", "(", "self", ".", "_endpoints", ".", "get", "(", "'get_range'", ")", ")", "if", "address", "is", "not", "None", ":", "url", "=", "\"{}(addre...
Returns a Range instance from whitin this worksheet :param str address: Optional, the range address you want :return: a Range instance
[ "Returns", "a", "Range", "instance", "from", "whitin", "this", "worksheet", ":", "param", "str", "address", ":", "Optional", "the", "range", "address", "you", "want", ":", "return", ":", "a", "Range", "instance" ]
python
train
41.692308
rjdkmr/do_x3dna
dnaMD/dnaMD/dnaEY.py
https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaEY.py#L797-L851
def _calcEnergyStretchTwist(self, diff, es, which): r"""Calculate energy for ``estype='ST'`` using a difference vector. It is called in :meth:`dnaEY.getGlobalDeformationEnergy` for energy calculation of each frame. Parameters ---------- diff : numpy.ndarray Array of...
[ "def", "_calcEnergyStretchTwist", "(", "self", ",", "diff", ",", "es", ",", "which", ")", ":", "if", "which", "not", "in", "self", ".", "enGlobalTypes", "[", ":", "5", "]", ":", "raise", "ValueError", "(", "'{0} is not a supported energy keywords.\\n Use any of ...
r"""Calculate energy for ``estype='ST'`` using a difference vector. It is called in :meth:`dnaEY.getGlobalDeformationEnergy` for energy calculation of each frame. Parameters ---------- diff : numpy.ndarray Array of difference between minimum and current parameter values. ...
[ "r", "Calculate", "energy", "for", "estype", "=", "ST", "using", "a", "difference", "vector", "." ]
python
train
30.963636
spyder-ide/spyder
spyder/plugins/explorer/widgets.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1147-L1149
def sort(self, column, order=Qt.AscendingOrder): """Reimplement Qt method""" self.sourceModel().sort(column, order)
[ "def", "sort", "(", "self", ",", "column", ",", "order", "=", "Qt", ".", "AscendingOrder", ")", ":", "self", ".", "sourceModel", "(", ")", ".", "sort", "(", "column", ",", "order", ")" ]
Reimplement Qt method
[ "Reimplement", "Qt", "method" ]
python
train
43.666667
materialsproject/pymatgen
pymatgen/analysis/elasticity/elastic.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/elasticity/elastic.py#L171-L177
def g_reuss(self): """ returns the G_r shear modulus """ return 15. / (8. * self.compliance_tensor.voigt[:3, :3].trace() - 4. * np.triu(self.compliance_tensor.voigt[:3, :3]).sum() + 3. * self.compliance_tensor.voigt[3:, 3:].trace())
[ "def", "g_reuss", "(", "self", ")", ":", "return", "15.", "/", "(", "8.", "*", "self", ".", "compliance_tensor", ".", "voigt", "[", ":", "3", ",", ":", "3", "]", ".", "trace", "(", ")", "-", "4.", "*", "np", ".", "triu", "(", "self", ".", "co...
returns the G_r shear modulus
[ "returns", "the", "G_r", "shear", "modulus" ]
python
train
43.142857
ray-project/ray
python/ray/experimental/array/distributed/linalg.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/array/distributed/linalg.py#L15-L84
def tsqr(a): """Perform a QR decomposition of a tall-skinny matrix. Args: a: A distributed matrix with shape MxN (suppose K = min(M, N)). Returns: A tuple of q (a DistArray) and r (a numpy array) satisfying the following. - If q_full = ray.get(DistArray, q).assemble...
[ "def", "tsqr", "(", "a", ")", ":", "if", "len", "(", "a", ".", "shape", ")", "!=", "2", ":", "raise", "Exception", "(", "\"tsqr requires len(a.shape) == 2, but a.shape is \"", "\"{}\"", ".", "format", "(", "a", ".", "shape", ")", ")", "if", "a", ".", "...
Perform a QR decomposition of a tall-skinny matrix. Args: a: A distributed matrix with shape MxN (suppose K = min(M, N)). Returns: A tuple of q (a DistArray) and r (a numpy array) satisfying the following. - If q_full = ray.get(DistArray, q).assemble(), then ...
[ "Perform", "a", "QR", "decomposition", "of", "a", "tall", "-", "skinny", "matrix", "." ]
python
train
38.014286
RRZE-HPC/kerncraft
kerncraft/kernel.py
https://github.com/RRZE-HPC/kerncraft/blob/c60baf8043e4da8d8d66da7575021c2f4c6c78af/kerncraft/kernel.py#L1172-L1197
def _build_dummy_calls(self): """ Generate false if branch with dummy calls Requires kerncraft.h to be included, which defines dummy(...) and var_false. :return: dummy statement """ # Make sure nothing gets removed by inserting dummy calls dummy_calls = [] ...
[ "def", "_build_dummy_calls", "(", "self", ")", ":", "# Make sure nothing gets removed by inserting dummy calls", "dummy_calls", "=", "[", "]", "for", "d", "in", "self", ".", "kernel_ast", ".", "block_items", ":", "# Only consider toplevel declarations from kernel ast", "if"...
Generate false if branch with dummy calls Requires kerncraft.h to be included, which defines dummy(...) and var_false. :return: dummy statement
[ "Generate", "false", "if", "branch", "with", "dummy", "calls" ]
python
test
38.576923
ibis-project/ibis
ibis/impala/client.py
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/impala/client.py#L1574-L1595
def create_function(self, func, name=None, database=None): """ Creates a function within Impala Parameters ---------- func : ImpalaUDF or ImpalaUDA Created with wrap_udf or wrap_uda name : string (optional) database : string (optional) """ ...
[ "def", "create_function", "(", "self", ",", "func", ",", "name", "=", "None", ",", "database", "=", "None", ")", ":", "if", "name", "is", "None", ":", "name", "=", "func", ".", "name", "database", "=", "database", "or", "self", ".", "current_database",...
Creates a function within Impala Parameters ---------- func : ImpalaUDF or ImpalaUDA Created with wrap_udf or wrap_uda name : string (optional) database : string (optional)
[ "Creates", "a", "function", "within", "Impala" ]
python
train
32.045455
jalanb/pysyte
pysyte/lists.py
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/lists.py#L4-L14
def de_duplicate(items): """Remove any duplicate item, preserving order >>> de_duplicate([1, 2, 1, 2]) [1, 2] """ result = [] for item in items: if item not in result: result.append(item) return result
[ "def", "de_duplicate", "(", "items", ")", ":", "result", "=", "[", "]", "for", "item", "in", "items", ":", "if", "item", "not", "in", "result", ":", "result", ".", "append", "(", "item", ")", "return", "result" ]
Remove any duplicate item, preserving order >>> de_duplicate([1, 2, 1, 2]) [1, 2]
[ "Remove", "any", "duplicate", "item", "preserving", "order" ]
python
train
21.818182
emory-libraries/eulfedora
eulfedora/models.py
https://github.com/emory-libraries/eulfedora/blob/161826f3fdcdab4007f6fa7dfd9f1ecabc4bcbe4/eulfedora/models.py#L1183-L1187
def risearch(self): "Instance of :class:`eulfedora.api.ResourceIndex`, with the same root url and credentials" if self._risearch is None: self._risearch = ResourceIndex(self.api.base_url, self.api.username, self.api.password) return self._risearch
[ "def", "risearch", "(", "self", ")", ":", "if", "self", ".", "_risearch", "is", "None", ":", "self", ".", "_risearch", "=", "ResourceIndex", "(", "self", ".", "api", ".", "base_url", ",", "self", ".", "api", ".", "username", ",", "self", ".", "api", ...
Instance of :class:`eulfedora.api.ResourceIndex`, with the same root url and credentials
[ "Instance", "of", ":", "class", ":", "eulfedora", ".", "api", ".", "ResourceIndex", "with", "the", "same", "root", "url", "and", "credentials" ]
python
train
55.8
push-things/django-th
th_joplin/my_joplin.py
https://github.com/push-things/django-th/blob/86c999d16bcf30b6224206e5b40824309834ac8c/th_joplin/my_joplin.py#L54-L76
def save_data(self, trigger_id, **data): """ let's save the data :param trigger_id: trigger ID from which to save data :param data: the data to check to be used and save :type trigger_id: int :type data: dict :return: the status of the sav...
[ "def", "save_data", "(", "self", ",", "trigger_id", ",", "*", "*", "data", ")", ":", "from", "th_joplin", ".", "models", "import", "Joplin", "status", "=", "False", "data", "[", "'output_format'", "]", "=", "'markdown_github'", "title", ",", "content", "="...
let's save the data :param trigger_id: trigger ID from which to save data :param data: the data to check to be used and save :type trigger_id: int :type data: dict :return: the status of the save statement :rtype: boolean
[ "let", "s", "save", "the", "data", ":", "param", "trigger_id", ":", "trigger", "ID", "from", "which", "to", "save", "data", ":", "param", "data", ":", "the", "data", "to", "check", "to", "be", "used", "and", "save", ":", "type", "trigger_id", ":", "i...
python
train
36.086957
dev-pipeline/dev-pipeline-configure
lib/devpipeline_configure/cache.py
https://github.com/dev-pipeline/dev-pipeline-configure/blob/26de2dd1b39d9a77d5417244f09319e7dce47495/lib/devpipeline_configure/cache.py#L121-L125
def write(self): """Write the configuration.""" if self.dirty: with open(self._cache_path, "w") as output_file: self._config.write(output_file)
[ "def", "write", "(", "self", ")", ":", "if", "self", ".", "dirty", ":", "with", "open", "(", "self", ".", "_cache_path", ",", "\"w\"", ")", "as", "output_file", ":", "self", ".", "_config", ".", "write", "(", "output_file", ")" ]
Write the configuration.
[ "Write", "the", "configuration", "." ]
python
train
36.6
peterbrittain/asciimatics
asciimatics/widgets.py
https://github.com/peterbrittain/asciimatics/blob/f471427d7786ce2d5f1eeb2dae0e67d19e46e085/asciimatics/widgets.py#L2515-L2522
def _set_pos(self, pos): """ Set current position for scroll bar. """ if self._h < len(self._options): pos *= len(self._options) - self._h pos = int(round(max(0, pos), 0)) self._start_line = pos
[ "def", "_set_pos", "(", "self", ",", "pos", ")", ":", "if", "self", ".", "_h", "<", "len", "(", "self", ".", "_options", ")", ":", "pos", "*=", "len", "(", "self", ".", "_options", ")", "-", "self", ".", "_h", "pos", "=", "int", "(", "round", ...
Set current position for scroll bar.
[ "Set", "current", "position", "for", "scroll", "bar", "." ]
python
train
31.875
evhub/coconut
coconut/compiler/compiler.py
https://github.com/evhub/coconut/blob/ff97177344e7604e89a0a98a977a87ed2a56fc6d/coconut/compiler/compiler.py#L377-L390
def reset(self): """Resets references.""" self.indchar = None self.comments = {} self.refs = [] self.set_skips([]) self.docstring = "" self.ichain_count = 0 self.tre_store_count = 0 self.case_check_count = 0 self.stmt_lambdas = [] i...
[ "def", "reset", "(", "self", ")", ":", "self", ".", "indchar", "=", "None", "self", ".", "comments", "=", "{", "}", "self", ".", "refs", "=", "[", "]", "self", ".", "set_skips", "(", "[", "]", ")", "self", ".", "docstring", "=", "\"\"", "self", ...
Resets references.
[ "Resets", "references", "." ]
python
train
27.214286
saltstack/salt
salt/modules/dockermod.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L3214-L3452
def run_container(image, name=None, skip_translate=None, ignore_collisions=False, validate_ip_addrs=True, client_timeout=salt.utils.docker.CLIENT_TIMEOUT, bg=False, replace=False, ...
[ "def", "run_container", "(", "image", ",", "name", "=", "None", ",", "skip_translate", "=", "None", ",", "ignore_collisions", "=", "False", ",", "validate_ip_addrs", "=", "True", ",", "client_timeout", "=", "salt", ".", "utils", ".", "docker", ".", "CLIENT_T...
.. versionadded:: 2018.3.0 Equivalent to ``docker run`` on the Docker CLI. Runs the container, waits for it to exit, and returns the container's logs when complete. .. note:: Not to be confused with :py:func:`docker.run <salt.modules.dockermod.run>`, which provides a :py:func:`cmd.run ...
[ "..", "versionadded", "::", "2018", ".", "3", ".", "0" ]
python
train
41.372385
trevisanj/a99
a99/gui/parameter.py
https://github.com/trevisanj/a99/blob/193e6e3c9b3e4f4a0ba7eb3eece846fe7045c539/a99/gui/parameter.py#L46-L53
def AddToLayout(self, layout): """ Arguments: layout -- a QFormLayout instance """ for param in self.params: widget = param.RenderWidget() layout.addRow(param.caption, widget)
[ "def", "AddToLayout", "(", "self", ",", "layout", ")", ":", "for", "param", "in", "self", ".", "params", ":", "widget", "=", "param", ".", "RenderWidget", "(", ")", "layout", ".", "addRow", "(", "param", ".", "caption", ",", "widget", ")" ]
Arguments: layout -- a QFormLayout instance
[ "Arguments", ":", "layout", "--", "a", "QFormLayout", "instance" ]
python
train
30.125
mozilla/configman
configman/namespace.py
https://github.com/mozilla/configman/blob/83159fed61cc4cbbe5a4a6a00d3acad8a0c39c96/configman/namespace.py#L31-L52
def add_option(self, name, *args, **kwargs): """add an option to the namespace. This can take two forms: 'name' is a string representing the name of an option and the kwargs are its parameters, or 'name' is an instance of an Option object """ if isinst...
[ "def", "add_option", "(", "self", ",", "name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "name", ",", "Option", ")", ":", "an_option", "=", "name", "name", "=", "an_option", ".", "name", "else", ":", "an_option", ...
add an option to the namespace. This can take two forms: 'name' is a string representing the name of an option and the kwargs are its parameters, or 'name' is an instance of an Option object
[ "add", "an", "option", "to", "the", "namespace", ".", "This", "can", "take", "two", "forms", ":", "name", "is", "a", "string", "representing", "the", "name", "of", "an", "option", "and", "the", "kwargs", "are", "its", "parameters", "or", "name", "is", ...
python
train
40.409091
miguelgrinberg/python-socketio
socketio/asyncio_server.py
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_server.py#L287-L303
async def disconnect(self, sid, namespace=None): """Disconnect a client. :param sid: Session ID of the client. :param namespace: The Socket.IO namespace to disconnect. If this argument is omitted the default namespace is used. Note: this method is a coroutine....
[ "async", "def", "disconnect", "(", "self", ",", "sid", ",", "namespace", "=", "None", ")", ":", "namespace", "=", "namespace", "or", "'/'", "if", "self", ".", "manager", ".", "is_connected", "(", "sid", ",", "namespace", "=", "namespace", ")", ":", "se...
Disconnect a client. :param sid: Session ID of the client. :param namespace: The Socket.IO namespace to disconnect. If this argument is omitted the default namespace is used. Note: this method is a coroutine.
[ "Disconnect", "a", "client", "." ]
python
train
49.058824
twilio/twilio-python
twilio/rest/autopilot/v1/assistant/query.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/autopilot/v1/assistant/query.py#L499-L509
def update(self, sample_sid=values.unset, status=values.unset): """ Update the QueryInstance :param unicode sample_sid: The SID of an optional reference to the Sample created from the query :param unicode status: The new status of the resource :returns: Updated QueryInstance ...
[ "def", "update", "(", "self", ",", "sample_sid", "=", "values", ".", "unset", ",", "status", "=", "values", ".", "unset", ")", ":", "return", "self", ".", "_proxy", ".", "update", "(", "sample_sid", "=", "sample_sid", ",", "status", "=", "status", ",",...
Update the QueryInstance :param unicode sample_sid: The SID of an optional reference to the Sample created from the query :param unicode status: The new status of the resource :returns: Updated QueryInstance :rtype: twilio.rest.autopilot.v1.assistant.query.QueryInstance
[ "Update", "the", "QueryInstance" ]
python
train
42.181818
saltstack/salt
salt/fileclient.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L169-L180
def get_file(self, path, dest='', makedirs=False, saltenv='base', gzip=None, cachedir=None): ''' Copies a file from the local files or master depending on implementation ''' rais...
[ "def", "get_file", "(", "self", ",", "path", ",", "dest", "=", "''", ",", "makedirs", "=", "False", ",", "saltenv", "=", "'base'", ",", "gzip", "=", "None", ",", "cachedir", "=", "None", ")", ":", "raise", "NotImplementedError" ]
Copies a file from the local files or master depending on implementation
[ "Copies", "a", "file", "from", "the", "local", "files", "or", "master", "depending", "on", "implementation" ]
python
train
27.5
sdispater/orator
orator/dbal/platforms/sqlite_platform.py
https://github.com/sdispater/orator/blob/bd90bf198ee897751848f9a92e49d18e60a74136/orator/dbal/platforms/sqlite_platform.py#L195-L294
def get_alter_table_sql(self, diff): """ Get the ALTER TABLE SQL statement :param diff: The table diff :type diff: orator.dbal.table_diff.TableDiff :rtype: list """ sql = self._get_simple_alter_table_sql(diff) if sql is not False: return sql ...
[ "def", "get_alter_table_sql", "(", "self", ",", "diff", ")", ":", "sql", "=", "self", ".", "_get_simple_alter_table_sql", "(", "diff", ")", "if", "sql", "is", "not", "False", ":", "return", "sql", "from_table", "=", "diff", ".", "from_table", "if", "not", ...
Get the ALTER TABLE SQL statement :param diff: The table diff :type diff: orator.dbal.table_diff.TableDiff :rtype: list
[ "Get", "the", "ALTER", "TABLE", "SQL", "statement" ]
python
train
34.67
log2timeline/plaso
plaso/storage/sqlite/sqlite_file.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/storage/sqlite/sqlite_file.py#L966-L979
def HasWarnings(self): """Determines if a store contains extraction warnings. Returns: bool: True if the store contains extraction warnings. """ # To support older storage versions, check for the now deprecated # extraction errors. has_errors = self._HasAttributeContainers( self._...
[ "def", "HasWarnings", "(", "self", ")", ":", "# To support older storage versions, check for the now deprecated", "# extraction errors.", "has_errors", "=", "self", ".", "_HasAttributeContainers", "(", "self", ".", "_CONTAINER_TYPE_EXTRACTION_ERROR", ")", "if", "has_errors", ...
Determines if a store contains extraction warnings. Returns: bool: True if the store contains extraction warnings.
[ "Determines", "if", "a", "store", "contains", "extraction", "warnings", "." ]
python
train
32.714286
mfussenegger/cr8
cr8/metrics.py
https://github.com/mfussenegger/cr8/blob/a37d6049f1f9fee2d0556efae2b7b7f8761bffe8/cr8/metrics.py#L10-L28
def percentile(sorted_values, p): """Calculate the percentile using the nearest rank method. >>> percentile([15, 20, 35, 40, 50], 50) 35 >>> percentile([15, 20, 35, 40, 50], 40) 20 >>> percentile([], 90) Traceback (most recent call last): ... ValueError: Too few data points (0...
[ "def", "percentile", "(", "sorted_values", ",", "p", ")", ":", "size", "=", "len", "(", "sorted_values", ")", "idx", "=", "(", "p", "/", "100.0", ")", "*", "size", "-", "0.5", "if", "idx", "<", "0", "or", "idx", ">", "size", ":", "raise", "ValueE...
Calculate the percentile using the nearest rank method. >>> percentile([15, 20, 35, 40, 50], 50) 35 >>> percentile([15, 20, 35, 40, 50], 40) 20 >>> percentile([], 90) Traceback (most recent call last): ... ValueError: Too few data points (0) for 90th percentile
[ "Calculate", "the", "percentile", "using", "the", "nearest", "rank", "method", "." ]
python
train
28.947368
mfitzp/biocyc
biocyc/biocyc.py
https://github.com/mfitzp/biocyc/blob/2fe81971687e4dcf1fcf869af0e7b3549be535b1/biocyc/biocyc.py#L651-L657
def _set_id_from_xml_frameid(self, xml, xmlpath, var): ''' Set a single variable with the frameids of matching entity ''' e = xml.find(xmlpath) if e is not None: setattr(self, var, e.attrib['frameid'])
[ "def", "_set_id_from_xml_frameid", "(", "self", ",", "xml", ",", "xmlpath", ",", "var", ")", ":", "e", "=", "xml", ".", "find", "(", "xmlpath", ")", "if", "e", "is", "not", "None", ":", "setattr", "(", "self", ",", "var", ",", "e", ".", "attrib", ...
Set a single variable with the frameids of matching entity
[ "Set", "a", "single", "variable", "with", "the", "frameids", "of", "matching", "entity" ]
python
train
35.285714
pytorch/text
torchtext/data/field.py
https://github.com/pytorch/text/blob/26bfce6869dc704f1d86792f9a681d453d7e7bb8/torchtext/data/field.py#L545-L644
def pad(self, minibatch): """Pad a batch of examples using this field. If ``self.nesting_field.sequential`` is ``False``, each example in the batch must be a list of string tokens, and pads them as if by a ``Field`` with ``sequential=True``. Otherwise, each example must be a list of lis...
[ "def", "pad", "(", "self", ",", "minibatch", ")", ":", "minibatch", "=", "list", "(", "minibatch", ")", "if", "not", "self", ".", "nesting_field", ".", "sequential", ":", "return", "super", "(", "NestedField", ",", "self", ")", ".", "pad", "(", "miniba...
Pad a batch of examples using this field. If ``self.nesting_field.sequential`` is ``False``, each example in the batch must be a list of string tokens, and pads them as if by a ``Field`` with ``sequential=True``. Otherwise, each example must be a list of list of tokens. Using ``self.nes...
[ "Pad", "a", "batch", "of", "examples", "using", "this", "field", "." ]
python
train
47.91
HPENetworking/PYHPEIMC
archived/pyhpimc.py
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/archived/pyhpimc.py#L488-L512
def get_custom_views(name=None): """ function takes no input and issues a RESTFUL call to get a list of custom views from HPE IMC. Optioanl Name input will return only the specified view. :param name: string containg the name of the desired custom view :return: list of dictionaries containing attrib...
[ "def", "get_custom_views", "(", "name", "=", "None", ")", ":", "if", "auth", "is", "None", "or", "url", "is", "None", ":", "# checks to see if the imc credentials are already available", "set_imc_creds", "(", ")", "if", "name", "is", "None", ":", "get_custom_views...
function takes no input and issues a RESTFUL call to get a list of custom views from HPE IMC. Optioanl Name input will return only the specified view. :param name: string containg the name of the desired custom view :return: list of dictionaries containing attributes of the custom views.
[ "function", "takes", "no", "input", "and", "issues", "a", "RESTFUL", "call", "to", "get", "a", "list", "of", "custom", "views", "from", "HPE", "IMC", ".", "Optioanl", "Name", "input", "will", "return", "only", "the", "specified", "view", ".", ":", "param...
python
train
49.04
wesyoung/pyzyre
czmq/_czmq_ctypes.py
https://github.com/wesyoung/pyzyre/blob/22d4c757acefcfdb700d3802adaf30b402bb9eea/czmq/_czmq_ctypes.py#L3223-L3229
def comment(self, format, *args): """ Add a comment to hash table before saving to disk. You can add as many comment lines as you like. These comment lines are discarded when loading the file. If you use a null format, all comments are deleted. """ return lib.zhashx_comment(self._as_para...
[ "def", "comment", "(", "self", ",", "format", ",", "*", "args", ")", ":", "return", "lib", ".", "zhashx_comment", "(", "self", ".", "_as_parameter_", ",", "format", ",", "*", "args", ")" ]
Add a comment to hash table before saving to disk. You can add as many comment lines as you like. These comment lines are discarded when loading the file. If you use a null format, all comments are deleted.
[ "Add", "a", "comment", "to", "hash", "table", "before", "saving", "to", "disk", ".", "You", "can", "add", "as", "many", "comment", "lines", "as", "you", "like", ".", "These", "comment", "lines", "are", "discarded", "when", "loading", "the", "file", ".", ...
python
train
48
textbook/atmdb
atmdb/core.py
https://github.com/textbook/atmdb/blob/cab14547d2e777a1e26c2560266365c484855789/atmdb/core.py#L65-L85
def calculate_timeout(http_date): """Extract request timeout from e.g. ``Retry-After`` header. Notes: Per :rfc:`2616#section-14.37`, the ``Retry-After`` header can be either an integer number of seconds or an HTTP date. This function can handle either. Arguments: ...
[ "def", "calculate_timeout", "(", "http_date", ")", ":", "try", ":", "return", "int", "(", "http_date", ")", "except", "ValueError", ":", "date_after", "=", "parse", "(", "http_date", ")", "utc_now", "=", "datetime", ".", "now", "(", "tz", "=", "timezone", ...
Extract request timeout from e.g. ``Retry-After`` header. Notes: Per :rfc:`2616#section-14.37`, the ``Retry-After`` header can be either an integer number of seconds or an HTTP date. This function can handle either. Arguments: http_date (:py:class:`str`): The da...
[ "Extract", "request", "timeout", "from", "e", ".", "g", ".", "Retry", "-", "After", "header", "." ]
python
train
31.571429
kmike/port-for
port_for/ephemeral.py
https://github.com/kmike/port-for/blob/f61ebf3c2caf54eabe8233b40ef67b973176a6f5/port_for/ephemeral.py#L15-L30
def port_ranges(): """ Returns a list of ephemeral port ranges for current machine. """ try: return _linux_ranges() except (OSError, IOError): # not linux, try BSD try: ranges = _bsd_ranges() if ranges: return ranges except (OSError, IO...
[ "def", "port_ranges", "(", ")", ":", "try", ":", "return", "_linux_ranges", "(", ")", "except", "(", "OSError", ",", "IOError", ")", ":", "# not linux, try BSD", "try", ":", "ranges", "=", "_bsd_ranges", "(", ")", "if", "ranges", ":", "return", "ranges", ...
Returns a list of ephemeral port ranges for current machine.
[ "Returns", "a", "list", "of", "ephemeral", "port", "ranges", "for", "current", "machine", "." ]
python
train
24.1875
CalebBell/thermo
thermo/viscosity.py
https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/viscosity.py#L1704-L1748
def Wilke(ys, mus, MWs): r'''Calculates viscosity of a gas mixture according to mixing rules in [1]_. .. math:: \eta_{mix} = \sum_{i=1}^n \frac{y_i \eta_i}{\sum_{j=1}^n y_j \phi_{ij}} \phi_{ij} = \frac{(1 + \sqrt{\eta_i/\eta_j}(MW_j/MW_i)^{0.25})^2} {\sqrt{8(1+MW_i/MW_j)}} Par...
[ "def", "Wilke", "(", "ys", ",", "mus", ",", "MWs", ")", ":", "if", "not", "none_and_length_check", "(", "[", "ys", ",", "mus", ",", "MWs", "]", ")", ":", "# check same-length inputs", "raise", "Exception", "(", "'Function inputs are incorrect format'", ")", ...
r'''Calculates viscosity of a gas mixture according to mixing rules in [1]_. .. math:: \eta_{mix} = \sum_{i=1}^n \frac{y_i \eta_i}{\sum_{j=1}^n y_j \phi_{ij}} \phi_{ij} = \frac{(1 + \sqrt{\eta_i/\eta_j}(MW_j/MW_i)^{0.25})^2} {\sqrt{8(1+MW_i/MW_j)}} Parameters ---------- ys...
[ "r", "Calculates", "viscosity", "of", "a", "gas", "mixture", "according", "to", "mixing", "rules", "in", "[", "1", "]", "_", "." ]
python
valid
28.555556
spyder-ide/spyder
spyder/plugins/editor/widgets/editor.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/editor.py#L883-L887
def set_bookmark(self, slot_num): """Bookmark current position to given slot.""" if self.data: editor = self.get_current_editor() editor.add_bookmark(slot_num)
[ "def", "set_bookmark", "(", "self", ",", "slot_num", ")", ":", "if", "self", ".", "data", ":", "editor", "=", "self", ".", "get_current_editor", "(", ")", "editor", ".", "add_bookmark", "(", "slot_num", ")" ]
Bookmark current position to given slot.
[ "Bookmark", "current", "position", "to", "given", "slot", "." ]
python
train
39.8
tanghaibao/jcvi
jcvi/formats/fasta.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/formats/fasta.py#L758-L790
def clean(args): """ %prog clean fastafile Remove irregular chars in FASTA seqs. """ p = OptionParser(clean.__doc__) p.add_option("--fancy", default=False, action="store_true", help="Pretty print the sequence [default: %default]") p.add_option("--canonical", default=False, ...
[ "def", "clean", "(", "args", ")", ":", "p", "=", "OptionParser", "(", "clean", ".", "__doc__", ")", "p", ".", "add_option", "(", "\"--fancy\"", ",", "default", "=", "False", ",", "action", "=", "\"store_true\"", ",", "help", "=", "\"Pretty print the sequen...
%prog clean fastafile Remove irregular chars in FASTA seqs.
[ "%prog", "clean", "fastafile" ]
python
train
28.939394
misli/django-cms-articles
cms_articles/models/managers.py
https://github.com/misli/django-cms-articles/blob/d96ac77e049022deb4c70d268e4eab74d175145c/cms_articles/models/managers.py#L19-L60
def search(self, q, language=None, current_site_only=True): """Simple search function Plugins can define a 'search_fields' tuple similar to ModelAdmin classes """ from cms.plugin_pool import plugin_pool qs = self.get_queryset() qs = qs.public() if current_site_...
[ "def", "search", "(", "self", ",", "q", ",", "language", "=", "None", ",", "current_site_only", "=", "True", ")", ":", "from", "cms", ".", "plugin_pool", "import", "plugin_pool", "qs", "=", "self", ".", "get_queryset", "(", ")", "qs", "=", "qs", ".", ...
Simple search function Plugins can define a 'search_fields' tuple similar to ModelAdmin classes
[ "Simple", "search", "function" ]
python
train
33.97619
sananth12/ImageScraper
image_scraper/utils.py
https://github.com/sananth12/ImageScraper/blob/04cdefaa184420637d02b5a285cf407bbd428929/image_scraper/utils.py#L184-L207
def download_image(self, img_url): """ Downloads a single image. Downloads img_url using self.page_url as base. Also, raises the appropriate exception if required. """ img_request = None try: img_request = requests.request( 'get', img_...
[ "def", "download_image", "(", "self", ",", "img_url", ")", ":", "img_request", "=", "None", "try", ":", "img_request", "=", "requests", ".", "request", "(", "'get'", ",", "img_url", ",", "stream", "=", "True", ",", "proxies", "=", "self", ".", "proxies",...
Downloads a single image. Downloads img_url using self.page_url as base. Also, raises the appropriate exception if required.
[ "Downloads", "a", "single", "image", "." ]
python
train
43.333333
hotzenklotz/pybeerxml
pybeerxml/parser.py
https://github.com/hotzenklotz/pybeerxml/blob/e9cf8d6090b1e01e5bbb101e255792b134affbe0/pybeerxml/parser.py#L15-L19
def nodes_to_object(self, node, object): "Map all child nodes to one object's attributes" for n in list(node): self.node_to_object(n, object)
[ "def", "nodes_to_object", "(", "self", ",", "node", ",", "object", ")", ":", "for", "n", "in", "list", "(", "node", ")", ":", "self", ".", "node_to_object", "(", "n", ",", "object", ")" ]
Map all child nodes to one object's attributes
[ "Map", "all", "child", "nodes", "to", "one", "object", "s", "attributes" ]
python
train
33.2
matthew-brett/delocate
delocate/tools.py
https://github.com/matthew-brett/delocate/blob/ed48de15fce31c3f52f1a9f32cae1b02fc55aa60/delocate/tools.py#L513-L534
def validate_signature(filename): """ Remove invalid signatures from a binary file If the file signature is missing or valid then it will be ignored Invalid signatures are replaced with an ad-hoc signature. This is the closest you can get to removing a signature on MacOS Parameters ---------...
[ "def", "validate_signature", "(", "filename", ")", ":", "out", ",", "err", "=", "back_tick", "(", "[", "'codesign'", ",", "'--verify'", ",", "filename", "]", ",", "ret_err", "=", "True", ",", "as_str", "=", "True", ",", "raise_err", "=", "False", ")", ...
Remove invalid signatures from a binary file If the file signature is missing or valid then it will be ignored Invalid signatures are replaced with an ad-hoc signature. This is the closest you can get to removing a signature on MacOS Parameters ---------- filename : str Filepath to a...
[ "Remove", "invalid", "signatures", "from", "a", "binary", "file" ]
python
train
35.681818
spacetelescope/drizzlepac
drizzlepac/processInput.py
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/processInput.py#L709-L739
def buildASNList(rootnames, asnname, check_for_duplicates=True): """ Return the list of filenames for a given set of rootnames """ # Recognize when multiple valid inputs with the same rootname are present # this would happen when both CTE-corrected (_flc) and non-CTE-corrected (_flt) # products...
[ "def", "buildASNList", "(", "rootnames", ",", "asnname", ",", "check_for_duplicates", "=", "True", ")", ":", "# Recognize when multiple valid inputs with the same rootname are present", "# this would happen when both CTE-corrected (_flc) and non-CTE-corrected (_flt)", "# products are in ...
Return the list of filenames for a given set of rootnames
[ "Return", "the", "list", "of", "filenames", "for", "a", "given", "set", "of", "rootnames" ]
python
train
43.612903
thomwiggers/httpserver
httpserver/httpserver.py
https://github.com/thomwiggers/httpserver/blob/88a3a35619ce5185347c6764f211878e898e6aad/httpserver/httpserver.py#L16-L28
def _get_response(**kwargs): """Get a template response Use kwargs to add things to the dictionary """ if 'code' not in kwargs: kwargs['code'] = 200 if 'headers' not in kwargs: kwargs['headers'] = dict() if 'version' not in kwargs: kwargs['version'] = 'HTTP/1.1' ret...
[ "def", "_get_response", "(", "*", "*", "kwargs", ")", ":", "if", "'code'", "not", "in", "kwargs", ":", "kwargs", "[", "'code'", "]", "=", "200", "if", "'headers'", "not", "in", "kwargs", ":", "kwargs", "[", "'headers'", "]", "=", "dict", "(", ")", ...
Get a template response Use kwargs to add things to the dictionary
[ "Get", "a", "template", "response" ]
python
train
25.076923
flashingpumpkin/django-socialregistration
socialregistration/mixins.py
https://github.com/flashingpumpkin/django-socialregistration/blob/9da9fb83c9bf79997ff81fe1378ab5ca3074b32b/socialregistration/mixins.py#L190-L197
def get_session_data(self, request): """ Return a tuple ``(user, profile, client)`` from the session. """ user = request.session['%suser' % SESSION_KEY] profile = request.session['%sprofile' % SESSION_KEY] client = request.session['%sclient' % SESSION_KEY] return ...
[ "def", "get_session_data", "(", "self", ",", "request", ")", ":", "user", "=", "request", ".", "session", "[", "'%suser'", "%", "SESSION_KEY", "]", "profile", "=", "request", ".", "session", "[", "'%sprofile'", "%", "SESSION_KEY", "]", "client", "=", "requ...
Return a tuple ``(user, profile, client)`` from the session.
[ "Return", "a", "tuple", "(", "user", "profile", "client", ")", "from", "the", "session", "." ]
python
train
41.75
tensorforce/tensorforce
docs/mistune.py
https://github.com/tensorforce/tensorforce/blob/520a8d992230e382f08e315ede5fc477f5e26bfb/docs/mistune.py#L865-L876
def link(self, link, title, text): """Rendering a given link with content and title. :param link: href link for ``<a>`` tag. :param title: title content for `title` attribute. :param text: text content for description. """ link = escape_link(link) if not title: ...
[ "def", "link", "(", "self", ",", "link", ",", "title", ",", "text", ")", ":", "link", "=", "escape_link", "(", "link", ")", "if", "not", "title", ":", "return", "'<a href=\"%s\">%s</a>'", "%", "(", "link", ",", "text", ")", "title", "=", "escape", "(...
Rendering a given link with content and title. :param link: href link for ``<a>`` tag. :param title: title content for `title` attribute. :param text: text content for description.
[ "Rendering", "a", "given", "link", "with", "content", "and", "title", "." ]
python
valid
39.583333
SeattleTestbed/seash
seash_modules.py
https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/seash_modules.py#L190-L213
def are_cmddicts_same(dict1, dict2): """ Checks to see if two cmddicts are the same. Two cmddicts are defined to be the same if they have the same callbacks/ helptexts/children/summaries for all nodes. """ # If the set of all keys are not the same, they must not be the same. if set(dict1.keys()) != s...
[ "def", "are_cmddicts_same", "(", "dict1", ",", "dict2", ")", ":", "# If the set of all keys are not the same, they must not be the same.", "if", "set", "(", "dict1", ".", "keys", "(", ")", ")", "!=", "set", "(", "dict2", ".", "keys", "(", ")", ")", ":", "retur...
Checks to see if two cmddicts are the same. Two cmddicts are defined to be the same if they have the same callbacks/ helptexts/children/summaries for all nodes.
[ "Checks", "to", "see", "if", "two", "cmddicts", "are", "the", "same", ".", "Two", "cmddicts", "are", "defined", "to", "be", "the", "same", "if", "they", "have", "the", "same", "callbacks", "/", "helptexts", "/", "children", "/", "summaries", "for", "all"...
python
train
32.541667
scoutapp/scout_apm_python
src/scout_apm/api/context.py
https://github.com/scoutapp/scout_apm_python/blob/e5539ee23b8129be9b75d5007c88b6158b51294f/src/scout_apm/api/context.py#L8-L18
def add(key, value): """Adds context to the currently executing request. :key: Any String identifying the request context. Example: "user_ip", "plan", "alert_count" :value: Any json-serializable type. Example: "1.1.1.1", "free", 100 :returns: nothing. ...
[ "def", "add", "(", "key", ",", "value", ")", ":", "tr", "=", "TrackedRequest", ".", "instance", "(", ")", "tr", ".", "tag", "(", "key", ",", "value", ")" ]
Adds context to the currently executing request. :key: Any String identifying the request context. Example: "user_ip", "plan", "alert_count" :value: Any json-serializable type. Example: "1.1.1.1", "free", 100 :returns: nothing.
[ "Adds", "context", "to", "the", "currently", "executing", "request", "." ]
python
train
34.545455