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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
llSourcell/AI_Artist | 3038c06c2e389b9c919c881c9a169efe2fd7810e | lib/python2.7/site-packages/pip/_vendor/requests/models.py | python | PreparedRequest.prepare_auth | (self, auth, url='') | Prepares the given HTTP auth data. | Prepares the given HTTP auth data. | [
"Prepares",
"the",
"given",
"HTTP",
"auth",
"data",
"."
] | def prepare_auth(self, auth, url=''):
"""Prepares the given HTTP auth data."""
# If no Auth is explicitly provided, extract it from the URL first.
if auth is None:
url_auth = get_auth_from_url(self.url)
auth = url_auth if any(url_auth) else None
if auth:
... | [
"def",
"prepare_auth",
"(",
"self",
",",
"auth",
",",
"url",
"=",
"''",
")",
":",
"# If no Auth is explicitly provided, extract it from the URL first.",
"if",
"auth",
"is",
"None",
":",
"url_auth",
"=",
"get_auth_from_url",
"(",
"self",
".",
"url",
")",
"auth",
... | https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site-packages/pip/_vendor/requests/models.py#L480-L500 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/lyric/config_flow.py | python | OAuth2FlowHandler.async_step_reauth_confirm | (self, user_input=None) | return await self.async_step_user() | Dialog that informs the user that reauth is required. | Dialog that informs the user that reauth is required. | [
"Dialog",
"that",
"informs",
"the",
"user",
"that",
"reauth",
"is",
"required",
"."
] | async def async_step_reauth_confirm(self, user_input=None):
"""Dialog that informs the user that reauth is required."""
if user_input is None:
return self.async_show_form(
step_id="reauth_confirm",
data_schema=vol.Schema({}),
)
return await... | [
"async",
"def",
"async_step_reauth_confirm",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"None",
":",
"return",
"self",
".",
"async_show_form",
"(",
"step_id",
"=",
"\"reauth_confirm\"",
",",
"data_schema",
"=",
"vol",
".",... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/lyric/config_flow.py#L27-L34 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/cachecontrol/serialize.py | python | Serializer.loads | (self, request, data) | [] | def loads(self, request, data):
# Short circuit if we've been given an empty set of data
if not data:
return
# Determine what version of the serializer the data was serialized
# with
try:
ver, data = data.split(b",", 1)
except ValueError:
... | [
"def",
"loads",
"(",
"self",
",",
"request",
",",
"data",
")",
":",
"# Short circuit if we've been given an empty set of data",
"if",
"not",
"data",
":",
"return",
"# Determine what version of the serializer the data was serialized",
"# with",
"try",
":",
"ver",
",",
"dat... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/cachecontrol/serialize.py#L91-L118 | ||||
TuSimple/simpledet | 97413463f0bc3116f684eaf7031fd3dd6ded3149 | core/detection_module.py | python | DetModule.forward | (self, data_batch, is_train=None) | Forward computation. It supports data batches with different shapes, such as
different batch sizes or different image sizes.
If reshaping of data batch relates to modification of symbol or module, such as
changing image layout ordering or switching from training to predicting, module
reb... | Forward computation. It supports data batches with different shapes, such as
different batch sizes or different image sizes.
If reshaping of data batch relates to modification of symbol or module, such as
changing image layout ordering or switching from training to predicting, module
reb... | [
"Forward",
"computation",
".",
"It",
"supports",
"data",
"batches",
"with",
"different",
"shapes",
"such",
"as",
"different",
"batch",
"sizes",
"or",
"different",
"image",
"sizes",
".",
"If",
"reshaping",
"of",
"data",
"batch",
"relates",
"to",
"modification",
... | def forward(self, data_batch, is_train=None):
"""Forward computation. It supports data batches with different shapes, such as
different batch sizes or different image sizes.
If reshaping of data batch relates to modification of symbol or module, such as
changing image layout ordering or ... | [
"def",
"forward",
"(",
"self",
",",
"data_batch",
",",
"is_train",
"=",
"None",
")",
":",
"assert",
"self",
".",
"binded",
"and",
"self",
".",
"params_initialized",
"curr_data_shapes",
"=",
"tuple",
"(",
"i",
".",
"shape",
"for",
"i",
"in",
"self",
".",
... | https://github.com/TuSimple/simpledet/blob/97413463f0bc3116f684eaf7031fd3dd6ded3149/core/detection_module.py#L592-L644 | ||
dabeaz/ply | 559a7a1feabb0853be79d4f4dd9e9e9e5ea0d08c | example/yply/ylex.py | python | t_code_ignore_char | (t) | r'\'([^\\\n]|(\\.))*?\ | r'\'([^\\\n]|(\\.))*?\ | [
"r",
"\\",
"(",
"[",
"^",
"\\\\\\",
"n",
"]",
"|",
"(",
"\\\\",
".",
"))",
"*",
"?",
"\\"
] | def t_code_ignore_char(t):
r'\'([^\\\n]|(\\.))*?\'' | [
"def",
"t_code_ignore_char",
"(",
"t",
")",
":"
] | https://github.com/dabeaz/ply/blob/559a7a1feabb0853be79d4f4dd9e9e9e5ea0d08c/example/yply/ylex.py#L75-L76 | ||
TheAlgorithms/Python | 9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c | project_euler/problem_064/sol1.py | python | solution | (n: int = 10000) | return count_odd_periods | Returns the count of numbers <= 10000 with odd periods.
This function calls continuous_fraction_period for numbers which are
not perfect squares.
This is checked in if sr - floor(sr) != 0 statement.
If an odd period is returned by continuous_fraction_period,
count_odd_periods is increased by 1.
... | Returns the count of numbers <= 10000 with odd periods.
This function calls continuous_fraction_period for numbers which are
not perfect squares.
This is checked in if sr - floor(sr) != 0 statement.
If an odd period is returned by continuous_fraction_period,
count_odd_periods is increased by 1. | [
"Returns",
"the",
"count",
"of",
"numbers",
"<",
"=",
"10000",
"with",
"odd",
"periods",
".",
"This",
"function",
"calls",
"continuous_fraction_period",
"for",
"numbers",
"which",
"are",
"not",
"perfect",
"squares",
".",
"This",
"is",
"checked",
"in",
"if",
... | def solution(n: int = 10000) -> int:
"""
Returns the count of numbers <= 10000 with odd periods.
This function calls continuous_fraction_period for numbers which are
not perfect squares.
This is checked in if sr - floor(sr) != 0 statement.
If an odd period is returned by continuous_fraction_peri... | [
"def",
"solution",
"(",
"n",
":",
"int",
"=",
"10000",
")",
"->",
"int",
":",
"count_odd_periods",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"2",
",",
"n",
"+",
"1",
")",
":",
"sr",
"=",
"sqrt",
"(",
"i",
")",
"if",
"sr",
"-",
"floor",
"(",
... | https://github.com/TheAlgorithms/Python/blob/9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c/project_euler/problem_064/sol1.py#L47-L73 | |
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/transfer_learning/hetero_ftl/ftl_base.py | python | FTL.learning_rate_decay | (self, learning_rate, epoch) | return learning_rate * 1 / np.sqrt(epoch + 1) | learning_rate decay | learning_rate decay | [
"learning_rate",
"decay"
] | def learning_rate_decay(self, learning_rate, epoch):
"""
learning_rate decay
"""
return learning_rate * 1 / np.sqrt(epoch + 1) | [
"def",
"learning_rate_decay",
"(",
"self",
",",
"learning_rate",
",",
"epoch",
")",
":",
"return",
"learning_rate",
"*",
"1",
"/",
"np",
".",
"sqrt",
"(",
"epoch",
"+",
"1",
")"
] | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/transfer_learning/hetero_ftl/ftl_base.py#L167-L171 | |
huawei-noah/CV-Backbones | 03e8cdfe92494a55ddfb11cc875ff2e1c33f91da | versatile_filters/vcnn.py | python | vgg11 | (pretrained=False, **kwargs) | return model | VGG 11-layer model (configuration "A")
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet | VGG 11-layer model (configuration "A") | [
"VGG",
"11",
"-",
"layer",
"model",
"(",
"configuration",
"A",
")"
] | def vgg11(pretrained=False, **kwargs):
"""VGG 11-layer model (configuration "A")
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet
"""
if pretrained:
kwargs['init_weights'] = False
model = VGG(make_layers(cfg['A']), **kwargs)
if pretrained:
model.... | [
"def",
"vgg11",
"(",
"pretrained",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"pretrained",
":",
"kwargs",
"[",
"'init_weights'",
"]",
"=",
"False",
"model",
"=",
"VGG",
"(",
"make_layers",
"(",
"cfg",
"[",
"'A'",
"]",
")",
",",
"*",
"*... | https://github.com/huawei-noah/CV-Backbones/blob/03e8cdfe92494a55ddfb11cc875ff2e1c33f91da/versatile_filters/vcnn.py#L132-L143 | |
marcosfede/algorithms | 1ee7c815f9d556c9cef4d4b0d21ee3a409d21629 | dp/matrix_chain_order.py | python | main | () | [] | def main():
array = [30, 35, 15, 5, 10, 20, 25]
n = len(array)
# Size of matrix created from above array will be
# 30*35 35*15 15*5 5*10 10*20 20*25
matrix, optimal_solution = matrix_chain_order(array)
print("No. of Operation required: " + str((matrix[1][n - 1])))
print_optimal_solution(opt... | [
"def",
"main",
"(",
")",
":",
"array",
"=",
"[",
"30",
",",
"35",
",",
"15",
",",
"5",
",",
"10",
",",
"20",
",",
"25",
"]",
"n",
"=",
"len",
"(",
"array",
")",
"# Size of matrix created from above array will be",
"# 30*35 35*15 15*5 5*10 10*20 20*25",
"ma... | https://github.com/marcosfede/algorithms/blob/1ee7c815f9d556c9cef4d4b0d21ee3a409d21629/dp/matrix_chain_order.py#L39-L47 | ||||
nucleic/enaml | 65c2a2a2d765e88f2e1103046680571894bb41ed | enaml/qt/qt_scintilla.py | python | QtScintilla.set_autocomplete | (self, mode) | Set the autocompletion mode | Set the autocompletion mode | [
"Set",
"the",
"autocompletion",
"mode"
] | def set_autocomplete(self, mode):
""" Set the autocompletion mode
"""
self.widget.setAutoCompletionSource(AUTOCOMPLETION_SOURCE[mode]) | [
"def",
"set_autocomplete",
"(",
"self",
",",
"mode",
")",
":",
"self",
".",
"widget",
".",
"setAutoCompletionSource",
"(",
"AUTOCOMPLETION_SOURCE",
"[",
"mode",
"]",
")"
] | https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/qt/qt_scintilla.py#L480-L484 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/_pyio.py | python | TextIOWrapper.fileno | (self) | return self.buffer.fileno() | [] | def fileno(self):
return self.buffer.fileno() | [
"def",
"fileno",
"(",
"self",
")",
":",
"return",
"self",
".",
"buffer",
".",
"fileno",
"(",
")"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/_pyio.py#L2223-L2224 | |||
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/gen/git_revision.py | python | get_git_revision | (path="") | Return the short commit hash of the latest commit. | Return the short commit hash of the latest commit. | [
"Return",
"the",
"short",
"commit",
"hash",
"of",
"the",
"latest",
"commit",
"."
] | def get_git_revision(path=""):
"""
Return the short commit hash of the latest commit.
"""
stdout = ""
command = ['git', 'log', '-1', '--format=%h', path]
try:
proc = subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=s... | [
"def",
"get_git_revision",
"(",
"path",
"=",
"\"\"",
")",
":",
"stdout",
"=",
"\"\"",
"command",
"=",
"[",
"'git'",
",",
"'log'",
",",
"'-1'",
",",
"'--format=%h'",
",",
"path",
"]",
"try",
":",
"proc",
"=",
"subprocess",
".",
"Popen",
"(",
"command",
... | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gen/git_revision.py#L28-L49 | ||
i-pan/kaggle-rsna18 | 2db498fe99615d935aa676f04847d0c562fd8e46 | models/DeformableConvNets/lib/dataset/coco.py | python | coco._load_coco_annotation | (self, index) | return roi_rec | coco ann: [u'segmentation', u'area', u'iscrowd', u'image_id', u'bbox', u'category_id', u'id']
iscrowd:
crowd instances are handled by marking their overlaps with all categories to -1
and later excluded in training
bbox:
[x1, y1, w, h]
:param index: coco image ... | coco ann: [u'segmentation', u'area', u'iscrowd', u'image_id', u'bbox', u'category_id', u'id']
iscrowd:
crowd instances are handled by marking their overlaps with all categories to -1
and later excluded in training
bbox:
[x1, y1, w, h]
:param index: coco image ... | [
"coco",
"ann",
":",
"[",
"u",
"segmentation",
"u",
"area",
"u",
"iscrowd",
"u",
"image_id",
"u",
"bbox",
"u",
"category_id",
"u",
"id",
"]",
"iscrowd",
":",
"crowd",
"instances",
"are",
"handled",
"by",
"marking",
"their",
"overlaps",
"with",
"all",
"cat... | def _load_coco_annotation(self, index):
"""
coco ann: [u'segmentation', u'area', u'iscrowd', u'image_id', u'bbox', u'category_id', u'id']
iscrowd:
crowd instances are handled by marking their overlaps with all categories to -1
and later excluded in training
bbox:
... | [
"def",
"_load_coco_annotation",
"(",
"self",
",",
"index",
")",
":",
"im_ann",
"=",
"self",
".",
"coco",
".",
"loadImgs",
"(",
"index",
")",
"[",
"0",
"]",
"width",
"=",
"im_ann",
"[",
"'width'",
"]",
"height",
"=",
"im_ann",
"[",
"'height'",
"]",
"a... | https://github.com/i-pan/kaggle-rsna18/blob/2db498fe99615d935aa676f04847d0c562fd8e46/models/DeformableConvNets/lib/dataset/coco.py#L142-L196 | |
wbond/oscrypto | d40c62577706682a0f6da5616ad09964f1c9137d | oscrypto/_openssl/symmetric.py | python | aes_cbc_pkcs7_decrypt | (key, data, iv) | return _decrypt(cipher, key, data, iv, True) | Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key
:param key:
The encryption key - a byte string either 16, 24 or 32 bytes long
:param data:
The ciphertext - a byte string
:param iv:
The initialization vector - a byte string 16-bytes long
:raises:
Va... | Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key | [
"Decrypts",
"AES",
"ciphertext",
"in",
"CBC",
"mode",
"using",
"a",
"128",
"192",
"or",
"256",
"bit",
"key"
] | def aes_cbc_pkcs7_decrypt(key, data, iv):
"""
Decrypts AES ciphertext in CBC mode using a 128, 192 or 256 bit key
:param key:
The encryption key - a byte string either 16, 24 or 32 bytes long
:param data:
The ciphertext - a byte string
:param iv:
The initialization vector ... | [
"def",
"aes_cbc_pkcs7_decrypt",
"(",
"key",
",",
"data",
",",
"iv",
")",
":",
"cipher",
"=",
"_calculate_aes_cipher",
"(",
"key",
")",
"if",
"len",
"(",
"iv",
")",
"!=",
"16",
":",
"raise",
"ValueError",
"(",
"pretty_message",
"(",
"'''\n iv must ... | https://github.com/wbond/oscrypto/blob/d40c62577706682a0f6da5616ad09964f1c9137d/oscrypto/_openssl/symmetric.py#L152-L184 | |
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/gdata/codesearch/service.py | python | CodesearchService.__init__ | (self, email=None, password=None, source=None,
server='www.google.com', additional_headers=None, **kwargs) | Creates a client for the Google codesearch service.
Args:
email: string (optional) The user's email address, used for
authentication.
password: string (optional) The user's password.
source: string (optional) The name of the user's application.
server: stri... | Creates a client for the Google codesearch service. | [
"Creates",
"a",
"client",
"for",
"the",
"Google",
"codesearch",
"service",
"."
] | def __init__(self, email=None, password=None, source=None,
server='www.google.com', additional_headers=None, **kwargs):
"""Creates a client for the Google codesearch service.
Args:
email: string (optional) The user's email address, used for
authentication.
... | [
"def",
"__init__",
"(",
"self",
",",
"email",
"=",
"None",
",",
"password",
"=",
"None",
",",
"source",
"=",
"None",
",",
"server",
"=",
"'www.google.com'",
",",
"additional_headers",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"gdata",
".",
"servi... | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/gdata/codesearch/service.py#L33-L50 | ||
Fizzadar/pyinfra | ff0913d6a172966760b63fe59e55dff9ea852e0d | pyinfra/facts/server.py | python | KernelModules.process | (output) | return modules | [] | def process(output):
modules = {}
for line in output:
name, size, instances, depends, state, _ = line.split(' ', 5)
instances = int(instances)
module = {
'size': size,
'instances': instances,
'state': state,
... | [
"def",
"process",
"(",
"output",
")",
":",
"modules",
"=",
"{",
"}",
"for",
"line",
"in",
"output",
":",
"name",
",",
"size",
",",
"instances",
",",
"depends",
",",
"state",
",",
"_",
"=",
"line",
".",
"split",
"(",
"' '",
",",
"5",
")",
"instanc... | https://github.com/Fizzadar/pyinfra/blob/ff0913d6a172966760b63fe59e55dff9ea852e0d/pyinfra/facts/server.py#L212-L234 | |||
qtile/qtile | 803dc06fc1f8b121a1d8fe047f26a43812cd427f | libqtile/backend/x11/window.py | python | Window.cmd_static | (
self,
screen: Optional[int] = None,
x: Optional[int] = None,
y: Optional[int] = None,
width: Optional[int] = None,
height: Optional[int] = None,
) | Makes this window a static window, attached to a Screen
If any of the arguments are left unspecified, the values given by the
window itself are used instead. So, for a window that's aware of its
appropriate size and location (like dzen), you don't have to specify
anything. | Makes this window a static window, attached to a Screen | [
"Makes",
"this",
"window",
"a",
"static",
"window",
"attached",
"to",
"a",
"Screen"
] | def cmd_static(
self,
screen: Optional[int] = None,
x: Optional[int] = None,
y: Optional[int] = None,
width: Optional[int] = None,
height: Optional[int] = None,
) -> None:
"""Makes this window a static window, attached to a Screen
If any of the argume... | [
"def",
"cmd_static",
"(",
"self",
",",
"screen",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
"x",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
"y",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
"width",
":",
"Optional",
"[",
... | https://github.com/qtile/qtile/blob/803dc06fc1f8b121a1d8fe047f26a43812cd427f/libqtile/backend/x11/window.py#L1381-L1406 | ||
pywavefront/PyWavefront | 7ae734c3317e2af59b93f3e24b68e5a57a2088ab | pywavefront/texture.py | python | Texture.path | (self) | return str(self._path) | str: search_path + name | str: search_path + name | [
"str",
":",
"search_path",
"+",
"name"
] | def path(self):
"""str: search_path + name"""
return str(self._path) | [
"def",
"path",
"(",
"self",
")",
":",
"return",
"str",
"(",
"self",
".",
"_path",
")"
] | https://github.com/pywavefront/PyWavefront/blob/7ae734c3317e2af59b93f3e24b68e5a57a2088ab/pywavefront/texture.py#L244-L246 | |
SamSchott/maestral | a32653bac7b5a76cb326d4fd5a4fb2c11f19a2fc | src/maestral/sync.py | python | SyncEngine.excluded_items | (self) | return self._excluded_items | List of all files and folders excluded from sync. Changes are saved to the
config file. If a parent folder is excluded, its children will automatically be
removed from the list. If only children are given but not the parent folder, any
new items added to the parent will be synced. Change this pr... | List of all files and folders excluded from sync. Changes are saved to the
config file. If a parent folder is excluded, its children will automatically be
removed from the list. If only children are given but not the parent folder, any
new items added to the parent will be synced. Change this pr... | [
"List",
"of",
"all",
"files",
"and",
"folders",
"excluded",
"from",
"sync",
".",
"Changes",
"are",
"saved",
"to",
"the",
"config",
"file",
".",
"If",
"a",
"parent",
"folder",
"is",
"excluded",
"its",
"children",
"will",
"automatically",
"be",
"removed",
"f... | def excluded_items(self) -> List[str]:
"""List of all files and folders excluded from sync. Changes are saved to the
config file. If a parent folder is excluded, its children will automatically be
removed from the list. If only children are given but not the parent folder, any
new items ... | [
"def",
"excluded_items",
"(",
"self",
")",
"->",
"List",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_excluded_items"
] | https://github.com/SamSchott/maestral/blob/a32653bac7b5a76cb326d4fd5a4fb2c11f19a2fc/src/maestral/sync.py#L593-L599 | |
ConvLab/ConvLab | a04582a77537c1a706fbf64715baa9ad0be1301a | convlab/modules/policy/user/multiwoz/policy_agenda_multiwoz.py | python | Goal.task_complete | (self) | return True | Check that all requests have been met
Returns:
(boolean): True to accomplish. | Check that all requests have been met
Returns:
(boolean): True to accomplish. | [
"Check",
"that",
"all",
"requests",
"have",
"been",
"met",
"Returns",
":",
"(",
"boolean",
")",
":",
"True",
"to",
"accomplish",
"."
] | def task_complete(self):
"""
Check that all requests have been met
Returns:
(boolean): True to accomplish.
"""
for domain in self.domains:
if 'reqt' in self.domain_goals[domain]:
reqt_vals = self.domain_goals[domain]['reqt'].values()
... | [
"def",
"task_complete",
"(",
"self",
")",
":",
"for",
"domain",
"in",
"self",
".",
"domains",
":",
"if",
"'reqt'",
"in",
"self",
".",
"domain_goals",
"[",
"domain",
"]",
":",
"reqt_vals",
"=",
"self",
".",
"domain_goals",
"[",
"domain",
"]",
"[",
"'req... | https://github.com/ConvLab/ConvLab/blob/a04582a77537c1a706fbf64715baa9ad0be1301a/convlab/modules/policy/user/multiwoz/policy_agenda_multiwoz.py#L294-L310 | |
wagtail/wagtail | ba8207a5d82c8a1de8f5f9693a7cd07421762999 | wagtail/core/models/__init__.py | python | PageViewRestriction.save | (self, user=None, **kwargs) | Custom save handler to include logging.
:param user: the user add/updating the view restriction
:param specific_instance: the specific model instance the restriction applies to | Custom save handler to include logging.
:param user: the user add/updating the view restriction
:param specific_instance: the specific model instance the restriction applies to | [
"Custom",
"save",
"handler",
"to",
"include",
"logging",
".",
":",
"param",
"user",
":",
"the",
"user",
"add",
"/",
"updating",
"the",
"view",
"restriction",
":",
"param",
"specific_instance",
":",
"the",
"specific",
"model",
"instance",
"the",
"restriction",
... | def save(self, user=None, **kwargs):
"""
Custom save handler to include logging.
:param user: the user add/updating the view restriction
:param specific_instance: the specific model instance the restriction applies to
"""
specific_instance = self.page.specific
is_... | [
"def",
"save",
"(",
"self",
",",
"user",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"specific_instance",
"=",
"self",
".",
"page",
".",
"specific",
"is_new",
"=",
"self",
".",
"id",
"is",
"None",
"super",
"(",
")",
".",
"save",
"(",
"*",
"*"... | https://github.com/wagtail/wagtail/blob/ba8207a5d82c8a1de8f5f9693a7cd07421762999/wagtail/core/models/__init__.py#L2770-L2791 | ||
googlefonts/gftools | 8ad55dd4d7e38729524329c79f236476f1576e67 | Lib/gftools/utils.py | python | download_file | (url, dst_path=None) | Download a file from a url. If no dst_path is specified, store the file
as a BytesIO object | Download a file from a url. If no dst_path is specified, store the file
as a BytesIO object | [
"Download",
"a",
"file",
"from",
"a",
"url",
".",
"If",
"no",
"dst_path",
"is",
"specified",
"store",
"the",
"file",
"as",
"a",
"BytesIO",
"object"
] | def download_file(url, dst_path=None):
"""Download a file from a url. If no dst_path is specified, store the file
as a BytesIO object"""
request = requests.get(url, stream=True)
if not dst_path:
return BytesIO(request.content)
with open(dst_path, 'wb') as downloaded_file:
downloaded_... | [
"def",
"download_file",
"(",
"url",
",",
"dst_path",
"=",
"None",
")",
":",
"request",
"=",
"requests",
".",
"get",
"(",
"url",
",",
"stream",
"=",
"True",
")",
"if",
"not",
"dst_path",
":",
"return",
"BytesIO",
"(",
"request",
".",
"content",
")",
"... | https://github.com/googlefonts/gftools/blob/8ad55dd4d7e38729524329c79f236476f1576e67/Lib/gftools/utils.py#L200-L207 | ||
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/zipfile.py | python | ZipFile.close | (self) | Close the file, and for mode "w" and "a" write the ending
records. | Close the file, and for mode "w" and "a" write the ending
records. | [
"Close",
"the",
"file",
"and",
"for",
"mode",
"w",
"and",
"a",
"write",
"the",
"ending",
"records",
"."
] | def close(self):
"""Close the file, and for mode "w" and "a" write the ending
records."""
if self.fp is None:
return
if self.mode in ("w", "a") and self._didModify: # write ending records
count = 0
pos1 = self.fp.tell()
for zinfo in self.f... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"fp",
"is",
"None",
":",
"return",
"if",
"self",
".",
"mode",
"in",
"(",
"\"w\"",
",",
"\"a\"",
")",
"and",
"self",
".",
"_didModify",
":",
"# write ending records",
"count",
"=",
"0",
"pos1",... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/zipfile.py#L1152-L1260 | ||
jd/tenacity | 005ef22015ec4fda8646bf9dce7aaa1a4fa121d2 | tenacity/wait.py | python | wait_base.__radd__ | (self, other: "wait_base") | return self.__add__(other) | [] | def __radd__(self, other: "wait_base") -> typing.Union["wait_combine", "wait_base"]:
# make it possible to use multiple waits with the built-in sum function
if other == 0:
return self
return self.__add__(other) | [
"def",
"__radd__",
"(",
"self",
",",
"other",
":",
"\"wait_base\"",
")",
"->",
"typing",
".",
"Union",
"[",
"\"wait_combine\"",
",",
"\"wait_base\"",
"]",
":",
"# make it possible to use multiple waits with the built-in sum function",
"if",
"other",
"==",
"0",
":",
... | https://github.com/jd/tenacity/blob/005ef22015ec4fda8646bf9dce7aaa1a4fa121d2/tenacity/wait.py#L37-L41 | |||
albertz/music-player | d23586f5bf657cbaea8147223be7814d117ae73d | mac/pyobjc-core/Examples/NonFunctional/RemotePyInterpreter/netrepr.py | python | ObjectPool.referenceForObject | (self, obj) | return rval | [] | def referenceForObject(self, obj):
obj_id = id(obj)
rval = self.obj_ids.get(obj_id)
if rval is None:
ident = self._identfactory.next()
rval = ObjectReference(self, ident, type_string(obj), obj, obj_id)
rval = rval.alloc().autorelease()
return rval | [
"def",
"referenceForObject",
"(",
"self",
",",
"obj",
")",
":",
"obj_id",
"=",
"id",
"(",
"obj",
")",
"rval",
"=",
"self",
".",
"obj_ids",
".",
"get",
"(",
"obj_id",
")",
"if",
"rval",
"is",
"None",
":",
"ident",
"=",
"self",
".",
"_identfactory",
... | https://github.com/albertz/music-player/blob/d23586f5bf657cbaea8147223be7814d117ae73d/mac/pyobjc-core/Examples/NonFunctional/RemotePyInterpreter/netrepr.py#L133-L140 | |||
Pext/Pext | f13e455e8003e7719e583dcff1fdb2826b6e10e0 | pext/__main__.py | python | ModuleManager.unload | (self, index: int, for_reload=False, window=None) | Unload a module by tab index. | Unload a module by tab index. | [
"Unload",
"a",
"module",
"by",
"tab",
"index",
"."
] | def unload(self, index: int, for_reload=False, window=None) -> None:
"""Unload a module by tab index."""
Core.remove_module(index)
if window:
window.remove_module(index, for_reload) | [
"def",
"unload",
"(",
"self",
",",
"index",
":",
"int",
",",
"for_reload",
"=",
"False",
",",
"window",
"=",
"None",
")",
"->",
"None",
":",
"Core",
".",
"remove_module",
"(",
"index",
")",
"if",
"window",
":",
"window",
".",
"remove_module",
"(",
"i... | https://github.com/Pext/Pext/blob/f13e455e8003e7719e583dcff1fdb2826b6e10e0/pext/__main__.py#L1455-L1459 | ||
k2kobayashi/sprocket | e16d9c8c49ef8aa15a5dec89bfb0049a9baf845e | example/download_speech_corpus.py | python | ExtensionList.itemize_in_directory | (self, directory, recurse=False) | Search for audio files with the designated extensions in the directory.
Parameters
----------
directory : Path
The path of the directory where audio files are searched for.
recurse : bool
`True` if audio files in subdirectories must be searched.
Returns
... | Search for audio files with the designated extensions in the directory. | [
"Search",
"for",
"audio",
"files",
"with",
"the",
"designated",
"extensions",
"in",
"the",
"directory",
"."
] | def itemize_in_directory(self, directory, recurse=False):
"""
Search for audio files with the designated extensions in the directory.
Parameters
----------
directory : Path
The path of the directory where audio files are searched for.
recurse : bool
... | [
"def",
"itemize_in_directory",
"(",
"self",
",",
"directory",
",",
"recurse",
"=",
"False",
")",
":",
"query_prefix",
"=",
"(",
"\"**/\"",
"if",
"recurse",
"else",
"\"\"",
")",
"+",
"\"*.\"",
"for",
"extension",
"in",
"self",
".",
"extensions",
":",
"yield... | https://github.com/k2kobayashi/sprocket/blob/e16d9c8c49ef8aa15a5dec89bfb0049a9baf845e/example/download_speech_corpus.py#L247-L265 | ||
davidteather/TikTok-Api | a356324ab3171d473619fdf3e1dd71e5996cfc29 | TikTokApi/tiktok.py | python | TikTokApi.get_music_object_full_by_api | (self, id, **kwargs) | return res["musicInfo"] | Returns a music object for a specific sound id, but using the API rather than HTML requests.
##### Parameters
* id: The sound id to get the object for
This can be found by using other methods. | Returns a music object for a specific sound id, but using the API rather than HTML requests. | [
"Returns",
"a",
"music",
"object",
"for",
"a",
"specific",
"sound",
"id",
"but",
"using",
"the",
"API",
"rather",
"than",
"HTML",
"requests",
"."
] | def get_music_object_full_by_api(self, id, **kwargs):
"""Returns a music object for a specific sound id, but using the API rather than HTML requests.
##### Parameters
* id: The sound id to get the object for
This can be found by using other methods.
"""
(
... | [
"def",
"get_music_object_full_by_api",
"(",
"self",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"(",
"region",
",",
"language",
",",
"proxy",
",",
"maxCount",
",",
"device_id",
",",
")",
"=",
"self",
".",
"__process_kwargs__",
"(",
"kwargs",
")",
"kwar... | https://github.com/davidteather/TikTok-Api/blob/a356324ab3171d473619fdf3e1dd71e5996cfc29/TikTokApi/tiktok.py#L1022-L1047 | |
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/tkinter/tix.py | python | Tree.close | (self, entrypath) | Close the entry given by entryPath if its mode is close. | Close the entry given by entryPath if its mode is close. | [
"Close",
"the",
"entry",
"given",
"by",
"entryPath",
"if",
"its",
"mode",
"is",
"close",
"."
] | def close(self, entrypath):
'''Close the entry given by entryPath if its mode is close.'''
self.tk.call(self._w, 'close', entrypath) | [
"def",
"close",
"(",
"self",
",",
"entrypath",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'close'",
",",
"entrypath",
")"
] | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/tkinter/tix.py#L1522-L1524 | ||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/reportlab/platypus/figures.py | python | FlexFigure._scale | (self,availWidth,availHeight) | Rescale to fit according to the rules, but only once | Rescale to fit according to the rules, but only once | [
"Rescale",
"to",
"fit",
"according",
"to",
"the",
"rules",
"but",
"only",
"once"
] | def _scale(self,availWidth,availHeight):
"Rescale to fit according to the rules, but only once"
if self._scaleFactor is None or self.width>availWidth or self.height>availHeight:
w, h = Figure.wrap(self, availWidth, availHeight)
captionHeight = h - self.figureHeight
if... | [
"def",
"_scale",
"(",
"self",
",",
"availWidth",
",",
"availHeight",
")",
":",
"if",
"self",
".",
"_scaleFactor",
"is",
"None",
"or",
"self",
".",
"width",
">",
"availWidth",
"or",
"self",
".",
"height",
">",
"availHeight",
":",
"w",
",",
"h",
"=",
"... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/reportlab/platypus/figures.py#L195-L210 | ||
pypa/setuptools | 9f37366aab9cd8f6baa23e6a77cfdb8daf97757e | setuptools/_distutils/msvccompiler.py | python | MSVCCompiler.link | (self,
target_desc,
objects,
output_filename,
output_dir=None,
libraries=None,
library_dirs=None,
runtime_library_dirs=None,
export_symbols=None,
debug=0,
extra_preargs=None,
ex... | [] | def link(self,
target_desc,
objects,
output_filename,
output_dir=None,
libraries=None,
library_dirs=None,
runtime_library_dirs=None,
export_symbols=None,
debug=0,
extra_preargs=None,
... | [
"def",
"link",
"(",
"self",
",",
"target_desc",
",",
"objects",
",",
"output_filename",
",",
"output_dir",
"=",
"None",
",",
"libraries",
"=",
"None",
",",
"library_dirs",
"=",
"None",
",",
"runtime_library_dirs",
"=",
"None",
",",
"export_symbols",
"=",
"No... | https://github.com/pypa/setuptools/blob/9f37366aab9cd8f6baa23e6a77cfdb8daf97757e/setuptools/_distutils/msvccompiler.py#L453-L529 | ||||
IOActive/XDiFF | 552d3394e119ca4ced8115f9fd2d7e26760e40b1 | classes/db.py | python | Db.get_software | (self) | return self.restrict_software | Get the current software ids restriction | Get the current software ids restriction | [
"Get",
"the",
"current",
"software",
"ids",
"restriction"
] | def get_software(self):
"""Get the current software ids restriction"""
return self.restrict_software | [
"def",
"get_software",
"(",
"self",
")",
":",
"return",
"self",
".",
"restrict_software"
] | https://github.com/IOActive/XDiFF/blob/552d3394e119ca4ced8115f9fd2d7e26760e40b1/classes/db.py#L100-L102 | |
tdryer/hangups | f0b37be1d46e71b30337227d7c46192cc726dcb4 | examples/common.py | python | run_example | (example_coroutine, *extra_args) | Run a hangups example coroutine.
Args:
example_coroutine (coroutine): Coroutine to run with a connected
hangups client and arguments namespace as arguments.
extra_args (str): Any extra command line arguments required by the
example. | Run a hangups example coroutine. | [
"Run",
"a",
"hangups",
"example",
"coroutine",
"."
] | def run_example(example_coroutine, *extra_args):
"""Run a hangups example coroutine.
Args:
example_coroutine (coroutine): Coroutine to run with a connected
hangups client and arguments namespace as arguments.
extra_args (str): Any extra command line arguments required by the
... | [
"def",
"run_example",
"(",
"example_coroutine",
",",
"*",
"extra_args",
")",
":",
"args",
"=",
"_get_parser",
"(",
"extra_args",
")",
".",
"parse_args",
"(",
")",
"logging",
".",
"basicConfig",
"(",
"level",
"=",
"logging",
".",
"DEBUG",
"if",
"args",
".",... | https://github.com/tdryer/hangups/blob/f0b37be1d46e71b30337227d7c46192cc726dcb4/examples/common.py#L12-L37 | ||
nschloe/quadpy | c4c076d8ddfa968486a2443a95e2fb3780dcde0f | src/quadpy/e2r2/_helpers.py | python | E2r2Scheme.plot | (self, show_axes=False) | [] | def plot(self, show_axes=False):
from matplotlib import pyplot as plt
ax = plt.gca()
plt.axis("equal")
if not show_axes:
ax.set_axis_off()
I0 = 2 * math.pi
plot_disks(plt, self.points.T, self.weights, I0) | [
"def",
"plot",
"(",
"self",
",",
"show_axes",
"=",
"False",
")",
":",
"from",
"matplotlib",
"import",
"pyplot",
"as",
"plt",
"ax",
"=",
"plt",
".",
"gca",
"(",
")",
"plt",
".",
"axis",
"(",
"\"equal\"",
")",
"if",
"not",
"show_axes",
":",
"ax",
"."... | https://github.com/nschloe/quadpy/blob/c4c076d8ddfa968486a2443a95e2fb3780dcde0f/src/quadpy/e2r2/_helpers.py#L28-L38 | ||||
dbsr/vimfox | 4a0145937226843b4b8b5681136ab9a45fb5d066 | vimfox/server/server.py | python | send_vimfox_file | (filename) | [] | def send_vimfox_file(filename):
app.logger.info(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'assets', filename))
try:
return send_file(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'assets', filename))
except:
return Response(':(', status=404) | [
"def",
"send_vimfox_file",
"(",
"filename",
")",
":",
"app",
".",
"logger",
".",
"info",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"__file__",
")",
")",
",",
"'assets'"... | https://github.com/dbsr/vimfox/blob/4a0145937226843b4b8b5681136ab9a45fb5d066/vimfox/server/server.py#L18-L23 | ||||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py | python | WorkerChannelList.__repr__ | (self) | return '<Twilio.Taskrouter.V1.WorkerChannelList>' | Provide a friendly representation
:returns: Machine friendly representation
:rtype: str | Provide a friendly representation | [
"Provide",
"a",
"friendly",
"representation"
] | def __repr__(self):
"""
Provide a friendly representation
:returns: Machine friendly representation
:rtype: str
"""
return '<Twilio.Taskrouter.V1.WorkerChannelList>' | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'<Twilio.Taskrouter.V1.WorkerChannelList>'"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py#L145-L152 | |
stoq/stoq | c26991644d1affcf96bc2e0a0434796cabdf8448 | stoqlib/domain/workorder.py | python | WorkOrder.finish | (self, current_branch: Branch, user: LoginUser) | Finishes this work order's task
The :obj:`.execution_responsible` has finished working on
this order's task. It's possible now to give the equipment
back to the |client| and create a |sale| so we are able
to :meth:`deliver <.deliver>` this order. | Finishes this work order's task | [
"Finishes",
"this",
"work",
"order",
"s",
"task"
] | def finish(self, current_branch: Branch, user: LoginUser):
"""Finishes this work order's task
The :obj:`.execution_responsible` has finished working on
this order's task. It's possible now to give the equipment
back to the |client| and create a |sale| so we are able
to :meth:`de... | [
"def",
"finish",
"(",
"self",
",",
"current_branch",
":",
"Branch",
",",
"user",
":",
"LoginUser",
")",
":",
"assert",
"self",
".",
"can_finish",
"(",
"current_branch",
")",
"self",
".",
"finish_date",
"=",
"localnow",
"(",
")",
"# Make sure we are not overwri... | https://github.com/stoq/stoq/blob/c26991644d1affcf96bc2e0a0434796cabdf8448/stoqlib/domain/workorder.py#L1085-L1099 | ||
collinsctk/PyQYT | 7af3673955f94ff1b2df2f94220cd2dab2e252af | ExtentionPackages/tornado/auth.py | python | OpenIdMixin.get_authenticated_user | (self, callback, http_client=None) | Fetches the authenticated user data upon redirect.
This method should be called by the handler that receives the
redirect from the `authenticate_redirect()` method (which is
often the same as the one that calls it; in that case you would
call `get_authenticated_user` if the ``openid.mod... | Fetches the authenticated user data upon redirect. | [
"Fetches",
"the",
"authenticated",
"user",
"data",
"upon",
"redirect",
"."
] | def get_authenticated_user(self, callback, http_client=None):
"""Fetches the authenticated user data upon redirect.
This method should be called by the handler that receives the
redirect from the `authenticate_redirect()` method (which is
often the same as the one that calls it; in that... | [
"def",
"get_authenticated_user",
"(",
"self",
",",
"callback",
",",
"http_client",
"=",
"None",
")",
":",
"# Verify the OpenID response via direct request to the OP",
"args",
"=",
"dict",
"(",
"(",
"k",
",",
"v",
"[",
"-",
"1",
"]",
")",
"for",
"k",
",",
"v"... | https://github.com/collinsctk/PyQYT/blob/7af3673955f94ff1b2df2f94220cd2dab2e252af/ExtentionPackages/tornado/auth.py#L178-L197 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/categories/category_with_axiom.py | python | CategoryWithAxiom.extra_super_categories | (self) | return [] | Return the extra super categories of a category with axiom.
Default implementation which returns ``[]``.
EXAMPLES::
sage: FiniteSets().extra_super_categories()
[] | Return the extra super categories of a category with axiom. | [
"Return",
"the",
"extra",
"super",
"categories",
"of",
"a",
"category",
"with",
"axiom",
"."
] | def extra_super_categories(self):
"""
Return the extra super categories of a category with axiom.
Default implementation which returns ``[]``.
EXAMPLES::
sage: FiniteSets().extra_super_categories()
[]
"""
return [] | [
"def",
"extra_super_categories",
"(",
"self",
")",
":",
"return",
"[",
"]"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/categories/category_with_axiom.py#L2123-L2134 | |
cuthbertLab/music21 | bd30d4663e52955ed922c10fdf541419d8c67671 | music21/text.py | python | Trigram.makeWords | (self, count) | return ''.join(text) | returns a string of made-up words based on the known text. | returns a string of made-up words based on the known text. | [
"returns",
"a",
"string",
"of",
"made",
"-",
"up",
"words",
"based",
"on",
"the",
"known",
"text",
"."
] | def makeWords(self, count):
'''
returns a string of made-up words based on the known text.
'''
text = []
k = ' '
while count:
n = self.likely(k)
text.append(n)
k = k[1] + n
if n in ' \t':
count -= 1
... | [
"def",
"makeWords",
"(",
"self",
",",
"count",
")",
":",
"text",
"=",
"[",
"]",
"k",
"=",
"' '",
"while",
"count",
":",
"n",
"=",
"self",
".",
"likely",
"(",
"k",
")",
"text",
".",
"append",
"(",
"n",
")",
"k",
"=",
"k",
"[",
"1",
"]",
"+"... | https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/text.py#L579-L591 | |
phimpme/phimpme-generator | ba6d11190b9016238f27672e1ad55e6a875b74a0 | Phimpme/site-packages/coverage/files.py | python | FnmatchMatcher.match | (self, fpath) | return False | Does `fpath` match one of our filename patterns? | Does `fpath` match one of our filename patterns? | [
"Does",
"fpath",
"match",
"one",
"of",
"our",
"filename",
"patterns?"
] | def match(self, fpath):
"""Does `fpath` match one of our filename patterns?"""
for pat in self.pats:
if fnmatch.fnmatch(fpath, pat):
return True
return False | [
"def",
"match",
"(",
"self",
",",
"fpath",
")",
":",
"for",
"pat",
"in",
"self",
".",
"pats",
":",
"if",
"fnmatch",
".",
"fnmatch",
"(",
"fpath",
",",
"pat",
")",
":",
"return",
"True",
"return",
"False"
] | https://github.com/phimpme/phimpme-generator/blob/ba6d11190b9016238f27672e1ad55e6a875b74a0/Phimpme/site-packages/coverage/files.py#L188-L193 | |
O365/python-o365 | 7f77005c3cee8177d0141e79b8eda8a7b60c5124 | O365/calendar.py | python | Event.organizer | (self) | return self.__organizer | Organizer of the meeting event
:rtype: Recipient | Organizer of the meeting event | [
"Organizer",
"of",
"the",
"meeting",
"event"
] | def organizer(self):
""" Organizer of the meeting event
:rtype: Recipient
"""
return self.__organizer | [
"def",
"organizer",
"(",
"self",
")",
":",
"return",
"self",
".",
"__organizer"
] | https://github.com/O365/python-o365/blob/7f77005c3cee8177d0141e79b8eda8a7b60c5124/O365/calendar.py#L1195-L1200 | |
gorakhargosh/watchdog | 77e1f4668bc42b4a8706b181d882fd68c05ab8b9 | src/watchdog/utils/patterns.py | python | match_any_paths | (paths, included_patterns=None, excluded_patterns=None, case_sensitive=True) | return False | Matches from a set of paths based on acceptable patterns and
ignorable patterns.
:param pathnames:
A list of path names that will be filtered based on matching and
ignored patterns.
:param included_patterns:
Allow filenames matching wildcard patterns specified in this list.
I... | Matches from a set of paths based on acceptable patterns and
ignorable patterns.
:param pathnames:
A list of path names that will be filtered based on matching and
ignored patterns.
:param included_patterns:
Allow filenames matching wildcard patterns specified in this list.
I... | [
"Matches",
"from",
"a",
"set",
"of",
"paths",
"based",
"on",
"acceptable",
"patterns",
"and",
"ignorable",
"patterns",
".",
":",
"param",
"pathnames",
":",
"A",
"list",
"of",
"path",
"names",
"that",
"will",
"be",
"filtered",
"based",
"on",
"matching",
"an... | def match_any_paths(paths, included_patterns=None, excluded_patterns=None, case_sensitive=True):
"""
Matches from a set of paths based on acceptable patterns and
ignorable patterns.
:param pathnames:
A list of path names that will be filtered based on matching and
ignored patterns.
:... | [
"def",
"match_any_paths",
"(",
"paths",
",",
"included_patterns",
"=",
"None",
",",
"excluded_patterns",
"=",
"None",
",",
"case_sensitive",
"=",
"True",
")",
":",
"included",
"=",
"[",
"\"*\"",
"]",
"if",
"included_patterns",
"is",
"None",
"else",
"included_p... | https://github.com/gorakhargosh/watchdog/blob/77e1f4668bc42b4a8706b181d882fd68c05ab8b9/src/watchdog/utils/patterns.py#L62-L87 | |
google-research/albert | 932b41f0319fbef7efd069d5ff545e3358574e19 | tokenization.py | python | encode_pieces | (sp_model, text, return_unicode=True, sample=False) | return new_pieces | turn sentences into word pieces. | turn sentences into word pieces. | [
"turn",
"sentences",
"into",
"word",
"pieces",
"."
] | def encode_pieces(sp_model, text, return_unicode=True, sample=False):
"""turn sentences into word pieces."""
if six.PY2 and isinstance(text, six.text_type):
text = six.ensure_binary(text, "utf-8")
if not sample:
pieces = sp_model.EncodeAsPieces(text)
else:
pieces = sp_model.SampleEncodeAsPieces(te... | [
"def",
"encode_pieces",
"(",
"sp_model",
",",
"text",
",",
"return_unicode",
"=",
"True",
",",
"sample",
"=",
"False",
")",
":",
"if",
"six",
".",
"PY2",
"and",
"isinstance",
"(",
"text",
",",
"six",
".",
"text_type",
")",
":",
"text",
"=",
"six",
".... | https://github.com/google-research/albert/blob/932b41f0319fbef7efd069d5ff545e3358574e19/tokenization.py#L54-L89 | |
caktus/django-timepiece | 52515dec027664890efbc535429e1ba1ee152f40 | timepiece/reports/forms.py | python | BillableHoursReportForm.__init__ | (self, *args, **kwargs) | If the 'select_all' argument is given, any data values for users,
activities, and project_types are overwritten with all available
choices. | If the 'select_all' argument is given, any data values for users,
activities, and project_types are overwritten with all available
choices. | [
"If",
"the",
"select_all",
"argument",
"is",
"given",
"any",
"data",
"values",
"for",
"users",
"activities",
"and",
"project_types",
"are",
"overwritten",
"with",
"all",
"available",
"choices",
"."
] | def __init__(self, *args, **kwargs):
"""
If the 'select_all' argument is given, any data values for users,
activities, and project_types are overwritten with all available
choices.
"""
select_all = kwargs.pop('select_all', False)
super(BillableHoursReportForm, se... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"select_all",
"=",
"kwargs",
".",
"pop",
"(",
"'select_all'",
",",
"False",
")",
"super",
"(",
"BillableHoursReportForm",
",",
"self",
")",
".",
"__init__",
"(",
"*",
... | https://github.com/caktus/django-timepiece/blob/52515dec027664890efbc535429e1ba1ee152f40/timepiece/reports/forms.py#L30-L56 | ||
sham00n/buster | 131437e6128b6ad85fa2a9f17ad51311c885b8c2 | buster/lib/modules/github.py | python | email2github | (email,response) | [] | def email2github(email,response):
try:
if response.status_code==200:
data=response.json()
if data['items'] != []:
return data['items'][0]['html_url']
else:
return ""
else:
return ""
except:
print("[=]Warning:Something went wrong while attempting to scrap github.com")
return "" | [
"def",
"email2github",
"(",
"email",
",",
"response",
")",
":",
"try",
":",
"if",
"response",
".",
"status_code",
"==",
"200",
":",
"data",
"=",
"response",
".",
"json",
"(",
")",
"if",
"data",
"[",
"'items'",
"]",
"!=",
"[",
"]",
":",
"return",
"d... | https://github.com/sham00n/buster/blob/131437e6128b6ad85fa2a9f17ad51311c885b8c2/buster/lib/modules/github.py#L4-L18 | ||||
scrapinghub/splash | 802d8391984bae049ef95a3fe1a74feaee95a233 | splash/har_builder.py | python | HarBuilder.store_reply_finished | (self, req_id, reply, content) | Store information about a finished reply. | Store information about a finished reply. | [
"Store",
"information",
"about",
"a",
"finished",
"reply",
"."
] | def store_reply_finished(self, req_id, reply, content):
"""
Store information about a finished reply.
"""
if not self.log.has_entry(req_id):
return
entry = self.log.get_mutable_entry(req_id)
entry["_splash_processing_state"] = self.REQUEST_FINISHED
# ... | [
"def",
"store_reply_finished",
"(",
"self",
",",
"req_id",
",",
"reply",
",",
"content",
")",
":",
"if",
"not",
"self",
".",
"log",
".",
"has_entry",
"(",
"req_id",
")",
":",
"return",
"entry",
"=",
"self",
".",
"log",
".",
"get_mutable_entry",
"(",
"r... | https://github.com/scrapinghub/splash/blob/802d8391984bae049ef95a3fe1a74feaee95a233/splash/har_builder.py#L122-L149 | ||
unknown-horizons/unknown-horizons | 7397fb333006d26c3d9fe796c7bd9cb8c3b43a49 | horizons/scenario/conditions.py | python | _get_player_settlements | (session) | return session.world.player.settlements | Helper generator, returns settlements of local player. | Helper generator, returns settlements of local player. | [
"Helper",
"generator",
"returns",
"settlements",
"of",
"local",
"player",
"."
] | def _get_player_settlements(session):
"""Helper generator, returns settlements of local player."""
return session.world.player.settlements | [
"def",
"_get_player_settlements",
"(",
"session",
")",
":",
"return",
"session",
".",
"world",
".",
"player",
".",
"settlements"
] | https://github.com/unknown-horizons/unknown-horizons/blob/7397fb333006d26c3d9fe796c7bd9cb8c3b43a49/horizons/scenario/conditions.py#L254-L256 | |
EducationalTestingService/skll | 1502fe8455cbb2c76cfc819db66f02f8ae11d321 | skll/experiments/utils.py | python | _get_stat_float | (label_result_dict, stat) | A helper function to get output for the precision, recall, and f-score
columns in the confusion matrix.
Parameters
----------
label_result_dict : dict
Dictionary containing the stat we'd like
to retrieve for a particular label.
stat : str
The statistic we're looking for in t... | A helper function to get output for the precision, recall, and f-score
columns in the confusion matrix. | [
"A",
"helper",
"function",
"to",
"get",
"output",
"for",
"the",
"precision",
"recall",
"and",
"f",
"-",
"score",
"columns",
"in",
"the",
"confusion",
"matrix",
"."
] | def _get_stat_float(label_result_dict, stat):
"""
A helper function to get output for the precision, recall, and f-score
columns in the confusion matrix.
Parameters
----------
label_result_dict : dict
Dictionary containing the stat we'd like
to retrieve for a particular label.
... | [
"def",
"_get_stat_float",
"(",
"label_result_dict",
",",
"stat",
")",
":",
"if",
"stat",
"in",
"label_result_dict",
"and",
"label_result_dict",
"[",
"stat",
"]",
"is",
"not",
"None",
":",
"return",
"label_result_dict",
"[",
"stat",
"]",
"else",
":",
"return",
... | https://github.com/EducationalTestingService/skll/blob/1502fe8455cbb2c76cfc819db66f02f8ae11d321/skll/experiments/utils.py#L236-L258 | ||
IntelPython/sdc | 1ebf55c00ef38dfbd401a70b3945e352a5a38b87 | sdc/timsort.py | python | sort | (key_arrs, lo, hi, data) | [] | def sort(key_arrs, lo, hi, data): # pragma: no cover
nRemaining = hi - lo
if nRemaining < 2:
return # Arrays of size 0 and 1 are always sorted
# If array is small, do a "mini-TimSort" with no merges
if nRemaining < MIN_MERGE:
initRunLen = countRunAndMakeAscending(key_arrs, lo, hi, da... | [
"def",
"sort",
"(",
"key_arrs",
",",
"lo",
",",
"hi",
",",
"data",
")",
":",
"# pragma: no cover",
"nRemaining",
"=",
"hi",
"-",
"lo",
"if",
"nRemaining",
"<",
"2",
":",
"return",
"# Arrays of size 0 and 1 are always sorted",
"# If array is small, do a \"mini-TimSor... | https://github.com/IntelPython/sdc/blob/1ebf55c00ef38dfbd401a70b3945e352a5a38b87/sdc/timsort.py#L88-L135 | ||||
Parsely/pykafka | e7665bf36bfe521050fdcb017c68e92365bd89ed | pykafka/handlers.py | python | ResponseFuture.get | (self, response_cls=None, timeout=None, **response_kwargs) | Block until data is ready and return.
Raises an exception if there was an error. | Block until data is ready and return. | [
"Block",
"until",
"data",
"is",
"ready",
"and",
"return",
"."
] | def get(self, response_cls=None, timeout=None, **response_kwargs):
"""Block until data is ready and return.
Raises an exception if there was an error.
"""
self._ready.wait(timeout)
if self.error:
raise self.error
if response_cls:
return response_c... | [
"def",
"get",
"(",
"self",
",",
"response_cls",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
"*",
"*",
"response_kwargs",
")",
":",
"self",
".",
"_ready",
".",
"wait",
"(",
"timeout",
")",
"if",
"self",
".",
"error",
":",
"raise",
"self",
".",
"e... | https://github.com/Parsely/pykafka/blob/e7665bf36bfe521050fdcb017c68e92365bd89ed/pykafka/handlers.py#L67-L78 | ||
ukBaz/python-bluezero | e6b4e96342de6c66571a6660d711c018f8c6b470 | bluezero/adapter.py | python | Adapter.discoverabletimeout | (self) | return self.adapter_props.Get(constants.ADAPTER_INTERFACE,
'DiscoverableTimeout') | Discoverable timeout of the Adapter. | Discoverable timeout of the Adapter. | [
"Discoverable",
"timeout",
"of",
"the",
"Adapter",
"."
] | def discoverabletimeout(self):
"""Discoverable timeout of the Adapter."""
return self.adapter_props.Get(constants.ADAPTER_INTERFACE,
'DiscoverableTimeout') | [
"def",
"discoverabletimeout",
"(",
"self",
")",
":",
"return",
"self",
".",
"adapter_props",
".",
"Get",
"(",
"constants",
".",
"ADAPTER_INTERFACE",
",",
"'DiscoverableTimeout'",
")"
] | https://github.com/ukBaz/python-bluezero/blob/e6b4e96342de6c66571a6660d711c018f8c6b470/bluezero/adapter.py#L189-L192 | |
scikit-hep/awkward-0.x | dd885bef15814f588b58944d2505296df4aaae0e | awkward0/array/base.py | python | AwkwardArray.count | (self) | return self._reduce(None, 0, None) | [] | def count(self):
return self._reduce(None, 0, None) | [
"def",
"count",
"(",
"self",
")",
":",
"return",
"self",
".",
"_reduce",
"(",
"None",
",",
"0",
",",
"None",
")"
] | https://github.com/scikit-hep/awkward-0.x/blob/dd885bef15814f588b58944d2505296df4aaae0e/awkward0/array/base.py#L199-L200 | |||
theatlantic/django-nested-admin | 2554f51f6d05489dd2d81b24c60b59781fda4e8a | nested_admin/__init__.py | python | module.__dir__ | (self) | return result | Just show what we want to show. | Just show what we want to show. | [
"Just",
"show",
"what",
"we",
"want",
"to",
"show",
"."
] | def __dir__(self):
"""Just show what we want to show."""
result = list(new_module.__all__)
result.extend(('__file__', '__path__', '__doc__', '__all__',
'__docformat__', '__name__', '__path__',
'__package__', '__version__'))
return result | [
"def",
"__dir__",
"(",
"self",
")",
":",
"result",
"=",
"list",
"(",
"new_module",
".",
"__all__",
")",
"result",
".",
"extend",
"(",
"(",
"'__file__'",
",",
"'__path__'",
",",
"'__doc__'",
",",
"'__all__'",
",",
"'__docformat__'",
",",
"'__name__'",
",",
... | https://github.com/theatlantic/django-nested-admin/blob/2554f51f6d05489dd2d81b24c60b59781fda4e8a/nested_admin/__init__.py#L54-L60 | |
dabeaz/python-cookbook | 6e46b78e5644b3e5bf7426d900e2203b7cc630da | src/2/writing_a_simple_recursive_descent_parser/example.py | python | ExpressionEvaluator._expect | (self,toktype) | Consume next token if it matches toktype or raise SyntaxError | Consume next token if it matches toktype or raise SyntaxError | [
"Consume",
"next",
"token",
"if",
"it",
"matches",
"toktype",
"or",
"raise",
"SyntaxError"
] | def _expect(self,toktype):
'Consume next token if it matches toktype or raise SyntaxError'
if not self._accept(toktype):
raise SyntaxError('Expected ' + toktype) | [
"def",
"_expect",
"(",
"self",
",",
"toktype",
")",
":",
"if",
"not",
"self",
".",
"_accept",
"(",
"toktype",
")",
":",
"raise",
"SyntaxError",
"(",
"'Expected '",
"+",
"toktype",
")"
] | https://github.com/dabeaz/python-cookbook/blob/6e46b78e5644b3e5bf7426d900e2203b7cc630da/src/2/writing_a_simple_recursive_descent_parser/example.py#L60-L63 | ||
google/tf-quant-finance | 8fd723689ebf27ff4bb2bd2acb5f6091c5e07309 | tf_quant_finance/experimental/pricing_platform/framework/core/processed_market_data.py | python | ProcessedMarketData.yield_curve | (self, curve_type: curve_types.CurveType) | The yield curve object. | The yield curve object. | [
"The",
"yield",
"curve",
"object",
"."
] | def yield_curve(self, curve_type: curve_types.CurveType) -> RateCurve:
"""The yield curve object."""
pass | [
"def",
"yield_curve",
"(",
"self",
",",
"curve_type",
":",
"curve_types",
".",
"CurveType",
")",
"->",
"RateCurve",
":",
"pass"
] | https://github.com/google/tf-quant-finance/blob/8fd723689ebf27ff4bb2bd2acb5f6091c5e07309/tf_quant_finance/experimental/pricing_platform/framework/core/processed_market_data.py#L226-L228 | ||
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/django/contrib/staticfiles/handlers.py | python | StaticFilesHandler._should_handle | (self, path) | return path.startswith(self.base_url[2]) and not self.base_url[1] | Checks if the path should be handled. Ignores the path if:
* the host is provided as part of the base_url
* the request's path isn't under the media path (or equal) | Checks if the path should be handled. Ignores the path if: | [
"Checks",
"if",
"the",
"path",
"should",
"be",
"handled",
".",
"Ignores",
"the",
"path",
"if",
":"
] | def _should_handle(self, path):
"""
Checks if the path should be handled. Ignores the path if:
* the host is provided as part of the base_url
* the request's path isn't under the media path (or equal)
"""
return path.startswith(self.base_url[2]) and not self.base_url[1] | [
"def",
"_should_handle",
"(",
"self",
",",
"path",
")",
":",
"return",
"path",
".",
"startswith",
"(",
"self",
".",
"base_url",
"[",
"2",
"]",
")",
"and",
"not",
"self",
".",
"base_url",
"[",
"1",
"]"
] | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/django/contrib/staticfiles/handlers.py#L31-L38 | |
holoviz/datashader | 25578abde75c7fa28c6633b33cb8d8a1e433da67 | datashader/glyphs/line.py | python | LinesAxis1.compute_x_bounds | (self, df) | return self.maybe_expand_bounds((min(mins), max(maxes))) | [] | def compute_x_bounds(self, df):
xs = tuple(df[xlabel] for xlabel in self.x)
bounds_list = [self._compute_bounds(xcol) for xcol in xs]
mins, maxes = zip(*bounds_list)
return self.maybe_expand_bounds((min(mins), max(maxes))) | [
"def",
"compute_x_bounds",
"(",
"self",
",",
"df",
")",
":",
"xs",
"=",
"tuple",
"(",
"df",
"[",
"xlabel",
"]",
"for",
"xlabel",
"in",
"self",
".",
"x",
")",
"bounds_list",
"=",
"[",
"self",
".",
"_compute_bounds",
"(",
"xcol",
")",
"for",
"xcol",
... | https://github.com/holoviz/datashader/blob/25578abde75c7fa28c6633b33cb8d8a1e433da67/datashader/glyphs/line.py#L205-L211 | |||
PokemonGoF/PokemonGo-Bot-Desktop | 4bfa94f0183406c6a86f93645eff7abd3ad4ced8 | build/pywin/Lib/wsgiref/handlers.py | python | BaseHandler.handle_error | (self) | Log current error, and send error output to client if possible | Log current error, and send error output to client if possible | [
"Log",
"current",
"error",
"and",
"send",
"error",
"output",
"to",
"client",
"if",
"possible"
] | def handle_error(self):
"""Log current error, and send error output to client if possible"""
self.log_exception(sys.exc_info())
if not self.headers_sent:
self.result = self.error_output(self.environ, self.start_response)
self.finish_response() | [
"def",
"handle_error",
"(",
"self",
")",
":",
"self",
".",
"log_exception",
"(",
"sys",
".",
"exc_info",
"(",
")",
")",
"if",
"not",
"self",
".",
"headers_sent",
":",
"self",
".",
"result",
"=",
"self",
".",
"error_output",
"(",
"self",
".",
"environ",... | https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/wsgiref/handlers.py#L301-L306 | ||
tobegit3hub/deep_image_model | 8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e | java_predict_client/src/main/proto/tensorflow/python/training/moving_averages.py | python | _zero_debias | (unbiased_var, value, decay) | Compute the delta required for a debiased Variable.
All exponential moving averages initialized with Tensors are initialized to 0,
and therefore are biased to 0. Variables initialized to 0 and used as EMAs are
similarly biased. This function creates the debias updated amount according to
a scale factor, as in ... | Compute the delta required for a debiased Variable. | [
"Compute",
"the",
"delta",
"required",
"for",
"a",
"debiased",
"Variable",
"."
] | def _zero_debias(unbiased_var, value, decay):
"""Compute the delta required for a debiased Variable.
All exponential moving averages initialized with Tensors are initialized to 0,
and therefore are biased to 0. Variables initialized to 0 and used as EMAs are
similarly biased. This function creates the debias u... | [
"def",
"_zero_debias",
"(",
"unbiased_var",
",",
"value",
",",
"decay",
")",
":",
"with",
"variable_scope",
".",
"variable_scope",
"(",
"\"ZeroDebias\"",
",",
"values",
"=",
"[",
"unbiased_var",
",",
"value",
",",
"decay",
"]",
")",
"as",
"scope",
":",
"wi... | https://github.com/tobegit3hub/deep_image_model/blob/8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e/java_predict_client/src/main/proto/tensorflow/python/training/moving_averages.py#L136-L196 | ||
danirus/django-comments-xtd | c2ec50226d219d98fe0faeae4e66e8a676b47e5b | django_comments_xtd/api/serializers.py | python | WriteCommentSerializer.validate_reply_to | (self, value) | return value | [] | def validate_reply_to(self, value):
if value != 0:
try:
parent = get_model().objects.get(pk=value)
except get_model().DoesNotExist:
raise serializers.ValidationError(
"reply_to comment does not exist")
else:
... | [
"def",
"validate_reply_to",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"!=",
"0",
":",
"try",
":",
"parent",
"=",
"get_model",
"(",
")",
".",
"objects",
".",
"get",
"(",
"pk",
"=",
"value",
")",
"except",
"get_model",
"(",
")",
".",
"DoesN... | https://github.com/danirus/django-comments-xtd/blob/c2ec50226d219d98fe0faeae4e66e8a676b47e5b/django_comments_xtd/api/serializers.py#L70-L82 | |||
spotify/luigi | c3b66f4a5fa7eaa52f9a72eb6704b1049035c789 | luigi/configuration/core.py | python | _check_parser | (parser_class, parser) | [] | def _check_parser(parser_class, parser):
if not parser_class.enabled:
msg = (
"Parser not installed yet. "
"Please, install luigi with required parser:\n"
"pip install luigi[{parser}]"
)
raise ImportError(msg.format(parser=parser)) | [
"def",
"_check_parser",
"(",
"parser_class",
",",
"parser",
")",
":",
"if",
"not",
"parser_class",
".",
"enabled",
":",
"msg",
"=",
"(",
"\"Parser not installed yet. \"",
"\"Please, install luigi with required parser:\\n\"",
"\"pip install luigi[{parser}]\"",
")",
"raise",
... | https://github.com/spotify/luigi/blob/c3b66f4a5fa7eaa52f9a72eb6704b1049035c789/luigi/configuration/core.py#L46-L53 | ||||
inkandswitch/livebook | 93c8d467734787366ad084fc3566bf5cbe249c51 | public/pypyjs/modules/datetime.py | python | date.ctime | (self) | return "%s %s %2d 00:00:00 %04d" % (
_DAYNAMES[weekday],
_MONTHNAMES[self._month],
self._day, self._year) | Return ctime() style string. | Return ctime() style string. | [
"Return",
"ctime",
"()",
"style",
"string",
"."
] | def ctime(self):
"Return ctime() style string."
weekday = self.toordinal() % 7 or 7
return "%s %s %2d 00:00:00 %04d" % (
_DAYNAMES[weekday],
_MONTHNAMES[self._month],
self._day, self._year) | [
"def",
"ctime",
"(",
"self",
")",
":",
"weekday",
"=",
"self",
".",
"toordinal",
"(",
")",
"%",
"7",
"or",
"7",
"return",
"\"%s %s %2d 00:00:00 %04d\"",
"%",
"(",
"_DAYNAMES",
"[",
"weekday",
"]",
",",
"_MONTHNAMES",
"[",
"self",
".",
"_month",
"]",
",... | https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/datetime.py#L811-L817 | |
apache/libcloud | 90971e17bfd7b6bb97b2489986472c531cc8e140 | libcloud/compute/drivers/ec2.py | python | BaseEC2NodeDriver.ex_delete_subnet | (self, subnet) | return self._get_boolean(res) | Deletes a VPC subnet.
:param subnet: The subnet to delete
:type subnet: :class:`.EC2NetworkSubnet`
:rtype: ``bool`` | Deletes a VPC subnet. | [
"Deletes",
"a",
"VPC",
"subnet",
"."
] | def ex_delete_subnet(self, subnet):
"""
Deletes a VPC subnet.
:param subnet: The subnet to delete
:type subnet: :class:`.EC2NetworkSubnet`
:rtype: ``bool``
"""
params = {"Action": "DeleteSubnet", "SubnetId": subnet.id}
res = self.connecti... | [
"def",
"ex_delete_subnet",
"(",
"self",
",",
"subnet",
")",
":",
"params",
"=",
"{",
"\"Action\"",
":",
"\"DeleteSubnet\"",
",",
"\"SubnetId\"",
":",
"subnet",
".",
"id",
"}",
"res",
"=",
"self",
".",
"connection",
".",
"request",
"(",
"self",
".",
"path... | https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/compute/drivers/ec2.py#L2647-L2660 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/setuptools/__init__.py | python | Command.reinitialize_command | (self, command, reinit_subcommands=0, **kw) | return cmd | [] | def reinitialize_command(self, command, reinit_subcommands=0, **kw):
cmd = _Command.reinitialize_command(self, command, reinit_subcommands)
vars(cmd).update(kw)
return cmd | [
"def",
"reinitialize_command",
"(",
"self",
",",
"command",
",",
"reinit_subcommands",
"=",
"0",
",",
"*",
"*",
"kw",
")",
":",
"cmd",
"=",
"_Command",
".",
"reinitialize_command",
"(",
"self",
",",
"command",
",",
"reinit_subcommands",
")",
"vars",
"(",
"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/setuptools/__init__.py#L150-L153 | |||
OpenAgricultureFoundation/openag-device-software | a51d2de399c0a6781ae51d0dcfaae1583d75f346 | device/utilities/communication/i2c/main.py | python | I2C.read | (
self, num_bytes: int, retry: bool = True, disable_mux: bool = False
) | Reads num bytes from device. Returns byte array. | Reads num bytes from device. Returns byte array. | [
"Reads",
"num",
"bytes",
"from",
"device",
".",
"Returns",
"byte",
"array",
"."
] | def read(
self, num_bytes: int, retry: bool = True, disable_mux: bool = False
) -> bytes:
"""Reads num bytes from device. Returns byte array."""
with self.i2c_lock:
self.manage_mux("read bytes", disable_mux)
#self.logger.debug("Reading {} bytes".format(num_bytes))
... | [
"def",
"read",
"(",
"self",
",",
"num_bytes",
":",
"int",
",",
"retry",
":",
"bool",
"=",
"True",
",",
"disable_mux",
":",
"bool",
"=",
"False",
")",
"->",
"bytes",
":",
"with",
"self",
".",
"i2c_lock",
":",
"self",
".",
"manage_mux",
"(",
"\"read by... | https://github.com/OpenAgricultureFoundation/openag-device-software/blob/a51d2de399c0a6781ae51d0dcfaae1583d75f346/device/utilities/communication/i2c/main.py#L112-L121 | ||
dipy/dipy | be956a529465b28085f8fc435a756947ddee1c89 | dipy/reconst/shore.py | python | shore_matrix_pdf | (radial_order, zeta, rtab) | return psi | r"""Compute the SHORE propagator matrix [1]_"
Parameters
----------
radial_order : unsigned int,
an even integer that represent the order of the basis
zeta : unsigned int,
scale factor
rtab : array, shape (N,3)
real space points in which calculates the pdf
References
... | r"""Compute the SHORE propagator matrix [1]_" | [
"r",
"Compute",
"the",
"SHORE",
"propagator",
"matrix",
"[",
"1",
"]",
"_"
] | def shore_matrix_pdf(radial_order, zeta, rtab):
r"""Compute the SHORE propagator matrix [1]_"
Parameters
----------
radial_order : unsigned int,
an even integer that represent the order of the basis
zeta : unsigned int,
scale factor
rtab : array, shape (N,3)
real space p... | [
"def",
"shore_matrix_pdf",
"(",
"radial_order",
",",
"zeta",
",",
"rtab",
")",
":",
"r",
",",
"theta",
",",
"phi",
"=",
"cart2sphere",
"(",
"rtab",
"[",
":",
",",
"0",
"]",
",",
"rtab",
"[",
":",
",",
"1",
"]",
",",
"rtab",
"[",
":",
",",
"2",
... | https://github.com/dipy/dipy/blob/be956a529465b28085f8fc435a756947ddee1c89/dipy/reconst/shore.py#L570-L607 | |
hatRiot/zarp | 2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad | src/lib/scapy/modules/nmap.py | python | NmapKnowledgeBase.lazy_init | (self) | [] | def lazy_init(self):
try:
f=open(self.filename)
except IOError:
return
self.base = []
name = None
try:
for l in f:
l = l.strip()
if not l or l[0] == "#":
continue
if l[:12] ==... | [
"def",
"lazy_init",
"(",
"self",
")",
":",
"try",
":",
"f",
"=",
"open",
"(",
"self",
".",
"filename",
")",
"except",
"IOError",
":",
"return",
"self",
".",
"base",
"=",
"[",
"]",
"name",
"=",
"None",
"try",
":",
"for",
"l",
"in",
"f",
":",
"l"... | https://github.com/hatRiot/zarp/blob/2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad/src/lib/scapy/modules/nmap.py#L25-L63 | ||||
yuanxiaosc/Multiple-Relations-Extraction-Only-Look-Once | 3d1fc216c6aedc0494e52f2ff142af856dcb673f | experimental_loss_function/run_multiple_relations_extraction_balanced_loss.py | python | DataProcessor.get_labels | (self) | Gets the list of labels for this data set. | Gets the list of labels for this data set. | [
"Gets",
"the",
"list",
"of",
"labels",
"for",
"this",
"data",
"set",
"."
] | def get_labels(self):
"""Gets the list of labels for this data set."""
raise NotImplementedError() | [
"def",
"get_labels",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/yuanxiaosc/Multiple-Relations-Extraction-Only-Look-Once/blob/3d1fc216c6aedc0494e52f2ff142af856dcb673f/experimental_loss_function/run_multiple_relations_extraction_balanced_loss.py#L188-L190 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/vpc/v20170312/vpc_client.py | python | VpcClient.CreateLocalGateway | (self, request) | 该接口用于创建用于CDC的本地网关。
:param request: Request instance for CreateLocalGateway.
:type request: :class:`tencentcloud.vpc.v20170312.models.CreateLocalGatewayRequest`
:rtype: :class:`tencentcloud.vpc.v20170312.models.CreateLocalGatewayResponse` | 该接口用于创建用于CDC的本地网关。 | [
"该接口用于创建用于CDC的本地网关。"
] | def CreateLocalGateway(self, request):
"""该接口用于创建用于CDC的本地网关。
:param request: Request instance for CreateLocalGateway.
:type request: :class:`tencentcloud.vpc.v20170312.models.CreateLocalGatewayRequest`
:rtype: :class:`tencentcloud.vpc.v20170312.models.CreateLocalGatewayResponse`
... | [
"def",
"CreateLocalGateway",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"CreateLocalGateway\"",
",",
"params",
")",
"response",
"=",
"json",
".",
"loa... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/vpc/v20170312/vpc_client.py#L1185-L1210 | ||
smartbgp/yabgp | f073633a813899cd9b413bc28ea2f7737deee141 | yabgp/core/timer.py | python | BGPTimer.reset | (self, seconds_fromnow) | Resets an already running timer, or starts it if it wasn't running.
:param seconds_fromnow : restart timer | Resets an already running timer, or starts it if it wasn't running. | [
"Resets",
"an",
"already",
"running",
"timer",
"or",
"starts",
"it",
"if",
"it",
"wasn",
"t",
"running",
"."
] | def reset(self, seconds_fromnow):
"""Resets an already running timer, or starts it if it wasn't running.
:param seconds_fromnow : restart timer
"""
try:
self.status = True
self.delayed_call.reset(seconds_fromnow)
except (AttributeError, error.AlreadyCall... | [
"def",
"reset",
"(",
"self",
",",
"seconds_fromnow",
")",
":",
"try",
":",
"self",
".",
"status",
"=",
"True",
"self",
".",
"delayed_call",
".",
"reset",
"(",
"seconds_fromnow",
")",
"except",
"(",
"AttributeError",
",",
"error",
".",
"AlreadyCalled",
",",... | https://github.com/smartbgp/yabgp/blob/f073633a813899cd9b413bc28ea2f7737deee141/yabgp/core/timer.py#L44-L54 | ||
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/state_plugins/trace_additions.py | python | FormatInfoDontConstrain.__init__ | (self, addr, func_name, check_symbolic_arg) | [] | def __init__(self, addr, func_name, check_symbolic_arg):
self.addr = addr
self.func_name = func_name
self.check_symbolic_arg = check_symbolic_arg | [
"def",
"__init__",
"(",
"self",
",",
"addr",
",",
"func_name",
",",
"check_symbolic_arg",
")",
":",
"self",
".",
"addr",
"=",
"addr",
"self",
".",
"func_name",
"=",
"func_name",
"self",
".",
"check_symbolic_arg",
"=",
"check_symbolic_arg"
] | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/state_plugins/trace_additions.py#L110-L113 | ||||
JBakamovic/cxxd | 142c19649b036bd6f6bdcd4684de735ea11a6c94 | parser/cxxd_config_parser.py | python | CxxdConfigParser._extract_clang_format_binary_path | (self, config) | return None | [] | def _extract_clang_format_binary_path(self, config):
if 'clang-format' in config:
if 'binary' in config['clang-format']:
return config['clang-format']['binary']
return None | [
"def",
"_extract_clang_format_binary_path",
"(",
"self",
",",
"config",
")",
":",
"if",
"'clang-format'",
"in",
"config",
":",
"if",
"'binary'",
"in",
"config",
"[",
"'clang-format'",
"]",
":",
"return",
"config",
"[",
"'clang-format'",
"]",
"[",
"'binary'",
"... | https://github.com/JBakamovic/cxxd/blob/142c19649b036bd6f6bdcd4684de735ea11a6c94/parser/cxxd_config_parser.py#L226-L230 | |||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/tornado/template.py | python | _ChunkList.__init__ | (self, chunks) | [] | def __init__(self, chunks):
self.chunks = chunks | [
"def",
"__init__",
"(",
"self",
",",
"chunks",
")",
":",
"self",
".",
"chunks",
"=",
"chunks"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/tornado/template.py#L506-L507 | ||||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/layout/updatemenu/_pad.py | python | Pad.r | (self) | return self["r"] | The amount of padding (in px) on the right side of the
component.
The 'r' property is a number and may be specified as:
- An int or float
Returns
-------
int|float | The amount of padding (in px) on the right side of the
component.
The 'r' property is a number and may be specified as:
- An int or float | [
"The",
"amount",
"of",
"padding",
"(",
"in",
"px",
")",
"on",
"the",
"right",
"side",
"of",
"the",
"component",
".",
"The",
"r",
"property",
"is",
"a",
"number",
"and",
"may",
"be",
"specified",
"as",
":",
"-",
"An",
"int",
"or",
"float"
] | def r(self):
"""
The amount of padding (in px) on the right side of the
component.
The 'r' property is a number and may be specified as:
- An int or float
Returns
-------
int|float
"""
return self["r"] | [
"def",
"r",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"r\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/layout/updatemenu/_pad.py#L58-L70 | |
microsoft/azure-devops-python-api | 451cade4c475482792cbe9e522c1fee32393139e | azure-devops/azure/devops/v5_1/feature_availability/feature_availability_client.py | python | FeatureAvailabilityClient.get_feature_flag_by_name_and_user_id | (self, name, user_id, check_feature_exists=None) | return self._deserialize('FeatureFlag', response) | GetFeatureFlagByNameAndUserId.
[Preview API] Retrieve information on a single feature flag and its current states for a user
:param str name: The name of the feature to retrieve
:param str user_id: The id of the user to check
:param bool check_feature_exists: Check if feature exists
... | GetFeatureFlagByNameAndUserId.
[Preview API] Retrieve information on a single feature flag and its current states for a user
:param str name: The name of the feature to retrieve
:param str user_id: The id of the user to check
:param bool check_feature_exists: Check if feature exists
... | [
"GetFeatureFlagByNameAndUserId",
".",
"[",
"Preview",
"API",
"]",
"Retrieve",
"information",
"on",
"a",
"single",
"feature",
"flag",
"and",
"its",
"current",
"states",
"for",
"a",
"user",
":",
"param",
"str",
"name",
":",
"The",
"name",
"of",
"the",
"feature... | def get_feature_flag_by_name_and_user_id(self, name, user_id, check_feature_exists=None):
"""GetFeatureFlagByNameAndUserId.
[Preview API] Retrieve information on a single feature flag and its current states for a user
:param str name: The name of the feature to retrieve
:param str user_i... | [
"def",
"get_feature_flag_by_name_and_user_id",
"(",
"self",
",",
"name",
",",
"user_id",
",",
"check_feature_exists",
"=",
"None",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"name",
"is",
"not",
"None",
":",
"route_values",
"[",
"'name'",
"]",
"=",
"self... | https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v5_1/feature_availability/feature_availability_client.py#L86-L107 | |
panpanpandas/ultrafinance | ce3594dbfef747cba0c39f059316df7c208aac40 | ultrafinance/dam/excelLib.py | python | ExcelLib.readRow | (self, row, startCol=0, endCol=-1) | return self.__operation.readRow(row, startCol, endCol) | read row | read row | [
"read",
"row"
] | def readRow(self, row, startCol=0, endCol=-1):
''' read row '''
return self.__operation.readRow(row, startCol, endCol) | [
"def",
"readRow",
"(",
"self",
",",
"row",
",",
"startCol",
"=",
"0",
",",
"endCol",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"__operation",
".",
"readRow",
"(",
"row",
",",
"startCol",
",",
"endCol",
")"
] | https://github.com/panpanpandas/ultrafinance/blob/ce3594dbfef747cba0c39f059316df7c208aac40/ultrafinance/dam/excelLib.py#L45-L47 | |
skelsec/pypykatz | dd129ff36e00593d1340776b517f7e749ad8d314 | pypykatz/commons/winapi/local/function_defs/kernel32.py | python | MemoryBasicInformation.is_free | (self) | return self.State == MEM_FREE | @rtype: bool
@return: C{True} if the memory in this region is free. | [] | def is_free(self):
"""
@rtype: bool
@return: C{True} if the memory in this region is free.
"""
return self.State == MEM_FREE | [
"def",
"is_free",
"(",
"self",
")",
":",
"return",
"self",
".",
"State",
"==",
"MEM_FREE"
] | https://github.com/skelsec/pypykatz/blob/dd129ff36e00593d1340776b517f7e749ad8d314/pypykatz/commons/winapi/local/function_defs/kernel32.py#L196-L201 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_adm_ca_server_cert.py | python | Utils.get_resource_file | (sfile, sfile_type='yaml') | return contents | return the service file | return the service file | [
"return",
"the",
"service",
"file"
] | def get_resource_file(sfile, sfile_type='yaml'):
''' return the service file '''
contents = None
with open(sfile) as sfd:
contents = sfd.read()
if sfile_type == 'yaml':
# AUDIT:no-member makes sense here due to ruamel.YAML/PyYAML usage
# pylint: disab... | [
"def",
"get_resource_file",
"(",
"sfile",
",",
"sfile_type",
"=",
"'yaml'",
")",
":",
"contents",
"=",
"None",
"with",
"open",
"(",
"sfile",
")",
"as",
"sfd",
":",
"contents",
"=",
"sfd",
".",
"read",
"(",
")",
"if",
"sfile_type",
"==",
"'yaml'",
":",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_adm_ca_server_cert.py#L1287-L1303 | |
albertz/PyCParser | 080a7b0472444fd366006c44fc15e388122989bd | sortedcontainers/sortedlist.py | python | SortedListWithKey.__repr__ | (self) | return temp.format(
self.__class__.__name__,
repr(list(self)),
repr(self._key),
repr(self._load)
) | Return string representation of sequence. | Return string representation of sequence. | [
"Return",
"string",
"representation",
"of",
"sequence",
"."
] | def __repr__(self):
"""Return string representation of sequence."""
temp = '{0}({1}, key={2}, load={3})'
return temp.format(
self.__class__.__name__,
repr(list(self)),
repr(self._key),
repr(self._load)
) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"temp",
"=",
"'{0}({1}, key={2}, load={3})'",
"return",
"temp",
".",
"format",
"(",
"self",
".",
"__class__",
".",
"__name__",
",",
"repr",
"(",
"list",
"(",
"self",
")",
")",
",",
"repr",
"(",
"self",
".",
"_k... | https://github.com/albertz/PyCParser/blob/080a7b0472444fd366006c44fc15e388122989bd/sortedcontainers/sortedlist.py#L2308-L2316 | |
leapcode/bitmask_client | d2fe20df24fc6eaf146fa5ce1e847de6ab515688 | src/leap/bitmask/gui/eip_status.py | python | EIPStatusWidget.set_eip_status_menu | (self, eip_status_menu) | Sets the eip_status_menu to use.
:param eip_status_menu: eip_status_menu to be used
:type eip_status_menu: QtGui.QMenu | Sets the eip_status_menu to use. | [
"Sets",
"the",
"eip_status_menu",
"to",
"use",
"."
] | def set_eip_status_menu(self, eip_status_menu):
"""
Sets the eip_status_menu to use.
:param eip_status_menu: eip_status_menu to be used
:type eip_status_menu: QtGui.QMenu
"""
leap_assert_type(eip_status_menu, QtGui.QMenu)
self._eip_status_menu = eip_status_menu | [
"def",
"set_eip_status_menu",
"(",
"self",
",",
"eip_status_menu",
")",
":",
"leap_assert_type",
"(",
"eip_status_menu",
",",
"QtGui",
".",
"QMenu",
")",
"self",
".",
"_eip_status_menu",
"=",
"eip_status_menu"
] | https://github.com/leapcode/bitmask_client/blob/d2fe20df24fc6eaf146fa5ce1e847de6ab515688/src/leap/bitmask/gui/eip_status.py#L266-L274 | ||
FSecureLABS/Jandroid | e31d0dab58a2bfd6ed8e0a387172b8bd7c893436 | libs/platform-tools/platform-tools_linux/systrace/catapult/devil/devil/utils/lsusb.py | python | lsusb | () | return devices | Call lsusb and return the parsed output. | Call lsusb and return the parsed output. | [
"Call",
"lsusb",
"and",
"return",
"the",
"parsed",
"output",
"."
] | def lsusb():
"""Call lsusb and return the parsed output."""
_, lsusb_list_output = cmd_helper.GetCmdStatusAndOutputWithTimeout(
['lsusb'], timeout=10)
devices = []
for line in lsusb_list_output.splitlines():
m = _LSUSB_BUS_DEVICE_RE.match(line)
if m:
bus_num = m.group(1)
dev_num = m.gr... | [
"def",
"lsusb",
"(",
")",
":",
"_",
",",
"lsusb_list_output",
"=",
"cmd_helper",
".",
"GetCmdStatusAndOutputWithTimeout",
"(",
"[",
"'lsusb'",
"]",
",",
"timeout",
"=",
"10",
")",
"devices",
"=",
"[",
"]",
"for",
"line",
"in",
"lsusb_list_output",
".",
"sp... | https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/libs/platform-tools/platform-tools_linux/systrace/catapult/devil/devil/utils/lsusb.py#L137-L152 | |
quartiq/rayopt | 3890c72b8f56253bdce309b0fe42beda91c6d3e0 | rayopt/transformations.py | python | quaternion_slerp | (quat0, quat1, fraction, spin=0, shortestpath=True) | return q0 | Return spherical linear interpolation between two quaternions.
>>> q0 = random_quaternion()
>>> q1 = random_quaternion()
>>> q = quaternion_slerp(q0, q1, 0)
>>> numpy.allclose(q, q0)
True
>>> q = quaternion_slerp(q0, q1, 1, 1)
>>> numpy.allclose(q, q1)
True
>>> q = quaternion_slerp(... | Return spherical linear interpolation between two quaternions. | [
"Return",
"spherical",
"linear",
"interpolation",
"between",
"two",
"quaternions",
"."
] | def quaternion_slerp(quat0, quat1, fraction, spin=0, shortestpath=True):
"""Return spherical linear interpolation between two quaternions.
>>> q0 = random_quaternion()
>>> q1 = random_quaternion()
>>> q = quaternion_slerp(q0, q1, 0)
>>> numpy.allclose(q, q0)
True
>>> q = quaternion_slerp(q0... | [
"def",
"quaternion_slerp",
"(",
"quat0",
",",
"quat1",
",",
"fraction",
",",
"spin",
"=",
"0",
",",
"shortestpath",
"=",
"True",
")",
":",
"q0",
"=",
"unit_vector",
"(",
"quat0",
"[",
":",
"4",
"]",
")",
"q1",
"=",
"unit_vector",
"(",
"quat1",
"[",
... | https://github.com/quartiq/rayopt/blob/3890c72b8f56253bdce309b0fe42beda91c6d3e0/rayopt/transformations.py#L1420-L1458 | |
emesene/emesene | 4548a4098310e21b16437bb36223a7f632a4f7bc | emesene/gui/gtkui/AdiumTextBox.py | python | OutputText.__init__ | (self, config, handler) | constructor | constructor | [
"constructor"
] | def __init__(self, config, handler):
'''constructor'''
gtk.ScrolledWindow.__init__(self)
gui.base.OutputText.__init__(self, config)
self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.set_shadow_type(gtk.SHADOW_IN)
self.loaded = False
self.view = Ou... | [
"def",
"__init__",
"(",
"self",
",",
"config",
",",
"handler",
")",
":",
"gtk",
".",
"ScrolledWindow",
".",
"__init__",
"(",
"self",
")",
"gui",
".",
"base",
".",
"OutputText",
".",
"__init__",
"(",
"self",
",",
"config",
")",
"self",
".",
"set_policy"... | https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/gui/gtkui/AdiumTextBox.py#L184-L197 | ||
openstack/swift | b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100 | swift/obj/diskfile.py | python | DiskFileManager._update_suffix_hashes | (self, hashes, ondisk_info) | Applies policy specific updates to the given dict of md5 hashes for
the given ondisk_info.
:param hashes: a dict of md5 hashes to be updated
:param ondisk_info: a dict describing the state of ondisk files, as
returned by get_ondisk_files | Applies policy specific updates to the given dict of md5 hashes for
the given ondisk_info. | [
"Applies",
"policy",
"specific",
"updates",
"to",
"the",
"given",
"dict",
"of",
"md5",
"hashes",
"for",
"the",
"given",
"ondisk_info",
"."
] | def _update_suffix_hashes(self, hashes, ondisk_info):
"""
Applies policy specific updates to the given dict of md5 hashes for
the given ondisk_info.
:param hashes: a dict of md5 hashes to be updated
:param ondisk_info: a dict describing the state of ondisk files, as
... | [
"def",
"_update_suffix_hashes",
"(",
"self",
",",
"hashes",
",",
"ondisk_info",
")",
":",
"if",
"'data_info'",
"in",
"ondisk_info",
":",
"file_info",
"=",
"ondisk_info",
"[",
"'data_info'",
"]",
"hashes",
"[",
"None",
"]",
".",
"update",
"(",
"file_info",
"[... | https://github.com/openstack/swift/blob/b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100/swift/obj/diskfile.py#L3031-L3043 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/utils/jinja.py | python | lst_avg | (lst) | return float(lst) | Returns the average value of a list.
.. code-block:: jinja
{% my_list = [1,2,3,4] -%}
{{ set my_list | avg }}
will be rendered as:
.. code-block:: yaml
2.5 | Returns the average value of a list. | [
"Returns",
"the",
"average",
"value",
"of",
"a",
"list",
"."
] | def lst_avg(lst):
"""
Returns the average value of a list.
.. code-block:: jinja
{% my_list = [1,2,3,4] -%}
{{ set my_list | avg }}
will be rendered as:
.. code-block:: yaml
2.5
"""
if not isinstance(lst, Hashable):
return float(sum(lst) / len(lst))
r... | [
"def",
"lst_avg",
"(",
"lst",
")",
":",
"if",
"not",
"isinstance",
"(",
"lst",
",",
"Hashable",
")",
":",
"return",
"float",
"(",
"sum",
"(",
"lst",
")",
"/",
"len",
"(",
"lst",
")",
")",
"return",
"float",
"(",
"lst",
")"
] | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/utils/jinja.py#L598-L615 | |
yuanxiaosc/Multiple-Relations-Extraction-Only-Look-Once | 3d1fc216c6aedc0494e52f2ff142af856dcb673f | bert/run_classifier.py | python | file_based_input_fn_builder | (input_file, seq_length, is_training,
drop_remainder) | return input_fn | Creates an `input_fn` closure to be passed to TPUEstimator. | Creates an `input_fn` closure to be passed to TPUEstimator. | [
"Creates",
"an",
"input_fn",
"closure",
"to",
"be",
"passed",
"to",
"TPUEstimator",
"."
] | def file_based_input_fn_builder(input_file, seq_length, is_training,
drop_remainder):
"""Creates an `input_fn` closure to be passed to TPUEstimator."""
name_to_features = {
"input_ids": tf.FixedLenFeature([seq_length], tf.int64),
"input_mask": tf.FixedLenFeature([seq_len... | [
"def",
"file_based_input_fn_builder",
"(",
"input_file",
",",
"seq_length",
",",
"is_training",
",",
"drop_remainder",
")",
":",
"name_to_features",
"=",
"{",
"\"input_ids\"",
":",
"tf",
".",
"FixedLenFeature",
"(",
"[",
"seq_length",
"]",
",",
"tf",
".",
"int64... | https://github.com/yuanxiaosc/Multiple-Relations-Extraction-Only-Look-Once/blob/3d1fc216c6aedc0494e52f2ff142af856dcb673f/bert/run_classifier.py#L509-L554 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/layout/ternary/caxis/_tickformatstop.py | python | Tickformatstop.__init__ | (
self,
arg=None,
dtickrange=None,
enabled=None,
name=None,
templateitemname=None,
value=None,
**kwargs
) | Construct a new Tickformatstop object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.layout.ternary
.caxis.Tickformatstop`
dtickrange
range [*min*, *max*], ... | Construct a new Tickformatstop object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.layout.ternary
.caxis.Tickformatstop`
dtickrange
range [*min*, *max*], ... | [
"Construct",
"a",
"new",
"Tickformatstop",
"object",
"Parameters",
"----------",
"arg",
"dict",
"of",
"properties",
"compatible",
"with",
"this",
"constructor",
"or",
"an",
"instance",
"of",
":",
"class",
":",
"plotly",
".",
"graph_objs",
".",
"layout",
".",
"... | def __init__(
self,
arg=None,
dtickrange=None,
enabled=None,
name=None,
templateitemname=None,
value=None,
**kwargs
):
"""
Construct a new Tickformatstop object
Parameters
----------
arg
dict... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"dtickrange",
"=",
"None",
",",
"enabled",
"=",
"None",
",",
"name",
"=",
"None",
",",
"templateitemname",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"sup... | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/layout/ternary/caxis/_tickformatstop.py#L173-L283 | ||
digidotcom/xbee-python | 0757f4be0017530c205175fbee8f9f61be9614d1 | digi/xbee/filesystem.py | python | FileSystemManager.read_file | (self, file, offset=0, progress_cb=None) | return _ReadFileProcess(self, file, offset, self.DEFAULT_TIMEOUT,
read_callback=progress_cb) | Reads from the provided file starting at the given offset.
If there is no progress callback the function blocks
until the required amount of bytes is read.
Args:
file (:class:`.FileSystemElement` or String): File to read or its
absolute path.
offset (Inte... | Reads from the provided file starting at the given offset.
If there is no progress callback the function blocks
until the required amount of bytes is read. | [
"Reads",
"from",
"the",
"provided",
"file",
"starting",
"at",
"the",
"given",
"offset",
".",
"If",
"there",
"is",
"no",
"progress",
"callback",
"the",
"function",
"blocks",
"until",
"the",
"required",
"amount",
"of",
"bytes",
"is",
"read",
"."
] | def read_file(self, file, offset=0, progress_cb=None):
"""
Reads from the provided file starting at the given offset.
If there is no progress callback the function blocks
until the required amount of bytes is read.
Args:
file (:class:`.FileSystemElement` or String): ... | [
"def",
"read_file",
"(",
"self",
",",
"file",
",",
"offset",
"=",
"0",
",",
"progress_cb",
"=",
"None",
")",
":",
"return",
"_ReadFileProcess",
"(",
"self",
",",
"file",
",",
"offset",
",",
"self",
".",
"DEFAULT_TIMEOUT",
",",
"read_callback",
"=",
"prog... | https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/filesystem.py#L1258-L1289 | |
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit /tools/inject/thirdparty/gprof2dot/gprof2dot.py | python | DotWriter.begin_graph | (self) | [] | def begin_graph(self):
self.write('digraph {\n') | [
"def",
"begin_graph",
"(",
"self",
")",
":",
"self",
".",
"write",
"(",
"'digraph {\\n'",
")"
] | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/inject/thirdparty/gprof2dot/gprof2dot.py#L2353-L2354 | ||||
asyml/texar | a23f021dae289a3d768dc099b220952111da04fd | texar/tf/modules/decoders/rnn_decoder_base.py | python | RNNDecoderBase.vocab_size | (self) | return self._vocab_size | The vocab size. | The vocab size. | [
"The",
"vocab",
"size",
"."
] | def vocab_size(self):
"""The vocab size.
"""
return self._vocab_size | [
"def",
"vocab_size",
"(",
"self",
")",
":",
"return",
"self",
".",
"_vocab_size"
] | https://github.com/asyml/texar/blob/a23f021dae289a3d768dc099b220952111da04fd/texar/tf/modules/decoders/rnn_decoder_base.py#L564-L567 | |
google/coursebuilder-core | 08f809db3226d9269e30d5edd0edd33bd22041f4 | coursebuilder/modules/courses/triggers.py | python | ContentTrigger.type | (self) | return None if self.content is None else self.content.type | Returns associated course content type if one exists, or None. | Returns associated course content type if one exists, or None. | [
"Returns",
"associated",
"course",
"content",
"type",
"if",
"one",
"exists",
"or",
"None",
"."
] | def type(self):
"""Returns associated course content type if one exists, or None."""
return None if self.content is None else self.content.type | [
"def",
"type",
"(",
"self",
")",
":",
"return",
"None",
"if",
"self",
".",
"content",
"is",
"None",
"else",
"self",
".",
"content",
".",
"type"
] | https://github.com/google/coursebuilder-core/blob/08f809db3226d9269e30d5edd0edd33bd22041f4/coursebuilder/modules/courses/triggers.py#L1288-L1290 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/libs/azure/src/azure/abfs/abfs.py | python | ABFS._local_copy_file | (self, local_src, remote_dst, chunk_size=UPLOAD_CHUCK_SIZE) | A wraper function for copying local Files | A wraper function for copying local Files | [
"A",
"wraper",
"function",
"for",
"copying",
"local",
"Files"
] | def _local_copy_file(self, local_src, remote_dst, chunk_size=UPLOAD_CHUCK_SIZE):
"""
A wraper function for copying local Files
"""
if os.path.isfile(local_src):
if self.exists(remote_dst):
LOG.info('%s already exists. Skipping.' % remote_dst)
return
src = file(local_src)
... | [
"def",
"_local_copy_file",
"(",
"self",
",",
"local_src",
",",
"remote_dst",
",",
"chunk_size",
"=",
"UPLOAD_CHUCK_SIZE",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"local_src",
")",
":",
"if",
"self",
".",
"exists",
"(",
"remote_dst",
")",
"... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/libs/azure/src/azure/abfs/abfs.py#L625-L652 | ||
hequan2017/autoops | 5e717a2d86dd37cd2cfaf6db3d9613a0c41c49ae | script/connections.py | python | Connection._send_autocommit_mode | (self) | Set whether or not to commit after every execute() | Set whether or not to commit after every execute() | [
"Set",
"whether",
"or",
"not",
"to",
"commit",
"after",
"every",
"execute",
"()"
] | def _send_autocommit_mode(self):
"""Set whether or not to commit after every execute()"""
self._execute_command(COMMAND.COM_QUERY, "SET AUTOCOMMIT = %s" %
self.escape(self.autocommit_mode))
self._read_ok_packet() | [
"def",
"_send_autocommit_mode",
"(",
"self",
")",
":",
"self",
".",
"_execute_command",
"(",
"COMMAND",
".",
"COM_QUERY",
",",
"\"SET AUTOCOMMIT = %s\"",
"%",
"self",
".",
"escape",
"(",
"self",
".",
"autocommit_mode",
")",
")",
"self",
".",
"_read_ok_packet",
... | https://github.com/hequan2017/autoops/blob/5e717a2d86dd37cd2cfaf6db3d9613a0c41c49ae/script/connections.py#L774-L778 | ||
AstusRush/AMaDiA | e2ad87318d9dd30bc24428e05c29cb32a29c83aa | External_Libraries/python_control_master/control/frdata.py | python | FrequencyResponseData.eval | (self, omega) | return self._evalfr(omega) | Evaluate a transfer function at a single angular frequency.
self.evalfr(omega) returns the value of the frequency response
at frequency omega.
Note that a "normal" FRD only returns values for which there is an
entry in the omega vector. An interpolating FRD can return
intermedi... | Evaluate a transfer function at a single angular frequency. | [
"Evaluate",
"a",
"transfer",
"function",
"at",
"a",
"single",
"angular",
"frequency",
"."
] | def eval(self, omega):
"""Evaluate a transfer function at a single angular frequency.
self.evalfr(omega) returns the value of the frequency response
at frequency omega.
Note that a "normal" FRD only returns values for which there is an
entry in the omega vector. An interpolatin... | [
"def",
"eval",
"(",
"self",
",",
"omega",
")",
":",
"return",
"self",
".",
"_evalfr",
"(",
"omega",
")"
] | https://github.com/AstusRush/AMaDiA/blob/e2ad87318d9dd30bc24428e05c29cb32a29c83aa/External_Libraries/python_control_master/control/frdata.py#L357-L368 | |
sqlmapproject/sqlmap | 3b07b70864624dff4c29dcaa8a61c78e7f9189f7 | thirdparty/pydes/pyDes.py | python | _baseDes.getMode | (self) | return self._mode | getMode() -> pyDes.ECB or pyDes.CBC | getMode() -> pyDes.ECB or pyDes.CBC | [
"getMode",
"()",
"-",
">",
"pyDes",
".",
"ECB",
"or",
"pyDes",
".",
"CBC"
] | def getMode(self):
"""getMode() -> pyDes.ECB or pyDes.CBC"""
return self._mode | [
"def",
"getMode",
"(",
"self",
")",
":",
"return",
"self",
".",
"_mode"
] | https://github.com/sqlmapproject/sqlmap/blob/3b07b70864624dff4c29dcaa8a61c78e7f9189f7/thirdparty/pydes/pyDes.py#L135-L137 | |
tosher/Mediawiker | 81bf97cace59bedcb1668e7830b85c36e014428e | lib/Crypto.win.x64/Crypto/Hash/keccak.py | python | Keccak_Hash.update | (self, data) | return self | Continue hashing of a message by consuming the next chunk of data.
Args:
data (byte string/byte array/memoryview): The next chunk of the message being hashed. | Continue hashing of a message by consuming the next chunk of data. | [
"Continue",
"hashing",
"of",
"a",
"message",
"by",
"consuming",
"the",
"next",
"chunk",
"of",
"data",
"."
] | def update(self, data):
"""Continue hashing of a message by consuming the next chunk of data.
Args:
data (byte string/byte array/memoryview): The next chunk of the message being hashed.
"""
if self._digest_done and not self._update_after_digest:
raise TypeError(... | [
"def",
"update",
"(",
"self",
",",
"data",
")",
":",
"if",
"self",
".",
"_digest_done",
"and",
"not",
"self",
".",
"_update_after_digest",
":",
"raise",
"TypeError",
"(",
"\"You can only call 'digest' or 'hexdigest' on this object\"",
")",
"result",
"=",
"_raw_kecca... | https://github.com/tosher/Mediawiker/blob/81bf97cace59bedcb1668e7830b85c36e014428e/lib/Crypto.win.x64/Crypto/Hash/keccak.py#L81-L96 | |
CedricGuillemet/Imogen | ee417b42747ed5b46cb11b02ef0c3630000085b3 | bin/Lib/functools.py | python | _le_from_lt | (self, other, NotImplemented=NotImplemented) | return op_result or self == other | Return a <= b. Computed by @total_ordering from (a < b) or (a == b). | Return a <= b. Computed by | [
"Return",
"a",
"<",
"=",
"b",
".",
"Computed",
"by"
] | def _le_from_lt(self, other, NotImplemented=NotImplemented):
'Return a <= b. Computed by @total_ordering from (a < b) or (a == b).'
op_result = self.__lt__(other)
return op_result or self == other | [
"def",
"_le_from_lt",
"(",
"self",
",",
"other",
",",
"NotImplemented",
"=",
"NotImplemented",
")",
":",
"op_result",
"=",
"self",
".",
"__lt__",
"(",
"other",
")",
"return",
"op_result",
"or",
"self",
"==",
"other"
] | https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/functools.py#L98-L101 | |
nathanlopez/Stitch | 8e22e91c94237959c02d521aab58dc7e3d994cea | Application/stitch_osxshell.py | python | st_osxshell.help_location | (self) | [] | def help_location(self): st_help_location() | [
"def",
"help_location",
"(",
"self",
")",
":",
"st_help_location",
"(",
")"
] | https://github.com/nathanlopez/Stitch/blob/8e22e91c94237959c02d521aab58dc7e3d994cea/Application/stitch_osxshell.py#L249-L249 | ||||
wrye-bash/wrye-bash | d495c47cfdb44475befa523438a40c4419cb386f | Mopy/bash/patcher/patchers/preservers.py | python | ImportCellsPatcher.buildPatch | (self, log, progress, __attrgetters=attrgetter_cache) | Adds merged lists to patchfile. | Adds merged lists to patchfile. | [
"Adds",
"merged",
"lists",
"to",
"patchfile",
"."
] | def buildPatch(self, log, progress, __attrgetters=attrgetter_cache):
"""Adds merged lists to patchfile."""
def handlePatchCellBlock(patchCellBlock):
"""This function checks if an attribute or flag in CellData has
a value which is different to the corresponding value in the
... | [
"def",
"buildPatch",
"(",
"self",
",",
"log",
",",
"progress",
",",
"__attrgetters",
"=",
"attrgetter_cache",
")",
":",
"def",
"handlePatchCellBlock",
"(",
"patchCellBlock",
")",
":",
"\"\"\"This function checks if an attribute or flag in CellData has\n a value whi... | https://github.com/wrye-bash/wrye-bash/blob/d495c47cfdb44475befa523438a40c4419cb386f/Mopy/bash/patcher/patchers/preservers.py#L492-L546 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.