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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
OpenNMT/OpenNMT-py | 4815f07fcd482af9a1fe1d3b620d144197178bc5 | onmt/inputters/inputter.py | python | build_vocab | (train_dataset_files, fields, data_type, share_vocab,
src_vocab_path, src_vocab_size, src_words_min_frequency,
tgt_vocab_path, tgt_vocab_size, tgt_words_min_frequency,
vocab_size_multiple=1) | return fields | Build the fields for all data sides.
Args:
train_dataset_files: a list of train dataset pt file.
fields (dict[str, Field]): fields to build vocab for.
data_type (str): A supported data type string.
share_vocab (bool): share source and target vocabulary?
src_vocab_path (str):... | Build the fields for all data sides. | [
"Build",
"the",
"fields",
"for",
"all",
"data",
"sides",
"."
] | def build_vocab(train_dataset_files, fields, data_type, share_vocab,
src_vocab_path, src_vocab_size, src_words_min_frequency,
tgt_vocab_path, tgt_vocab_size, tgt_words_min_frequency,
vocab_size_multiple=1):
"""Build the fields for all data sides.
Args:
tr... | [
"def",
"build_vocab",
"(",
"train_dataset_files",
",",
"fields",
",",
"data_type",
",",
"share_vocab",
",",
"src_vocab_path",
",",
"src_vocab_size",
",",
"src_words_min_frequency",
",",
"tgt_vocab_path",
",",
"tgt_vocab_size",
",",
"tgt_words_min_frequency",
",",
"vocab... | https://github.com/OpenNMT/OpenNMT-py/blob/4815f07fcd482af9a1fe1d3b620d144197178bc5/onmt/inputters/inputter.py#L374-L464 | |
awslabs/autogluon | 7309118f2ab1c9519f25acf61a283a95af95842b | tabular/src/autogluon/tabular/models/fastainn/tabular_nn_fastai.py | python | NNFastAiTabularModel._get_batch_size | (self, X, default_batch_size_for_small_inputs=32) | return bs | [] | def _get_batch_size(self, X, default_batch_size_for_small_inputs=32):
bs = self.params['bs']
if bs == 'auto':
bs = 512 if len(X) >= 200000 else 256
bs = bs if len(X) > bs else default_batch_size_for_small_inputs
if self.params['bs'] == 'auto':
logger.log(15, f'Au... | [
"def",
"_get_batch_size",
"(",
"self",
",",
"X",
",",
"default_batch_size_for_small_inputs",
"=",
"32",
")",
":",
"bs",
"=",
"self",
".",
"params",
"[",
"'bs'",
"]",
"if",
"bs",
"==",
"'auto'",
":",
"bs",
"=",
"512",
"if",
"len",
"(",
"X",
")",
">=",... | https://github.com/awslabs/autogluon/blob/7309118f2ab1c9519f25acf61a283a95af95842b/tabular/src/autogluon/tabular/models/fastainn/tabular_nn_fastai.py#L295-L304 | |||
CvvT/dumpDex | 92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1 | python/idaapi.py | python | sval_pointer.frompointer | (*args) | return _idaapi.sval_pointer_frompointer(*args) | frompointer(t) -> sval_pointer | frompointer(t) -> sval_pointer | [
"frompointer",
"(",
"t",
")",
"-",
">",
"sval_pointer"
] | def frompointer(*args):
"""
frompointer(t) -> sval_pointer
"""
return _idaapi.sval_pointer_frompointer(*args) | [
"def",
"frompointer",
"(",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"sval_pointer_frompointer",
"(",
"*",
"args",
")"
] | https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L2539-L2543 | |
dpressel/mead-baseline | 9987e6b37fa6525a4ddc187c305e292a718f59a9 | mead/api_examples/eager_lm_pytorch.py | python | repackage_hidden | (h) | Wraps hidden states in new Variables, to detach them from their history. | Wraps hidden states in new Variables, to detach them from their history. | [
"Wraps",
"hidden",
"states",
"in",
"new",
"Variables",
"to",
"detach",
"them",
"from",
"their",
"history",
"."
] | def repackage_hidden(h):
"""Wraps hidden states in new Variables, to detach them from their history."""
if h is None:
return None
if isinstance(h, torch.Tensor):
return h.detach()
else:
return tuple(repackage_hidden(v) for v in h) | [
"def",
"repackage_hidden",
"(",
"h",
")",
":",
"if",
"h",
"is",
"None",
":",
"return",
"None",
"if",
"isinstance",
"(",
"h",
",",
"torch",
".",
"Tensor",
")",
":",
"return",
"h",
".",
"detach",
"(",
")",
"else",
":",
"return",
"tuple",
"(",
"repack... | https://github.com/dpressel/mead-baseline/blob/9987e6b37fa6525a4ddc187c305e292a718f59a9/mead/api_examples/eager_lm_pytorch.py#L162-L169 | ||
sethmlarson/virtualbox-python | 984a6e2cb0e8996f4df40f4444c1528849f1c70d | virtualbox/library.py | python | IGuestSession.fs_obj_query_info | (self, path, follow_symlinks) | return info | Queries information about a file system object (file, directory, etc)
in the guest.
in path of type str
Path to the file system object to gather information about.
Guest path style.
in follow_symlinks of type bool
Information about symbolic links is returned... | Queries information about a file system object (file, directory, etc)
in the guest. | [
"Queries",
"information",
"about",
"a",
"file",
"system",
"object",
"(",
"file",
"directory",
"etc",
")",
"in",
"the",
"guest",
"."
] | def fs_obj_query_info(self, path, follow_symlinks):
"""Queries information about a file system object (file, directory, etc)
in the guest.
in path of type str
Path to the file system object to gather information about.
Guest path style.
in follow_symlinks of typ... | [
"def",
"fs_obj_query_info",
"(",
"self",
",",
"path",
",",
"follow_symlinks",
")",
":",
"if",
"not",
"isinstance",
"(",
"path",
",",
"basestring",
")",
":",
"raise",
"TypeError",
"(",
"\"path can only be an instance of type basestring\"",
")",
"if",
"not",
"isinst... | https://github.com/sethmlarson/virtualbox-python/blob/984a6e2cb0e8996f4df40f4444c1528849f1c70d/virtualbox/library.py#L23101-L23130 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/http/cookiejar.py | python | CookieJar.make_cookies | (self, response, request) | return cookies | Return sequence of Cookie objects extracted from response object. | Return sequence of Cookie objects extracted from response object. | [
"Return",
"sequence",
"of",
"Cookie",
"objects",
"extracted",
"from",
"response",
"object",
"."
] | def make_cookies(self, response, request):
"""Return sequence of Cookie objects extracted from response object."""
# get cookie-attributes for RFC 2965 and Netscape protocols
headers = response.info()
rfc2965_hdrs = headers.get_all("Set-Cookie2", [])
ns_hdrs = headers.get_all("Se... | [
"def",
"make_cookies",
"(",
"self",
",",
"response",
",",
"request",
")",
":",
"# get cookie-attributes for RFC 2965 and Netscape protocols",
"headers",
"=",
"response",
".",
"info",
"(",
")",
"rfc2965_hdrs",
"=",
"headers",
".",
"get_all",
"(",
"\"Set-Cookie2\"",
"... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/http/cookiejar.py#L1604-L1657 | |
LinOTP/LinOTP | bb3940bbaccea99550e6c063ff824f258dd6d6d7 | linotp/provider/__init__.py | python | get_provider_from_policy | (
provider_type, realm=None, user=None, scope="authentication", action=None
) | return providers | interface for the provider user like email token or sms token
:param provider_type: 'push', 'email' or 'sms
:param user: the user, who should receive the message, used for
the policy lookup
:return: the list of all identified providers by name | interface for the provider user like email token or sms token | [
"interface",
"for",
"the",
"provider",
"user",
"like",
"email",
"token",
"or",
"sms",
"token"
] | def get_provider_from_policy(
provider_type, realm=None, user=None, scope="authentication", action=None
):
"""
interface for the provider user like email token or sms token
:param provider_type: 'push', 'email' or 'sms
:param user: the user, who should receive the message, used for
... | [
"def",
"get_provider_from_policy",
"(",
"provider_type",
",",
"realm",
"=",
"None",
",",
"user",
"=",
"None",
",",
"scope",
"=",
"\"authentication\"",
",",
"action",
"=",
"None",
")",
":",
"# check if the provider is defined in a policy",
"provider_name",
"=",
"None... | https://github.com/LinOTP/LinOTP/blob/bb3940bbaccea99550e6c063ff824f258dd6d6d7/linotp/provider/__init__.py#L711-L769 | |
WerWolv/EdiZon_CheatsConfigsAndScripts | d16d36c7509c01dca770f402babd83ff2e9ae6e7 | Scripts/lib/python3.5/_pydecimal.py | python | _Log10Memoize.getdigits | (self, p) | return int(self.digits[:p+1]) | Given an integer p >= 0, return floor(10**p)*log(10).
For example, self.getdigits(3) returns 2302. | Given an integer p >= 0, return floor(10**p)*log(10). | [
"Given",
"an",
"integer",
"p",
">",
"=",
"0",
"return",
"floor",
"(",
"10",
"**",
"p",
")",
"*",
"log",
"(",
"10",
")",
"."
] | def getdigits(self, p):
"""Given an integer p >= 0, return floor(10**p)*log(10).
For example, self.getdigits(3) returns 2302.
"""
# digits are stored as a string, for quick conversion to
# integer in the case that we've already computed enough
# digits; the stored digits... | [
"def",
"getdigits",
"(",
"self",
",",
"p",
")",
":",
"# digits are stored as a string, for quick conversion to",
"# integer in the case that we've already computed enough",
"# digits; the stored digits should always be correct",
"# (truncated, not rounded to nearest).",
"if",
"p",
"<",
... | https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/_pydecimal.py#L5846-L5872 | |
awslabs/autogluon | 7309118f2ab1c9519f25acf61a283a95af95842b | core/src/autogluon/core/utils/sync_remote.py | python | sync_training_processes | (proccess_id_string, worker_id, sync_frequency=300) | [] | def sync_training_processes(proccess_id_string, worker_id, sync_frequency=300):
training_process_started = False
while True:
time.sleep(sync_frequency)
training_process_ps = subprocess.check_output(f'ps -elf | grep "{proccess_id_string}"', encoding='utf-8', shell=True)
print(training_pro... | [
"def",
"sync_training_processes",
"(",
"proccess_id_string",
",",
"worker_id",
",",
"sync_frequency",
"=",
"300",
")",
":",
"training_process_started",
"=",
"False",
"while",
"True",
":",
"time",
".",
"sleep",
"(",
"sync_frequency",
")",
"training_process_ps",
"=",
... | https://github.com/awslabs/autogluon/blob/7309118f2ab1c9519f25acf61a283a95af95842b/core/src/autogluon/core/utils/sync_remote.py#L47-L68 | ||||
ninthDevilHAUNSTER/ArknightsAutoHelper | a27a930502d6e432368d9f62595a1d69a992f4e6 | vendor/penguin_client/penguin_client/models/advanced_query_response.py | python | AdvancedQueryResponse.__init__ | (self, advanced_results=None, error=None) | AdvancedQueryResponse - a model defined in Swagger | AdvancedQueryResponse - a model defined in Swagger | [
"AdvancedQueryResponse",
"-",
"a",
"model",
"defined",
"in",
"Swagger"
] | def __init__(self, advanced_results=None, error=None): # noqa: E501
"""AdvancedQueryResponse - a model defined in Swagger""" # noqa: E501
self._advanced_results = None
self._error = None
self.discriminator = None
if advanced_results is not None:
self.advanced_resu... | [
"def",
"__init__",
"(",
"self",
",",
"advanced_results",
"=",
"None",
",",
"error",
"=",
"None",
")",
":",
"# noqa: E501",
"# noqa: E501",
"self",
".",
"_advanced_results",
"=",
"None",
"self",
".",
"_error",
"=",
"None",
"self",
".",
"discriminator",
"=",
... | https://github.com/ninthDevilHAUNSTER/ArknightsAutoHelper/blob/a27a930502d6e432368d9f62595a1d69a992f4e6/vendor/penguin_client/penguin_client/models/advanced_query_response.py#L43-L53 | ||
pypa/setuptools | 9f37366aab9cd8f6baa23e6a77cfdb8daf97757e | setuptools/_vendor/more_itertools/more.py | python | seekable.__iter__ | (self) | return self | [] | def __iter__(self):
return self | [
"def",
"__iter__",
"(",
"self",
")",
":",
"return",
"self"
] | https://github.com/pypa/setuptools/blob/9f37366aab9cd8f6baa23e6a77cfdb8daf97757e/setuptools/_vendor/more_itertools/more.py#L2657-L2658 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/idlelib/EditorWindow.py | python | EditorWindow.smart_backspace_event | (self, event) | return "break" | [] | def smart_backspace_event(self, event):
text = self.text
first, last = self.get_selection_indices()
if first and last:
text.delete(first, last)
text.mark_set("insert", first)
return "break"
# Delete whitespace left, until hitting a real char or closest... | [
"def",
"smart_backspace_event",
"(",
"self",
",",
"event",
")",
":",
"text",
"=",
"self",
".",
"text",
"first",
",",
"last",
"=",
"self",
".",
"get_selection_indices",
"(",
")",
"if",
"first",
"and",
"last",
":",
"text",
".",
"delete",
"(",
"first",
",... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/idlelib/EditorWindow.py#L1233-L1279 | |||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/numpy/fft/helper.py | python | _FFTCache.pop_twiddle_factors | (self, n) | Pop twiddle factors for an FFT of length n from the cache.
Will return None if the requested twiddle factors are not available in
the cache.
Parameters
----------
n : int
Data length for the FFT.
Returns
-------
out : ndarray or None
... | Pop twiddle factors for an FFT of length n from the cache. | [
"Pop",
"twiddle",
"factors",
"for",
"an",
"FFT",
"of",
"length",
"n",
"from",
"the",
"cache",
"."
] | def pop_twiddle_factors(self, n):
"""
Pop twiddle factors for an FFT of length n from the cache.
Will return None if the requested twiddle factors are not available in
the cache.
Parameters
----------
n : int
Data length for the FFT.
Returns... | [
"def",
"pop_twiddle_factors",
"(",
"self",
",",
"n",
")",
":",
"with",
"self",
".",
"_lock",
":",
"if",
"n",
"not",
"in",
"self",
".",
"_dict",
"or",
"not",
"self",
".",
"_dict",
"[",
"n",
"]",
":",
"return",
"None",
"# Pop + later add to move it to the ... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/numpy/fft/helper.py#L283-L309 | ||
galaxyproject/galaxy | 4c03520f05062e0f4a1b3655dc0b7452fda69943 | lib/galaxy/managers/hdas.py | python | HDAManager.copy_ldda | (self, history, ldda, **kwargs) | return ldda.to_history_dataset_association(history, add_to_history=True) | Copy this HDA as a LDDA and return. | Copy this HDA as a LDDA and return. | [
"Copy",
"this",
"HDA",
"as",
"a",
"LDDA",
"and",
"return",
"."
] | def copy_ldda(self, history, ldda, **kwargs):
"""
Copy this HDA as a LDDA and return.
"""
return ldda.to_history_dataset_association(history, add_to_history=True) | [
"def",
"copy_ldda",
"(",
"self",
",",
"history",
",",
"ldda",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"ldda",
".",
"to_history_dataset_association",
"(",
"history",
",",
"add_to_history",
"=",
"True",
")"
] | https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/lib/galaxy/managers/hdas.py#L141-L145 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/rings/invariants/invariant_theory.py | python | BinaryQuintic.coeffs | (self) | return self._extract_coefficients(self.monomials()) | The coefficients of a binary quintic.
Given
.. MATH::
f(x) = a_0 x_1^5 + a_1 x_0 x_1^4 + a_2 x_0^2 x_1^3 +
a_3 x_0^3 x_1^2 + a_4 x_0^4 x_1 + a_5 x_1^5
this function returns `a = (a_0, a_1, a_2, a_3, a_4, a_5)`
EXAMPLES::
sage: R.<a0, a1, a... | The coefficients of a binary quintic. | [
"The",
"coefficients",
"of",
"a",
"binary",
"quintic",
"."
] | def coeffs(self):
"""
The coefficients of a binary quintic.
Given
.. MATH::
f(x) = a_0 x_1^5 + a_1 x_0 x_1^4 + a_2 x_0^2 x_1^3 +
a_3 x_0^3 x_1^2 + a_4 x_0^4 x_1 + a_5 x_1^5
this function returns `a = (a_0, a_1, a_2, a_3, a_4, a_5)`
EXAM... | [
"def",
"coeffs",
"(",
"self",
")",
":",
"return",
"self",
".",
"_extract_coefficients",
"(",
"self",
".",
"monomials",
"(",
")",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/invariants/invariant_theory.py#L1752-L1779 | |
TesterlifeRaymond/doraemon | d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333 | venv/lib/python3.6/site-packages/pip/_vendor/requests/utils.py | python | to_key_val_list | (value) | return list(value) | Take an object and test to see if it can be represented as a
dictionary. If it can be, return a list of tuples, e.g.,
::
>>> to_key_val_list([('key', 'val')])
[('key', 'val')]
>>> to_key_val_list({'key': 'val'})
[('key', 'val')]
>>> to_key_val_list('string')
Val... | Take an object and test to see if it can be represented as a
dictionary. If it can be, return a list of tuples, e.g., | [
"Take",
"an",
"object",
"and",
"test",
"to",
"see",
"if",
"it",
"can",
"be",
"represented",
"as",
"a",
"dictionary",
".",
"If",
"it",
"can",
"be",
"return",
"a",
"list",
"of",
"tuples",
"e",
".",
"g",
"."
] | def to_key_val_list(value):
"""Take an object and test to see if it can be represented as a
dictionary. If it can be, return a list of tuples, e.g.,
::
>>> to_key_val_list([('key', 'val')])
[('key', 'val')]
>>> to_key_val_list({'key': 'val'})
[('key', 'val')]
>>> to... | [
"def",
"to_key_val_list",
"(",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"if",
"isinstance",
"(",
"value",
",",
"(",
"str",
",",
"bytes",
",",
"bool",
",",
"int",
")",
")",
":",
"raise",
"ValueError",
"(",
"'cannot encode o... | https://github.com/TesterlifeRaymond/doraemon/blob/d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333/venv/lib/python3.6/site-packages/pip/_vendor/requests/utils.py#L179-L203 | |
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/pandas/io/pytables.py | python | WORMTable.write | (self, **kwargs) | write in a format that we can search later on (but cannot append
to): write out the indicies and the values using _write_array
(e.g. a CArray) create an indexing table so that we can search | write in a format that we can search later on (but cannot append
to): write out the indicies and the values using _write_array
(e.g. a CArray) create an indexing table so that we can search | [
"write",
"in",
"a",
"format",
"that",
"we",
"can",
"search",
"later",
"on",
"(",
"but",
"cannot",
"append",
"to",
")",
":",
"write",
"out",
"the",
"indicies",
"and",
"the",
"values",
"using",
"_write_array",
"(",
"e",
".",
"g",
".",
"a",
"CArray",
")... | def write(self, **kwargs):
""" write in a format that we can search later on (but cannot append
to): write out the indicies and the values using _write_array
(e.g. a CArray) create an indexing table so that we can search
"""
raise NotImplementedError("WORKTable need... | [
"def",
"write",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"WORKTable needs to implement write\"",
")"
] | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/pandas/io/pytables.py#L3704-L3709 | ||
hydroshare/hydroshare | 7ba563b55412f283047fb3ef6da367d41dec58c6 | hs_file_types/nc_functions/nc_utils.py | python | get_nc_dataset | (nc_file_name) | return nc_dataset | (string)-> object
Return: the netCDF dataset | (string)-> object | [
"(",
"string",
")",
"-",
">",
"object"
] | def get_nc_dataset(nc_file_name):
"""
(string)-> object
Return: the netCDF dataset
"""
try:
nc_dataset = netCDF4.Dataset(nc_file_name, 'r')
except Exception:
nc_dataset = None
return nc_dataset | [
"def",
"get_nc_dataset",
"(",
"nc_file_name",
")",
":",
"try",
":",
"nc_dataset",
"=",
"netCDF4",
".",
"Dataset",
"(",
"nc_file_name",
",",
"'r'",
")",
"except",
"Exception",
":",
"nc_dataset",
"=",
"None",
"return",
"nc_dataset"
] | https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/hs_file_types/nc_functions/nc_utils.py#L21-L32 | |
niosus/EasyClangComplete | 3b16eb17735aaa3f56bb295fc5481b269ee9f2ef | plugin/completion/lib_complete.py | python | Completer._is_valid_result | (completion_result, excluded_kinds) | return True | Check if completion is valid.
Remove excluded types and unaccessible members.
Args:
completion_result: completion result from libclang
excluded_kinds (list): list of CursorKind types that shouldn't be
added to completion list
Retur... | Check if completion is valid. | [
"Check",
"if",
"completion",
"is",
"valid",
"."
] | def _is_valid_result(completion_result, excluded_kinds):
"""Check if completion is valid.
Remove excluded types and unaccessible members.
Args:
completion_result: completion result from libclang
excluded_kinds (list): list of CursorKind types that shouldn't be
... | [
"def",
"_is_valid_result",
"(",
"completion_result",
",",
"excluded_kinds",
")",
":",
"if",
"str",
"(",
"completion_result",
".",
"string",
".",
"availability",
")",
"!=",
"\"Available\"",
":",
"return",
"False",
"try",
":",
"if",
"completion_result",
".",
"kind... | https://github.com/niosus/EasyClangComplete/blob/3b16eb17735aaa3f56bb295fc5481b269ee9f2ef/plugin/completion/lib_complete.py#L373-L393 | |
PyHDI/veriloggen | 2382d200deabf59cfcfd741f5eba371010aaf2bb | veriloggen/stream/stypes.py | python | _Variable._implement_input | (self, m, seq, aswire=False) | [] | def _implement_input(self, m, seq, aswire=False):
if self.input_data is None:
raise TypeError("'input_data' must not be None")
# if input_data is an other variable, skip
if isinstance(self.input_data, _Numeric):
return
# if already synthesized
if self.si... | [
"def",
"_implement_input",
"(",
"self",
",",
"m",
",",
"seq",
",",
"aswire",
"=",
"False",
")",
":",
"if",
"self",
".",
"input_data",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"\"'input_data' must not be None\"",
")",
"# if input_data is an other variable, ski... | https://github.com/PyHDI/veriloggen/blob/2382d200deabf59cfcfd741f5eba371010aaf2bb/veriloggen/stream/stypes.py#L2837-L2858 | ||||
BillBillBillBill/Tickeys-linux | 2df31b8665004c58a5d4ab05277f245267d96364 | tickeys/kivy_32/kivy/resources.py | python | resource_add_path | (path) | Add a custom path to search in. | Add a custom path to search in. | [
"Add",
"a",
"custom",
"path",
"to",
"search",
"in",
"."
] | def resource_add_path(path):
'''Add a custom path to search in.
'''
if path in resource_paths:
return
Logger.debug('Resource: add <%s> in path list' % path)
resource_paths.append(path) | [
"def",
"resource_add_path",
"(",
"path",
")",
":",
"if",
"path",
"in",
"resource_paths",
":",
"return",
"Logger",
".",
"debug",
"(",
"'Resource: add <%s> in path list'",
"%",
"path",
")",
"resource_paths",
".",
"append",
"(",
"path",
")"
] | https://github.com/BillBillBillBill/Tickeys-linux/blob/2df31b8665004c58a5d4ab05277f245267d96364/tickeys/kivy_32/kivy/resources.py#L42-L48 | ||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/twitter/twitter_utils.py | python | is_url | (text) | return bool(re.findall(URL_REGEXP, text)) | Checks to see if a bit of text is a URL.
Args:
text: text to check.
Returns:
Boolean of whether the text should be treated as a URL or not. | Checks to see if a bit of text is a URL. | [
"Checks",
"to",
"see",
"if",
"a",
"bit",
"of",
"text",
"is",
"a",
"URL",
"."
] | def is_url(text):
""" Checks to see if a bit of text is a URL.
Args:
text: text to check.
Returns:
Boolean of whether the text should be treated as a URL or not.
"""
return bool(re.findall(URL_REGEXP, text)) | [
"def",
"is_url",
"(",
"text",
")",
":",
"return",
"bool",
"(",
"re",
".",
"findall",
"(",
"URL_REGEXP",
",",
"text",
")",
")"
] | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/twitter/twitter_utils.py#L199-L208 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_pvc.py | python | OpenShiftCLI._evacuate | (self, node=None, selector=None, pod_selector=None, dry_run=False, grace_period=None, force=False) | return self.openshift_cmd(cmd, oadm=True, output=True, output_type='raw') | perform oadm manage-node evacuate | perform oadm manage-node evacuate | [
"perform",
"oadm",
"manage",
"-",
"node",
"evacuate"
] | def _evacuate(self, node=None, selector=None, pod_selector=None, dry_run=False, grace_period=None, force=False):
''' perform oadm manage-node evacuate '''
cmd = ['manage-node']
if node:
cmd.extend(node)
else:
cmd.append('--selector={}'.format(selector))
i... | [
"def",
"_evacuate",
"(",
"self",
",",
"node",
"=",
"None",
",",
"selector",
"=",
"None",
",",
"pod_selector",
"=",
"None",
",",
"dry_run",
"=",
"False",
",",
"grace_period",
"=",
"None",
",",
"force",
"=",
"False",
")",
":",
"cmd",
"=",
"[",
"'manage... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_pvc.py#L1067-L1089 | |
VirtueSecurity/aws-extender | d123b7e1a845847709ba3a481f11996bddc68a1c | BappModules/botocore/vendored/requests/api.py | python | post | (url, data=None, json=None, **kwargs) | return request('post', url, data=data, json=json, **kwargs) | Sends a POST request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of the :class:`Request`.
:param \*\*kwargs: Optional arguments tha... | Sends a POST request. | [
"Sends",
"a",
"POST",
"request",
"."
] | def post(url, data=None, json=None, **kwargs):
"""Sends a POST request.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
:param json: (optional) json data to send in the body of the :class:`R... | [
"def",
"post",
"(",
"url",
",",
"data",
"=",
"None",
",",
"json",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"request",
"(",
"'post'",
",",
"url",
",",
"data",
"=",
"data",
",",
"json",
"=",
"json",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/botocore/vendored/requests/api.py#L98-L109 | |
evennia/evennia | fa79110ba6b219932f22297838e8ac72ebc0be0e | evennia/server/evennia_launcher.py | python | AMPLauncherProtocol.wait_for_status | (self, callback) | Register a waiter for a status return. | Register a waiter for a status return. | [
"Register",
"a",
"waiter",
"for",
"a",
"status",
"return",
"."
] | def wait_for_status(self, callback):
"""
Register a waiter for a status return.
"""
self.on_status.append(callback) | [
"def",
"wait_for_status",
"(",
"self",
",",
"callback",
")",
":",
"self",
".",
"on_status",
".",
"append",
"(",
"callback",
")"
] | https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/server/evennia_launcher.py#L589-L594 | ||
ronghanghu/seg_every_thing | 0bd7b8b2c6b63a8540e01b551b062a714d7488c9 | tools/train_net.py | python | test_model | (model_file, multi_gpu_testing, opts=None) | Test a model. | Test a model. | [
"Test",
"a",
"model",
"."
] | def test_model(model_file, multi_gpu_testing, opts=None):
"""Test a model."""
# Clear memory before inference
workspace.ResetWorkspace()
# Run inference
run_inference(
model_file, multi_gpu_testing=multi_gpu_testing,
check_expected_results=True,
) | [
"def",
"test_model",
"(",
"model_file",
",",
"multi_gpu_testing",
",",
"opts",
"=",
"None",
")",
":",
"# Clear memory before inference",
"workspace",
".",
"ResetWorkspace",
"(",
")",
"# Run inference",
"run_inference",
"(",
"model_file",
",",
"multi_gpu_testing",
"=",... | https://github.com/ronghanghu/seg_every_thing/blob/0bd7b8b2c6b63a8540e01b551b062a714d7488c9/tools/train_net.py#L116-L124 | ||
huggingface/datasets | 249b4a38390bf1543f5b6e2f3dc208b5689c1c13 | datasets/qa_srl/qa_srl.py | python | QaSrl._generate_examples | (self, filepath) | Yields examples. | Yields examples. | [
"Yields",
"examples",
"."
] | def _generate_examples(self, filepath):
"""Yields examples."""
with open(filepath, encoding="utf-8") as f:
qa_counter = 0
# Start reading entries
sent_id, predicates_cnt = f.readline().rstrip("\n").split("\t")
while True:
sentence = f.r... | [
"def",
"_generate_examples",
"(",
"self",
",",
"filepath",
")",
":",
"with",
"open",
"(",
"filepath",
",",
"encoding",
"=",
"\"utf-8\"",
")",
"as",
"f",
":",
"qa_counter",
"=",
"0",
"# Start reading entries",
"sent_id",
",",
"predicates_cnt",
"=",
"f",
".",
... | https://github.com/huggingface/datasets/blob/249b4a38390bf1543f5b6e2f3dc208b5689c1c13/datasets/qa_srl/qa_srl.py#L128-L181 | ||
bendmorris/static-python | 2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473 | Lib/imaplib.py | python | IMAP4.lsub | (self, directory='""', pattern='*') | return self._untagged_response(typ, dat, name) | List 'subscribed' mailbox names in directory matching pattern.
(typ, [data, ...]) = <instance>.lsub(directory='""', pattern='*')
'data' are tuples of message part envelope and data. | List 'subscribed' mailbox names in directory matching pattern. | [
"List",
"subscribed",
"mailbox",
"names",
"in",
"directory",
"matching",
"pattern",
"."
] | def lsub(self, directory='""', pattern='*'):
"""List 'subscribed' mailbox names in directory matching pattern.
(typ, [data, ...]) = <instance>.lsub(directory='""', pattern='*')
'data' are tuples of message part envelope and data.
"""
name = 'LSUB'
typ, dat = self._simpl... | [
"def",
"lsub",
"(",
"self",
",",
"directory",
"=",
"'\"\"'",
",",
"pattern",
"=",
"'*'",
")",
":",
"name",
"=",
"'LSUB'",
"typ",
",",
"dat",
"=",
"self",
".",
"_simple_command",
"(",
"name",
",",
"directory",
",",
"pattern",
")",
"return",
"self",
".... | https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/imaplib.py#L564-L573 | |
A-bone1/Attention-ocr-Chinese-Version | a08d4e587e73bb013cd22eadae250dbbf9cff7d4 | python/sequence_layers.py | python | get_layer_class | (use_attention, use_autoregression) | return layer_class | A convenience function to get a layer class based on requirements.
Args:
use_attention: if True a returned class will use attention.
use_autoregression: if True a returned class will use auto regression.
Returns:
One of available sequence layers (child classes for SequenceLayerBase). | A convenience function to get a layer class based on requirements. | [
"A",
"convenience",
"function",
"to",
"get",
"a",
"layer",
"class",
"based",
"on",
"requirements",
"."
] | def get_layer_class(use_attention, use_autoregression):
"""A convenience function to get a layer class based on requirements.
Args:
use_attention: if True a returned class will use attention.
use_autoregression: if True a returned class will use auto regression.
Returns:
One of available sequence la... | [
"def",
"get_layer_class",
"(",
"use_attention",
",",
"use_autoregression",
")",
":",
"if",
"use_attention",
"and",
"use_autoregression",
":",
"layer_class",
"=",
"AttentionWithAutoregression",
"elif",
"use_attention",
"and",
"not",
"use_autoregression",
":",
"layer_class"... | https://github.com/A-bone1/Attention-ocr-Chinese-Version/blob/a08d4e587e73bb013cd22eadae250dbbf9cff7d4/python/sequence_layers.py#L400-L422 | |
lektor/lektor | d5a7f22343572a991f2316c086f24005d0cbf0f8 | lektor/environment/config.py | python | Config.get_alternative_url_span | (self, alt=PRIMARY_ALT) | return "", "" | Returns the URL span (prefix, suffix) for an alt. | Returns the URL span (prefix, suffix) for an alt. | [
"Returns",
"the",
"URL",
"span",
"(",
"prefix",
"suffix",
")",
"for",
"an",
"alt",
"."
] | def get_alternative_url_span(self, alt=PRIMARY_ALT):
"""Returns the URL span (prefix, suffix) for an alt."""
if alt == PRIMARY_ALT:
alt = self.primary_alternative
cfg = self.values["ALTERNATIVES"].get(alt)
if cfg is not None:
return cfg["url_prefix"] or "", cfg["u... | [
"def",
"get_alternative_url_span",
"(",
"self",
",",
"alt",
"=",
"PRIMARY_ALT",
")",
":",
"if",
"alt",
"==",
"PRIMARY_ALT",
":",
"alt",
"=",
"self",
".",
"primary_alternative",
"cfg",
"=",
"self",
".",
"values",
"[",
"\"ALTERNATIVES\"",
"]",
".",
"get",
"(... | https://github.com/lektor/lektor/blob/d5a7f22343572a991f2316c086f24005d0cbf0f8/lektor/environment/config.py#L241-L248 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/konnected/panel.py | python | AlarmPanel.update_switch | (self, zone, state, momentary=None, times=None, pause=None) | Update the state of a switchable output. | Update the state of a switchable output. | [
"Update",
"the",
"state",
"of",
"a",
"switchable",
"output",
"."
] | async def update_switch(self, zone, state, momentary=None, times=None, pause=None):
"""Update the state of a switchable output."""
try:
if self.client:
if self.api_version == CONF_ZONE:
return await self.client.put_zone(
zone,
... | [
"async",
"def",
"update_switch",
"(",
"self",
",",
"zone",
",",
"state",
",",
"momentary",
"=",
"None",
",",
"times",
"=",
"None",
",",
"pause",
"=",
"None",
")",
":",
"try",
":",
"if",
"self",
".",
"client",
":",
"if",
"self",
".",
"api_version",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/konnected/panel.py#L166-L191 | ||
Kismuz/btgym | 7fb3316e67f1d7a17c620630fb62fb29428b2cec | btgym/research/strategy_gen_5/base.py | python | BaseStrategy5.update_broker_stat | (self) | Updates all sliding broker statistics deques with latest-step values such as:
- normalized broker value
- normalized broker cash
- normalized exposure (position size)
- exp. scaled episode duration in steps, normalized wrt. max possible episode steps
- normali... | Updates all sliding broker statistics deques with latest-step values such as:
- normalized broker value
- normalized broker cash
- normalized exposure (position size)
- exp. scaled episode duration in steps, normalized wrt. max possible episode steps
- normali... | [
"Updates",
"all",
"sliding",
"broker",
"statistics",
"deques",
"with",
"latest",
"-",
"step",
"values",
"such",
"as",
":",
"-",
"normalized",
"broker",
"value",
"-",
"normalized",
"broker",
"cash",
"-",
"normalized",
"exposure",
"(",
"position",
"size",
")",
... | def update_broker_stat(self):
"""
Updates all sliding broker statistics deques with latest-step values such as:
- normalized broker value
- normalized broker cash
- normalized exposure (position size)
- exp. scaled episode duration in steps, normalized wrt... | [
"def",
"update_broker_stat",
"(",
"self",
")",
":",
"# Current account value:",
"current_value",
"=",
"self",
".",
"env",
".",
"broker",
".",
"get_value",
"(",
")",
"# Individual positions for each instrument traded:",
"positions",
"=",
"[",
"self",
".",
"env",
".",... | https://github.com/Kismuz/btgym/blob/7fb3316e67f1d7a17c620630fb62fb29428b2cec/btgym/research/strategy_gen_5/base.py#L426-L454 | ||
sametmax/Django--an-app-at-a-time | 99eddf12ead76e6dfbeb09ce0bae61e282e22f8a | ignore_this_directory/django/template/defaultfilters.py | python | urlize | (value, autoescape=True) | return mark_safe(_urlize(value, nofollow=True, autoescape=autoescape)) | Convert URLs in plain text into clickable links. | Convert URLs in plain text into clickable links. | [
"Convert",
"URLs",
"in",
"plain",
"text",
"into",
"clickable",
"links",
"."
] | def urlize(value, autoescape=True):
"""Convert URLs in plain text into clickable links."""
return mark_safe(_urlize(value, nofollow=True, autoescape=autoescape)) | [
"def",
"urlize",
"(",
"value",
",",
"autoescape",
"=",
"True",
")",
":",
"return",
"mark_safe",
"(",
"_urlize",
"(",
"value",
",",
"nofollow",
"=",
"True",
",",
"autoescape",
"=",
"autoescape",
")",
")"
] | https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/template/defaultfilters.py#L326-L328 | |
armijnhemel/binaryanalysis-ng | 34c655ed71d3d022ee49c4e1271002b2ebf40001 | src/bangfilescans.py | python | unpack_ssh_known_hosts | (fileresult, scanenvironment, offset, unpackdir) | return {'status': True, 'length': filesize, 'labels': labels,
'filesandlabels': unpackedfilesandlabels} | Verify a SSH known hosts file. | Verify a SSH known hosts file. | [
"Verify",
"a",
"SSH",
"known",
"hosts",
"file",
"."
] | def unpack_ssh_known_hosts(fileresult, scanenvironment, offset, unpackdir):
'''Verify a SSH known hosts file.'''
filesize = fileresult.filesize
filename_full = scanenvironment.unpack_path(fileresult.filename)
unpackedfilesandlabels = []
labels = []
unpackingerror = {}
unpackedsize = 0
#... | [
"def",
"unpack_ssh_known_hosts",
"(",
"fileresult",
",",
"scanenvironment",
",",
"offset",
",",
"unpackdir",
")",
":",
"filesize",
"=",
"fileresult",
".",
"filesize",
"filename_full",
"=",
"scanenvironment",
".",
"unpack_path",
"(",
"fileresult",
".",
"filename",
... | https://github.com/armijnhemel/binaryanalysis-ng/blob/34c655ed71d3d022ee49c4e1271002b2ebf40001/src/bangfilescans.py#L623-L706 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/glob.py | python | escape | (pathname) | return drive + pathname | Escape all special characters. | Escape all special characters. | [
"Escape",
"all",
"special",
"characters",
"."
] | def escape(pathname):
"""Escape all special characters.
"""
# Escaping is done by wrapping any of "*?[" between square brackets.
# Metacharacters do not work in the drive part and shouldn't be escaped.
drive, pathname = os.path.splitdrive(pathname)
if isinstance(pathname, bytes):
pathnam... | [
"def",
"escape",
"(",
"pathname",
")",
":",
"# Escaping is done by wrapping any of \"*?[\" between square brackets.",
"# Metacharacters do not work in the drive part and shouldn't be escaped.",
"drive",
",",
"pathname",
"=",
"os",
".",
"path",
".",
"splitdrive",
"(",
"pathname",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/glob.py#L161-L171 | |
PySimpleGUI/PySimpleGUI | 6c0d1fb54f493d45e90180b322fbbe70f7a5af3c | UserCreatedPrograms/Minesweeper_Colored_Numbers.py | python | button.right_click | (self) | [] | def right_click(self): # Right_click handler
if self.state == 1:
self.update(3)
elif self.state == 3:
self.update(1) | [
"def",
"right_click",
"(",
"self",
")",
":",
"# Right_click handler",
"if",
"self",
".",
"state",
"==",
"1",
":",
"self",
".",
"update",
"(",
"3",
")",
"elif",
"self",
".",
"state",
"==",
"3",
":",
"self",
".",
"update",
"(",
"1",
")"
] | https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/UserCreatedPrograms/Minesweeper_Colored_Numbers.py#L136-L140 | ||||
nosmokingbandit/Watcher3 | 0217e75158b563bdefc8e01c3be7620008cf3977 | lib/sqlalchemy/util/langhelpers.py | python | wrap_callable | (wrapper, fn) | Augment functools.update_wrapper() to work with objects with
a ``__call__()`` method.
:param fn:
object with __call__ method | Augment functools.update_wrapper() to work with objects with
a ``__call__()`` method. | [
"Augment",
"functools",
".",
"update_wrapper",
"()",
"to",
"work",
"with",
"objects",
"with",
"a",
"__call__",
"()",
"method",
"."
] | def wrap_callable(wrapper, fn):
"""Augment functools.update_wrapper() to work with objects with
a ``__call__()`` method.
:param fn:
object with __call__ method
"""
if hasattr(fn, '__name__'):
return update_wrapper(wrapper, fn)
else:
_f = wrapper
_f.__name__ = fn._... | [
"def",
"wrap_callable",
"(",
"wrapper",
",",
"fn",
")",
":",
"if",
"hasattr",
"(",
"fn",
",",
"'__name__'",
")",
":",
"return",
"update_wrapper",
"(",
"wrapper",
",",
"fn",
")",
"else",
":",
"_f",
"=",
"wrapper",
"_f",
".",
"__name__",
"=",
"fn",
"."... | https://github.com/nosmokingbandit/Watcher3/blob/0217e75158b563bdefc8e01c3be7620008cf3977/lib/sqlalchemy/util/langhelpers.py#L1388-L1409 | ||
hankcs/HanLP | 6c02812969c4827d74b404c3ad4207f71ca9165a | hanlp/transform/transformer_tokenizer.py | python | TransformerSequenceTokenizer.__init__ | (self,
tokenizer: Union[PreTrainedTokenizer, str],
input_key,
output_key=None,
max_seq_length=512,
truncate_long_sequences=False,
config: PretrainedConfig = None,
cls_token_at_end=False,
... | A transformer tokenizer for token-level tasks. It honors the boundary of tokens and tokenize each token into
several subtokens then merge them. The information about each subtoken belongs to which token are kept and
returned as a new field in the sample. It also provides out-of-box sliding window trick ... | A transformer tokenizer for token-level tasks. It honors the boundary of tokens and tokenize each token into
several subtokens then merge them. The information about each subtoken belongs to which token are kept and
returned as a new field in the sample. It also provides out-of-box sliding window trick ... | [
"A",
"transformer",
"tokenizer",
"for",
"token",
"-",
"level",
"tasks",
".",
"It",
"honors",
"the",
"boundary",
"of",
"tokens",
"and",
"tokenize",
"each",
"token",
"into",
"several",
"subtokens",
"then",
"merge",
"them",
".",
"The",
"information",
"about",
"... | def __init__(self,
tokenizer: Union[PreTrainedTokenizer, str],
input_key,
output_key=None,
max_seq_length=512,
truncate_long_sequences=False,
config: PretrainedConfig = None,
cls_token_at_end=False,
... | [
"def",
"__init__",
"(",
"self",
",",
"tokenizer",
":",
"Union",
"[",
"PreTrainedTokenizer",
",",
"str",
"]",
",",
"input_key",
",",
"output_key",
"=",
"None",
",",
"max_seq_length",
"=",
"512",
",",
"truncate_long_sequences",
"=",
"False",
",",
"config",
":"... | https://github.com/hankcs/HanLP/blob/6c02812969c4827d74b404c3ad4207f71ca9165a/hanlp/transform/transformer_tokenizer.py#L84-L241 | ||
kalliope-project/kalliope | 7b2bb4671c8fbfa0ea9f768c84994fe75da974eb | kalliope/core/OrderAnalyser.py | python | OrderAnalyser.is_order_matching_signal | (cls, user_order, signal) | return True if the user_order matches the provided signal. False otherwise
Note: it applies `stt-correction` and handles `not-contain` matching type.
:param user_order: order from the user
:param signal: The signal to compare with the user_order
:return: True if the order match | return True if the user_order matches the provided signal. False otherwise
Note: it applies `stt-correction` and handles `not-contain` matching type.
:param user_order: order from the user
:param signal: The signal to compare with the user_order
:return: True if the order match | [
"return",
"True",
"if",
"the",
"user_order",
"matches",
"the",
"provided",
"signal",
".",
"False",
"otherwise",
"Note",
":",
"it",
"applies",
"stt",
"-",
"correction",
"and",
"handles",
"not",
"-",
"contain",
"matching",
"type",
".",
":",
"param",
"user_orde... | def is_order_matching_signal(cls, user_order, signal):
"""
return True if the user_order matches the provided signal. False otherwise
Note: it applies `stt-correction` and handles `not-contain` matching type.
:param user_order: order from the user
:param signal: The signal to com... | [
"def",
"is_order_matching_signal",
"(",
"cls",
",",
"user_order",
",",
"signal",
")",
":",
"matching_type_function",
"=",
"{",
"\"normal\"",
":",
"cls",
".",
"is_normal_matching",
",",
"\"strict\"",
":",
"cls",
".",
"is_strict_matching",
",",
"\"ordered-strict\"",
... | https://github.com/kalliope-project/kalliope/blob/7b2bb4671c8fbfa0ea9f768c84994fe75da974eb/kalliope/core/OrderAnalyser.py#L271-L302 | ||
qtile/qtile | 803dc06fc1f8b121a1d8fe047f26a43812cd427f | libqtile/scratchpad.py | python | ScratchPad.cmd_dropdown_toggle | (self, name) | Toggle visibility of named DropDown. | Toggle visibility of named DropDown. | [
"Toggle",
"visibility",
"of",
"named",
"DropDown",
"."
] | def cmd_dropdown_toggle(self, name):
"""
Toggle visibility of named DropDown.
"""
if self._single:
for n, d in self.dropdowns.items():
if n != name:
d.hide()
if name in self.dropdowns:
self.dropdowns[name].toggle()
... | [
"def",
"cmd_dropdown_toggle",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"_single",
":",
"for",
"n",
",",
"d",
"in",
"self",
".",
"dropdowns",
".",
"items",
"(",
")",
":",
"if",
"n",
"!=",
"name",
":",
"d",
".",
"hide",
"(",
")",
"i... | https://github.com/qtile/qtile/blob/803dc06fc1f8b121a1d8fe047f26a43812cd427f/libqtile/scratchpad.py#L306-L318 | ||
CouchPotato/CouchPotatoServer | 7260c12f72447ddb6f062367c6dfbda03ecd4e9c | libs/httplib2/__init__.py | python | Http.clear_credentials | (self) | Remove all the names and passwords
that are used for authentication | Remove all the names and passwords
that are used for authentication | [
"Remove",
"all",
"the",
"names",
"and",
"passwords",
"that",
"are",
"used",
"for",
"authentication"
] | def clear_credentials(self):
"""Remove all the names and passwords
that are used for authentication"""
self.credentials.clear()
self.authorizations = [] | [
"def",
"clear_credentials",
"(",
"self",
")",
":",
"self",
".",
"credentials",
".",
"clear",
"(",
")",
"self",
".",
"authorizations",
"=",
"[",
"]"
] | https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/httplib2/__init__.py#L1244-L1248 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/site-packages/Crypto/Cipher/ARC4.py | python | ARC4Cipher.__init__ | (self, key, *args, **kwargs) | Initialize an ARC4 cipher object
See also `new()` at the module level. | Initialize an ARC4 cipher object
See also `new()` at the module level. | [
"Initialize",
"an",
"ARC4",
"cipher",
"object",
"See",
"also",
"new",
"()",
"at",
"the",
"module",
"level",
"."
] | def __init__(self, key, *args, **kwargs):
"""Initialize an ARC4 cipher object
See also `new()` at the module level."""
self._cipher = _ARC4.new(key, *args, **kwargs)
self.block_size = self._cipher.block_size
self.key_size = self._cipher.key_size | [
"def",
"__init__",
"(",
"self",
",",
"key",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_cipher",
"=",
"_ARC4",
".",
"new",
"(",
"key",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"block_size",
"=",
"self... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/site-packages/Crypto/Cipher/ARC4.py#L72-L79 | ||
nccgroup/fuzzowski | a9f96700a2697a66f5d7af5e817835bd3f1f790c | fuzzowski/mutants/imutant.py | python | IMutant.mutation_generator | (self, mutant_index: int = 0) | Creates a generator that will change the Mutant and return the mutated value
Args:
mutant_index: It initializes the mutant_index at the specified value
Returns:
Generator: The mutations generator | Creates a generator that will change the Mutant and return the mutated value | [
"Creates",
"a",
"generator",
"that",
"will",
"change",
"the",
"Mutant",
"and",
"return",
"the",
"mutated",
"value"
] | def mutation_generator(self, mutant_index: int = 0) -> Generator[bytes, None, None]:
"""
Creates a generator that will change the Mutant and return the mutated value
Args:
mutant_index: It initializes the mutant_index at the specified value
Returns:
Generator: T... | [
"def",
"mutation_generator",
"(",
"self",
",",
"mutant_index",
":",
"int",
"=",
"0",
")",
"->",
"Generator",
"[",
"bytes",
",",
"None",
",",
"None",
"]",
":",
"pass"
] | https://github.com/nccgroup/fuzzowski/blob/a9f96700a2697a66f5d7af5e817835bd3f1f790c/fuzzowski/mutants/imutant.py#L115-L125 | ||
jiangxinyang227/NLP-Project | b11f67d8962f40e17990b4fc4551b0ea5496881c | pre_trained_model/bert_model/tf_metrics.py | python | fbeta | (labels, predictions, num_classes, pos_indices=None, weights=None,
average='micro', beta=1) | return (fbeta, op) | Multi-class fbeta metric for Tensorflow
Parameters
----------
labels : Tensor of tf.int32 or tf.int64
The true labels
predictions : Tensor of tf.int32 or tf.int64
The predictions, same shape as labels
num_classes : int
The number of classes
pos_indices : list of int, opti... | Multi-class fbeta metric for Tensorflow
Parameters
----------
labels : Tensor of tf.int32 or tf.int64
The true labels
predictions : Tensor of tf.int32 or tf.int64
The predictions, same shape as labels
num_classes : int
The number of classes
pos_indices : list of int, opti... | [
"Multi",
"-",
"class",
"fbeta",
"metric",
"for",
"Tensorflow",
"Parameters",
"----------",
"labels",
":",
"Tensor",
"of",
"tf",
".",
"int32",
"or",
"tf",
".",
"int64",
"The",
"true",
"labels",
"predictions",
":",
"Tensor",
"of",
"tf",
".",
"int32",
"or",
... | def fbeta(labels, predictions, num_classes, pos_indices=None, weights=None,
average='micro', beta=1):
"""Multi-class fbeta metric for Tensorflow
Parameters
----------
labels : Tensor of tf.int32 or tf.int64
The true labels
predictions : Tensor of tf.int32 or tf.int64
The pr... | [
"def",
"fbeta",
"(",
"labels",
",",
"predictions",
",",
"num_classes",
",",
"pos_indices",
"=",
"None",
",",
"weights",
"=",
"None",
",",
"average",
"=",
"'micro'",
",",
"beta",
"=",
"1",
")",
":",
"cm",
",",
"op",
"=",
"_streaming_confusion_matrix",
"("... | https://github.com/jiangxinyang227/NLP-Project/blob/b11f67d8962f40e17990b4fc4551b0ea5496881c/pre_trained_model/bert_model/tf_metrics.py#L97-L134 | |
JetBrains/python-skeletons | 95ad24b666e475998e5d1cc02ed53a2188036167 | numpy/core/__init__.py | python | longlong.__rfloordiv__ | (self, *args, **kwargs) | Return value//self. | Return value//self. | [
"Return",
"value",
"//",
"self",
"."
] | def __rfloordiv__(self, *args, **kwargs): # real signature unknown
""" Return value//self. """
pass | [
"def",
"__rfloordiv__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# real signature unknown",
"pass"
] | https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/numpy/core/__init__.py#L3133-L3135 | ||
bendmorris/static-python | 2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473 | Lib/mailcap.py | python | parseline | (line) | return key, fields | Parse one entry in a mailcap file and return a dictionary.
The viewing command is stored as the value with the key "view",
and the rest of the fields produce key-value pairs in the dict. | Parse one entry in a mailcap file and return a dictionary. | [
"Parse",
"one",
"entry",
"in",
"a",
"mailcap",
"file",
"and",
"return",
"a",
"dictionary",
"."
] | def parseline(line):
"""Parse one entry in a mailcap file and return a dictionary.
The viewing command is stored as the value with the key "view",
and the rest of the fields produce key-value pairs in the dict.
"""
fields = []
i, n = 0, len(line)
while i < n:
field, i = parsefield(l... | [
"def",
"parseline",
"(",
"line",
")",
":",
"fields",
"=",
"[",
"]",
"i",
",",
"n",
"=",
"0",
",",
"len",
"(",
"line",
")",
"while",
"i",
"<",
"n",
":",
"field",
",",
"i",
"=",
"parsefield",
"(",
"line",
",",
"i",
",",
"n",
")",
"fields",
".... | https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/mailcap.py#L91-L120 | |
angr/claripy | 4c961b4dc664706be8142fe4868f27655bc8da77 | claripy/backends/backend_concrete.py | python | BackendConcrete.convert | (self, expr) | return super().convert(expr) | Override Backend.convert() to add fast paths for BVVs and BoolVs. | Override Backend.convert() to add fast paths for BVVs and BoolVs. | [
"Override",
"Backend",
".",
"convert",
"()",
"to",
"add",
"fast",
"paths",
"for",
"BVVs",
"and",
"BoolVs",
"."
] | def convert(self, expr):
"""
Override Backend.convert() to add fast paths for BVVs and BoolVs.
"""
if type(expr) is BV:
if expr.op == "BVV":
cached_obj = self._object_cache.get(expr._cache_key, None)
if cached_obj is None:
c... | [
"def",
"convert",
"(",
"self",
",",
"expr",
")",
":",
"if",
"type",
"(",
"expr",
")",
"is",
"BV",
":",
"if",
"expr",
".",
"op",
"==",
"\"BVV\"",
":",
"cached_obj",
"=",
"self",
".",
"_object_cache",
".",
"get",
"(",
"expr",
".",
"_cache_key",
",",
... | https://github.com/angr/claripy/blob/4c961b4dc664706be8142fe4868f27655bc8da77/claripy/backends/backend_concrete.py#L90-L103 | |
CastagnaIT/plugin.video.netflix | 5cf5fa436eb9956576c0f62aa31a4c7d6c5b8a4a | packages/httpx/_models.py | python | URL.raw_host | (self) | return host.encode("ascii") | The raw bytes representation of the URL host.
Always normalized to lowercase, and IDNA encoded.
Examples:
url = httpx.URL("http://www.EXAMPLE.org")
assert url.raw_host == b"www.example.org"
url = httpx.URL("http://中国.icom.museum")
assert url.raw_host == b"xn--fiqs8s.ic... | The raw bytes representation of the URL host.
Always normalized to lowercase, and IDNA encoded. | [
"The",
"raw",
"bytes",
"representation",
"of",
"the",
"URL",
"host",
".",
"Always",
"normalized",
"to",
"lowercase",
"and",
"IDNA",
"encoded",
"."
] | def raw_host(self) -> bytes:
"""
The raw bytes representation of the URL host.
Always normalized to lowercase, and IDNA encoded.
Examples:
url = httpx.URL("http://www.EXAMPLE.org")
assert url.raw_host == b"www.example.org"
url = httpx.URL("http://中国.icom.museum... | [
"def",
"raw_host",
"(",
"self",
")",
"->",
"bytes",
":",
"host",
":",
"str",
"=",
"self",
".",
"_uri_reference",
".",
"host",
"or",
"\"\"",
"if",
"host",
"and",
"\":\"",
"in",
"host",
"and",
"host",
"[",
"0",
"]",
"==",
"\"[\"",
":",
"# it's an IPv6 ... | https://github.com/CastagnaIT/plugin.video.netflix/blob/5cf5fa436eb9956576c0f62aa31a4c7d6c5b8a4a/packages/httpx/_models.py#L250-L275 | |
arthurdejong/python-stdnum | 02dec52602ae0709b940b781fc1fcebfde7340b7 | stdnum/pl/regon.py | python | compact | (number) | return clean(number, ' -').upper().strip() | Convert the number to the minimal representation. This strips the
number of any valid separators and removes surrounding whitespace. | Convert the number to the minimal representation. This strips the
number of any valid separators and removes surrounding whitespace. | [
"Convert",
"the",
"number",
"to",
"the",
"minimal",
"representation",
".",
"This",
"strips",
"the",
"number",
"of",
"any",
"valid",
"separators",
"and",
"removes",
"surrounding",
"whitespace",
"."
] | def compact(number):
"""Convert the number to the minimal representation. This strips the
number of any valid separators and removes surrounding whitespace."""
return clean(number, ' -').upper().strip() | [
"def",
"compact",
"(",
"number",
")",
":",
"return",
"clean",
"(",
"number",
",",
"' -'",
")",
".",
"upper",
"(",
")",
".",
"strip",
"(",
")"
] | https://github.com/arthurdejong/python-stdnum/blob/02dec52602ae0709b940b781fc1fcebfde7340b7/stdnum/pl/regon.py#L57-L60 | |
Taxel/PlexTraktSync | 1afead73580081e9e4329a2fa270683432d55155 | plextraktsync/trakt_api.py | python | TraktBatch.add_to_collection | (self, media_type: str, item) | Add item of media_type to collection | Add item of media_type to collection | [
"Add",
"item",
"of",
"media_type",
"to",
"collection"
] | def add_to_collection(self, media_type: str, item):
"""
Add item of media_type to collection
"""
if media_type not in self.collection:
self.collection[media_type] = []
self.collection[media_type].append(item)
self.flush() | [
"def",
"add_to_collection",
"(",
"self",
",",
"media_type",
":",
"str",
",",
"item",
")",
":",
"if",
"media_type",
"not",
"in",
"self",
".",
"collection",
":",
"self",
".",
"collection",
"[",
"media_type",
"]",
"=",
"[",
"]",
"self",
".",
"collection",
... | https://github.com/Taxel/PlexTraktSync/blob/1afead73580081e9e4329a2fa270683432d55155/plextraktsync/trakt_api.py#L327-L335 | ||
alibaba/iOSSecAudit | f94ed3254263f3382f374e3f05afae8a1fe79f20 | lib/taskutil.py | python | TaskUtil.crack_ipa_inpath | (self, path, save_path) | [] | def crack_ipa_inpath(self, path, save_path):
""""""
#check check check
if path is None:
return None
abpath = os.path.abspath(os.path.expanduser(path))
if not os.path.exists(abpath):
G.log(G.INFO, 'File \'{}\' not exist.')
retu... | [
"def",
"crack_ipa_inpath",
"(",
"self",
",",
"path",
",",
"save_path",
")",
":",
"#check check check",
"if",
"path",
"is",
"None",
":",
"return",
"None",
"abpath",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
... | https://github.com/alibaba/iOSSecAudit/blob/f94ed3254263f3382f374e3f05afae8a1fe79f20/lib/taskutil.py#L882-L951 | ||||
scrapy/scrapy | b04cfa48328d5d5749dca6f50fa34e0cfc664c89 | scrapy/linkextractors/__init__.py | python | FilteringLinkExtractor.__init__ | (self, link_extractor, allow, deny, allow_domains, deny_domains,
restrict_xpaths, canonicalize, deny_extensions, restrict_css, restrict_text) | [] | def __init__(self, link_extractor, allow, deny, allow_domains, deny_domains,
restrict_xpaths, canonicalize, deny_extensions, restrict_css, restrict_text):
self.link_extractor = link_extractor
self.allow_res = [x if isinstance(x, _re_type) else re.compile(x)
f... | [
"def",
"__init__",
"(",
"self",
",",
"link_extractor",
",",
"allow",
",",
"deny",
",",
"allow_domains",
",",
"deny_domains",
",",
"restrict_xpaths",
",",
"canonicalize",
",",
"deny_extensions",
",",
"restrict_css",
",",
"restrict_text",
")",
":",
"self",
".",
... | https://github.com/scrapy/scrapy/blob/b04cfa48328d5d5749dca6f50fa34e0cfc664c89/scrapy/linkextractors/__init__.py#L70-L92 | ||||
isnowfy/pydown | 71ecc891868cd2a34b7e5fe662c99474f2d0fd7f | pygments/lexers/templates.py | python | DjangoLexer.analyse_text | (text) | return rv | [] | def analyse_text(text):
rv = 0.0
if re.search(r'\{%\s*(block|extends)', text) is not None:
rv += 0.4
if re.search(r'\{%\s*if\s*.*?%\}', text) is not None:
rv += 0.1
if re.search(r'\{\{.*?\}\}', text) is not None:
rv += 0.1
return rv | [
"def",
"analyse_text",
"(",
"text",
")",
":",
"rv",
"=",
"0.0",
"if",
"re",
".",
"search",
"(",
"r'\\{%\\s*(block|extends)'",
",",
"text",
")",
"is",
"not",
"None",
":",
"rv",
"+=",
"0.4",
"if",
"re",
".",
"search",
"(",
"r'\\{%\\s*if\\s*.*?%\\}'",
",",
... | https://github.com/isnowfy/pydown/blob/71ecc891868cd2a34b7e5fe662c99474f2d0fd7f/pygments/lexers/templates.py#L381-L389 | |||
zh-plus/video-to-pose3D | c1e14af8d184f08d510826852da5a06c57d4a4ec | pose_trackers/lighttrack/lib/setup.py | python | customize_compiler_for_nvcc | (self) | inject deep into distutils to customize how the dispatch
to gcc/nvcc works.
If you subclass UnixCCompiler, it's not trivial to get your subclass
injected in, and still have the right customizations (i.e.
distutils.sysconfig.customize_compiler) run on it. So instead of going
the OO route, I have thi... | inject deep into distutils to customize how the dispatch
to gcc/nvcc works. | [
"inject",
"deep",
"into",
"distutils",
"to",
"customize",
"how",
"the",
"dispatch",
"to",
"gcc",
"/",
"nvcc",
"works",
"."
] | def customize_compiler_for_nvcc(self):
"""inject deep into distutils to customize how the dispatch
to gcc/nvcc works.
If you subclass UnixCCompiler, it's not trivial to get your subclass
injected in, and still have the right customizations (i.e.
distutils.sysconfig.customize_compiler) run on it. So... | [
"def",
"customize_compiler_for_nvcc",
"(",
"self",
")",
":",
"# tell the compiler it can processes .cu",
"self",
".",
"src_extensions",
".",
"append",
"(",
"'.cu'",
")",
"# save references to the default compiler_so and _comple methods",
"default_compiler_so",
"=",
"self",
".",... | https://github.com/zh-plus/video-to-pose3D/blob/c1e14af8d184f08d510826852da5a06c57d4a4ec/pose_trackers/lighttrack/lib/setup.py#L63-L99 | ||
sametmax/Django--an-app-at-a-time | 99eddf12ead76e6dfbeb09ce0bae61e282e22f8a | ignore_this_directory/django/contrib/admin/views/main.py | python | ChangeList.get_ordering_field_columns | (self) | return ordering_fields | Return an OrderedDict of ordering field column numbers and asc/desc. | Return an OrderedDict of ordering field column numbers and asc/desc. | [
"Return",
"an",
"OrderedDict",
"of",
"ordering",
"field",
"column",
"numbers",
"and",
"asc",
"/",
"desc",
"."
] | def get_ordering_field_columns(self):
"""
Return an OrderedDict of ordering field column numbers and asc/desc.
"""
# We must cope with more than one column having the same underlying sort
# field, so we base things on column numbers.
ordering = self._get_default_ordering(... | [
"def",
"get_ordering_field_columns",
"(",
"self",
")",
":",
"# We must cope with more than one column having the same underlying sort",
"# field, so we base things on column numbers.",
"ordering",
"=",
"self",
".",
"_get_default_ordering",
"(",
")",
"ordering_fields",
"=",
"Ordered... | https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/contrib/admin/views/main.py#L362-L400 | |
CGATOxford/cgat | 326aad4694bdfae8ddc194171bb5d73911243947 | CGAT/dictzip.py | python | open | (filename, mode="rb", compresslevel=9, buffersize=None, chunksize=58315) | return GzipFile(filename, mode, compresslevel, buffersize=buffersize, chunksize=chunksize) | Shorthand for GzipFile(filename, mode, compresslevel, buffersize, chunksize).
The filename argument is required; mode defaults to 'rb', compresslevel
defaults to 9, buffersize to None (no random access points) and chunksize to 58315
(good compression but slowish seeks; irrelevant without random access poin... | Shorthand for GzipFile(filename, mode, compresslevel, buffersize, chunksize). | [
"Shorthand",
"for",
"GzipFile",
"(",
"filename",
"mode",
"compresslevel",
"buffersize",
"chunksize",
")",
"."
] | def open(filename, mode="rb", compresslevel=9, buffersize=None, chunksize=58315):
"""Shorthand for GzipFile(filename, mode, compresslevel, buffersize, chunksize).
The filename argument is required; mode defaults to 'rb', compresslevel
defaults to 9, buffersize to None (no random access points) and chunksiz... | [
"def",
"open",
"(",
"filename",
",",
"mode",
"=",
"\"rb\"",
",",
"compresslevel",
"=",
"9",
",",
"buffersize",
"=",
"None",
",",
"chunksize",
"=",
"58315",
")",
":",
"return",
"GzipFile",
"(",
"filename",
",",
"mode",
",",
"compresslevel",
",",
"buffersi... | https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/CGAT/dictzip.py#L54-L62 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_service.py | python | locate_oc_binary | () | return oc_binary | Find and return oc binary file | Find and return oc binary file | [
"Find",
"and",
"return",
"oc",
"binary",
"file"
] | def locate_oc_binary():
''' Find and return oc binary file '''
# https://github.com/openshift/openshift-ansible/issues/3410
# oc can be in /usr/local/bin in some cases, but that may not
# be in $PATH due to ansible/sudo
paths = os.environ.get("PATH", os.defpath).split(os.pathsep) + ADDITIONAL_PATH_L... | [
"def",
"locate_oc_binary",
"(",
")",
":",
"# https://github.com/openshift/openshift-ansible/issues/3410",
"# oc can be in /usr/local/bin in some cases, but that may not",
"# be in $PATH due to ansible/sudo",
"paths",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"\"PATH\"",
",",
"o... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_service.py#L909-L929 | |
mwaskom/seaborn | 77e3b6b03763d24cc99a8134ee9a6f43b32b8e7b | seaborn/distributions.py | python | rugplot | (
x=None, # Allow positional x, because behavior won't change
*,
height=.025, axis=None, ax=None,
# New parameters
data=None, y=None, hue=None,
palette=None, hue_order=None, hue_norm=None,
expand_margins=True,
legend=True, # TODO or maybe default to False?
# Renamed parameter
... | return ax | [] | def rugplot(
x=None, # Allow positional x, because behavior won't change
*,
height=.025, axis=None, ax=None,
# New parameters
data=None, y=None, hue=None,
palette=None, hue_order=None, hue_norm=None,
expand_margins=True,
legend=True, # TODO or maybe default to False?
# Renamed pa... | [
"def",
"rugplot",
"(",
"x",
"=",
"None",
",",
"# Allow positional x, because behavior won't change",
"*",
",",
"height",
"=",
".025",
",",
"axis",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"# New parameters",
"data",
"=",
"None",
",",
"y",
"=",
"None",
","... | https://github.com/mwaskom/seaborn/blob/77e3b6b03763d24cc99a8134ee9a6f43b32b8e7b/seaborn/distributions.py#L2016-L2089 | |||
ranahanocka/point2mesh | 333dba0b2ced97adfbdb62a5383d04bb5628680b | models/networks.py | python | DownConv.__init__ | (self, in_channels, out_channels, blocks=0, pool=0, leaky=0) | [] | def __init__(self, in_channels, out_channels, blocks=0, pool=0, leaky=0):
super(DownConv, self).__init__()
self.leaky = leaky
self.bn = []
self.pool = None
self.conv1 = ConvBlock(in_channels, out_channels)
self.conv2 = []
for _ in range(blocks):
self.c... | [
"def",
"__init__",
"(",
"self",
",",
"in_channels",
",",
"out_channels",
",",
"blocks",
"=",
"0",
",",
"pool",
"=",
"0",
",",
"leaky",
"=",
"0",
")",
":",
"super",
"(",
"DownConv",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"leaky",
... | https://github.com/ranahanocka/point2mesh/blob/333dba0b2ced97adfbdb62a5383d04bb5628680b/models/networks.py#L188-L202 | ||||
dlenski/vpn-slice | c10c3eaccc658ff12b113e6e017b170a2567c447 | vpn_slice/mac.py | python | PfFirewallProvider.configure_firewall | (self, device) | [] | def configure_firewall(self, device):
# Enabled Packet Filter - increments a reference counter for processes that need packet filter enabled
cl = [self.pfctl, '-E']
p = subprocess.Popen(cl, universal_newlines=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
output, stderr = p.commun... | [
"def",
"configure_firewall",
"(",
"self",
",",
"device",
")",
":",
"# Enabled Packet Filter - increments a reference counter for processes that need packet filter enabled",
"cl",
"=",
"[",
"self",
".",
"pfctl",
",",
"'-E'",
"]",
"p",
"=",
"subprocess",
".",
"Popen",
"("... | https://github.com/dlenski/vpn-slice/blob/c10c3eaccc658ff12b113e6e017b170a2567c447/vpn_slice/mac.py#L151-L190 | ||||
radlab/sparrow | afb8efadeb88524f1394d1abe4ea66c6fd2ac744 | upload.py | python | EncodeMultipartFormData | (fields, files) | return content_type, body | Encode form fields for multipart/form-data.
Args:
fields: A sequence of (name, value) elements for regular form fields.
files: A sequence of (name, filename, value) elements for data to be
uploaded as files.
Returns:
(content_type, body) ready for httplib.HTTP instance.
Source:
http:/... | Encode form fields for multipart/form-data. | [
"Encode",
"form",
"fields",
"for",
"multipart",
"/",
"form",
"-",
"data",
"."
] | def EncodeMultipartFormData(fields, files):
"""Encode form fields for multipart/form-data.
Args:
fields: A sequence of (name, value) elements for regular form fields.
files: A sequence of (name, filename, value) elements for data to be
uploaded as files.
Returns:
(content_type, body) ready... | [
"def",
"EncodeMultipartFormData",
"(",
"fields",
",",
"files",
")",
":",
"BOUNDARY",
"=",
"'-M-A-G-I-C---B-O-U-N-D-A-R-Y-'",
"CRLF",
"=",
"'\\r\\n'",
"lines",
"=",
"[",
"]",
"for",
"(",
"key",
",",
"value",
")",
"in",
"fields",
":",
"lines",
".",
"append",
... | https://github.com/radlab/sparrow/blob/afb8efadeb88524f1394d1abe4ea66c6fd2ac744/upload.py#L699-L735 | |
daler/pybedtools | ffe0d4bd2f32a0a5fc0cea049ee73773c4d57573 | pybedtools/bedtool.py | python | BedTool.set_chromsizes | (self, chromsizes) | return self | Prepare BedTool for operations that require chromosome coords.
Set the chromsizes for this genome. If *chromsizes* is a string, it
will be considered a genome assembly name. If that assembly name is
not available in pybedtools.genome_registry, then it will be searched
for on the UCSC G... | Prepare BedTool for operations that require chromosome coords. | [
"Prepare",
"BedTool",
"for",
"operations",
"that",
"require",
"chromosome",
"coords",
"."
] | def set_chromsizes(self, chromsizes):
"""
Prepare BedTool for operations that require chromosome coords.
Set the chromsizes for this genome. If *chromsizes* is a string, it
will be considered a genome assembly name. If that assembly name is
not available in pybedtools.genome_re... | [
"def",
"set_chromsizes",
"(",
"self",
",",
"chromsizes",
")",
":",
"if",
"isinstance",
"(",
"chromsizes",
",",
"six",
".",
"string_types",
")",
":",
"self",
".",
"chromsizes",
"=",
"pybedtools",
".",
"chromsizes",
"(",
"chromsizes",
")",
"elif",
"isinstance"... | https://github.com/daler/pybedtools/blob/ffe0d4bd2f32a0a5fc0cea049ee73773c4d57573/pybedtools/bedtool.py#L1322-L1349 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_label.py | python | OpenShiftCLIConfig.config_options | (self) | return self._options | return config options | return config options | [
"return",
"config",
"options"
] | def config_options(self):
''' return config options '''
return self._options | [
"def",
"config_options",
"(",
"self",
")",
":",
"return",
"self",
".",
"_options"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_label.py#L1449-L1451 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/calendar.py | python | HTMLCalendar.formatweekheader | (self) | return '<tr>%s</tr>' % s | Return a header for a week as a table row. | Return a header for a week as a table row. | [
"Return",
"a",
"header",
"for",
"a",
"week",
"as",
"a",
"table",
"row",
"."
] | def formatweekheader(self):
"""
Return a header for a week as a table row.
"""
s = ''.join(self.formatweekday(i) for i in self.iterweekdays())
return '<tr>%s</tr>' % s | [
"def",
"formatweekheader",
"(",
"self",
")",
":",
"s",
"=",
"''",
".",
"join",
"(",
"self",
".",
"formatweekday",
"(",
"i",
")",
"for",
"i",
"in",
"self",
".",
"iterweekdays",
"(",
")",
")",
"return",
"'<tr>%s</tr>'",
"%",
"s"
] | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/calendar.py#L462-L467 | |
tosher/Mediawiker | 81bf97cace59bedcb1668e7830b85c36e014428e | lib/Crypto.win.x64/Crypto/PublicKey/RSA.py | python | _import_keyDER | (extern_key, passphrase) | Import an RSA key (public or private half), encoded in DER form. | Import an RSA key (public or private half), encoded in DER form. | [
"Import",
"an",
"RSA",
"key",
"(",
"public",
"or",
"private",
"half",
")",
"encoded",
"in",
"DER",
"form",
"."
] | def _import_keyDER(extern_key, passphrase):
"""Import an RSA key (public or private half), encoded in DER form."""
decodings = (_import_pkcs1_private,
_import_pkcs1_public,
_import_subjectPublicKeyInfo,
_import_x509_cert,
_import_pkcs8)
f... | [
"def",
"_import_keyDER",
"(",
"extern_key",
",",
"passphrase",
")",
":",
"decodings",
"=",
"(",
"_import_pkcs1_private",
",",
"_import_pkcs1_public",
",",
"_import_subjectPublicKeyInfo",
",",
"_import_x509_cert",
",",
"_import_pkcs8",
")",
"for",
"decoding",
"in",
"de... | https://github.com/tosher/Mediawiker/blob/81bf97cace59bedcb1668e7830b85c36e014428e/lib/Crypto.win.x64/Crypto/PublicKey/RSA.py#L664-L679 | ||
pysmt/pysmt | ade4dc2a825727615033a96d31c71e9f53ce4764 | pysmt/shortcuts.py | python | BVAnd | (left, right) | return get_env().formula_manager.BVAnd(left, right) | Returns the Bit-wise AND of two bitvectors of the same size.
:param left: Specify the left bitvector
:param right: Specify the right bitvector
:returns: The bit-wise AND of left and right
:rtype: FNode | Returns the Bit-wise AND of two bitvectors of the same size. | [
"Returns",
"the",
"Bit",
"-",
"wise",
"AND",
"of",
"two",
"bitvectors",
"of",
"the",
"same",
"size",
"."
] | def BVAnd(left, right):
"""Returns the Bit-wise AND of two bitvectors of the same size.
:param left: Specify the left bitvector
:param right: Specify the right bitvector
:returns: The bit-wise AND of left and right
:rtype: FNode
"""
return get_env().formula_manager.BVAnd(left, right) | [
"def",
"BVAnd",
"(",
"left",
",",
"right",
")",
":",
"return",
"get_env",
"(",
")",
".",
"formula_manager",
".",
"BVAnd",
"(",
"left",
",",
"right",
")"
] | https://github.com/pysmt/pysmt/blob/ade4dc2a825727615033a96d31c71e9f53ce4764/pysmt/shortcuts.py#L442-L450 | |
ohmyadd/wetland | 76d296ec66dc438606e2455a848619d446f4a4b7 | paramiko/file.py | python | BufferedFile.xreadlines | (self) | return self | Identical to ``iter(f)``. This is a deprecated file interface that
predates Python iterator support. | Identical to ``iter(f)``. This is a deprecated file interface that
predates Python iterator support. | [
"Identical",
"to",
"iter",
"(",
"f",
")",
".",
"This",
"is",
"a",
"deprecated",
"file",
"interface",
"that",
"predates",
"Python",
"iterator",
"support",
"."
] | def xreadlines(self):
"""
Identical to ``iter(f)``. This is a deprecated file interface that
predates Python iterator support.
"""
return self | [
"def",
"xreadlines",
"(",
"self",
")",
":",
"return",
"self"
] | https://github.com/ohmyadd/wetland/blob/76d296ec66dc438606e2455a848619d446f4a4b7/paramiko/file.py#L434-L439 | |
materialsproject/pymatgen | 8128f3062a334a2edd240e4062b5b9bdd1ae6f58 | pymatgen/electronic_structure/core.py | python | Magmom.get_xyz_magmom_with_001_saxis | (self) | return Magmom(self.get_moment()) | Returns a Magmom in the default setting of saxis = [0, 0, 1] and
the magnetic moment rotated as required.
:return: Magmom | Returns a Magmom in the default setting of saxis = [0, 0, 1] and
the magnetic moment rotated as required. | [
"Returns",
"a",
"Magmom",
"in",
"the",
"default",
"setting",
"of",
"saxis",
"=",
"[",
"0",
"0",
"1",
"]",
"and",
"the",
"magnetic",
"moment",
"rotated",
"as",
"required",
"."
] | def get_xyz_magmom_with_001_saxis(self):
"""
Returns a Magmom in the default setting of saxis = [0, 0, 1] and
the magnetic moment rotated as required.
:return: Magmom
"""
return Magmom(self.get_moment()) | [
"def",
"get_xyz_magmom_with_001_saxis",
"(",
"self",
")",
":",
"return",
"Magmom",
"(",
"self",
".",
"get_moment",
"(",
")",
")"
] | https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/electronic_structure/core.py#L258-L265 | |
intuition-io/intuition | cd517e6b3b315a743eb4d0d0dc294e264ab913ce | intuition/data/forex.py | python | _fx_mapping | (raw_rates) | return {pair[0].lower(): {
'timeStamp': pair[1],
'bid': float(pair[2] + pair[3]),
'ask': float(pair[4] + pair[5]),
'high': float(pair[6]),
'low': float(pair[7])
} for pair in map(lambda x: x.split(','), raw_rates)} | Map raw output to clearer labels | Map raw output to clearer labels | [
"Map",
"raw",
"output",
"to",
"clearer",
"labels"
] | def _fx_mapping(raw_rates):
''' Map raw output to clearer labels '''
return {pair[0].lower(): {
'timeStamp': pair[1],
'bid': float(pair[2] + pair[3]),
'ask': float(pair[4] + pair[5]),
'high': float(pair[6]),
'low': float(pair[7])
} for pair in map(lambda x: x.split(',... | [
"def",
"_fx_mapping",
"(",
"raw_rates",
")",
":",
"return",
"{",
"pair",
"[",
"0",
"]",
".",
"lower",
"(",
")",
":",
"{",
"'timeStamp'",
":",
"pair",
"[",
"1",
"]",
",",
"'bid'",
":",
"float",
"(",
"pair",
"[",
"2",
"]",
"+",
"pair",
"[",
"3",
... | https://github.com/intuition-io/intuition/blob/cd517e6b3b315a743eb4d0d0dc294e264ab913ce/intuition/data/forex.py#L29-L37 | |
PyMVPA/PyMVPA | 76c476b3de8264b0bb849bf226da5674d659564e | mvpa2/mappers/shape.py | python | AddAxisMapper.__init__ | (self, pos, **kwargs) | Parameters
----------
pos : int
Axis index to which the new axis is prepended. Negative indices are
supported as well, but the new axis will be placed behind the given
index. For example, a position of ``-1`` will cause an axis to be
added behind the last ... | Parameters
----------
pos : int
Axis index to which the new axis is prepended. Negative indices are
supported as well, but the new axis will be placed behind the given
index. For example, a position of ``-1`` will cause an axis to be
added behind the last ... | [
"Parameters",
"----------",
"pos",
":",
"int",
"Axis",
"index",
"to",
"which",
"the",
"new",
"axis",
"is",
"prepended",
".",
"Negative",
"indices",
"are",
"supported",
"as",
"well",
"but",
"the",
"new",
"axis",
"will",
"be",
"placed",
"behind",
"the",
"giv... | def __init__(self, pos, **kwargs):
"""
Parameters
----------
pos : int
Axis index to which the new axis is prepended. Negative indices are
supported as well, but the new axis will be placed behind the given
index. For example, a position of ``-1`` will... | [
"def",
"__init__",
"(",
"self",
",",
"pos",
",",
"*",
"*",
"kwargs",
")",
":",
"Mapper",
".",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"_pos",
"=",
"pos"
] | https://github.com/PyMVPA/PyMVPA/blob/76c476b3de8264b0bb849bf226da5674d659564e/mvpa2/mappers/shape.py#L73-L86 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/Django-1.11.29/django/contrib/gis/geos/collections.py | python | GeometryCollection.__iter__ | (self) | Iterates over each Geometry in the Collection. | Iterates over each Geometry in the Collection. | [
"Iterates",
"over",
"each",
"Geometry",
"in",
"the",
"Collection",
"."
] | def __iter__(self):
"Iterates over each Geometry in the Collection."
for i in range(len(self)):
yield self[i] | [
"def",
"__iter__",
"(",
"self",
")",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
")",
")",
":",
"yield",
"self",
"[",
"i",
"]"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/Django-1.11.29/django/contrib/gis/geos/collections.py#L45-L48 | ||
YichenGong/Densely-Interactive-Inference-Network | cb2c23bc1aca7cafb523104b0db07df2332a877a | python/models/attmix_CNN.py | python | normalize | (inputs,
epsilon = 1e-8,
scope="ln",
reuse=None) | return outputs | Applies layer normalization.
Args:
inputs: A tensor with 2 or more dimensions, where the first dimension has
`batch_size`.
epsilon: A floating number. A very small number for preventing ZeroDivision Error.
scope: Optional scope for `variable_scope`.
reuse: Boolean, whether to re... | Applies layer normalization.
Args:
inputs: A tensor with 2 or more dimensions, where the first dimension has
`batch_size`.
epsilon: A floating number. A very small number for preventing ZeroDivision Error.
scope: Optional scope for `variable_scope`.
reuse: Boolean, whether to re... | [
"Applies",
"layer",
"normalization",
".",
"Args",
":",
"inputs",
":",
"A",
"tensor",
"with",
"2",
"or",
"more",
"dimensions",
"where",
"the",
"first",
"dimension",
"has",
"batch_size",
".",
"epsilon",
":",
"A",
"floating",
"number",
".",
"A",
"very",
"smal... | def normalize(inputs,
epsilon = 1e-8,
scope="ln",
reuse=None):
'''Applies layer normalization.
Args:
inputs: A tensor with 2 or more dimensions, where the first dimension has
`batch_size`.
epsilon: A floating number. A very small number for pre... | [
"def",
"normalize",
"(",
"inputs",
",",
"epsilon",
"=",
"1e-8",
",",
"scope",
"=",
"\"ln\"",
",",
"reuse",
"=",
"None",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"scope",
",",
"reuse",
"=",
"reuse",
")",
":",
"inputs_shape",
"=",
"inputs",
... | https://github.com/YichenGong/Densely-Interactive-Inference-Network/blob/cb2c23bc1aca7cafb523104b0db07df2332a877a/python/models/attmix_CNN.py#L1486-L1513 | |
nltk/nltk | 3f74ac55681667d7ef78b664557487145f51eb02 | nltk/app/chartparser_app.py | python | ChartParserApp.save_chart | (self, *args) | Save a chart to a pickle file | Save a chart to a pickle file | [
"Save",
"a",
"chart",
"to",
"a",
"pickle",
"file"
] | def save_chart(self, *args):
"Save a chart to a pickle file"
filename = asksaveasfilename(
filetypes=self.CHART_FILE_TYPES, defaultextension=".pickle"
)
if not filename:
return
try:
with open(filename, "wb") as outfile:
pickle.d... | [
"def",
"save_chart",
"(",
"self",
",",
"*",
"args",
")",
":",
"filename",
"=",
"asksaveasfilename",
"(",
"filetypes",
"=",
"self",
".",
"CHART_FILE_TYPES",
",",
"defaultextension",
"=",
"\".pickle\"",
")",
"if",
"not",
"filename",
":",
"return",
"try",
":",
... | https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/app/chartparser_app.py#L2286-L2298 | ||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/layout/polar/_radialaxis.py | python | RadialAxis.tickformatstops | (self) | return self["tickformatstops"] | The 'tickformatstops' property is a tuple of instances of
Tickformatstop that may be specified as:
- A list or tuple of instances of plotly.graph_objs.layout.polar.radialaxis.Tickformatstop
- A list or tuple of dicts of string/value properties that
will be passed to the Tickforma... | The 'tickformatstops' property is a tuple of instances of
Tickformatstop that may be specified as:
- A list or tuple of instances of plotly.graph_objs.layout.polar.radialaxis.Tickformatstop
- A list or tuple of dicts of string/value properties that
will be passed to the Tickforma... | [
"The",
"tickformatstops",
"property",
"is",
"a",
"tuple",
"of",
"instances",
"of",
"Tickformatstop",
"that",
"may",
"be",
"specified",
"as",
":",
"-",
"A",
"list",
"or",
"tuple",
"of",
"instances",
"of",
"plotly",
".",
"graph_objs",
".",
"layout",
".",
"po... | def tickformatstops(self):
"""
The 'tickformatstops' property is a tuple of instances of
Tickformatstop that may be specified as:
- A list or tuple of instances of plotly.graph_objs.layout.polar.radialaxis.Tickformatstop
- A list or tuple of dicts of string/value properties t... | [
"def",
"tickformatstops",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickformatstops\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/layout/polar/_radialaxis.py#L1047-L1095 | |
joke2k/faker | 0ebe46fc9b9793fe315cf0fce430258ce74df6f8 | faker/providers/company/fr_FR/__init__.py | python | Provider.siret | (self, max_sequential_digits: int = 2) | return self.numerify(self.siren() + " " + sequential_number + "#") | Generates a siret number (14 digits).
It is in fact the result of the concatenation of a siren number (9 digits),
a sequential number (4 digits) and a control number (1 digit) concatenation.
If $max_sequential_digits is invalid, it is set to 2.
:param max_sequential_digits The maximum nu... | Generates a siret number (14 digits).
It is in fact the result of the concatenation of a siren number (9 digits),
a sequential number (4 digits) and a control number (1 digit) concatenation.
If $max_sequential_digits is invalid, it is set to 2.
:param max_sequential_digits The maximum nu... | [
"Generates",
"a",
"siret",
"number",
"(",
"14",
"digits",
")",
".",
"It",
"is",
"in",
"fact",
"the",
"result",
"of",
"the",
"concatenation",
"of",
"a",
"siren",
"number",
"(",
"9",
"digits",
")",
"a",
"sequential",
"number",
"(",
"4",
"digits",
")",
... | def siret(self, max_sequential_digits: int = 2) -> str:
"""
Generates a siret number (14 digits).
It is in fact the result of the concatenation of a siren number (9 digits),
a sequential number (4 digits) and a control number (1 digit) concatenation.
If $max_sequential_digits is ... | [
"def",
"siret",
"(",
"self",
",",
"max_sequential_digits",
":",
"int",
"=",
"2",
")",
"->",
"str",
":",
"if",
"max_sequential_digits",
">",
"4",
"or",
"max_sequential_digits",
"<=",
"0",
":",
"max_sequential_digits",
"=",
"2",
"sequential_number",
"=",
"str",
... | https://github.com/joke2k/faker/blob/0ebe46fc9b9793fe315cf0fce430258ce74df6f8/faker/providers/company/fr_FR/__init__.py#L128-L140 | |
OpenTreeMap/otm-core | 06600b85880136da46f0a18f9e447aa80b1a8d32 | opentreemap/treemap/plugin.py | python | get_plugin_function | (plugin_fn_setting, default_fn) | return wrapper | Gets a plugin function from an external python module, and wraps it
so that it can be safely overridden for testing purposes.
Implementors of plugin functions should ensure that their function's
signature matches that of the default_fn
plugin_fn_setting - A string in the Django settings specifiying th... | Gets a plugin function from an external python module, and wraps it
so that it can be safely overridden for testing purposes. | [
"Gets",
"a",
"plugin",
"function",
"from",
"an",
"external",
"python",
"module",
"and",
"wraps",
"it",
"so",
"that",
"it",
"can",
"be",
"safely",
"overridden",
"for",
"testing",
"purposes",
"."
] | def get_plugin_function(plugin_fn_setting, default_fn):
"""
Gets a plugin function from an external python module, and wraps it
so that it can be safely overridden for testing purposes.
Implementors of plugin functions should ensure that their function's
signature matches that of the default_fn
... | [
"def",
"get_plugin_function",
"(",
"plugin_fn_setting",
",",
"default_fn",
")",
":",
"# cache the function",
"_plugin_fn_dict",
"[",
"plugin_fn_setting",
"]",
"=",
"_resolve_plugin_function",
"(",
"plugin_fn_setting",
",",
"default_fn",
")",
"def",
"wrapper",
"(",
"*",
... | https://github.com/OpenTreeMap/otm-core/blob/06600b85880136da46f0a18f9e447aa80b1a8d32/opentreemap/treemap/plugin.py#L33-L57 | |
cherrypy/cherrypy | a7983fe61f7237f2354915437b04295694100372 | cherrypy/_cprequest.py | python | HookMap.attach | (self, point, callback, failsafe=None, priority=None, **kwargs) | Append a new Hook made from the supplied arguments. | Append a new Hook made from the supplied arguments. | [
"Append",
"a",
"new",
"Hook",
"made",
"from",
"the",
"supplied",
"arguments",
"."
] | def attach(self, point, callback, failsafe=None, priority=None, **kwargs):
"""Append a new Hook made from the supplied arguments."""
self[point].append(Hook(callback, failsafe, priority, **kwargs)) | [
"def",
"attach",
"(",
"self",
",",
"point",
",",
"callback",
",",
"failsafe",
"=",
"None",
",",
"priority",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
"[",
"point",
"]",
".",
"append",
"(",
"Hook",
"(",
"callback",
",",
"failsafe",
","... | https://github.com/cherrypy/cherrypy/blob/a7983fe61f7237f2354915437b04295694100372/cherrypy/_cprequest.py#L89-L91 | ||
Dman95/SASM | 7e3ae6da1c219a68e26d38939338567e5c27151a | Windows/MinGW64/opt/lib/python2.7/codecs.py | python | BufferedIncrementalEncoder.setstate | (self, state) | [] | def setstate(self, state):
self.buffer = state or "" | [
"def",
"setstate",
"(",
"self",
",",
"state",
")",
":",
"self",
".",
"buffer",
"=",
"state",
"or",
"\"\""
] | https://github.com/Dman95/SASM/blob/7e3ae6da1c219a68e26d38939338567e5c27151a/Windows/MinGW64/opt/lib/python2.7/codecs.py#L226-L227 | ||||
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/idlelib/keybindingDialog.py | python | GetKeysDialog.__init__ | (self,parent,title,action,currentKeySequences) | action - string, the name of the virtual event these keys will be
mapped to
currentKeys - list, a list of all key sequence lists currently mapped
to virtual events, for overlap checking | action - string, the name of the virtual event these keys will be
mapped to
currentKeys - list, a list of all key sequence lists currently mapped
to virtual events, for overlap checking | [
"action",
"-",
"string",
"the",
"name",
"of",
"the",
"virtual",
"event",
"these",
"keys",
"will",
"be",
"mapped",
"to",
"currentKeys",
"-",
"list",
"a",
"list",
"of",
"all",
"key",
"sequence",
"lists",
"currently",
"mapped",
"to",
"virtual",
"events",
"for... | def __init__(self,parent,title,action,currentKeySequences):
"""
action - string, the name of the virtual event these keys will be
mapped to
currentKeys - list, a list of all key sequence lists currently mapped
to virtual events, for overlap checking
"""
... | [
"def",
"__init__",
"(",
"self",
",",
"parent",
",",
"title",
",",
"action",
",",
"currentKeySequences",
")",
":",
"Toplevel",
".",
"__init__",
"(",
"self",
",",
"parent",
")",
"self",
".",
"configure",
"(",
"borderwidth",
"=",
"5",
")",
"self",
".",
"r... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/idlelib/keybindingDialog.py#L9-L46 | ||
vertical-knowledge/ripozo | e648db2967c4fbf4315860c21a8418f384db4454 | ripozo/resources/request.py | python | RequestContainer.url_params | (self) | return self._url_params.copy() | :return: A copy of the url_params dictionary
:rtype: dict | :return: A copy of the url_params dictionary
:rtype: dict | [
":",
"return",
":",
"A",
"copy",
"of",
"the",
"url_params",
"dictionary",
":",
"rtype",
":",
"dict"
] | def url_params(self):
"""
:return: A copy of the url_params dictionary
:rtype: dict
"""
return self._url_params.copy() | [
"def",
"url_params",
"(",
"self",
")",
":",
"return",
"self",
".",
"_url_params",
".",
"copy",
"(",
")"
] | https://github.com/vertical-knowledge/ripozo/blob/e648db2967c4fbf4315860c21a8418f384db4454/ripozo/resources/request.py#L43-L48 | |
husthuaan/AoANet | 94ffe176c3777bc54e53e9dd7b305b4046d91a70 | dataloader.py | python | DataLoader.__getitem__ | (self, index) | return (fc_feat,
att_feat, seq,
ix) | This function returns a tuple that is further passed to collate_fn | This function returns a tuple that is further passed to collate_fn | [
"This",
"function",
"returns",
"a",
"tuple",
"that",
"is",
"further",
"passed",
"to",
"collate_fn"
] | def __getitem__(self, index):
"""This function returns a tuple that is further passed to collate_fn
"""
ix = index #self.split_ix[index]
if self.use_att:
att_feat = self.att_loader.get(str(self.info['images'][ix]['id']))
# Reshape to K x C
att_feat = a... | [
"def",
"__getitem__",
"(",
"self",
",",
"index",
")",
":",
"ix",
"=",
"index",
"#self.split_ix[index]",
"if",
"self",
".",
"use_att",
":",
"att_feat",
"=",
"self",
".",
"att_loader",
".",
"get",
"(",
"str",
"(",
"self",
".",
"info",
"[",
"'images'",
"]... | https://github.com/husthuaan/AoANet/blob/94ffe176c3777bc54e53e9dd7b305b4046d91a70/dataloader.py#L252-L285 | |
cclib/cclib | 81cd4a81cc4a3bbed7016b3e417ca9bff8ad3a92 | cclib/parser/qchemparser.py | python | QChem.normalisesym | (self, label) | return label | Q-Chem does not require normalizing symmetry labels. | Q-Chem does not require normalizing symmetry labels. | [
"Q",
"-",
"Chem",
"does",
"not",
"require",
"normalizing",
"symmetry",
"labels",
"."
] | def normalisesym(self, label):
"""Q-Chem does not require normalizing symmetry labels."""
return label | [
"def",
"normalisesym",
"(",
"self",
",",
"label",
")",
":",
"return",
"label"
] | https://github.com/cclib/cclib/blob/81cd4a81cc4a3bbed7016b3e417ca9bff8ad3a92/cclib/parser/qchemparser.py#L38-L40 | |
facebookarchive/Audio2BodyDynamics | e79ff68e8d0799ef4452810d5efe9e1506db75d0 | data_utils/data.py | python | dataBatcher.hasNext | (self) | return self.cur_batch < len(self.indices) | [] | def hasNext(self):
return self.cur_batch < len(self.indices) | [
"def",
"hasNext",
"(",
"self",
")",
":",
"return",
"self",
".",
"cur_batch",
"<",
"len",
"(",
"self",
".",
"indices",
")"
] | https://github.com/facebookarchive/Audio2BodyDynamics/blob/e79ff68e8d0799ef4452810d5efe9e1506db75d0/data_utils/data.py#L29-L30 | |||
bayespy/bayespy | 0e6e6130c888a4295cc9421d61d4ad27b2960ebb | bayespy/inference/vmp/vmp.py | python | VB.get_gradients | (self, *nodes, euclidian=False) | Computes gradients (both Riemannian and normal) | Computes gradients (both Riemannian and normal) | [
"Computes",
"gradients",
"(",
"both",
"Riemannian",
"and",
"normal",
")"
] | def get_gradients(self, *nodes, euclidian=False):
"""
Computes gradients (both Riemannian and normal)
"""
rg = [self[node].get_riemannian_gradient() for node in nodes]
if euclidian:
g = [self[node].get_gradient(rg_x)
for (node, rg_x) in zip(nodes, rg)... | [
"def",
"get_gradients",
"(",
"self",
",",
"*",
"nodes",
",",
"euclidian",
"=",
"False",
")",
":",
"rg",
"=",
"[",
"self",
"[",
"node",
"]",
".",
"get_riemannian_gradient",
"(",
")",
"for",
"node",
"in",
"nodes",
"]",
"if",
"euclidian",
":",
"g",
"=",... | https://github.com/bayespy/bayespy/blob/0e6e6130c888a4295cc9421d61d4ad27b2960ebb/bayespy/inference/vmp/vmp.py#L409-L419 | ||
akanimax/pro_gan_pytorch | 97a5b4503045e07ffaf4d41d88d9cc11706d26f0 | pro_gan_pytorch/modules.py | python | ConDisFinalBlock.forward | (self, x: Tensor, labels: Tensor) | return final_score | [] | def forward(self, x: Tensor, labels: Tensor) -> Tensor:
y = self.batch_discriminator(x)
y = self.lrelu(self.conv_1(y))
y = self.lrelu(self.conv_2(y))
# embed the labels
labels = self.label_embedder(labels) # [B x C]
# compute the inner product with the label embeddings... | [
"def",
"forward",
"(",
"self",
",",
"x",
":",
"Tensor",
",",
"labels",
":",
"Tensor",
")",
"->",
"Tensor",
":",
"y",
"=",
"self",
".",
"batch_discriminator",
"(",
"x",
")",
"y",
"=",
"self",
".",
"lrelu",
"(",
"self",
".",
"conv_1",
"(",
"y",
")"... | https://github.com/akanimax/pro_gan_pytorch/blob/97a5b4503045e07ffaf4d41d88d9cc11706d26f0/pro_gan_pytorch/modules.py#L141-L160 | |||
arrayfire/arrayfire-python | 96fa9768ee02e5fb5ffcaf3d1f744c898b141637 | arrayfire/array.py | python | Array.numdims | (self) | return nd.value | Return the number of dimensions of the array. | Return the number of dimensions of the array. | [
"Return",
"the",
"number",
"of",
"dimensions",
"of",
"the",
"array",
"."
] | def numdims(self):
"""
Return the number of dimensions of the array.
"""
nd = c_uint_t(0)
safe_call(backend.get().af_get_numdims(c_pointer(nd), self.arr))
return nd.value | [
"def",
"numdims",
"(",
"self",
")",
":",
"nd",
"=",
"c_uint_t",
"(",
"0",
")",
"safe_call",
"(",
"backend",
".",
"get",
"(",
")",
".",
"af_get_numdims",
"(",
"c_pointer",
"(",
"nd",
")",
",",
"self",
".",
"arr",
")",
")",
"return",
"nd",
".",
"va... | https://github.com/arrayfire/arrayfire-python/blob/96fa9768ee02e5fb5ffcaf3d1f744c898b141637/arrayfire/array.py#L694-L700 | |
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/ssl.py | python | SSLObject.pending | (self) | return self._sslobj.pending() | Return the number of bytes that can be read immediately. | Return the number of bytes that can be read immediately. | [
"Return",
"the",
"number",
"of",
"bytes",
"that",
"can",
"be",
"read",
"immediately",
"."
] | def pending(self):
"""Return the number of bytes that can be read immediately."""
return self._sslobj.pending() | [
"def",
"pending",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sslobj",
".",
"pending",
"(",
")"
] | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/ssl.py#L938-L940 | |
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/idlelib/run.py | python | MyHandler.handle | (self) | Override base method | Override base method | [
"Override",
"base",
"method"
] | def handle(self):
"""Override base method"""
executive = Executive(self)
self.register("exec", executive)
self.console = self.get_remote_proxy("console")
sys.stdin = PyShell.PseudoInputFile(self.console, "stdin",
IOBinding.encoding)
sys.stdout = PyShell.Ps... | [
"def",
"handle",
"(",
"self",
")",
":",
"executive",
"=",
"Executive",
"(",
"self",
")",
"self",
".",
"register",
"(",
"\"exec\"",
",",
"executive",
")",
"self",
".",
"console",
"=",
"self",
".",
"get_remote_proxy",
"(",
"\"console\"",
")",
"sys",
".",
... | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/idlelib/run.py#L289-L306 | ||
cuthbertLab/music21 | bd30d4663e52955ed922c10fdf541419d8c67671 | music21/base.py | python | Music21Object._reprText | (self, **keywords) | return repr(self) | Return a text representation possible with line
breaks. This methods can be overridden by subclasses
to provide alternative text representations. | Return a text representation possible with line
breaks. This methods can be overridden by subclasses
to provide alternative text representations. | [
"Return",
"a",
"text",
"representation",
"possible",
"with",
"line",
"breaks",
".",
"This",
"methods",
"can",
"be",
"overridden",
"by",
"subclasses",
"to",
"provide",
"alternative",
"text",
"representations",
"."
] | def _reprText(self, **keywords):
'''
Return a text representation possible with line
breaks. This methods can be overridden by subclasses
to provide alternative text representations.
'''
return repr(self) | [
"def",
"_reprText",
"(",
"self",
",",
"*",
"*",
"keywords",
")",
":",
"return",
"repr",
"(",
"self",
")"
] | https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/base.py#L2672-L2678 | |
puddletag/puddletag | e5fb85c34ff2e699ca35274298d1921f2598be98 | source/puddlestuff/audioinfo/util.py | python | lngtime | (value) | return calendar.timegm(time.strptime(value, '%Y-%m-%d %H:%M:%S')) | Converts time in %Y-%m-%d %H:%M:%S format to seconds. | Converts time in %Y-%m-%d %H:%M:%S format to seconds. | [
"Converts",
"time",
"in",
"%Y",
"-",
"%m",
"-",
"%d",
"%H",
":",
"%M",
":",
"%S",
"format",
"to",
"seconds",
"."
] | def lngtime(value):
'''Converts time in %Y-%m-%d %H:%M:%S format to seconds.'''
return calendar.timegm(time.strptime(value, '%Y-%m-%d %H:%M:%S')) | [
"def",
"lngtime",
"(",
"value",
")",
":",
"return",
"calendar",
".",
"timegm",
"(",
"time",
".",
"strptime",
"(",
"value",
",",
"'%Y-%m-%d %H:%M:%S'",
")",
")"
] | https://github.com/puddletag/puddletag/blob/e5fb85c34ff2e699ca35274298d1921f2598be98/source/puddlestuff/audioinfo/util.py#L429-L431 | |
django/django | 0a17666045de6739ae1c2ac695041823d5f827f7 | django/contrib/admin/views/autocomplete.py | python | AutocompleteJsonView.get_paginator | (self, *args, **kwargs) | return self.model_admin.get_paginator(self.request, *args, **kwargs) | Use the ModelAdmin's paginator. | Use the ModelAdmin's paginator. | [
"Use",
"the",
"ModelAdmin",
"s",
"paginator",
"."
] | def get_paginator(self, *args, **kwargs):
"""Use the ModelAdmin's paginator."""
return self.model_admin.get_paginator(self.request, *args, **kwargs) | [
"def",
"get_paginator",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"model_admin",
".",
"get_paginator",
"(",
"self",
".",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/django/django/blob/0a17666045de6739ae1c2ac695041823d5f827f7/django/contrib/admin/views/autocomplete.py#L43-L45 | |
google/deepvariant | 9cf1c7b0e2342d013180aa153cba3c9331c9aef7 | deepvariant/haplotypes.py | python | _LikelihoodAggregator.__init__ | (self, num_alts) | Constructor.
Args:
num_alts: int. The number of alternate alleles in the variant. | Constructor. | [
"Constructor",
"."
] | def __init__(self, num_alts):
"""Constructor.
Args:
num_alts: int. The number of alternate alleles in the variant.
"""
self._num_likelihoods = variant_utils.genotype_likelihood_index(
(num_alts, num_alts)) + 1
# At each GL index, we keep a list that will include the joint GL across a... | [
"def",
"__init__",
"(",
"self",
",",
"num_alts",
")",
":",
"self",
".",
"_num_likelihoods",
"=",
"variant_utils",
".",
"genotype_likelihood_index",
"(",
"(",
"num_alts",
",",
"num_alts",
")",
")",
"+",
"1",
"# At each GL index, we keep a list that will include the joi... | https://github.com/google/deepvariant/blob/9cf1c7b0e2342d013180aa153cba3c9331c9aef7/deepvariant/haplotypes.py#L230-L244 | ||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/scipy/stats/mstats_basic.py | python | tsem | (a, limits=None, inclusive=(True, True), axis=0, ddof=1) | return sd / np.sqrt(am.count()) | Compute the trimmed standard error of the mean.
This function finds the standard error of the mean for given
values, ignoring values outside the given `limits`.
Parameters
----------
a : array_like
array of values
limits : None or (lower limit, upper limit), optional
Values in ... | Compute the trimmed standard error of the mean. | [
"Compute",
"the",
"trimmed",
"standard",
"error",
"of",
"the",
"mean",
"."
] | def tsem(a, limits=None, inclusive=(True, True), axis=0, ddof=1):
"""
Compute the trimmed standard error of the mean.
This function finds the standard error of the mean for given
values, ignoring values outside the given `limits`.
Parameters
----------
a : array_like
array of value... | [
"def",
"tsem",
"(",
"a",
",",
"limits",
"=",
"None",
",",
"inclusive",
"=",
"(",
"True",
",",
"True",
")",
",",
"axis",
"=",
"0",
",",
"ddof",
"=",
"1",
")",
":",
"a",
"=",
"ma",
".",
"asarray",
"(",
"a",
")",
".",
"ravel",
"(",
")",
"if",
... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/scipy/stats/mstats_basic.py#L1727-L1769 | |
ShreyAmbesh/Traffic-Rule-Violation-Detection-System | ae0c327ce014ce6a427da920b5798a0d4bbf001e | openalpr_api/api_client.py | python | ApiClient.user_agent | (self, value) | Sets user agent. | Sets user agent. | [
"Sets",
"user",
"agent",
"."
] | def user_agent(self, value):
"""
Sets user agent.
"""
self.default_headers['User-Agent'] = value | [
"def",
"user_agent",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"default_headers",
"[",
"'User-Agent'",
"]",
"=",
"value"
] | https://github.com/ShreyAmbesh/Traffic-Rule-Violation-Detection-System/blob/ae0c327ce014ce6a427da920b5798a0d4bbf001e/openalpr_api/api_client.py#L102-L106 | ||
3DLIRIOUS/MeshLabXML | e19fdc911644474f74463aabba1e6860cfad818e | meshlabxml/transform.py | python | scale | (script, value=1.0) | return None | An alternative scale implementation that uses a geometric function.
This is more accurate than the built-in version. | An alternative scale implementation that uses a geometric function.
This is more accurate than the built-in version. | [
"An",
"alternative",
"scale",
"implementation",
"that",
"uses",
"a",
"geometric",
"function",
".",
"This",
"is",
"more",
"accurate",
"than",
"the",
"built",
"-",
"in",
"version",
"."
] | def scale(script, value=1.0):
"""An alternative scale implementation that uses a geometric function.
This is more accurate than the built-in version."""
"""# Convert value to list if it isn't already
if not isinstance(value, list):
value = list(value)
# If a single value was supplied use it ... | [
"def",
"scale",
"(",
"script",
",",
"value",
"=",
"1.0",
")",
":",
"\"\"\"# Convert value to list if it isn't already\n if not isinstance(value, list):\n value = list(value)\n # If a single value was supplied use it for all 3 axes\n if len(value) == 1:\n value = [value[0],... | https://github.com/3DLIRIOUS/MeshLabXML/blob/e19fdc911644474f74463aabba1e6860cfad818e/meshlabxml/transform.py#L320-L334 | |
pgq/skytools-legacy | 8b7e6c118572a605d28b7a3403c96aeecfd0d272 | python/skytools/sqltools.py | python | DBTable.exists | (self, curs) | return exists_table(curs, self.name) | Does table exists. | Does table exists. | [
"Does",
"table",
"exists",
"."
] | def exists(self, curs):
"""Does table exists."""
return exists_table(curs, self.name) | [
"def",
"exists",
"(",
"self",
",",
"curs",
")",
":",
"return",
"exists_table",
"(",
"curs",
",",
"self",
".",
"name",
")"
] | https://github.com/pgq/skytools-legacy/blob/8b7e6c118572a605d28b7a3403c96aeecfd0d272/python/skytools/sqltools.py#L504-L506 | |
basketballandlearn/MRC_Competition_Dureader | 26c5c67e0ad7a1e8477a95ed601a21b668f4a56b | others/idiom_MRC/idiom/xlnet/modeling_xlnet.py | python | XLNetPreTrainedModel.init_weights | (self, module) | Initialize the weights. | Initialize the weights. | [
"Initialize",
"the",
"weights",
"."
] | def init_weights(self, module):
""" Initialize the weights.
"""
if isinstance(module, (nn.Linear, nn.Embedding)):
# Slightly different from the TF version which uses truncated_normal for initialization
# cf https://github.com/pytorch/pytorch/pull/5617
module.w... | [
"def",
"init_weights",
"(",
"self",
",",
"module",
")",
":",
"if",
"isinstance",
"(",
"module",
",",
"(",
"nn",
".",
"Linear",
",",
"nn",
".",
"Embedding",
")",
")",
":",
"# Slightly different from the TF version which uses truncated_normal for initialization",
"# c... | https://github.com/basketballandlearn/MRC_Competition_Dureader/blob/26c5c67e0ad7a1e8477a95ed601a21b668f4a56b/others/idiom_MRC/idiom/xlnet/modeling_xlnet.py#L582-L600 | ||
frappe/erpnext | 9d36e30ef7043b391b5ed2523b8288bf46c45d18 | erpnext/stock/dashboard/warehouse_capacity_dashboard.py | python | get_data | (item_code=None, warehouse=None, parent_warehouse=None,
company=None, start=0, sort_by="stock_capacity", sort_order="desc") | return capacity_data | Return data to render the warehouse capacity dashboard. | Return data to render the warehouse capacity dashboard. | [
"Return",
"data",
"to",
"render",
"the",
"warehouse",
"capacity",
"dashboard",
"."
] | def get_data(item_code=None, warehouse=None, parent_warehouse=None,
company=None, start=0, sort_by="stock_capacity", sort_order="desc"):
"""Return data to render the warehouse capacity dashboard."""
filters = get_filters(item_code, warehouse, parent_warehouse, company)
no_permission, filters = get_warehouse_filter... | [
"def",
"get_data",
"(",
"item_code",
"=",
"None",
",",
"warehouse",
"=",
"None",
",",
"parent_warehouse",
"=",
"None",
",",
"company",
"=",
"None",
",",
"start",
"=",
"0",
",",
"sort_by",
"=",
"\"stock_capacity\"",
",",
"sort_order",
"=",
"\"desc\"",
")",
... | https://github.com/frappe/erpnext/blob/9d36e30ef7043b391b5ed2523b8288bf46c45d18/erpnext/stock/dashboard/warehouse_capacity_dashboard.py#L9-L23 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.5/django/utils/feedgenerator.py | python | SyndicationFeed.add_item_elements | (self, handler, item) | Add elements on each item (i.e. item/entry) element. | Add elements on each item (i.e. item/entry) element. | [
"Add",
"elements",
"on",
"each",
"item",
"(",
"i",
".",
"e",
".",
"item",
"/",
"entry",
")",
"element",
"."
] | def add_item_elements(self, handler, item):
"""
Add elements on each item (i.e. item/entry) element.
"""
pass | [
"def",
"add_item_elements",
"(",
"self",
",",
"handler",
",",
"item",
")",
":",
"pass"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.5/django/utils/feedgenerator.py#L170-L174 | ||
getsentry/snuba | 6f92898b37c89d5d41a1894b313726d85ede0170 | snuba/state/__init__.py | python | is_project_in_rollout_list | (rollout_key: str, project_id: int) | return False | Helper function for doing selective rollouts by project ids. The config
value is assumed to be a string of the form `[project,project,...]`.
Returns `True` if `project_id` is present in the config. | Helper function for doing selective rollouts by project ids. The config
value is assumed to be a string of the form `[project,project,...]`. | [
"Helper",
"function",
"for",
"doing",
"selective",
"rollouts",
"by",
"project",
"ids",
".",
"The",
"config",
"value",
"is",
"assumed",
"to",
"be",
"a",
"string",
"of",
"the",
"form",
"[",
"project",
"project",
"...",
"]",
"."
] | def is_project_in_rollout_list(rollout_key: str, project_id: int) -> bool:
"""
Helper function for doing selective rollouts by project ids. The config
value is assumed to be a string of the form `[project,project,...]`.
Returns `True` if `project_id` is present in the config.
"""
project_rollou... | [
"def",
"is_project_in_rollout_list",
"(",
"rollout_key",
":",
"str",
",",
"project_id",
":",
"int",
")",
"->",
"bool",
":",
"project_rollout_setting",
"=",
"get_config",
"(",
"rollout_key",
",",
"\"\"",
")",
"assert",
"isinstance",
"(",
"project_rollout_setting",
... | https://github.com/getsentry/snuba/blob/6f92898b37c89d5d41a1894b313726d85ede0170/snuba/state/__init__.py#L277-L293 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.