nwo stringlengths 5 106 | sha stringlengths 40 40 | path stringlengths 4 174 | language stringclasses 1
value | identifier stringlengths 1 140 | parameters stringlengths 0 87.7k | argument_list stringclasses 1
value | return_statement stringlengths 0 426k | docstring stringlengths 0 64.3k | docstring_summary stringlengths 0 26.3k | docstring_tokens list | function stringlengths 18 4.83M | function_tokens list | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
HymanLiuTS/flaskTs | 286648286976e85d9b9a5873632331efcafe0b21 | flasky/lib/python2.7/site-packages/pygments/cmdline.py | python | main | (args=sys.argv) | Main command line entry point. | Main command line entry point. | [
"Main",
"command",
"line",
"entry",
"point",
"."
] | def main(args=sys.argv):
"""
Main command line entry point.
"""
usage = USAGE % ((args[0],) * 6)
try:
popts, args = getopt.getopt(args[1:], "l:f:F:o:O:P:LS:a:N:vhVHgs")
except getopt.GetoptError:
print(usage, file=sys.stderr)
return 2
try:
return main_inner(... | [
"def",
"main",
"(",
"args",
"=",
"sys",
".",
"argv",
")",
":",
"usage",
"=",
"USAGE",
"%",
"(",
"(",
"args",
"[",
"0",
"]",
",",
")",
"*",
"6",
")",
"try",
":",
"popts",
",",
"args",
"=",
"getopt",
".",
"getopt",
"(",
"args",
"[",
"1",
":",... | https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/pygments/cmdline.py#L491-L529 | ||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/scipy/sparse/base.py | python | spmatrix.tobsr | (self, blocksize=None, copy=False) | return self.tocsr(copy=False).tobsr(blocksize=blocksize, copy=copy) | Convert this matrix to Block Sparse Row format.
With copy=False, the data/indices may be shared between this matrix and
the resultant bsr_matrix.
When blocksize=(R, C) is provided, it will be used for construction of
the bsr_matrix. | Convert this matrix to Block Sparse Row format. | [
"Convert",
"this",
"matrix",
"to",
"Block",
"Sparse",
"Row",
"format",
"."
] | def tobsr(self, blocksize=None, copy=False):
"""Convert this matrix to Block Sparse Row format.
With copy=False, the data/indices may be shared between this matrix and
the resultant bsr_matrix.
When blocksize=(R, C) is provided, it will be used for construction of
the bsr_matri... | [
"def",
"tobsr",
"(",
"self",
",",
"blocksize",
"=",
"None",
",",
"copy",
"=",
"False",
")",
":",
"return",
"self",
".",
"tocsr",
"(",
"copy",
"=",
"False",
")",
".",
"tobsr",
"(",
"blocksize",
"=",
"blocksize",
",",
"copy",
"=",
"copy",
")"
] | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/scipy/sparse/base.py#L798-L807 | |
SanPen/GridCal | d3f4566d2d72c11c7e910c9d162538ef0e60df31 | src/GridCal/Engine/Simulations/ATC/available_transfer_capacity_driver.py | python | AvailableTransferCapacityOptions.__init__ | (self, distributed_slack=True, correct_values=True, use_provided_flows=False,
bus_idx_from=list(), bus_idx_to=list(), idx_br=list(), sense_br=list(), Pf=None,
idx_hvdc_br=list(), sense_hvdc_br=list(), Pf_hvdc=None,
dT=100.0, threshold=0.02, mode: AvailableTransferMode ... | :param distributed_slack:
:param correct_values:
:param use_provided_flows:
:param bus_idx_from:
:param bus_idx_to:
:param idx_br:
:param sense_br:
:param Pf:
:param idx_hvdc_br:
:param sense_hvdc_br:
:param Pf_hvdc:
:param dT:
... | [] | def __init__(self, distributed_slack=True, correct_values=True, use_provided_flows=False,
bus_idx_from=list(), bus_idx_to=list(), idx_br=list(), sense_br=list(), Pf=None,
idx_hvdc_br=list(), sense_hvdc_br=list(), Pf_hvdc=None,
dT=100.0, threshold=0.02, mode: AvailableT... | [
"def",
"__init__",
"(",
"self",
",",
"distributed_slack",
"=",
"True",
",",
"correct_values",
"=",
"True",
",",
"use_provided_flows",
"=",
"False",
",",
"bus_idx_from",
"=",
"list",
"(",
")",
",",
"bus_idx_to",
"=",
"list",
"(",
")",
",",
"idx_br",
"=",
... | https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Engine/Simulations/ATC/available_transfer_capacity_driver.py#L483-L528 | |||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-47/fabmetheus_utilities/geometry/solids/triangle_mesh.py | python | ZoneArrangement.getEmptyZ | (self, z) | Get the first z which is not in the zone table. | Get the first z which is not in the zone table. | [
"Get",
"the",
"first",
"z",
"which",
"is",
"not",
"in",
"the",
"zone",
"table",
"."
] | def getEmptyZ(self, z):
'Get the first z which is not in the zone table.'
zoneIndex = round(z / self.zoneInterval)
if zoneIndex not in self.zZoneSet:
return z
zoneAround = 1
while 1:
zoneDown = zoneIndex - zoneAround
if zoneDown not in self.zZoneSet:
return zoneDown * self.zoneInterval
zoneUp ... | [
"def",
"getEmptyZ",
"(",
"self",
",",
"z",
")",
":",
"zoneIndex",
"=",
"round",
"(",
"z",
"/",
"self",
".",
"zoneInterval",
")",
"if",
"zoneIndex",
"not",
"in",
"self",
".",
"zZoneSet",
":",
"return",
"z",
"zoneAround",
"=",
"1",
"while",
"1",
":",
... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/fabmetheus_utilities/geometry/solids/triangle_mesh.py#L926-L939 | ||
aws-quickstart/quickstart-redhat-openshift | 2b87dd38b72e7e4c439a606c5a9ea458d72da612 | functions/source/DeleteBucketContents/requests/models.py | python | PreparedRequest.prepare_headers | (self, headers) | Prepares the given HTTP headers. | Prepares the given HTTP headers. | [
"Prepares",
"the",
"given",
"HTTP",
"headers",
"."
] | def prepare_headers(self, headers):
"""Prepares the given HTTP headers."""
self.headers = CaseInsensitiveDict()
if headers:
for header in headers.items():
# Raise exception on invalid header value.
check_header_validity(header)
name, v... | [
"def",
"prepare_headers",
"(",
"self",
",",
"headers",
")",
":",
"self",
".",
"headers",
"=",
"CaseInsensitiveDict",
"(",
")",
"if",
"headers",
":",
"for",
"header",
"in",
"headers",
".",
"items",
"(",
")",
":",
"# Raise exception on invalid header value.",
"c... | https://github.com/aws-quickstart/quickstart-redhat-openshift/blob/2b87dd38b72e7e4c439a606c5a9ea458d72da612/functions/source/DeleteBucketContents/requests/models.py#L441-L450 | ||
biopython/biopython | 2dd97e71762af7b046d7f7f8a4f1e38db6b06c86 | Bio/Phylo/PAML/_parse_yn00.py | python | parse_ng86 | (lines, results) | return (results, sequences) | Parse the Nei & Gojobori (1986) section of the results.
Nei_Gojobori results are organized in a lower
triangular matrix, with the sequence names labeling
the rows and statistics in the format:
w (dN dS) per column
Example row (2 columns):
0.0000 (0.0000 0.0207) 0.0000 (0.0000 0.0421) | Parse the Nei & Gojobori (1986) section of the results. | [
"Parse",
"the",
"Nei",
"&",
"Gojobori",
"(",
"1986",
")",
"section",
"of",
"the",
"results",
"."
] | def parse_ng86(lines, results):
"""Parse the Nei & Gojobori (1986) section of the results.
Nei_Gojobori results are organized in a lower
triangular matrix, with the sequence names labeling
the rows and statistics in the format:
w (dN dS) per column
Example row (2 columns):
0.0000 (0.0000 0.... | [
"def",
"parse_ng86",
"(",
"lines",
",",
"results",
")",
":",
"sequences",
"=",
"[",
"]",
"for",
"line",
"in",
"lines",
":",
"# The purpose of this complex regex is to parse the NG86 section for",
"# valid lines of data that are mixed in with citations and comments.",
"# The dat... | https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/Phylo/PAML/_parse_yn00.py#L13-L56 | |
rconradharris/envparse | e67e70307af19d925e194b2a163e0608dae7eb55 | envparse.py | python | Env.__init__ | (self, **schema) | [] | def __init__(self, **schema):
self.schema = schema | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"schema",
")",
":",
"self",
".",
"schema",
"=",
"schema"
] | https://github.com/rconradharris/envparse/blob/e67e70307af19d925e194b2a163e0608dae7eb55/envparse.py#L56-L57 | ||||
taowen/es-monitor | c4deceb4964857f495d13bfaf2d92f36734c9e1c | es_sql/executors/translators/case_when_translator.py | python | CaseWhenFiltersTranslator.build | (self) | return agg | [] | def build(self):
if not self.filters:
raise Exception('internal error')
agg = {'filters': {'filters': self.filters}}
if self.other_bucket_key:
agg['filters']['other_bucket_key'] = self.other_bucket_key
return agg | [
"def",
"build",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"filters",
":",
"raise",
"Exception",
"(",
"'internal error'",
")",
"agg",
"=",
"{",
"'filters'",
":",
"{",
"'filters'",
":",
"self",
".",
"filters",
"}",
"}",
"if",
"self",
".",
"other... | https://github.com/taowen/es-monitor/blob/c4deceb4964857f495d13bfaf2d92f36734c9e1c/es_sql/executors/translators/case_when_translator.py#L150-L156 | |||
pallets/flask | 660994efc761efdfd49ca442b73f6712dc77b6cf | src/flask/scaffold.py | python | Scaffold.route | (self, rule: str, **options: t.Any) | return decorator | Decorate a view function to register it with the given URL
rule and options. Calls :meth:`add_url_rule`, which has more
details about the implementation.
.. code-block:: python
@app.route("/")
def index():
return "Hello, World!"
See :ref:`url-ro... | Decorate a view function to register it with the given URL
rule and options. Calls :meth:`add_url_rule`, which has more
details about the implementation. | [
"Decorate",
"a",
"view",
"function",
"to",
"register",
"it",
"with",
"the",
"given",
"URL",
"rule",
"and",
"options",
".",
"Calls",
":",
"meth",
":",
"add_url_rule",
"which",
"has",
"more",
"details",
"about",
"the",
"implementation",
"."
] | def route(self, rule: str, **options: t.Any) -> t.Callable:
"""Decorate a view function to register it with the given URL
rule and options. Calls :meth:`add_url_rule`, which has more
details about the implementation.
.. code-block:: python
@app.route("/")
def in... | [
"def",
"route",
"(",
"self",
",",
"rule",
":",
"str",
",",
"*",
"*",
"options",
":",
"t",
".",
"Any",
")",
"->",
"t",
".",
"Callable",
":",
"def",
"decorator",
"(",
"f",
":",
"t",
".",
"Callable",
")",
"->",
"t",
".",
"Callable",
":",
"endpoint... | https://github.com/pallets/flask/blob/660994efc761efdfd49ca442b73f6712dc77b6cf/src/flask/scaffold.py#L413-L442 | |
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Lib/urllib.py | python | localhost | () | return _localhost | Return the IP address of the magic hostname 'localhost'. | Return the IP address of the magic hostname 'localhost'. | [
"Return",
"the",
"IP",
"address",
"of",
"the",
"magic",
"hostname",
"localhost",
"."
] | def localhost():
"""Return the IP address of the magic hostname 'localhost'."""
global _localhost
if _localhost is None:
_localhost = socket.gethostbyname('localhost')
return _localhost | [
"def",
"localhost",
"(",
")",
":",
"global",
"_localhost",
"if",
"_localhost",
"is",
"None",
":",
"_localhost",
"=",
"socket",
".",
"gethostbyname",
"(",
"'localhost'",
")",
"return",
"_localhost"
] | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/urllib.py#L808-L813 | |
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/numpy/ma/core.py | python | masked_inside | (x, v1, v2, copy=True) | return masked_where(condition, x, copy=copy) | Mask an array inside a given interval.
Shortcut to ``masked_where``, where `condition` is True for `x` inside
the interval [v1,v2] (v1 <= x <= v2). The boundaries `v1` and `v2`
can be given in either order.
See Also
--------
masked_where : Mask where a condition is met.
Notes
-----
... | Mask an array inside a given interval. | [
"Mask",
"an",
"array",
"inside",
"a",
"given",
"interval",
"."
] | def masked_inside(x, v1, v2, copy=True):
"""
Mask an array inside a given interval.
Shortcut to ``masked_where``, where `condition` is True for `x` inside
the interval [v1,v2] (v1 <= x <= v2). The boundaries `v1` and `v2`
can be given in either order.
See Also
--------
masked_where : ... | [
"def",
"masked_inside",
"(",
"x",
",",
"v1",
",",
"v2",
",",
"copy",
"=",
"True",
")",
":",
"if",
"v2",
"<",
"v1",
":",
"(",
"v1",
",",
"v2",
")",
"=",
"(",
"v2",
",",
"v1",
")",
"xf",
"=",
"filled",
"(",
"x",
")",
"condition",
"=",
"(",
... | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/numpy/ma/core.py#L2082-L2119 | |
wbond/oscrypto | d40c62577706682a0f6da5616ad09964f1c9137d | oscrypto/_win/symmetric.py | python | aes_cbc_no_padding_encrypt | (key, data, iv) | return (iv, _encrypt('aes', key, data, iv, False)) | Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and
no padding. This means the ciphertext must be an exact multiple of 16 bytes
long.
:param key:
The encryption key - a byte string either 16, 24 or 32 bytes long
:param data:
The plaintext - a byte string
:p... | Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and
no padding. This means the ciphertext must be an exact multiple of 16 bytes
long. | [
"Encrypts",
"plaintext",
"using",
"AES",
"in",
"CBC",
"mode",
"with",
"a",
"128",
"192",
"or",
"256",
"bit",
"key",
"and",
"no",
"padding",
".",
"This",
"means",
"the",
"ciphertext",
"must",
"be",
"an",
"exact",
"multiple",
"of",
"16",
"bytes",
"long",
... | def aes_cbc_no_padding_encrypt(key, data, iv):
"""
Encrypts plaintext using AES in CBC mode with a 128, 192 or 256 bit key and
no padding. This means the ciphertext must be an exact multiple of 16 bytes
long.
:param key:
The encryption key - a byte string either 16, 24 or 32 bytes long
... | [
"def",
"aes_cbc_no_padding_encrypt",
"(",
"key",
",",
"data",
",",
"iv",
")",
":",
"if",
"len",
"(",
"key",
")",
"not",
"in",
"[",
"16",
",",
"24",
",",
"32",
"]",
":",
"raise",
"ValueError",
"(",
"pretty_message",
"(",
"'''\n key must be either... | https://github.com/wbond/oscrypto/blob/d40c62577706682a0f6da5616ad09964f1c9137d/oscrypto/_win/symmetric.py#L45-L97 | |
alanhamlett/pip-update-requirements | ce875601ef278c8ce00ad586434a978731525561 | pur/packages/pip/_internal/vcs/__init__.py | python | VersionControl.obtain | (self, dest) | Install or update in editable mode the package represented by this
VersionControl object.
Args:
dest: the repository directory in which to install or update. | Install or update in editable mode the package represented by this
VersionControl object. | [
"Install",
"or",
"update",
"in",
"editable",
"mode",
"the",
"package",
"represented",
"by",
"this",
"VersionControl",
"object",
"."
] | def obtain(self, dest):
# type: (str) -> None
"""
Install or update in editable mode the package represented by this
VersionControl object.
Args:
dest: the repository directory in which to install or update.
"""
url, rev_options = self.get_url_rev_optio... | [
"def",
"obtain",
"(",
"self",
",",
"dest",
")",
":",
"# type: (str) -> None",
"url",
",",
"rev_options",
"=",
"self",
".",
"get_url_rev_options",
"(",
"self",
".",
"url",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dest",
")",
":",
"self"... | https://github.com/alanhamlett/pip-update-requirements/blob/ce875601ef278c8ce00ad586434a978731525561/pur/packages/pip/_internal/vcs/__init__.py#L345-L436 | ||
xybu/onedrived-dev | 7189214d311a1f863c68c7fa808ce41d96dae958 | onedrived/od_tasks/merge_dir.py | python | MergeDirectoryTask._handle_local_file | (self, item_name, item_record, item_stat, item_local_abspath) | :param str item_name:
:param onedrived.od_repo.ItemRecord | None item_record:
:param posix.stat_result | None item_stat:
:param str item_local_abspath: | :param str item_name:
:param onedrived.od_repo.ItemRecord | None item_record:
:param posix.stat_result | None item_stat:
:param str item_local_abspath: | [
":",
"param",
"str",
"item_name",
":",
":",
"param",
"onedrived",
".",
"od_repo",
".",
"ItemRecord",
"|",
"None",
"item_record",
":",
":",
"param",
"posix",
".",
"stat_result",
"|",
"None",
"item_stat",
":",
":",
"param",
"str",
"item_local_abspath",
":"
] | def _handle_local_file(self, item_name, item_record, item_stat, item_local_abspath):
"""
:param str item_name:
:param onedrived.od_repo.ItemRecord | None item_record:
:param posix.stat_result | None item_stat:
:param str item_local_abspath:
"""
if self.repo.path_f... | [
"def",
"_handle_local_file",
"(",
"self",
",",
"item_name",
",",
"item_record",
",",
"item_stat",
",",
"item_local_abspath",
")",
":",
"if",
"self",
".",
"repo",
".",
"path_filter",
".",
"should_ignore",
"(",
"self",
".",
"rel_path",
"+",
"'/'",
"+",
"item_n... | https://github.com/xybu/onedrived-dev/blob/7189214d311a1f863c68c7fa808ce41d96dae958/onedrived/od_tasks/merge_dir.py#L469-L521 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_oa_openshift/library/oc_secret.py | python | OpenShiftCLI._create | (self, fname) | return self.openshift_cmd(['create', '-f', fname]) | call oc create on a filename | call oc create on a filename | [
"call",
"oc",
"create",
"on",
"a",
"filename"
] | def _create(self, fname):
'''call oc create on a filename'''
return self.openshift_cmd(['create', '-f', fname]) | [
"def",
"_create",
"(",
"self",
",",
"fname",
")",
":",
"return",
"self",
".",
"openshift_cmd",
"(",
"[",
"'create'",
",",
"'-f'",
",",
"fname",
"]",
")"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_openshift/library/oc_secret.py#L1001-L1003 | |
nteract/papermill | 6a942a1b930ea051520e45abf6d55fe868a8614f | papermill/parameterize.py | python | add_builtin_parameters | (parameters) | return with_builtin_parameters | Add built-in parameters to a dictionary of parameters
Parameters
----------
parameters : dict
Dictionary of parameters provided by the user | Add built-in parameters to a dictionary of parameters | [
"Add",
"built",
"-",
"in",
"parameters",
"to",
"a",
"dictionary",
"of",
"parameters"
] | def add_builtin_parameters(parameters):
"""Add built-in parameters to a dictionary of parameters
Parameters
----------
parameters : dict
Dictionary of parameters provided by the user
"""
with_builtin_parameters = {
"pm": {
"run_uuid": str(uuid4()),
"curren... | [
"def",
"add_builtin_parameters",
"(",
"parameters",
")",
":",
"with_builtin_parameters",
"=",
"{",
"\"pm\"",
":",
"{",
"\"run_uuid\"",
":",
"str",
"(",
"uuid4",
"(",
")",
")",
",",
"\"current_datetime_local\"",
":",
"datetime",
".",
"now",
"(",
")",
",",
"\"... | https://github.com/nteract/papermill/blob/6a942a1b930ea051520e45abf6d55fe868a8614f/papermill/parameterize.py#L14-L33 | |
Mendeley/mrec | d299e3b9490703843b041e6585643b7e42e229f0 | mrec/sparse.py | python | loadz | (file) | return coo_matrix((y['data'],(y['row'],y['col'])),shape=y['shape']) | Load a sparse matrix saved to file with savez.
Parameters
----------
file : str
The open file or filepath to read from.
Returns
-------
mat : scipy.sparse.coo_matrix
The sparse matrix. | Load a sparse matrix saved to file with savez. | [
"Load",
"a",
"sparse",
"matrix",
"saved",
"to",
"file",
"with",
"savez",
"."
] | def loadz(file):
"""
Load a sparse matrix saved to file with savez.
Parameters
----------
file : str
The open file or filepath to read from.
Returns
-------
mat : scipy.sparse.coo_matrix
The sparse matrix.
"""
y = np.load(file)
return coo_matrix((y['data'],(... | [
"def",
"loadz",
"(",
"file",
")",
":",
"y",
"=",
"np",
".",
"load",
"(",
"file",
")",
"return",
"coo_matrix",
"(",
"(",
"y",
"[",
"'data'",
"]",
",",
"(",
"y",
"[",
"'row'",
"]",
",",
"y",
"[",
"'col'",
"]",
")",
")",
",",
"shape",
"=",
"y"... | https://github.com/Mendeley/mrec/blob/d299e3b9490703843b041e6585643b7e42e229f0/mrec/sparse.py#L63-L78 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/socketserver.py | python | BaseServer.verify_request | (self, request, client_address) | return True | Verify the request. May be overridden.
Return True if we should proceed with this request. | Verify the request. May be overridden. | [
"Verify",
"the",
"request",
".",
"May",
"be",
"overridden",
"."
] | def verify_request(self, request, client_address):
"""Verify the request. May be overridden.
Return True if we should proceed with this request.
"""
return True | [
"def",
"verify_request",
"(",
"self",
",",
"request",
",",
"client_address",
")",
":",
"return",
"True"
] | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/socketserver.py#L318-L324 | |
quantopian/qdb | c25018d2f0979589a38a07667478cb6022d57ed9 | qdb/comm.py | python | TerminalCommandManager.do_unwatch | (self, arg, tracer) | return self.next_command.tailcall(tracer) | unw(atch) EXPR
Removes an expression from the watchlist if it is already being
watched, otherwise does nothing. | unw(atch) EXPR
Removes an expression from the watchlist if it is already being
watched, otherwise does nothing. | [
"unw",
"(",
"atch",
")",
"EXPR",
"Removes",
"an",
"expression",
"from",
"the",
"watchlist",
"if",
"it",
"is",
"already",
"being",
"watched",
"otherwise",
"does",
"nothing",
"."
] | def do_unwatch(self, arg, tracer):
"""
unw(atch) EXPR
Removes an expression from the watchlist if it is already being
watched, otherwise does nothing.
"""
if not arg:
return self.missing_argument('unw(atch)')
tracer.watchlist.pop(arg, None)
ret... | [
"def",
"do_unwatch",
"(",
"self",
",",
"arg",
",",
"tracer",
")",
":",
"if",
"not",
"arg",
":",
"return",
"self",
".",
"missing_argument",
"(",
"'unw(atch)'",
")",
"tracer",
".",
"watchlist",
".",
"pop",
"(",
"arg",
",",
"None",
")",
"return",
"self",
... | https://github.com/quantopian/qdb/blob/c25018d2f0979589a38a07667478cb6022d57ed9/qdb/comm.py#L968-L977 | |
DXsmiley/mathbot | 9c0719f430470e522101603f64aeda0c69b5fffe | mathbot/calculator/interpereter.py | python | Interpereter.push | (self, item) | Push an item to the stop of the stack | Push an item to the stop of the stack | [
"Push",
"an",
"item",
"to",
"the",
"stop",
"of",
"the",
"stack"
] | def push(self, item):
'''Push an item to the stop of the stack'''
self.stack.append(item) | [
"def",
"push",
"(",
"self",
",",
"item",
")",
":",
"self",
".",
"stack",
".",
"append",
"(",
"item",
")"
] | https://github.com/DXsmiley/mathbot/blob/9c0719f430470e522101603f64aeda0c69b5fffe/mathbot/calculator/interpereter.py#L306-L308 | ||
UniShared/videonotes | 803cdd97b90823fb17f50dd55999aa7d1fec6c3a | lib/oauth2client/multistore_file.py | python | _MultiStore._write | (self) | Write the cached data back out.
The multistore must be locked. | Write the cached data back out. | [
"Write",
"the",
"cached",
"data",
"back",
"out",
"."
] | def _write(self):
"""Write the cached data back out.
The multistore must be locked.
"""
raw_data = {'file_version': 1}
raw_creds = []
raw_data['data'] = raw_creds
for (cred_key, cred) in self._data.items():
raw_key = dict(cred_key)
raw_cred = simplejson.loads(cred.to_json())
... | [
"def",
"_write",
"(",
"self",
")",
":",
"raw_data",
"=",
"{",
"'file_version'",
":",
"1",
"}",
"raw_creds",
"=",
"[",
"]",
"raw_data",
"[",
"'data'",
"]",
"=",
"raw_creds",
"for",
"(",
"cred_key",
",",
"cred",
")",
"in",
"self",
".",
"_data",
".",
... | https://github.com/UniShared/videonotes/blob/803cdd97b90823fb17f50dd55999aa7d1fec6c3a/lib/oauth2client/multistore_file.py#L345-L357 | ||
bububa/MongoHub | 7f761c424741d88bb234426b74b4092c40fb4987 | Resources/pymongo/cursor.py | python | Cursor.skip | (self, skip) | return self | Skips the first `skip` results of this cursor.
Raises TypeError if skip is not an instance of int. Raises
InvalidOperation if this cursor has already been used. The last `skip`
applied to this cursor takes precedence.
:Parameters:
- `skip`: the number of results to skip | Skips the first `skip` results of this cursor. | [
"Skips",
"the",
"first",
"skip",
"results",
"of",
"this",
"cursor",
"."
] | def skip(self, skip):
"""Skips the first `skip` results of this cursor.
Raises TypeError if skip is not an instance of int. Raises
InvalidOperation if this cursor has already been used. The last `skip`
applied to this cursor takes precedence.
:Parameters:
- `skip`: th... | [
"def",
"skip",
"(",
"self",
",",
"skip",
")",
":",
"if",
"not",
"isinstance",
"(",
"skip",
",",
"(",
"types",
".",
"IntType",
",",
"types",
".",
"LongType",
")",
")",
":",
"raise",
"TypeError",
"(",
"\"skip must be an int\"",
")",
"self",
".",
"__check... | https://github.com/bububa/MongoHub/blob/7f761c424741d88bb234426b74b4092c40fb4987/Resources/pymongo/cursor.py#L171-L186 | |
privacyidea/privacyidea | 9490c12ddbf77a34ac935b082d09eb583dfafa2c | privacyidea/lib/decorators.py | python | check_token_locked | (func) | return token_locked_wrapper | Decorator to check if a token is locked or not.
The decorator is to be used in token class methods.
It can be used to avoid performing an action on a locked token.
If the token is locked, a TokenAdminError is raised. | Decorator to check if a token is locked or not.
The decorator is to be used in token class methods.
It can be used to avoid performing an action on a locked token. | [
"Decorator",
"to",
"check",
"if",
"a",
"token",
"is",
"locked",
"or",
"not",
".",
"The",
"decorator",
"is",
"to",
"be",
"used",
"in",
"token",
"class",
"methods",
".",
"It",
"can",
"be",
"used",
"to",
"avoid",
"performing",
"an",
"action",
"on",
"a",
... | def check_token_locked(func):
"""
Decorator to check if a token is locked or not.
The decorator is to be used in token class methods.
It can be used to avoid performing an action on a locked token.
If the token is locked, a TokenAdminError is raised.
"""
@functools.wraps(func)
def token... | [
"def",
"check_token_locked",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"token_locked_wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"# The token object",
"token",
"=",
"args",
"[",
"0",
"]",
"if",
"to... | https://github.com/privacyidea/privacyidea/blob/9490c12ddbf77a34ac935b082d09eb583dfafa2c/privacyidea/lib/decorators.py#L30-L48 | |
man-group/mdf | 4b2c78084467791ad883c0b4c53832ad70fc96ef | mdf/regression/differs.py | python | DataFrameDiffer.__write_xls | (self, rhs_differ, different_nodes, lhs_data, rhs_data, filename, lhs_ctx, rhs_ctx) | write the diffs to a spreadsheet | write the diffs to a spreadsheet | [
"write",
"the",
"diffs",
"to",
"a",
"spreadsheet"
] | def __write_xls(self, rhs_differ, different_nodes, lhs_data, rhs_data, filename, lhs_ctx, rhs_ctx):
"""write the diffs to a spreadsheet"""
wb = xlwt.Workbook()
date_style = xlwt.easyxf(num_format_str='YYYY-MM-DD')
nsheets = 0
for node in different_nodes:
lhs_columns ... | [
"def",
"__write_xls",
"(",
"self",
",",
"rhs_differ",
",",
"different_nodes",
",",
"lhs_data",
",",
"rhs_data",
",",
"filename",
",",
"lhs_ctx",
",",
"rhs_ctx",
")",
":",
"wb",
"=",
"xlwt",
".",
"Workbook",
"(",
")",
"date_style",
"=",
"xlwt",
".",
"easy... | https://github.com/man-group/mdf/blob/4b2c78084467791ad883c0b4c53832ad70fc96ef/mdf/regression/differs.py#L364-L437 | ||
etetoolkit/ete | 2b207357dc2a40ccad7bfd8f54964472c72e4726 | ete3/phyloxml/_phyloxml.py | python | Taxonomy.export | (self, outfile, level, namespace_='phy:', name_='Taxonomy', namespacedef_='') | [] | def export(self, outfile, level, namespace_='phy:', name_='Taxonomy', namespacedef_=''):
showIndent(outfile, level)
outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', ))
already_processed = []
self.exportAttributes(outfile, level, already_processed... | [
"def",
"export",
"(",
"self",
",",
"outfile",
",",
"level",
",",
"namespace_",
"=",
"'phy:'",
",",
"name_",
"=",
"'Taxonomy'",
",",
"namespacedef_",
"=",
"''",
")",
":",
"showIndent",
"(",
"outfile",
",",
"level",
")",
"outfile",
".",
"write",
"(",
"'<... | https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/phyloxml/_phyloxml.py#L1256-L1267 | ||||
maurosoria/dirsearch | b83e68c8fdf360ab06be670d7b92b263262ee5b1 | thirdparty/pyparsing/diagram/__init__.py | python | ConverterState.extract_into_diagram | (self, el_id: int) | Used when we encounter the same token twice in the same tree. When this happens, we replace all instances of that
token with a terminal, and create a new subdiagram for the token | Used when we encounter the same token twice in the same tree. When this happens, we replace all instances of that
token with a terminal, and create a new subdiagram for the token | [
"Used",
"when",
"we",
"encounter",
"the",
"same",
"token",
"twice",
"in",
"the",
"same",
"tree",
".",
"When",
"this",
"happens",
"we",
"replace",
"all",
"instances",
"of",
"that",
"token",
"with",
"a",
"terminal",
"and",
"create",
"a",
"new",
"subdiagram",... | def extract_into_diagram(self, el_id: int):
"""
Used when we encounter the same token twice in the same tree. When this happens, we replace all instances of that
token with a terminal, and create a new subdiagram for the token
"""
position = self.first[el_id]
# Replace t... | [
"def",
"extract_into_diagram",
"(",
"self",
",",
"el_id",
":",
"int",
")",
":",
"position",
"=",
"self",
".",
"first",
"[",
"el_id",
"]",
"# Replace the original definition of this element with a regular block",
"if",
"position",
".",
"parent",
":",
"ret",
"=",
"E... | https://github.com/maurosoria/dirsearch/blob/b83e68c8fdf360ab06be670d7b92b263262ee5b1/thirdparty/pyparsing/diagram/__init__.py#L229-L258 | ||
readthedocs/sphinx-autoapi | 71c6ceebe0b02c34027fcd3d56c8641e9b94c7af | autoapi/mappers/go.py | python | GoMethod.__init__ | (self, obj, **kwargs) | [] | def __init__(self, obj, **kwargs):
super(GoMethod, self).__init__(obj, **kwargs)
self.receiver = obj.get("recv") | [
"def",
"__init__",
"(",
"self",
",",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"GoMethod",
",",
"self",
")",
".",
"__init__",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"receiver",
"=",
"obj",
".",
"get",
"(",
"\"recv\""... | https://github.com/readthedocs/sphinx-autoapi/blob/71c6ceebe0b02c34027fcd3d56c8641e9b94c7af/autoapi/mappers/go.py#L188-L190 | ||||
pytorch/botorch | f85fb8ff36d21e21bdb881d107982fb6d5d78704 | botorch/acquisition/multi_objective/monte_carlo.py | python | qNoisyExpectedHypervolumeImprovement._cache_root_decomposition | (
self,
posterior: GPyTorchPosterior,
) | r"""Cache the root decomposition of the covariance of `f(X_baseline)`.
Args:
posterior: The posterior over f(X_baseline). | r"""Cache the root decomposition of the covariance of `f(X_baseline)`. | [
"r",
"Cache",
"the",
"root",
"decomposition",
"of",
"the",
"covariance",
"of",
"f",
"(",
"X_baseline",
")",
"."
] | def _cache_root_decomposition(
self,
posterior: GPyTorchPosterior,
) -> None:
r"""Cache the root decomposition of the covariance of `f(X_baseline)`.
Args:
posterior: The posterior over f(X_baseline).
"""
lazy_covar = extract_batch_covar(posterior.mvn)
... | [
"def",
"_cache_root_decomposition",
"(",
"self",
",",
"posterior",
":",
"GPyTorchPosterior",
",",
")",
"->",
"None",
":",
"lazy_covar",
"=",
"extract_batch_covar",
"(",
"posterior",
".",
"mvn",
")",
"with",
"gpt_settings",
".",
"fast_computations",
".",
"covar_roo... | https://github.com/pytorch/botorch/blob/f85fb8ff36d21e21bdb881d107982fb6d5d78704/botorch/acquisition/multi_objective/monte_carlo.py#L509-L522 | ||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | py/_io/saferepr.py | python | saferepr | (obj, maxsize=240) | return srepr.repr(obj) | return a size-limited safe repr-string for the given object.
Failing __repr__ functions of user instances will be represented
with a short exception info and 'saferepr' generally takes
care to never raise exceptions itself. This function is a wrapper
around the Repr/reprlib functionality of the standar... | return a size-limited safe repr-string for the given object.
Failing __repr__ functions of user instances will be represented
with a short exception info and 'saferepr' generally takes
care to never raise exceptions itself. This function is a wrapper
around the Repr/reprlib functionality of the standar... | [
"return",
"a",
"size",
"-",
"limited",
"safe",
"repr",
"-",
"string",
"for",
"the",
"given",
"object",
".",
"Failing",
"__repr__",
"functions",
"of",
"user",
"instances",
"will",
"be",
"represented",
"with",
"a",
"short",
"exception",
"info",
"and",
"saferep... | def saferepr(obj, maxsize=240):
""" return a size-limited safe repr-string for the given object.
Failing __repr__ functions of user instances will be represented
with a short exception info and 'saferepr' generally takes
care to never raise exceptions itself. This function is a wrapper
around the R... | [
"def",
"saferepr",
"(",
"obj",
",",
"maxsize",
"=",
"240",
")",
":",
"# review exception handling",
"srepr",
"=",
"SafeRepr",
"(",
")",
"srepr",
".",
"maxstring",
"=",
"maxsize",
"srepr",
".",
"maxsize",
"=",
"maxsize",
"srepr",
".",
"maxother",
"=",
"160"... | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/py/_io/saferepr.py#L64-L76 | |
Arachnid/bloggart | ba2b60417102fe14a77b1bcd809b9b801d3a96e2 | lib/docutils/writers/latex2e/__init__.py | python | LaTeXTranslator.visit_term | (self, node) | definition list term | definition list term | [
"definition",
"list",
"term"
] | def visit_term(self, node):
"""definition list term"""
# Commands with optional args inside an optional arg must be put
# in a group, e.g. ``\item[{\hyperref[label]{text}}]``.
self.out.append('\\item[{') | [
"def",
"visit_term",
"(",
"self",
",",
"node",
")",
":",
"# Commands with optional args inside an optional arg must be put",
"# in a group, e.g. ``\\item[{\\hyperref[label]{text}}]``.",
"self",
".",
"out",
".",
"append",
"(",
"'\\\\item[{'",
")"
] | https://github.com/Arachnid/bloggart/blob/ba2b60417102fe14a77b1bcd809b9b801d3a96e2/lib/docutils/writers/latex2e/__init__.py#L2467-L2471 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/wagtail/wagtailsearch/backends/base.py | python | BaseSearchResults.results | (self) | return self._results_cache | [] | def results(self):
if self._results_cache is None:
self._results_cache = self._do_search()
return self._results_cache | [
"def",
"results",
"(",
"self",
")",
":",
"if",
"self",
".",
"_results_cache",
"is",
"None",
":",
"self",
".",
"_results_cache",
"=",
"self",
".",
"_do_search",
"(",
")",
"return",
"self",
".",
"_results_cache"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail/wagtailsearch/backends/base.py#L136-L139 | |||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/freebsdservice.py | python | get_disabled | (jail=None) | return sorted(set(all_) - set(en_)) | Return what services are available but not enabled to start at boot
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs
CLI Example:
.. code-block:: bash
salt '*' service.get_disabled | Return what services are available but not enabled to start at boot | [
"Return",
"what",
"services",
"are",
"available",
"but",
"not",
"enabled",
"to",
"start",
"at",
"boot"
] | def get_disabled(jail=None):
"""
Return what services are available but not enabled to start at boot
.. versionchanged:: 2016.3.4
Support for jail (representing jid or jail name) keyword argument in kwargs
CLI Example:
.. code-block:: bash
salt '*' service.get_disabled
"""
e... | [
"def",
"get_disabled",
"(",
"jail",
"=",
"None",
")",
":",
"en_",
"=",
"get_enabled",
"(",
"jail",
")",
"all_",
"=",
"get_all",
"(",
"jail",
")",
"return",
"sorted",
"(",
"set",
"(",
"all_",
")",
"-",
"set",
"(",
"en_",
")",
")"
] | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/freebsdservice.py#L155-L171 | |
PokemonGoF/PokemonGo-Bot-Desktop | 4bfa94f0183406c6a86f93645eff7abd3ad4ced8 | build/pywin/Lib/nntplib.py | python | NNTP.next | (self) | return self.statcmd('NEXT') | Process a NEXT command. No arguments. Return as for STAT. | Process a NEXT command. No arguments. Return as for STAT. | [
"Process",
"a",
"NEXT",
"command",
".",
"No",
"arguments",
".",
"Return",
"as",
"for",
"STAT",
"."
] | def next(self):
"""Process a NEXT command. No arguments. Return as for STAT."""
return self.statcmd('NEXT') | [
"def",
"next",
"(",
"self",
")",
":",
"return",
"self",
".",
"statcmd",
"(",
"'NEXT'",
")"
] | https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/nntplib.py#L406-L408 | |
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py | python | WrappedSocket.fileno | (self) | return self.socket.fileno() | [] | def fileno(self):
return self.socket.fileno() | [
"def",
"fileno",
"(",
"self",
")",
":",
"return",
"self",
".",
"socket",
".",
"fileno",
"(",
")"
] | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py#L182-L183 | |||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/algebras/lie_algebras/rank_two_heisenberg_virasoro.py | python | RankTwoHeisenbergVirasoro.t | (self, a, b) | return self.monomial( ('t', self._v(a,b)) ) | r"""
Return the basis element `t^{(a,b)}` of ``self``.
EXAMPLES::
sage: L = lie_algebras.RankTwoHeisenbergVirasoro(QQ)
sage: L.t(1,-2)
t(1, -2) | r"""
Return the basis element `t^{(a,b)}` of ``self``. | [
"r",
"Return",
"the",
"basis",
"element",
"t^",
"{",
"(",
"a",
"b",
")",
"}",
"of",
"self",
"."
] | def t(self, a, b):
r"""
Return the basis element `t^{(a,b)}` of ``self``.
EXAMPLES::
sage: L = lie_algebras.RankTwoHeisenbergVirasoro(QQ)
sage: L.t(1,-2)
t(1, -2)
"""
if a == b == 0:
raise ValueError("no t(0, 0) element")
... | [
"def",
"t",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"if",
"a",
"==",
"b",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"\"no t(0, 0) element\"",
")",
"return",
"self",
".",
"monomial",
"(",
"(",
"'t'",
",",
"self",
".",
"_v",
"(",
"a",
",",
"... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/algebras/lie_algebras/rank_two_heisenberg_virasoro.py#L216-L228 | |
mailgun/talon | a8c7e6a97281ba506f741f7d8a81f886ffdb44b2 | talon/signature/learning/helpers.py | python | flatten_list | (list_to_flatten) | return [e for sublist in list_to_flatten for e in sublist] | Simple list comprehension to flatten list.
>>> flatten_list([[1, 2], [3, 4, 5]])
[1, 2, 3, 4, 5]
>>> flatten_list([[1], [[2]]])
[1, [2]]
>>> flatten_list([1, [2]])
Traceback (most recent call last):
...
TypeError: 'int' object is not iterable | Simple list comprehension to flatten list. | [
"Simple",
"list",
"comprehension",
"to",
"flatten",
"list",
"."
] | def flatten_list(list_to_flatten):
"""Simple list comprehension to flatten list.
>>> flatten_list([[1, 2], [3, 4, 5]])
[1, 2, 3, 4, 5]
>>> flatten_list([[1], [[2]]])
[1, [2]]
>>> flatten_list([1, [2]])
Traceback (most recent call last):
...
TypeError: 'int' object is not iterable
... | [
"def",
"flatten_list",
"(",
"list_to_flatten",
")",
":",
"return",
"[",
"e",
"for",
"sublist",
"in",
"list_to_flatten",
"for",
"e",
"in",
"sublist",
"]"
] | https://github.com/mailgun/talon/blob/a8c7e6a97281ba506f741f7d8a81f886ffdb44b2/talon/signature/learning/helpers.py#L89-L101 | |
spack/spack | 675210bd8bd1c5d32ad1cc83d898fb43b569ed74 | lib/spack/spack/stage.py | python | ResourceStage._add_to_root_stage | (self) | Move the extracted resource to the root stage (according to placement). | Move the extracted resource to the root stage (according to placement). | [
"Move",
"the",
"extracted",
"resource",
"to",
"the",
"root",
"stage",
"(",
"according",
"to",
"placement",
")",
"."
] | def _add_to_root_stage(self):
"""
Move the extracted resource to the root stage (according to placement).
"""
root_stage = self.root_stage
resource = self.resource
if resource.placement:
placement = resource.placement
elif self.srcdir:
pla... | [
"def",
"_add_to_root_stage",
"(",
"self",
")",
":",
"root_stage",
"=",
"self",
".",
"root_stage",
"resource",
"=",
"self",
".",
"resource",
"if",
"resource",
".",
"placement",
":",
"placement",
"=",
"resource",
".",
"placement",
"elif",
"self",
".",
"srcdir"... | https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/lib/spack/spack/stage.py#L673-L717 | ||
owid/covid-19-data | 936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92 | scripts/src/cowidev/vax/incremental/singapore.py | python | Singapore._parse_text_national | (self, soup) | return national_doses, national_boosters, national_people_vaccinated | [] | def _parse_text_national(self, soup):
national_program = (
r"We have administered a total of ([\d,]+) doses of COVID-19 vaccines under the.*"
r"In total, ([\d,]+) individuals have received at least one dose of vaccine under the national vaccination"
r" programme,.* ([\d,]+) (... | [
"def",
"_parse_text_national",
"(",
"self",
",",
"soup",
")",
":",
"national_program",
"=",
"(",
"r\"We have administered a total of ([\\d,]+) doses of COVID-19 vaccines under the.*\"",
"r\"In total, ([\\d,]+) individuals have received at least one dose of vaccine under the national vaccinat... | https://github.com/owid/covid-19-data/blob/936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92/scripts/src/cowidev/vax/incremental/singapore.py#L62-L72 | |||
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | pypy/module/sys/initpath.py | python | find_stdlib | (state, executable) | Find and compute the stdlib path, starting from the directory where
``executable`` is and going one level up until we find it. Return a
tuple (path, prefix), where ``prefix`` is the root directory which
contains the stdlib. If it cannot be found, return (None, None). | Find and compute the stdlib path, starting from the directory where
``executable`` is and going one level up until we find it. Return a
tuple (path, prefix), where ``prefix`` is the root directory which
contains the stdlib. If it cannot be found, return (None, None). | [
"Find",
"and",
"compute",
"the",
"stdlib",
"path",
"starting",
"from",
"the",
"directory",
"where",
"executable",
"is",
"and",
"going",
"one",
"level",
"up",
"until",
"we",
"find",
"it",
".",
"Return",
"a",
"tuple",
"(",
"path",
"prefix",
")",
"where",
"... | def find_stdlib(state, executable):
"""
Find and compute the stdlib path, starting from the directory where
``executable`` is and going one level up until we find it. Return a
tuple (path, prefix), where ``prefix`` is the root directory which
contains the stdlib. If it cannot be found, return (Non... | [
"def",
"find_stdlib",
"(",
"state",
",",
"executable",
")",
":",
"search",
"=",
"'pypy-c'",
"if",
"executable",
"==",
"''",
"else",
"executable",
"while",
"True",
":",
"dirname",
"=",
"resolvedirof",
"(",
"search",
")",
"if",
"dirname",
"==",
"search",
":"... | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/pypy/module/sys/initpath.py#L75-L90 | ||
mpastell/Pweave | 45b56ec60c5badb4e40796178397a4eae5bdddcb | pweave/pweb.py | python | Pweb.run | (self, Processor = None) | Execute code in the document | Execute code in the document | [
"Execute",
"code",
"in",
"the",
"document"
] | def run(self, Processor = None):
"""Execute code in the document"""
if Processor is None:
Processor = PwebProcessors.getprocessor(self.kernel)
proc = Processor(copy.deepcopy(self.parsed),
self.kernel,
self.source,
... | [
"def",
"run",
"(",
"self",
",",
"Processor",
"=",
"None",
")",
":",
"if",
"Processor",
"is",
"None",
":",
"Processor",
"=",
"PwebProcessors",
".",
"getprocessor",
"(",
"self",
".",
"kernel",
")",
"proc",
"=",
"Processor",
"(",
"copy",
".",
"deepcopy",
... | https://github.com/mpastell/Pweave/blob/45b56ec60c5badb4e40796178397a4eae5bdddcb/pweave/pweb.py#L117-L130 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/spm/__init__.py | python | SPMClient._get_info | (self, formula_def) | return (
"Name: {name}\n"
"Version: {version}\n"
"Release: {release}\n"
"Install Date: {installed}\n"
"Supported OSes: {os}\n"
"Supported OS families: {os_family}\n"
"Dependencies: {dependencies}\n"
"OS Dependencies: {os_dep... | Get package info | Get package info | [
"Get",
"package",
"info"
] | def _get_info(self, formula_def):
"""
Get package info
"""
fields = (
"name",
"os",
"os_family",
"release",
"version",
"dependencies",
"os_dependencies",
"os_family_dependencies",
... | [
"def",
"_get_info",
"(",
"self",
",",
"formula_def",
")",
":",
"fields",
"=",
"(",
"\"name\"",
",",
"\"os\"",
",",
"\"os_family\"",
",",
"\"release\"",
",",
"\"version\"",
",",
"\"dependencies\"",
",",
"\"os_dependencies\"",
",",
"\"os_family_dependencies\"",
",",... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/spm/__init__.py#L963-L999 | |
renxingkai/BERT_Chinese_Classification | 8ed7b0ae09c81d0a40f76fdebc986bf3b6ebcded | run_squad.py | python | _improve_answer_span | (doc_tokens, input_start, input_end, tokenizer,
orig_answer_text) | return (input_start, input_end) | Returns tokenized answer spans that better match the annotated answer. | Returns tokenized answer spans that better match the annotated answer. | [
"Returns",
"tokenized",
"answer",
"spans",
"that",
"better",
"match",
"the",
"annotated",
"answer",
"."
] | def _improve_answer_span(doc_tokens, input_start, input_end, tokenizer,
orig_answer_text):
"""Returns tokenized answer spans that better match the annotated answer."""
# The SQuAD annotations are character based. We first project them to
# whitespace-tokenized words. But then after WordP... | [
"def",
"_improve_answer_span",
"(",
"doc_tokens",
",",
"input_start",
",",
"input_end",
",",
"tokenizer",
",",
"orig_answer_text",
")",
":",
"# The SQuAD annotations are character based. We first project them to",
"# whitespace-tokenized words. But then after WordPiece tokenization, we... | https://github.com/renxingkai/BERT_Chinese_Classification/blob/8ed7b0ae09c81d0a40f76fdebc986bf3b6ebcded/run_squad.py#L476-L510 | |
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/models/v1_git_repo_volume_source.py | python | V1GitRepoVolumeSource.repository | (self) | return self._repository | Gets the repository of this V1GitRepoVolumeSource.
Repository URL
:return: The repository of this V1GitRepoVolumeSource.
:rtype: str | Gets the repository of this V1GitRepoVolumeSource.
Repository URL | [
"Gets",
"the",
"repository",
"of",
"this",
"V1GitRepoVolumeSource",
".",
"Repository",
"URL"
] | def repository(self):
"""
Gets the repository of this V1GitRepoVolumeSource.
Repository URL
:return: The repository of this V1GitRepoVolumeSource.
:rtype: str
"""
return self._repository | [
"def",
"repository",
"(",
"self",
")",
":",
"return",
"self",
".",
"_repository"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_git_repo_volume_source.py#L73-L81 | |
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListMainWindow.ScrollList | (self, dx, dy) | return True | Scrolls the :class:`UltimateListCtrl`.
:param `dx`: if in icon, small icon or report view mode, specifies the number
of pixels to scroll. If in list view mode, `dx` specifies the number of
columns to scroll.
:param `dy`: always specifies the number of pixels to scroll vertically. | Scrolls the :class:`UltimateListCtrl`. | [
"Scrolls",
"the",
":",
"class",
":",
"UltimateListCtrl",
"."
] | def ScrollList(self, dx, dy):
"""
Scrolls the :class:`UltimateListCtrl`.
:param `dx`: if in icon, small icon or report view mode, specifies the number
of pixels to scroll. If in list view mode, `dx` specifies the number of
columns to scroll.
:param `dy`: always specifi... | [
"def",
"ScrollList",
"(",
"self",
",",
"dx",
",",
"dy",
")",
":",
"if",
"not",
"self",
".",
"InReportView",
"(",
")",
":",
"# TODO: this should work in all views but is not implemented now",
"return",
"False",
"top",
",",
"bottom",
"=",
"self",
".",
"GetVisibleL... | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/ultimatelistctrl.py#L10753-L10784 | |
seasonSH/WarpGAN | 794e24d9c3abce08c0e95f975ce5914ccaa2e1bb | align/mtcnntf/detect_face.py | python | Network.load | (self, data_path, session, ignore_missing=False) | Load network weights.
data_path: The path to the numpy-serialized network weights
session: The current TensorFlow session
ignore_missing: If true, serialized weights for missing layers are ignored. | Load network weights.
data_path: The path to the numpy-serialized network weights
session: The current TensorFlow session
ignore_missing: If true, serialized weights for missing layers are ignored. | [
"Load",
"network",
"weights",
".",
"data_path",
":",
"The",
"path",
"to",
"the",
"numpy",
"-",
"serialized",
"network",
"weights",
"session",
":",
"The",
"current",
"TensorFlow",
"session",
"ignore_missing",
":",
"If",
"true",
"serialized",
"weights",
"for",
"... | def load(self, data_path, session, ignore_missing=False):
"""Load network weights.
data_path: The path to the numpy-serialized network weights
session: The current TensorFlow session
ignore_missing: If true, serialized weights for missing layers are ignored.
"""
data_dict... | [
"def",
"load",
"(",
"self",
",",
"data_path",
",",
"session",
",",
"ignore_missing",
"=",
"False",
")",
":",
"data_dict",
"=",
"np",
".",
"load",
"(",
"data_path",
",",
"encoding",
"=",
"'latin1'",
")",
".",
"item",
"(",
")",
"#pylint: disable=no-member",
... | https://github.com/seasonSH/WarpGAN/blob/794e24d9c3abce08c0e95f975ce5914ccaa2e1bb/align/mtcnntf/detect_face.py#L79-L95 | ||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/numpy/lib/function_base.py | python | angle | (z, deg=False) | return a | Return the angle of the complex argument.
Parameters
----------
z : array_like
A complex number or sequence of complex numbers.
deg : bool, optional
Return angle in degrees if True, radians if False (default).
Returns
-------
angle : ndarray or scalar
The counterclo... | Return the angle of the complex argument. | [
"Return",
"the",
"angle",
"of",
"the",
"complex",
"argument",
"."
] | def angle(z, deg=False):
"""
Return the angle of the complex argument.
Parameters
----------
z : array_like
A complex number or sequence of complex numbers.
deg : bool, optional
Return angle in degrees if True, radians if False (default).
Returns
-------
angle : nda... | [
"def",
"angle",
"(",
"z",
",",
"deg",
"=",
"False",
")",
":",
"z",
"=",
"asanyarray",
"(",
"z",
")",
"if",
"issubclass",
"(",
"z",
".",
"dtype",
".",
"type",
",",
"_nx",
".",
"complexfloating",
")",
":",
"zimag",
"=",
"z",
".",
"imag",
"zreal",
... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/numpy/lib/function_base.py#L1420-L1464 | |
jeetsukumaran/DendroPy | 29fd294bf05d890ebf6a8d576c501e471db27ca1 | src/dendropy/datamodel/treemodel.py | python | Bipartition.compile_bipartition | (self, is_mutable=None) | Updates the values of the various masks specified and calculates the
normalized bipartition bitmask.
If a rooted bipartition, then this is set to the value of the leafset
bitmask.
If an unrooted bipartition, then the leafset bitmask is normalized such that
the lowest-significant... | Updates the values of the various masks specified and calculates the
normalized bipartition bitmask. | [
"Updates",
"the",
"values",
"of",
"the",
"various",
"masks",
"specified",
"and",
"calculates",
"the",
"normalized",
"bipartition",
"bitmask",
"."
] | def compile_bipartition(self, is_mutable=None):
"""
Updates the values of the various masks specified and calculates the
normalized bipartition bitmask.
If a rooted bipartition, then this is set to the value of the leafset
bitmask.
If an unrooted bipartition, then the le... | [
"def",
"compile_bipartition",
"(",
"self",
",",
"is_mutable",
"=",
"None",
")",
":",
"self",
".",
"compile_split_bitmask",
"(",
"self",
",",
"leafset_bitmask",
"=",
"self",
".",
"_leafset_bitmask",
",",
"tree_leafset_bitmask",
"=",
"self",
".",
"_tree_leafset_bitm... | https://github.com/jeetsukumaran/DendroPy/blob/29fd294bf05d890ebf6a8d576c501e471db27ca1/src/dendropy/datamodel/treemodel.py#L489-L511 | ||
mozman/ezdxf | 59d0fc2ea63f5cf82293428f5931da7e9f9718e9 | src/ezdxf/sections/header.py | python | HeaderSection.__setitem__ | (self, key: str, value: Any) | Set header variable `key` to `value` by index operator like:
:code:`drawing.header['$ANGDIR'] = 1` | Set header variable `key` to `value` by index operator like:
:code:`drawing.header['$ANGDIR'] = 1` | [
"Set",
"header",
"variable",
"key",
"to",
"value",
"by",
"index",
"operator",
"like",
":",
":",
"code",
":",
"drawing",
".",
"header",
"[",
"$ANGDIR",
"]",
"=",
"1"
] | def __setitem__(self, key: str, value: Any) -> None:
"""Set header variable `key` to `value` by index operator like:
:code:`drawing.header['$ANGDIR'] = 1`
"""
try:
tags = self._headervar_factory(key, value)
except (IndexError, ValueError):
raise const.DXF... | [
"def",
"__setitem__",
"(",
"self",
",",
"key",
":",
"str",
",",
"value",
":",
"Any",
")",
"->",
"None",
":",
"try",
":",
"tags",
"=",
"self",
".",
"_headervar_factory",
"(",
"key",
",",
"value",
")",
"except",
"(",
"IndexError",
",",
"ValueError",
")... | https://github.com/mozman/ezdxf/blob/59d0fc2ea63f5cf82293428f5931da7e9f9718e9/src/ezdxf/sections/header.py#L295-L304 | ||
Huangying-Zhan/DF-VO | 6a2ec43fc6209d9058ae1709d779c5ada68a31f3 | libs/flowlib/png.py | python | write_chunks | (out, chunks) | Create a PNG file by writing out the chunks. | Create a PNG file by writing out the chunks. | [
"Create",
"a",
"PNG",
"file",
"by",
"writing",
"out",
"the",
"chunks",
"."
] | def write_chunks(out, chunks):
"""Create a PNG file by writing out the chunks."""
out.write(_signature)
for chunk in chunks:
write_chunk(out, *chunk) | [
"def",
"write_chunks",
"(",
"out",
",",
"chunks",
")",
":",
"out",
".",
"write",
"(",
"_signature",
")",
"for",
"chunk",
"in",
"chunks",
":",
"write_chunk",
"(",
"out",
",",
"*",
"chunk",
")"
] | https://github.com/Huangying-Zhan/DF-VO/blob/6a2ec43fc6209d9058ae1709d779c5ada68a31f3/libs/flowlib/png.py#L969-L974 | ||
snarfed/granary | ab085de2aef0cff8ac31a99b5e21443a249e8419 | granary/facebook.py | python | Facebook.parse_id | (id, is_comment=False) | return fbid | Parses a Facebook post or comment id.
Facebook ids come in different formats:
* Simple number, usually a user or post: 12
* Two numbers with underscore, usually POST_COMMENT or USER_POST: 12_34
* Three numbers with underscores, USER_POST_COMMENT: 12_34_56
* Three numbers with colons, USER:POST:SHA... | Parses a Facebook post or comment id. | [
"Parses",
"a",
"Facebook",
"post",
"or",
"comment",
"id",
"."
] | def parse_id(id, is_comment=False):
"""Parses a Facebook post or comment id.
Facebook ids come in different formats:
* Simple number, usually a user or post: 12
* Two numbers with underscore, usually POST_COMMENT or USER_POST: 12_34
* Three numbers with underscores, USER_POST_COMMENT: 12_34_56
... | [
"def",
"parse_id",
"(",
"id",
",",
"is_comment",
"=",
"False",
")",
":",
"assert",
"is_comment",
"in",
"(",
"True",
",",
"False",
")",
",",
"is_comment",
"blank",
"=",
"FacebookId",
"(",
"None",
",",
"None",
",",
"None",
")",
"if",
"id",
"in",
"(",
... | https://github.com/snarfed/granary/blob/ab085de2aef0cff8ac31a99b5e21443a249e8419/granary/facebook.py#L2367-L2448 | |
respeaker/get_started_with_respeaker | ec859759fcec7e683a5e09328a8ea307046f353d | files/usr/lib/python2.7/site-packages/tornado/httpserver.py | python | HTTPRequest.cookies | (self) | return self._cookies | A dictionary of Cookie.Morsel objects. | A dictionary of Cookie.Morsel objects. | [
"A",
"dictionary",
"of",
"Cookie",
".",
"Morsel",
"objects",
"."
] | def cookies(self):
"""A dictionary of Cookie.Morsel objects."""
if not hasattr(self, "_cookies"):
self._cookies = Cookie.SimpleCookie()
if "Cookie" in self.headers:
try:
self._cookies.load(
native_str(self.headers["Cooki... | [
"def",
"cookies",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"_cookies\"",
")",
":",
"self",
".",
"_cookies",
"=",
"Cookie",
".",
"SimpleCookie",
"(",
")",
"if",
"\"Cookie\"",
"in",
"self",
".",
"headers",
":",
"try",
":",
"se... | https://github.com/respeaker/get_started_with_respeaker/blob/ec859759fcec7e683a5e09328a8ea307046f353d/files/usr/lib/python2.7/site-packages/tornado/httpserver.py#L455-L465 | |
py2neo-org/py2neo | 2e46bbf4d622f53282e796ffc521fc4bc6d0b60d | py2neo/vendor/bottle.py | python | _re_flatten | (p) | return re.sub(r'(\\*)(\(\?P<[^>]+>|\((?!\?))',
lambda m: m.group(0) if len(m.group(1)) % 2 else m.group(1) + '(?:', p) | Turn all capturing groups in a regular expression pattern into
non-capturing groups. | Turn all capturing groups in a regular expression pattern into
non-capturing groups. | [
"Turn",
"all",
"capturing",
"groups",
"in",
"a",
"regular",
"expression",
"pattern",
"into",
"non",
"-",
"capturing",
"groups",
"."
] | def _re_flatten(p):
''' Turn all capturing groups in a regular expression pattern into
non-capturing groups. '''
if '(' not in p: return p
return re.sub(r'(\\*)(\(\?P<[^>]+>|\((?!\?))',
lambda m: m.group(0) if len(m.group(1)) % 2 else m.group(1) + '(?:', p) | [
"def",
"_re_flatten",
"(",
"p",
")",
":",
"if",
"'('",
"not",
"in",
"p",
":",
"return",
"p",
"return",
"re",
".",
"sub",
"(",
"r'(\\\\*)(\\(\\?P<[^>]+>|\\((?!\\?))'",
",",
"lambda",
"m",
":",
"m",
".",
"group",
"(",
"0",
")",
"if",
"len",
"(",
"m",
... | https://github.com/py2neo-org/py2neo/blob/2e46bbf4d622f53282e796ffc521fc4bc6d0b60d/py2neo/vendor/bottle.py#L253-L258 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/twisted/twisted/mail/imap4.py | python | MessageSet.clean | (self) | Clean ranges list, combining adjacent ranges | Clean ranges list, combining adjacent ranges | [
"Clean",
"ranges",
"list",
"combining",
"adjacent",
"ranges"
] | def clean(self):
"""
Clean ranges list, combining adjacent ranges
"""
self.ranges.sort()
oldl, oldh = None, None
for i,(l, h) in enumerate(self.ranges):
if l is None:
continue
# l is >= oldl and h is >= oldh due to sort()
... | [
"def",
"clean",
"(",
"self",
")",
":",
"self",
".",
"ranges",
".",
"sort",
"(",
")",
"oldl",
",",
"oldh",
"=",
"None",
",",
"None",
"for",
"i",
",",
"(",
"l",
",",
"h",
")",
"in",
"enumerate",
"(",
"self",
".",
"ranges",
")",
":",
"if",
"l",
... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/mail/imap4.py#L181-L201 | ||
terrencepreilly/darglint | abc26b768cd7135d848223ba53f68323593c33d5 | darglint/parse/identifiers.py | python | Continuation.of | (self, path) | return self | [] | def of(self, path):
# type: (str) -> Continuation
Assert(
not self._sealed,
'Sealed continuations shouldn\'t be extended!',
)
if isinstance(self.child, Continuation):
self.child.of(path)
elif self.child is None:
self.child = Continu... | [
"def",
"of",
"(",
"self",
",",
"path",
")",
":",
"# type: (str) -> Continuation",
"Assert",
"(",
"not",
"self",
".",
"_sealed",
",",
"'Sealed continuations shouldn\\'t be extended!'",
",",
")",
"if",
"isinstance",
"(",
"self",
".",
"child",
",",
"Continuation",
... | https://github.com/terrencepreilly/darglint/blob/abc26b768cd7135d848223ba53f68323593c33d5/darglint/parse/identifiers.py#L33-L43 | |||
prody/ProDy | b24bbf58aa8fffe463c8548ae50e3955910e5b7f | prody/atomic/atomgroup.py | python | AtomGroup.setImpropers | (self, impropers) | Set covalent impropers between atoms. *impropers* must be a list or an
array of triplets of indices. All impropers must be set at once. Improper
information can be used to make atom selections, e.g. ``"improper to
index 1"``. See :mod:`.select` module documentation for details.
Also,... | Set covalent impropers between atoms. *impropers* must be a list or an
array of triplets of indices. All impropers must be set at once. Improper
information can be used to make atom selections, e.g. ``"improper to
index 1"``. See :mod:`.select` module documentation for details.
Also,... | [
"Set",
"covalent",
"impropers",
"between",
"atoms",
".",
"*",
"impropers",
"*",
"must",
"be",
"a",
"list",
"or",
"an",
"array",
"of",
"triplets",
"of",
"indices",
".",
"All",
"impropers",
"must",
"be",
"set",
"at",
"once",
".",
"Improper",
"information",
... | def setImpropers(self, impropers):
"""Set covalent impropers between atoms. *impropers* must be a list or an
array of triplets of indices. All impropers must be set at once. Improper
information can be used to make atom selections, e.g. ``"improper to
index 1"``. See :mod:`.select` m... | [
"def",
"setImpropers",
"(",
"self",
",",
"impropers",
")",
":",
"if",
"isinstance",
"(",
"impropers",
",",
"list",
")",
":",
"impropers",
"=",
"np",
".",
"array",
"(",
"impropers",
",",
"int",
")",
"if",
"impropers",
".",
"ndim",
"!=",
"2",
":",
"rai... | https://github.com/prody/ProDy/blob/b24bbf58aa8fffe463c8548ae50e3955910e5b7f/prody/atomic/atomgroup.py#L1301-L1329 | ||
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/registry/rest.py | python | RESTResponse.getheader | (self, name, default=None) | return self.urllib3_response.getheader(name, default) | Returns a given response header. | Returns a given response header. | [
"Returns",
"a",
"given",
"response",
"header",
"."
] | def getheader(self, name, default=None):
"""
Returns a given response header.
"""
return self.urllib3_response.getheader(name, default) | [
"def",
"getheader",
"(",
"self",
",",
"name",
",",
"default",
"=",
"None",
")",
":",
"return",
"self",
".",
"urllib3_response",
".",
"getheader",
"(",
"name",
",",
"default",
")"
] | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/registry/rest.py#L52-L56 | |
GoogleCloudPlatform/gsutil | 5be882803e76608e2fd29cf8c504ccd1fe0a7746 | gslib/commands/perfdiag.py | python | PerfDiagCommand.PerformSlicedUpload | (self,
file_name,
object_name,
use_file,
gsutil_api,
gzip_encoded=False) | Performs a parallel upload of a file using the slice strategy.
The metadata for file_name should be present in temp_file_dict prior
to calling. Also, the data from for file_name should be present in
temp_file_dict if use_file is specified as False.
Args:
file_name: The name of the file to upload... | Performs a parallel upload of a file using the slice strategy. | [
"Performs",
"a",
"parallel",
"upload",
"of",
"a",
"file",
"using",
"the",
"slice",
"strategy",
"."
] | def PerformSlicedUpload(self,
file_name,
object_name,
use_file,
gsutil_api,
gzip_encoded=False):
"""Performs a parallel upload of a file using the slice strategy.
The metadata for f... | [
"def",
"PerformSlicedUpload",
"(",
"self",
",",
"file_name",
",",
"object_name",
",",
"use_file",
",",
"gsutil_api",
",",
"gzip_encoded",
"=",
"False",
")",
":",
"# Divide the file into components.",
"component_size",
"=",
"DivideAndCeil",
"(",
"self",
".",
"thru_fi... | https://github.com/GoogleCloudPlatform/gsutil/blob/5be882803e76608e2fd29cf8c504ccd1fe0a7746/gslib/commands/perfdiag.py#L970-L1043 | ||
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/maasserver/views/rpc.py | python | info | (request) | return HttpResponse(json.dumps(info), content_type="application/json") | View returning a JSON document with information about RPC endpoints.
Currently the only information returned is a list of `(host, port)` tuples
on which the region has listening RPC endpoints.
When the `rpc-advertise` service is not running this returns `None`
instead of the list of event-loop endpoin... | View returning a JSON document with information about RPC endpoints. | [
"View",
"returning",
"a",
"JSON",
"document",
"with",
"information",
"about",
"RPC",
"endpoints",
"."
] | def info(request):
"""View returning a JSON document with information about RPC endpoints.
Currently the only information returned is a list of `(host, port)` tuples
on which the region has listening RPC endpoints.
When the `rpc-advertise` service is not running this returns `None`
instead of the ... | [
"def",
"info",
"(",
"request",
")",
":",
"endpoints",
"=",
"{",
"}",
"for",
"name",
",",
"addr",
",",
"port",
"in",
"get_endpoints",
"(",
")",
":",
"if",
"name",
"in",
"endpoints",
":",
"endpoints",
"[",
"name",
"]",
".",
"append",
"(",
"(",
"addr"... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/views/rpc.py#L55-L77 | |
reddit-archive/reddit | 753b17407e9a9dca09558526805922de24133d53 | r2/r2/models/traffic.py | python | decrement_month | (date) | return date.replace(day=1) | Given a truncated datetime, return a new one one month in the past. | Given a truncated datetime, return a new one one month in the past. | [
"Given",
"a",
"truncated",
"datetime",
"return",
"a",
"new",
"one",
"one",
"month",
"in",
"the",
"past",
"."
] | def decrement_month(date):
"""Given a truncated datetime, return a new one one month in the past."""
if date.day != 1:
raise ValueError("Input must be truncated to the 1st of the month.")
date -= datetime.timedelta(days=1)
return date.replace(day=1) | [
"def",
"decrement_month",
"(",
"date",
")",
":",
"if",
"date",
".",
"day",
"!=",
"1",
":",
"raise",
"ValueError",
"(",
"\"Input must be truncated to the 1st of the month.\"",
")",
"date",
"-=",
"datetime",
".",
"timedelta",
"(",
"days",
"=",
"1",
")",
"return"... | https://github.com/reddit-archive/reddit/blob/753b17407e9a9dca09558526805922de24133d53/r2/r2/models/traffic.py#L146-L153 | |
jaseg/python-mpv | 1f59cfa07246c993737b25857fd01421b2da8bbd | mpv.py | python | MPV.mouse | (x, y, button=None, mode='single') | Mapped mpv mouse command, see man mpv(1). | Mapped mpv mouse command, see man mpv(1). | [
"Mapped",
"mpv",
"mouse",
"command",
"see",
"man",
"mpv",
"(",
"1",
")",
"."
] | def mouse(x, y, button=None, mode='single'):
"""Mapped mpv mouse command, see man mpv(1)."""
if button is None:
self.command('mouse', x, y, mode)
else:
self.command('mouse', x, y, button, mode) | [
"def",
"mouse",
"(",
"x",
",",
"y",
",",
"button",
"=",
"None",
",",
"mode",
"=",
"'single'",
")",
":",
"if",
"button",
"is",
"None",
":",
"self",
".",
"command",
"(",
"'mouse'",
",",
"x",
",",
"y",
",",
"mode",
")",
"else",
":",
"self",
".",
... | https://github.com/jaseg/python-mpv/blob/1f59cfa07246c993737b25857fd01421b2da8bbd/mpv.py#L1273-L1278 | ||
liu-nlper/SLTK | b3edc58ef1d317eefc21e65d306932dedc6a8525 | sltk/nn/modules/crf.py | python | CRF._score_sentence | (self, scores, mask, tags) | return gold_score | Args:
scores: size=(seq_len, batch_size, tag_size, tag_size)
mask: size=(batch_size, seq_len)
tags: size=(batch_size, seq_len)
Returns:
score: | Args:
scores: size=(seq_len, batch_size, tag_size, tag_size)
mask: size=(batch_size, seq_len)
tags: size=(batch_size, seq_len) | [
"Args",
":",
"scores",
":",
"size",
"=",
"(",
"seq_len",
"batch_size",
"tag_size",
"tag_size",
")",
"mask",
":",
"size",
"=",
"(",
"batch_size",
"seq_len",
")",
"tags",
":",
"size",
"=",
"(",
"batch_size",
"seq_len",
")"
] | def _score_sentence(self, scores, mask, tags):
"""
Args:
scores: size=(seq_len, batch_size, tag_size, tag_size)
mask: size=(batch_size, seq_len)
tags: size=(batch_size, seq_len)
Returns:
score:
"""
batch_size = scores.size(1)
... | [
"def",
"_score_sentence",
"(",
"self",
",",
"scores",
",",
"mask",
",",
"tags",
")",
":",
"batch_size",
"=",
"scores",
".",
"size",
"(",
"1",
")",
"seq_len",
"=",
"scores",
".",
"size",
"(",
"0",
")",
"tag_size",
"=",
"scores",
".",
"size",
"(",
"-... | https://github.com/liu-nlper/SLTK/blob/b3edc58ef1d317eefc21e65d306932dedc6a8525/sltk/nn/modules/crf.py#L191-L228 | |
Robot-Will/Stino | a94831cd1bf40a59587a7b6cc2e9b5c4306b1bf2 | libs/base_utils/file.py | python | File.write | (self, text, append=False) | Method Docs. | Method Docs. | [
"Method",
"Docs",
"."
] | def write(self, text, append=False):
"""Method Docs."""
if self._is_readonly:
return
mode = 'w'
if append:
mode = 'a'
if not os.path.isdir(self._dir):
os.makedirs(self._dir)
try:
with codecs.open(self._path, mode, self._en... | [
"def",
"write",
"(",
"self",
",",
"text",
",",
"append",
"=",
"False",
")",
":",
"if",
"self",
".",
"_is_readonly",
":",
"return",
"mode",
"=",
"'w'",
"if",
"append",
":",
"mode",
"=",
"'a'",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"se... | https://github.com/Robot-Will/Stino/blob/a94831cd1bf40a59587a7b6cc2e9b5c4306b1bf2/libs/base_utils/file.py#L139-L154 | ||
trezor/trezor-core | 18c3a6a5bd45923380312b064be96155f5a7377d | mocks/generated/trezorcrypto/ed25519.py | python | generate_secret | () | Generate secret key. | Generate secret key. | [
"Generate",
"secret",
"key",
"."
] | def generate_secret() -> bytes:
'''
Generate secret key.
''' | [
"def",
"generate_secret",
"(",
")",
"->",
"bytes",
":"
] | https://github.com/trezor/trezor-core/blob/18c3a6a5bd45923380312b064be96155f5a7377d/mocks/generated/trezorcrypto/ed25519.py#L4-L7 | ||
hardbyte/python-can | e7a2b040ee1f0cdd7fd77fbfef0454353166b333 | can/interfaces/systec/ucanbus.py | python | UcanBus.state | (self, new_state) | [] | def state(self, new_state):
if self._state is not BusState.ERROR and (
new_state is BusState.ACTIVE or new_state is BusState.PASSIVE
):
try:
# close the CAN channel
self._ucan.shutdown(self.channel, False)
# set mode
... | [
"def",
"state",
"(",
"self",
",",
"new_state",
")",
":",
"if",
"self",
".",
"_state",
"is",
"not",
"BusState",
".",
"ERROR",
"and",
"(",
"new_state",
"is",
"BusState",
".",
"ACTIVE",
"or",
"new_state",
"is",
"BusState",
".",
"PASSIVE",
")",
":",
"try",... | https://github.com/hardbyte/python-can/blob/e7a2b040ee1f0cdd7fd77fbfef0454353166b333/can/interfaces/systec/ucanbus.py#L294-L309 | ||||
pypa/pip | 7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4 | src/pip/_internal/req/req_install.py | python | InstallRequirement.has_hash_options | (self) | return bool(self.hash_options) | Return whether any known-good hashes are specified as options.
These activate --require-hashes mode; hashes specified as part of a
URL do not. | Return whether any known-good hashes are specified as options. | [
"Return",
"whether",
"any",
"known",
"-",
"good",
"hashes",
"are",
"specified",
"as",
"options",
"."
] | def has_hash_options(self) -> bool:
"""Return whether any known-good hashes are specified as options.
These activate --require-hashes mode; hashes specified as part of a
URL do not.
"""
return bool(self.hash_options) | [
"def",
"has_hash_options",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"self",
".",
"hash_options",
")"
] | https://github.com/pypa/pip/blob/7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4/src/pip/_internal/req/req_install.py#L258-L265 | |
numenta/nupic | b9ebedaf54f49a33de22d8d44dff7c765cdb5548 | src/nupic/algorithms/backtracking_tm_shim.py | python | MonitoredTMShim.topDownCompute | (self, topDownIn=None) | return output | (From `backtracking_tm.py`)
Top-down compute - generate expected input given output of the TM
@param topDownIn top down input from the level above us
@returns best estimate of the TM input that would have generated bottomUpOut. | (From `backtracking_tm.py`)
Top-down compute - generate expected input given output of the TM | [
"(",
"From",
"backtracking_tm",
".",
"py",
")",
"Top",
"-",
"down",
"compute",
"-",
"generate",
"expected",
"input",
"given",
"output",
"of",
"the",
"TM"
] | def topDownCompute(self, topDownIn=None):
"""
(From `backtracking_tm.py`)
Top-down compute - generate expected input given output of the TM
@param topDownIn top down input from the level above us
@returns best estimate of the TM input that would have generated bottomUpOut.
"""
output = num... | [
"def",
"topDownCompute",
"(",
"self",
",",
"topDownIn",
"=",
"None",
")",
":",
"output",
"=",
"numpy",
".",
"zeros",
"(",
"self",
".",
"numberOfColumns",
"(",
")",
")",
"columns",
"=",
"[",
"self",
".",
"columnForCell",
"(",
"idx",
")",
"for",
"idx",
... | https://github.com/numenta/nupic/blob/b9ebedaf54f49a33de22d8d44dff7c765cdb5548/src/nupic/algorithms/backtracking_tm_shim.py#L281-L293 | |
fedora-infra/bodhi | 2b1df12d85eb2e575d8e481a3936c4f92d1fe29a | bodhi/client/__init__.py | python | releases | () | Interact with releases. | Interact with releases. | [
"Interact",
"with",
"releases",
"."
] | def releases():
# Docs that show in the --help
"""Interact with releases."""
# Developer Docs
"""Manage the releases."""
pass | [
"def",
"releases",
"(",
")",
":",
"# Docs that show in the --help",
"# Developer Docs",
"\"\"\"Manage the releases.\"\"\"",
"pass"
] | https://github.com/fedora-infra/bodhi/blob/2b1df12d85eb2e575d8e481a3936c4f92d1fe29a/bodhi/client/__init__.py#L1176-L1181 | ||
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/django/contrib/gis/forms/fields.py | python | GeometryField.to_python | (self, value) | return value | Transforms the value to a Geometry object. | Transforms the value to a Geometry object. | [
"Transforms",
"the",
"value",
"to",
"a",
"Geometry",
"object",
"."
] | def to_python(self, value):
"""
Transforms the value to a Geometry object.
"""
if value in self.empty_values:
return None
if not isinstance(value, GEOSGeometry):
try:
value = GEOSGeometry(value)
except (GEOSException, ValueErro... | [
"def",
"to_python",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"in",
"self",
".",
"empty_values",
":",
"return",
"None",
"if",
"not",
"isinstance",
"(",
"value",
",",
"GEOSGeometry",
")",
":",
"try",
":",
"value",
"=",
"GEOSGeometry",
"(",
"va... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/contrib/gis/forms/fields.py#L35-L55 | |
Teichlab/cellphonedb | dca1c26555b012df30af0f2521cd4df317cf4600 | cellphonedb/src/core/methods/cpdb_analysis_method.py | python | call | (meta: pd.DataFrame,
counts: pd.DataFrame,
counts_data: str,
interactions: pd.DataFrame,
genes: pd.DataFrame,
complexes: pd.DataFrame,
complex_compositions: pd.DataFrame,
separator: str,
threshold: float = 0.1,
result_precision: int = 3) | return means, significant_means, deconvoluted | [] | def call(meta: pd.DataFrame,
counts: pd.DataFrame,
counts_data: str,
interactions: pd.DataFrame,
genes: pd.DataFrame,
complexes: pd.DataFrame,
complex_compositions: pd.DataFrame,
separator: str,
threshold: float = 0.1,
result_precision: in... | [
"def",
"call",
"(",
"meta",
":",
"pd",
".",
"DataFrame",
",",
"counts",
":",
"pd",
".",
"DataFrame",
",",
"counts_data",
":",
"str",
",",
"interactions",
":",
"pd",
".",
"DataFrame",
",",
"genes",
":",
"pd",
".",
"DataFrame",
",",
"complexes",
":",
"... | https://github.com/Teichlab/cellphonedb/blob/dca1c26555b012df30af0f2521cd4df317cf4600/cellphonedb/src/core/methods/cpdb_analysis_method.py#L6-L31 | |||
biolab/orange2 | db40a9449cb45b507d63dcd5739b223f9cffb8e6 | Orange/OrangeCanvas/preview/previewdialog.py | python | PreviewDialog.setHeading | (self, heading) | Set `heading` as the heading string ('<h3>Preview</h3>'
by default). | Set `heading` as the heading string ('<h3>Preview</h3>'
by default). | [
"Set",
"heading",
"as",
"the",
"heading",
"string",
"(",
"<h3",
">",
"Preview<",
"/",
"h3",
">",
"by",
"default",
")",
"."
] | def setHeading(self, heading):
"""Set `heading` as the heading string ('<h3>Preview</h3>'
by default).
"""
self.__heading.setText(heading) | [
"def",
"setHeading",
"(",
"self",
",",
"heading",
")",
":",
"self",
".",
"__heading",
".",
"setText",
"(",
"heading",
")"
] | https://github.com/biolab/orange2/blob/db40a9449cb45b507d63dcd5739b223f9cffb8e6/Orange/OrangeCanvas/preview/previewdialog.py#L99-L104 | ||
galaxyproject/galaxy | 4c03520f05062e0f4a1b3655dc0b7452fda69943 | lib/galaxy/webapps/galaxy/api/jobs.py | python | JobController.inputs | (self, trans: ProvidesUserContext, id, **kwd) | return self.__dictify_associations(trans, job.input_datasets, job.input_library_datasets) | GET /api/jobs/{id}/inputs
returns input datasets created by job
:type id: string
:param id: Encoded job id
:rtype: dictionary
:returns: dictionary containing input dataset associations | GET /api/jobs/{id}/inputs | [
"GET",
"/",
"api",
"/",
"jobs",
"/",
"{",
"id",
"}",
"/",
"inputs"
] | def inputs(self, trans: ProvidesUserContext, id, **kwd):
"""
GET /api/jobs/{id}/inputs
returns input datasets created by job
:type id: string
:param id: Encoded job id
:rtype: dictionary
:returns: dictionary containing input dataset associations
... | [
"def",
"inputs",
"(",
"self",
",",
"trans",
":",
"ProvidesUserContext",
",",
"id",
",",
"*",
"*",
"kwd",
")",
":",
"job",
"=",
"self",
".",
"__get_job",
"(",
"trans",
",",
"id",
")",
"return",
"self",
".",
"__dictify_associations",
"(",
"trans",
",",
... | https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/lib/galaxy/webapps/galaxy/api/jobs.py#L265-L278 | |
Azure/azure-devops-cli-extension | 11334cd55806bef0b99c3bee5a438eed71e44037 | azure-devops/azext_devops/devops_sdk/v5_1/settings/settings_client.py | python | SettingsClient.set_entries | (self, entries, user_scope) | SetEntries.
[Preview API] Set the specified setting entry values for the given user/all-users scope
:param {object} entries: The entries to set
:param str user_scope: User-Scope at which to set the values. Should be "me" for the current user or "host" for all users. | SetEntries.
[Preview API] Set the specified setting entry values for the given user/all-users scope
:param {object} entries: The entries to set
:param str user_scope: User-Scope at which to set the values. Should be "me" for the current user or "host" for all users. | [
"SetEntries",
".",
"[",
"Preview",
"API",
"]",
"Set",
"the",
"specified",
"setting",
"entry",
"values",
"for",
"the",
"given",
"user",
"/",
"all",
"-",
"users",
"scope",
":",
"param",
"{",
"object",
"}",
"entries",
":",
"The",
"entries",
"to",
"set",
"... | def set_entries(self, entries, user_scope):
"""SetEntries.
[Preview API] Set the specified setting entry values for the given user/all-users scope
:param {object} entries: The entries to set
:param str user_scope: User-Scope at which to set the values. Should be "me" for the current user... | [
"def",
"set_entries",
"(",
"self",
",",
"entries",
",",
"user_scope",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"user_scope",
"is",
"not",
"None",
":",
"route_values",
"[",
"'userScope'",
"]",
"=",
"self",
".",
"_serialize",
".",
"url",
"(",
"'user_... | https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/v5_1/settings/settings_client.py#L60-L74 | ||
skelsec/msldap | ed3134135ddf9e13c74a4d7208ef3e48ec898192 | msldap/client.py | python | MSLDAPClient.get_tree_plot | (self, root_dn, level = 2) | return {root_dn : tree} | Returns a dictionary representing a tree starting from 'dn' containing all subtrees.
:param root_dn: The start DN of the tree
:type root_dn: str
:param level: Recursion level
:type level: int
:return: A dictionary representing the LDAP tree
:rtype: dict | Returns a dictionary representing a tree starting from 'dn' containing all subtrees. | [
"Returns",
"a",
"dictionary",
"representing",
"a",
"tree",
"starting",
"from",
"dn",
"containing",
"all",
"subtrees",
"."
] | async def get_tree_plot(self, root_dn, level = 2):
"""
Returns a dictionary representing a tree starting from 'dn' containing all subtrees.
:param root_dn: The start DN of the tree
:type root_dn: str
:param level: Recursion level
:type level: int
:return: A dictionary representing the LDAP tree
:rtype... | [
"async",
"def",
"get_tree_plot",
"(",
"self",
",",
"root_dn",
",",
"level",
"=",
"2",
")",
":",
"logger",
".",
"debug",
"(",
"'Tree, dn: %s level: %s'",
"%",
"(",
"root_dn",
",",
"level",
")",
")",
"tree",
"=",
"{",
"}",
"async",
"for",
"entry",
",",
... | https://github.com/skelsec/msldap/blob/ed3134135ddf9e13c74a4d7208ef3e48ec898192/msldap/client.py#L151-L186 | |
GoSecure/pyrdp | abd8b8762b6d7fd0e49d4a927b529f892b412743 | pyrdp/convert/ExportedPDUStream.py | python | ExportedPDUStream.__len__ | (self) | return len(self.packets) | [] | def __len__(self):
return len(self.packets) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"packets",
")"
] | https://github.com/GoSecure/pyrdp/blob/abd8b8762b6d7fd0e49d4a927b529f892b412743/pyrdp/convert/ExportedPDUStream.py#L21-L22 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/UserDict.py | python | DictMixin.itervalues | (self) | [] | def itervalues(self):
for _, v in self.iteritems():
yield v | [
"def",
"itervalues",
"(",
"self",
")",
":",
"for",
"_",
",",
"v",
"in",
"self",
".",
"iteritems",
"(",
")",
":",
"yield",
"v"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/UserDict.py#L116-L118 | ||||
frappe/frappe | b64cab6867dfd860f10ccaf41a4ec04bc890b583 | frappe/website/doctype/website_theme/website_theme.py | python | get_scss | (website_theme) | return frappe.render_template('frappe/website/doctype/website_theme/website_theme_template.scss', context) | Render `website_theme_template.scss` with the values defined in Website Theme.
params:
website_theme - instance of a Website Theme | Render `website_theme_template.scss` with the values defined in Website Theme. | [
"Render",
"website_theme_template",
".",
"scss",
"with",
"the",
"values",
"defined",
"in",
"Website",
"Theme",
"."
] | def get_scss(website_theme):
"""
Render `website_theme_template.scss` with the values defined in Website Theme.
params:
website_theme - instance of a Website Theme
"""
apps_to_ignore = tuple((d.app + '/') for d in website_theme.ignored_apps)
available_imports = get_scss_paths()
imports_to_include = [d for d in... | [
"def",
"get_scss",
"(",
"website_theme",
")",
":",
"apps_to_ignore",
"=",
"tuple",
"(",
"(",
"d",
".",
"app",
"+",
"'/'",
")",
"for",
"d",
"in",
"website_theme",
".",
"ignored_apps",
")",
"available_imports",
"=",
"get_scss_paths",
"(",
")",
"imports_to_incl... | https://github.com/frappe/frappe/blob/b64cab6867dfd860f10ccaf41a4ec04bc890b583/frappe/website/doctype/website_theme/website_theme.py#L139-L151 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/_cone.py | python | Cone.hovertemplatesrc | (self) | return self["hovertemplatesrc"] | Sets the source reference on Chart Studio Cloud for
`hovertemplate`.
The 'hovertemplatesrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str | Sets the source reference on Chart Studio Cloud for
`hovertemplate`.
The 'hovertemplatesrc' property must be specified as a string or
as a plotly.grid_objs.Column object | [
"Sets",
"the",
"source",
"reference",
"on",
"Chart",
"Studio",
"Cloud",
"for",
"hovertemplate",
".",
"The",
"hovertemplatesrc",
"property",
"must",
"be",
"specified",
"as",
"a",
"string",
"or",
"as",
"a",
"plotly",
".",
"grid_objs",
".",
"Column",
"object"
] | def hovertemplatesrc(self):
"""
Sets the source reference on Chart Studio Cloud for
`hovertemplate`.
The 'hovertemplatesrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return s... | [
"def",
"hovertemplatesrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"hovertemplatesrc\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_cone.py#L746-L758 | |
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/compat/__init__.py | python | get_path_uid | (path) | return file_uid | Return path's uid.
Does not follow symlinks:
https://github.com/pypa/pip/pull/935#discussion_r5307003
Placed this function in compat due to differences on AIX and
Jython, that should eventually go away.
:raises OSError: When path is a symlink or can't be read. | Return path's uid. | [
"Return",
"path",
"s",
"uid",
"."
] | def get_path_uid(path):
"""
Return path's uid.
Does not follow symlinks:
https://github.com/pypa/pip/pull/935#discussion_r5307003
Placed this function in compat due to differences on AIX and
Jython, that should eventually go away.
:raises OSError: When path is a symlink or can't be re... | [
"def",
"get_path_uid",
"(",
"path",
")",
":",
"if",
"hasattr",
"(",
"os",
",",
"'O_NOFOLLOW'",
")",
":",
"fd",
"=",
"os",
".",
"open",
"(",
"path",
",",
"os",
".",
"O_RDONLY",
"|",
"os",
".",
"O_NOFOLLOW",
")",
"file_uid",
"=",
"os",
".",
"fstat",
... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/compat/__init__.py#L101-L127 | |
tanghaibao/jcvi | 5e720870c0928996f8b77a38208106ff0447ccb6 | jcvi/formats/fasta.py | python | simulate | (args) | %prog simulate idsfile
Simulate random FASTA file based on idsfile, which is a two-column
tab-separated file with sequence name and size. | %prog simulate idsfile | [
"%prog",
"simulate",
"idsfile"
] | def simulate(args):
"""
%prog simulate idsfile
Simulate random FASTA file based on idsfile, which is a two-column
tab-separated file with sequence name and size.
"""
p = OptionParser(simulate.__doc__)
p.set_outfile()
opts, args = p.parse_args(args)
if len(args) != 1:
sys.ex... | [
"def",
"simulate",
"(",
"args",
")",
":",
"p",
"=",
"OptionParser",
"(",
"simulate",
".",
"__doc__",
")",
"p",
".",
"set_outfile",
"(",
")",
"opts",
",",
"args",
"=",
"p",
".",
"parse_args",
"(",
"args",
")",
"if",
"len",
"(",
"args",
")",
"!=",
... | https://github.com/tanghaibao/jcvi/blob/5e720870c0928996f8b77a38208106ff0447ccb6/jcvi/formats/fasta.py#L419-L440 | ||
FSecureLABS/Jandroid | e31d0dab58a2bfd6ed8e0a387172b8bd7c893436 | libs/platform-tools/platform-tools_windows/systrace/catapult/third_party/pyserial/serial/urlhandler/protocol_loop.py | python | LoopbackSerial.sendBreak | (self, duration=0.25) | Send break condition. Timed, returns to idle state after given
duration. | Send break condition. Timed, returns to idle state after given
duration. | [
"Send",
"break",
"condition",
".",
"Timed",
"returns",
"to",
"idle",
"state",
"after",
"given",
"duration",
"."
] | def sendBreak(self, duration=0.25):
"""Send break condition. Timed, returns to idle state after given
duration."""
if not self._isOpen: raise portNotOpenError | [
"def",
"sendBreak",
"(",
"self",
",",
"duration",
"=",
"0.25",
")",
":",
"if",
"not",
"self",
".",
"_isOpen",
":",
"raise",
"portNotOpenError"
] | https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/libs/platform-tools/platform-tools_windows/systrace/catapult/third_party/pyserial/serial/urlhandler/protocol_loop.py#L181-L184 | ||
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/IPython/nbconvert/writers/files.py | python | FilesWriter._makedir | (self, path) | Make a directory if it doesn't already exist | Make a directory if it doesn't already exist | [
"Make",
"a",
"directory",
"if",
"it",
"doesn",
"t",
"already",
"exist"
] | def _makedir(self, path):
"""Make a directory if it doesn't already exist"""
if path and not os.path.isdir(path):
self.log.info("Making directory %s", path)
os.makedirs(path) | [
"def",
"_makedir",
"(",
"self",
",",
"path",
")",
":",
"if",
"path",
"and",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"self",
".",
"log",
".",
"info",
"(",
"\"Making directory %s\"",
",",
"path",
")",
"os",
".",
"makedirs",
"("... | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/IPython/nbconvert/writers/files.py#L49-L53 | ||
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/rlcompleter.py | python | Completer.complete | (self, text, state) | Return the next possible completion for 'text'.
This is called successively with state == 0, 1, 2, ... until it
returns None. The completion should begin with 'text'. | Return the next possible completion for 'text'. | [
"Return",
"the",
"next",
"possible",
"completion",
"for",
"text",
"."
] | def complete(self, text, state):
"""Return the next possible completion for 'text'.
This is called successively with state == 0, 1, 2, ... until it
returns None. The completion should begin with 'text'.
"""
if self.use_main_ns:
self.namespace = __main__.__dict__
... | [
"def",
"complete",
"(",
"self",
",",
"text",
",",
"state",
")",
":",
"if",
"self",
".",
"use_main_ns",
":",
"self",
".",
"namespace",
"=",
"__main__",
".",
"__dict__",
"if",
"not",
"text",
".",
"strip",
"(",
")",
":",
"if",
"state",
"==",
"0",
":",... | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/rlcompleter.py#L66-L90 | ||
facelessuser/ColorHelper | cfed17c35dbae4db49a14165ef222407c48a3014 | lib/coloraide/distance/delta_e_ok.py | python | DEOK.distance | (cls, color: 'Color', sample: 'Color', scalar: float = 1, **kwargs: Any) | return scalar * super().distance(color, sample) | Delta E OK color distance formula.
This just uses simple Euclidean distance in the Oklab color space. | Delta E OK color distance formula. | [
"Delta",
"E",
"OK",
"color",
"distance",
"formula",
"."
] | def distance(cls, color: 'Color', sample: 'Color', scalar: float = 1, **kwargs: Any) -> float:
"""
Delta E OK color distance formula.
This just uses simple Euclidean distance in the Oklab color space.
"""
# Equation (1)
return scalar * super().distance(color, sample) | [
"def",
"distance",
"(",
"cls",
",",
"color",
":",
"'Color'",
",",
"sample",
":",
"'Color'",
",",
"scalar",
":",
"float",
"=",
"1",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"float",
":",
"# Equation (1)",
"return",
"scalar",
"*",
"super",
"(",
... | https://github.com/facelessuser/ColorHelper/blob/cfed17c35dbae4db49a14165ef222407c48a3014/lib/coloraide/distance/delta_e_ok.py#L16-L24 | |
nosmokingbandit/watcher | dadacd21a5790ee609058a98a17fcc8954d24439 | lib/infi/pkg_resources/_vendor/pyparsing.py | python | ParseResults.haskeys | ( self ) | return bool(self.__tokdict) | Since keys() returns an iterator, this method is helpful in bypassing
code that looks for the existence of any defined results names. | Since keys() returns an iterator, this method is helpful in bypassing
code that looks for the existence of any defined results names. | [
"Since",
"keys",
"()",
"returns",
"an",
"iterator",
"this",
"method",
"is",
"helpful",
"in",
"bypassing",
"code",
"that",
"looks",
"for",
"the",
"existence",
"of",
"any",
"defined",
"results",
"names",
"."
] | def haskeys( self ):
"""Since keys() returns an iterator, this method is helpful in bypassing
code that looks for the existence of any defined results names."""
return bool(self.__tokdict) | [
"def",
"haskeys",
"(",
"self",
")",
":",
"return",
"bool",
"(",
"self",
".",
"__tokdict",
")"
] | https://github.com/nosmokingbandit/watcher/blob/dadacd21a5790ee609058a98a17fcc8954d24439/lib/infi/pkg_resources/_vendor/pyparsing.py#L483-L486 | |
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e | tensorflow_dl_models/research/capsules/models/layers/layers.py | python | capsule | (input_tensor,
input_dim,
output_dim,
layer_name,
input_atoms=8,
output_atoms=8,
**routing_args) | Builds a fully connected capsule layer.
Given an input tensor of shape `[batch, input_dim, input_atoms]`, this op
performs the following:
1. For each input capsule, multiples it with the weight variable to get
votes of shape `[batch, input_dim, output_dim, output_atoms]`.
2. Scales the votes for eac... | Builds a fully connected capsule layer. | [
"Builds",
"a",
"fully",
"connected",
"capsule",
"layer",
"."
] | def capsule(input_tensor,
input_dim,
output_dim,
layer_name,
input_atoms=8,
output_atoms=8,
**routing_args):
"""Builds a fully connected capsule layer.
Given an input tensor of shape `[batch, input_dim, input_atoms]`, this op
performs the fo... | [
"def",
"capsule",
"(",
"input_tensor",
",",
"input_dim",
",",
"output_dim",
",",
"layer_name",
",",
"input_atoms",
"=",
"8",
",",
"output_atoms",
"=",
"8",
",",
"*",
"*",
"routing_args",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"layer_name",
")"... | https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/tensorflow_dl_models/research/capsules/models/layers/layers.py#L138-L199 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/antlr3/antlr3/streams.py | python | CommonTokenStream.__init__ | (self, tokenSource=None, channel=DEFAULT_CHANNEL) | @param tokenSource A TokenSource instance (usually a Lexer) to pull
the tokens from.
@param channel Skip tokens on any channel but this one; this is how we
skip whitespace... | @param tokenSource A TokenSource instance (usually a Lexer) to pull
the tokens from. | [
"@param",
"tokenSource",
"A",
"TokenSource",
"instance",
"(",
"usually",
"a",
"Lexer",
")",
"to",
"pull",
"the",
"tokens",
"from",
"."
] | def __init__(self, tokenSource=None, channel=DEFAULT_CHANNEL):
"""
@param tokenSource A TokenSource instance (usually a Lexer) to pull
the tokens from.
@param channel Skip tokens on any channel but this one; this is how we
skip whitespace...
"""
... | [
"def",
"__init__",
"(",
"self",
",",
"tokenSource",
"=",
"None",
",",
"channel",
"=",
"DEFAULT_CHANNEL",
")",
":",
"TokenStream",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"tokenSource",
"=",
"tokenSource",
"# Record every single token pulled from the source s... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/antlr3/antlr3/streams.py#L608-L643 | ||
mayank93/Twitter-Sentiment-Analysis | f095c6ca6bf69787582b5dabb140fefaf278eb37 | front-end/web2py/gluon/custom_import.py | python | _DateTrackerImporter.__call__ | (self, name, globals=None, locals=None,
fromlist=None, level=-1) | The import method itself. | The import method itself. | [
"The",
"import",
"method",
"itself",
"."
] | def __call__(self, name, globals=None, locals=None,
fromlist=None, level=-1):
"""
The import method itself.
"""
globals = globals or {}
locals = locals or {}
fromlist = fromlist or []
call_begin_end = self._tl._modules_loaded is None
if ... | [
"def",
"__call__",
"(",
"self",
",",
"name",
",",
"globals",
"=",
"None",
",",
"locals",
"=",
"None",
",",
"fromlist",
"=",
"None",
",",
"level",
"=",
"-",
"1",
")",
":",
"globals",
"=",
"globals",
"or",
"{",
"}",
"locals",
"=",
"locals",
"or",
"... | https://github.com/mayank93/Twitter-Sentiment-Analysis/blob/f095c6ca6bf69787582b5dabb140fefaf278eb37/front-end/web2py/gluon/custom_import.py#L106-L137 | ||
PINTO0309/PINTO_model_zoo | 2924acda7a7d541d8712efd7cc4fd1c61ef5bddd | 171_Fast-SRGAN/demo/demo_fast_srgan_onnx.py | python | main | () | [] | def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"--model",
type=str,
default='model_128x128/model_128x128.onnx',
)
parser.add_argument(
"--input_size",
type=str,
default='128,128',
)
args = parser.parse_args()
model_path =... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"\"--model\"",
",",
"type",
"=",
"str",
",",
"default",
"=",
"'model_128x128/model_128x128.onnx'",
",",
")",
"parser",
".",
"add_arg... | https://github.com/PINTO0309/PINTO_model_zoo/blob/2924acda7a7d541d8712efd7cc4fd1c61ef5bddd/171_Fast-SRGAN/demo/demo_fast_srgan_onnx.py#L36-L97 | ||||
wwqgtxx/wwqLyParse | 33136508e52821babd9294fdecffbdf02d73a6fc | wwqLyParse/lib/python-3.7.2-embed-win32/Crypto/Hash/SHA1.py | python | SHA1Hash.digest | (self) | return get_raw_buffer(bfr) | Return the **binary** (non-printable) digest of the message that has been hashed so far.
:return: The hash digest, computed over the data processed so far.
Binary form.
:rtype: byte string | Return the **binary** (non-printable) digest of the message that has been hashed so far. | [
"Return",
"the",
"**",
"binary",
"**",
"(",
"non",
"-",
"printable",
")",
"digest",
"of",
"the",
"message",
"that",
"has",
"been",
"hashed",
"so",
"far",
"."
] | def digest(self):
"""Return the **binary** (non-printable) digest of the message that has been hashed so far.
:return: The hash digest, computed over the data processed so far.
Binary form.
:rtype: byte string
"""
bfr = create_string_buffer(self.digest_size)
... | [
"def",
"digest",
"(",
"self",
")",
":",
"bfr",
"=",
"create_string_buffer",
"(",
"self",
".",
"digest_size",
")",
"result",
"=",
"_raw_sha1_lib",
".",
"SHA1_digest",
"(",
"self",
".",
"_state",
".",
"get",
"(",
")",
",",
"bfr",
")",
"if",
"result",
":"... | https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/python-3.7.2-embed-win32/Crypto/Hash/SHA1.py#L97-L112 | |
amymcgovern/pyparrot | bf4775ec1199b282e4edde1e4a8e018dcc8725e0 | pyparrot/utils/vlc.py | python | MediaPlayer.get_xwindow | (self) | return libvlc_media_player_get_xwindow(self) | Get the X Window System window identifier previously set with
L{set_xwindow}(). Note that this will return the identifier
even if VLC is not currently using it (for instance if it is playing an
audio-only input).
@return: an X window ID, or 0 if none where set. | Get the X Window System window identifier previously set with
L{set_xwindow}(). Note that this will return the identifier
even if VLC is not currently using it (for instance if it is playing an
audio-only input). | [
"Get",
"the",
"X",
"Window",
"System",
"window",
"identifier",
"previously",
"set",
"with",
"L",
"{",
"set_xwindow",
"}",
"()",
".",
"Note",
"that",
"this",
"will",
"return",
"the",
"identifier",
"even",
"if",
"VLC",
"is",
"not",
"currently",
"using",
"it"... | def get_xwindow(self):
'''Get the X Window System window identifier previously set with
L{set_xwindow}(). Note that this will return the identifier
even if VLC is not currently using it (for instance if it is playing an
audio-only input).
@return: an X window ID, or 0 if none whe... | [
"def",
"get_xwindow",
"(",
"self",
")",
":",
"return",
"libvlc_media_player_get_xwindow",
"(",
"self",
")"
] | https://github.com/amymcgovern/pyparrot/blob/bf4775ec1199b282e4edde1e4a8e018dcc8725e0/pyparrot/utils/vlc.py#L3552-L3559 | |
ShuangLI59/person_search | ef7d77a58a581825611e575010d9a3653b1ddf98 | lib/datasets/imdb.py | python | imdb.set_proposal_method | (self, method) | [] | def set_proposal_method(self, method):
method = eval('self.' + method + '_roidb')
self.roidb_handler = method | [
"def",
"set_proposal_method",
"(",
"self",
",",
"method",
")",
":",
"method",
"=",
"eval",
"(",
"'self.'",
"+",
"method",
"+",
"'_roidb'",
")",
"self",
".",
"roidb_handler",
"=",
"method"
] | https://github.com/ShuangLI59/person_search/blob/ef7d77a58a581825611e575010d9a3653b1ddf98/lib/datasets/imdb.py#L55-L57 | ||||
robhagemans/pcbasic | c3a043b46af66623a801e18a38175be077251ada | pcbasic/basic/interpreter.py | python | Interpreter.set_parse_mode | (self, on) | Enter or exit parse mode. | Enter or exit parse mode. | [
"Enter",
"or",
"exit",
"parse",
"mode",
"."
] | def set_parse_mode(self, on):
"""Enter or exit parse mode."""
self._parse_mode = on
self._cursor.set_direct(not on) | [
"def",
"set_parse_mode",
"(",
"self",
",",
"on",
")",
":",
"self",
".",
"_parse_mode",
"=",
"on",
"self",
".",
"_cursor",
".",
"set_direct",
"(",
"not",
"on",
")"
] | https://github.com/robhagemans/pcbasic/blob/c3a043b46af66623a801e18a38175be077251ada/pcbasic/basic/interpreter.py#L132-L135 | ||
stopstalk/stopstalk-deployment | 10c3ab44c4ece33ae515f6888c15033db2004bb1 | aws_lambda/spoj_aws_lambda_function/lambda_code/setuptools/msvc.py | python | SystemInfo.FSharpInstallDir | (self) | return self.ri.lookup(path, 'productdir') or '' | Microsoft Visual F# directory. | Microsoft Visual F# directory. | [
"Microsoft",
"Visual",
"F#",
"directory",
"."
] | def FSharpInstallDir(self):
"""
Microsoft Visual F# directory.
"""
path = r'%0.1f\Setup\F#' % self.vc_ver
path = os.path.join(self.ri.visualstudio, path)
return self.ri.lookup(path, 'productdir') or '' | [
"def",
"FSharpInstallDir",
"(",
"self",
")",
":",
"path",
"=",
"r'%0.1f\\Setup\\F#'",
"%",
"self",
".",
"vc_ver",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"ri",
".",
"visualstudio",
",",
"path",
")",
"return",
"self",
".",
"ri",
... | https://github.com/stopstalk/stopstalk-deployment/blob/10c3ab44c4ece33ae515f6888c15033db2004bb1/aws_lambda/spoj_aws_lambda_function/lambda_code/setuptools/msvc.py#L676-L682 | |
zim-desktop-wiki/zim-desktop-wiki | fe717d7ee64e5c06d90df90eb87758e5e72d25c5 | zim/formats/__init__.py | python | ParseTree.cleanup_headings | (self, offset=0, max=6) | Change the heading levels throughout the tree. This makes sure that
al headings are nested directly under their parent (no gaps in the
levels of the headings). Also you can set an offset for the top level
and a max depth. | Change the heading levels throughout the tree. This makes sure that
al headings are nested directly under their parent (no gaps in the
levels of the headings). Also you can set an offset for the top level
and a max depth. | [
"Change",
"the",
"heading",
"levels",
"throughout",
"the",
"tree",
".",
"This",
"makes",
"sure",
"that",
"al",
"headings",
"are",
"nested",
"directly",
"under",
"their",
"parent",
"(",
"no",
"gaps",
"in",
"the",
"levels",
"of",
"the",
"headings",
")",
".",... | def cleanup_headings(self, offset=0, max=6):
'''Change the heading levels throughout the tree. This makes sure that
al headings are nested directly under their parent (no gaps in the
levels of the headings). Also you can set an offset for the top level
and a max depth.
'''
path = []
for heading in self._e... | [
"def",
"cleanup_headings",
"(",
"self",
",",
"offset",
"=",
"0",
",",
"max",
"=",
"6",
")",
":",
"path",
"=",
"[",
"]",
"for",
"heading",
"in",
"self",
".",
"_etree",
".",
"iter",
"(",
"'h'",
")",
":",
"level",
"=",
"int",
"(",
"heading",
".",
... | https://github.com/zim-desktop-wiki/zim-desktop-wiki/blob/fe717d7ee64e5c06d90df90eb87758e5e72d25c5/zim/formats/__init__.py#L493-L512 | ||
PaulSonOfLars/tgbot | 0ece72778b7772725ab214fe0929daaa2fc7d2d1 | tg_bot/modules/helper_funcs/misc.py | python | revert_buttons | (buttons) | return res | [] | def revert_buttons(buttons):
res = ""
for btn in buttons:
if btn.same_line:
res += "\n[{}](buttonurl://{}:same)".format(btn.name, btn.url)
else:
res += "\n[{}](buttonurl://{})".format(btn.name, btn.url)
return res | [
"def",
"revert_buttons",
"(",
"buttons",
")",
":",
"res",
"=",
"\"\"",
"for",
"btn",
"in",
"buttons",
":",
"if",
"btn",
".",
"same_line",
":",
"res",
"+=",
"\"\\n[{}](buttonurl://{}:same)\"",
".",
"format",
"(",
"btn",
".",
"name",
",",
"btn",
".",
"url"... | https://github.com/PaulSonOfLars/tgbot/blob/0ece72778b7772725ab214fe0929daaa2fc7d2d1/tg_bot/modules/helper_funcs/misc.py#L97-L105 | |||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/msilib/__init__.py | python | CAB.append | (self, full, file, logical) | return self.index, logical | [] | def append(self, full, file, logical):
if os.path.isdir(full):
return
if not logical:
logical = self.gen_id(file)
self.index += 1
self.files.append((full, logical))
return self.index, logical | [
"def",
"append",
"(",
"self",
",",
"full",
",",
"file",
",",
"logical",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"full",
")",
":",
"return",
"if",
"not",
"logical",
":",
"logical",
"=",
"self",
".",
"gen_id",
"(",
"file",
")",
"self"... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/msilib/__init__.py#L201-L208 | |||
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | dist/lib/python2.7/decimal.py | python | Context.is_normal | (self, a) | return a.is_normal(context=self) | Return True if the operand is a normal number;
otherwise return False.
>>> c = ExtendedContext.copy()
>>> c.Emin = -999
>>> c.Emax = 999
>>> c.is_normal(Decimal('2.50'))
True
>>> c.is_normal(Decimal('0.1E-999'))
False
>>> c.is_normal(Decimal('0.00... | Return True if the operand is a normal number;
otherwise return False. | [
"Return",
"True",
"if",
"the",
"operand",
"is",
"a",
"normal",
"number",
";",
"otherwise",
"return",
"False",
"."
] | def is_normal(self, a):
"""Return True if the operand is a normal number;
otherwise return False.
>>> c = ExtendedContext.copy()
>>> c.Emin = -999
>>> c.Emax = 999
>>> c.is_normal(Decimal('2.50'))
True
>>> c.is_normal(Decimal('0.1E-999'))
False
... | [
"def",
"is_normal",
"(",
"self",
",",
"a",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"is_normal",
"(",
"context",
"=",
"self",
")"
] | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/decimal.py#L4348-L4369 | |
santhoshkolloju/Abstractive-Summarization-With-Transfer-Learning | 97ff2ae3ba9f2d478e174444c4e0f5349f28c319 | texar_repo/texar/data/data/scalar_data.py | python | ScalarData.dataset_size | (self) | return self._dataset_size | Returns the number of data instances in the dataset.
Note that this is the total data count in the raw files, before any
filtering and truncation. | Returns the number of data instances in the dataset. | [
"Returns",
"the",
"number",
"of",
"data",
"instances",
"in",
"the",
"dataset",
"."
] | def dataset_size(self):
"""Returns the number of data instances in the dataset.
Note that this is the total data count in the raw files, before any
filtering and truncation.
"""
if not self._dataset_size:
# pylint: disable=attribute-defined-outside-init
s... | [
"def",
"dataset_size",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_dataset_size",
":",
"# pylint: disable=attribute-defined-outside-init",
"self",
".",
"_dataset_size",
"=",
"count_file_lines",
"(",
"self",
".",
"_hparams",
".",
"dataset",
".",
"files",
")"... | https://github.com/santhoshkolloju/Abstractive-Summarization-With-Transfer-Learning/blob/97ff2ae3ba9f2d478e174444c4e0f5349f28c319/texar_repo/texar/data/data/scalar_data.py#L245-L255 | |
hellock/icrawler | 3506401984f4a2fe04db8a5608f54905c42bb6a6 | icrawler/utils/signal.py | python | Signal.reset | (self) | Reset signals with their initial values | Reset signals with their initial values | [
"Reset",
"signals",
"with",
"their",
"initial",
"values"
] | def reset(self):
"""Reset signals with their initial values"""
self._signals = self._init_status.copy() | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"_signals",
"=",
"self",
".",
"_init_status",
".",
"copy",
"(",
")"
] | https://github.com/hellock/icrawler/blob/3506401984f4a2fe04db8a5608f54905c42bb6a6/icrawler/utils/signal.py#L31-L33 | ||
Calysto/metakernel | 9815c0e8b3f9c427105b5d094e9041a303302469 | metakernel/magics/run_magic.py | python | RunMagic.line_run | (self, filename, language=None) | %run [--language LANG] FILENAME - run code in filename by
kernel
This magic will take the code in FILENAME and run it. The
exact details of how the code runs are deterimined by your
language.
The --language LANG option will prefix the file contents with
"%%LANG". You... | %run [--language LANG] FILENAME - run code in filename by
kernel | [
"%run",
"[",
"--",
"language",
"LANG",
"]",
"FILENAME",
"-",
"run",
"code",
"in",
"filename",
"by",
"kernel"
] | def line_run(self, filename, language=None):
"""
%run [--language LANG] FILENAME - run code in filename by
kernel
This magic will take the code in FILENAME and run it. The
exact details of how the code runs are deterimined by your
language.
The --language LAN... | [
"def",
"line_run",
"(",
"self",
",",
"filename",
",",
"language",
"=",
"None",
")",
":",
"if",
"filename",
".",
"startswith",
"(",
"\"~\"",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"filename",
")",
"filename",
"=",
"os",
... | https://github.com/Calysto/metakernel/blob/9815c0e8b3f9c427105b5d094e9041a303302469/metakernel/magics/run_magic.py#L13-L43 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.