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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
BEEmod/BEE2.4 | 02767f3cf476581789425ab308ca1bea978f6a74 | src/precomp/conditions/entities.py | python | res_create_entity | (vmf: VMF, inst: Entity, res: Property) | Create an entity.
* `keys` and `localkeys` defines the new keyvalues used.
* `origin` and `angles` are local to the instance. | Create an entity. | [
"Create",
"an",
"entity",
"."
] | def res_create_entity(vmf: VMF, inst: Entity, res: Property):
"""Create an entity.
* `keys` and `localkeys` defines the new keyvalues used.
* `origin` and `angles` are local to the instance.
"""
origin = Vec.from_str(inst['origin'])
orient = Angle.from_str(inst['angles'])
new_ent = vmf.cr... | [
"def",
"res_create_entity",
"(",
"vmf",
":",
"VMF",
",",
"inst",
":",
"Entity",
",",
"res",
":",
"Property",
")",
":",
"origin",
"=",
"Vec",
".",
"from_str",
"(",
"inst",
"[",
"'origin'",
"]",
")",
"orient",
"=",
"Angle",
".",
"from_str",
"(",
"inst"... | https://github.com/BEEmod/BEE2.4/blob/02767f3cf476581789425ab308ca1bea978f6a74/src/precomp/conditions/entities.py#L108-L128 | ||
google-research/tensor2robot | 484a15ee63df412f1f7e53861c936630ad31124b | hooks/hook_builder.py | python | HookBuilder.create_hooks | (
self, t2r_model,
estimator,
) | Create hooks for the trainer.
Subclasses can add arguments here.
Arguments:
t2r_model: Provided model
estimator: Provided estimator instance
Returns:
A list of tf.train.SessionRunHooks to add to the trainer. | Create hooks for the trainer. | [
"Create",
"hooks",
"for",
"the",
"trainer",
"."
] | def create_hooks(
self, t2r_model,
estimator,
):
"""Create hooks for the trainer.
Subclasses can add arguments here.
Arguments:
t2r_model: Provided model
estimator: Provided estimator instance
Returns:
A list of tf.train.SessionRunHooks to add to the trainer.
""" | [
"def",
"create_hooks",
"(",
"self",
",",
"t2r_model",
",",
"estimator",
",",
")",
":"
] | https://github.com/google-research/tensor2robot/blob/484a15ee63df412f1f7e53861c936630ad31124b/hooks/hook_builder.py#L30-L43 | ||
yuxiaokui/Intranet-Penetration | f57678a204840c83cbf3308e3470ae56c5ff514b | proxy/XX-Net/code/default/gae_proxy/server/lib/oauth2client/client.py | python | _save_private_file | (filename, json_contents) | Saves a file with read-write permissions on for the owner.
Args:
filename: String. Absolute path to file.
json_contents: JSON serializable object to be saved. | Saves a file with read-write permissions on for the owner. | [
"Saves",
"a",
"file",
"with",
"read",
"-",
"write",
"permissions",
"on",
"for",
"the",
"owner",
"."
] | def _save_private_file(filename, json_contents):
"""Saves a file with read-write permissions on for the owner.
Args:
filename: String. Absolute path to file.
json_contents: JSON serializable object to be saved.
"""
temp_filename = tempfile.mktemp()
file_desc = os.open(temp_filename, os.O_WRONLY | os.... | [
"def",
"_save_private_file",
"(",
"filename",
",",
"json_contents",
")",
":",
"temp_filename",
"=",
"tempfile",
".",
"mktemp",
"(",
")",
"file_desc",
"=",
"os",
".",
"open",
"(",
"temp_filename",
",",
"os",
".",
"O_WRONLY",
"|",
"os",
".",
"O_CREAT",
",",
... | https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/gae_proxy/server/lib/oauth2client/client.py#L1236-L1248 | ||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/github/Organization.py | python | Organization.email | (self) | return self._email.value | :type: string | :type: string | [
":",
"type",
":",
"string"
] | def email(self):
"""
:type: string
"""
self._completeIfNotSet(self._email)
return self._email.value | [
"def",
"email",
"(",
"self",
")",
":",
"self",
".",
"_completeIfNotSet",
"(",
"self",
".",
"_email",
")",
"return",
"self",
".",
"_email",
".",
"value"
] | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/github/Organization.py#L135-L140 | |
nicholastoddsmith/poeai | e95add37348f402b7e42f0e978b6af466dc0b055 | TargetingSystem.py | python | TargetingSystem.CharPos | (self) | return self.cp | Gets the character's position on the screen | Gets the character's position on the screen | [
"Gets",
"the",
"character",
"s",
"position",
"on",
"the",
"screen"
] | def CharPos(self):
'''
Gets the character's position on the screen
'''
return self.cp | [
"def",
"CharPos",
"(",
"self",
")",
":",
"return",
"self",
".",
"cp"
] | https://github.com/nicholastoddsmith/poeai/blob/e95add37348f402b7e42f0e978b6af466dc0b055/TargetingSystem.py#L120-L124 | |
openstack/magnum | fa298eeab19b1d87070d72c7c4fb26cd75b0781e | magnum/common/context.py | python | has_ctx | () | return hasattr(_CTX_STORE, _CTX_KEY) | [] | def has_ctx():
return hasattr(_CTX_STORE, _CTX_KEY) | [
"def",
"has_ctx",
"(",
")",
":",
"return",
"hasattr",
"(",
"_CTX_STORE",
",",
"_CTX_KEY",
")"
] | https://github.com/openstack/magnum/blob/fa298eeab19b1d87070d72c7c4fb26cd75b0781e/magnum/common/context.py#L134-L135 | |||
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/plugins/infrastructure/halberd.py | python | halberd._main | (self, url) | This was taken from the original halberd, 'script/halberd' . | This was taken from the original halberd, 'script/halberd' . | [
"This",
"was",
"taken",
"from",
"the",
"original",
"halberd",
"script",
"/",
"halberd",
"."
] | def _main(self, url):
"""
This was taken from the original halberd, 'script/halberd' .
"""
scantask = halberd_scan_task.ScanTask()
scantask.scantime = halberd_scan_task.default_scantime
scantask.parallelism = halberd_scan_task.default_parallelism
scantask.verbose... | [
"def",
"_main",
"(",
"self",
",",
"url",
")",
":",
"scantask",
"=",
"halberd_scan_task",
".",
"ScanTask",
"(",
")",
"scantask",
".",
"scantime",
"=",
"halberd_scan_task",
".",
"default_scantime",
"scantask",
".",
"parallelism",
"=",
"halberd_scan_task",
".",
"... | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/infrastructure/halberd.py#L65-L112 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/whoosh/matching/binary.py | python | IntersectionMatcher._find_next | (self) | return r | [] | def _find_next(self):
a = self.a
b = self.b
a_id = a.id()
b_id = b.id()
assert a_id != b_id
r = False
while a.is_active() and b.is_active() and a_id != b_id:
if a_id < b_id:
ra = a.skip_to(b_id)
if not a.is_active():
... | [
"def",
"_find_next",
"(",
"self",
")",
":",
"a",
"=",
"self",
".",
"a",
"b",
"=",
"self",
".",
"b",
"a_id",
"=",
"a",
".",
"id",
"(",
")",
"b_id",
"=",
"b",
".",
"id",
"(",
")",
"assert",
"a_id",
"!=",
"b_id",
"r",
"=",
"False",
"while",
"a... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/matching/binary.py#L469-L490 | |||
rndusr/stig | 334f03e2e3eda7c1856dd5489f0265a47b9861b6 | stig/tui/group.py | python | Group.focus_name | (self) | Name of currently focused widget or None | Name of currently focused widget or None | [
"Name",
"of",
"currently",
"focused",
"widget",
"or",
"None"
] | def focus_name(self):
"""Name of currently focused widget or None"""
try:
item = self._get_item_by_position(self._main.focus_position)
return item['name']
except ValueError:
return None | [
"def",
"focus_name",
"(",
"self",
")",
":",
"try",
":",
"item",
"=",
"self",
".",
"_get_item_by_position",
"(",
"self",
".",
"_main",
".",
"focus_position",
")",
"return",
"item",
"[",
"'name'",
"]",
"except",
"ValueError",
":",
"return",
"None"
] | https://github.com/rndusr/stig/blob/334f03e2e3eda7c1856dd5489f0265a47b9861b6/stig/tui/group.py#L340-L346 | ||
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/gdata/photos/__init__.py | python | AlbumEntry.GetCommentsUri | (self) | return self._feedUri('comment') | (string) Return the uri to this albums feed of the CommentEntry kind | (string) Return the uri to this albums feed of the CommentEntry kind | [
"(",
"string",
")",
"Return",
"the",
"uri",
"to",
"this",
"albums",
"feed",
"of",
"the",
"CommentEntry",
"kind"
] | def GetCommentsUri(self):
"(string) Return the uri to this albums feed of the CommentEntry kind"
return self._feedUri('comment') | [
"def",
"GetCommentsUri",
"(",
"self",
")",
":",
"return",
"self",
".",
"_feedUri",
"(",
"'comment'",
")"
] | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/gdata/photos/__init__.py#L609-L611 | |
AndrewAnnex/SpiceyPy | 9f8b626338f119bacd39ef2ba94a6f71bd6341c0 | src/spiceypy/spiceypy.py | python | pckcov | (pck: str, idcode: int, cover: SpiceCell) | Find the coverage window for a specified reference frame in a
specified binary PCK file.
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pckcov_c.html
:param pck: Name of PCK file.
:param idcode: Class ID code of PCK reference frame.
:param cover: Window giving coverage in pck for idcode. | Find the coverage window for a specified reference frame in a
specified binary PCK file. | [
"Find",
"the",
"coverage",
"window",
"for",
"a",
"specified",
"reference",
"frame",
"in",
"a",
"specified",
"binary",
"PCK",
"file",
"."
] | def pckcov(pck: str, idcode: int, cover: SpiceCell) -> None:
"""
Find the coverage window for a specified reference frame in a
specified binary PCK file.
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pckcov_c.html
:param pck: Name of PCK file.
:param idcode: Class ID code of PCK ref... | [
"def",
"pckcov",
"(",
"pck",
":",
"str",
",",
"idcode",
":",
"int",
",",
"cover",
":",
"SpiceCell",
")",
"->",
"None",
":",
"pck",
"=",
"stypes",
".",
"string_to_char_p",
"(",
"pck",
")",
"idcode",
"=",
"ctypes",
".",
"c_int",
"(",
"idcode",
")",
"... | https://github.com/AndrewAnnex/SpiceyPy/blob/9f8b626338f119bacd39ef2ba94a6f71bd6341c0/src/spiceypy/spiceypy.py#L9507-L9522 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/nose-1.3.7/nose/plugins/manager.py | python | PluginProxy.chain | (self, *arg, **kw) | return result | Call plugins in a chain, where the result of each plugin call is
sent to the next plugin as input. The final output result is returned. | Call plugins in a chain, where the result of each plugin call is
sent to the next plugin as input. The final output result is returned. | [
"Call",
"plugins",
"in",
"a",
"chain",
"where",
"the",
"result",
"of",
"each",
"plugin",
"call",
"is",
"sent",
"to",
"the",
"next",
"plugin",
"as",
"input",
".",
"The",
"final",
"output",
"result",
"is",
"returned",
"."
] | def chain(self, *arg, **kw):
"""Call plugins in a chain, where the result of each plugin call is
sent to the next plugin as input. The final output result is returned.
"""
result = None
# extract the static arguments (if any) from arg so they can
# be passed to each plugi... | [
"def",
"chain",
"(",
"self",
",",
"*",
"arg",
",",
"*",
"*",
"kw",
")",
":",
"result",
"=",
"None",
"# extract the static arguments (if any) from arg so they can",
"# be passed to each plugin call in the chain",
"static",
"=",
"[",
"a",
"for",
"(",
"static",
",",
... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/nose-1.3.7/nose/plugins/manager.py#L130-L144 | |
TheAlgorithms/Python | 9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c | machine_learning/word_frequency_functions.py | python | document_frequency | (term: str, corpus: str) | return (len([doc for doc in docs if term in doc]), len(docs)) | Calculate the number of documents in a corpus that contain a
given term
@params : term, the term to search each document for, and corpus, a collection of
documents. Each document should be separated by a newline.
@returns : the number of documents in the corpus that contain the term you are
... | Calculate the number of documents in a corpus that contain a
given term | [
"Calculate",
"the",
"number",
"of",
"documents",
"in",
"a",
"corpus",
"that",
"contain",
"a",
"given",
"term"
] | def document_frequency(term: str, corpus: str) -> tuple[int, int]:
"""
Calculate the number of documents in a corpus that contain a
given term
@params : term, the term to search each document for, and corpus, a collection of
documents. Each document should be separated by a newline.
@re... | [
"def",
"document_frequency",
"(",
"term",
":",
"str",
",",
"corpus",
":",
"str",
")",
"->",
"tuple",
"[",
"int",
",",
"int",
"]",
":",
"corpus_without_punctuation",
"=",
"corpus",
".",
"lower",
"(",
")",
".",
"translate",
"(",
"str",
".",
"maketrans",
... | https://github.com/TheAlgorithms/Python/blob/9af2eef9b3761bf51580dedfb6fa7136ca0c5c2c/machine_learning/word_frequency_functions.py#L64-L83 | |
napari/napari | dbf4158e801fa7a429de8ef1cdee73bf6d64c61e | napari/_qt/containers/_base_item_model.py | python | _BaseEventedItemModel._on_end_insert | (self) | Must be called after insert operation to update model. | Must be called after insert operation to update model. | [
"Must",
"be",
"called",
"after",
"insert",
"operation",
"to",
"update",
"model",
"."
] | def _on_end_insert(self):
"""Must be called after insert operation to update model."""
self.endInsertRows() | [
"def",
"_on_end_insert",
"(",
"self",
")",
":",
"self",
".",
"endInsertRows",
"(",
")"
] | https://github.com/napari/napari/blob/dbf4158e801fa7a429de8ef1cdee73bf6d64c61e/napari/_qt/containers/_base_item_model.py#L244-L246 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/sqlalchemy/util/_collections.py | python | OrderedDict.__reduce__ | (self) | return OrderedDict, (self.items(),) | [] | def __reduce__(self):
return OrderedDict, (self.items(),) | [
"def",
"__reduce__",
"(",
"self",
")",
":",
"return",
"OrderedDict",
",",
"(",
"self",
".",
"items",
"(",
")",
",",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/util/_collections.py#L268-L269 | |||
JacquesLucke/animation_nodes | b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1 | animation_nodes/nodes/generic/convert_node.py | python | ConvertNode.assignOutputType | (self, dataType) | [] | def assignOutputType(self, dataType):
self.fixedOutputDataType = True
if self.dataType != dataType:
self.dataType = dataType
self.refresh() | [
"def",
"assignOutputType",
"(",
"self",
",",
"dataType",
")",
":",
"self",
".",
"fixedOutputDataType",
"=",
"True",
"if",
"self",
".",
"dataType",
"!=",
"dataType",
":",
"self",
".",
"dataType",
"=",
"dataType",
"self",
".",
"refresh",
"(",
")"
] | https://github.com/JacquesLucke/animation_nodes/blob/b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1/animation_nodes/nodes/generic/convert_node.py#L37-L41 | ||||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/wagtail_bak/wagtailadmin/templatetags/wagtailadmin_tags.py | python | test_collection_is_public | (context, collection) | return not is_private | Usage: {% test_collection_is_public collection as is_public %}
Sets 'is_public' to True iff there are no collection view restrictions in place
on this collection.
Caches the list of collection view restrictions in the context, to avoid repeated
DB queries on repeated calls. | Usage: {% test_collection_is_public collection as is_public %}
Sets 'is_public' to True iff there are no collection view restrictions in place
on this collection.
Caches the list of collection view restrictions in the context, to avoid repeated
DB queries on repeated calls. | [
"Usage",
":",
"{",
"%",
"test_collection_is_public",
"collection",
"as",
"is_public",
"%",
"}",
"Sets",
"is_public",
"to",
"True",
"iff",
"there",
"are",
"no",
"collection",
"view",
"restrictions",
"in",
"place",
"on",
"this",
"collection",
".",
"Caches",
"the... | def test_collection_is_public(context, collection):
"""
Usage: {% test_collection_is_public collection as is_public %}
Sets 'is_public' to True iff there are no collection view restrictions in place
on this collection.
Caches the list of collection view restrictions in the context, to avoid repeated... | [
"def",
"test_collection_is_public",
"(",
"context",
",",
"collection",
")",
":",
"if",
"'all_collection_view_restrictions'",
"not",
"in",
"context",
":",
"context",
"[",
"'all_collection_view_restrictions'",
"]",
"=",
"CollectionViewRestriction",
".",
"objects",
".",
"s... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail_bak/wagtailadmin/templatetags/wagtailadmin_tags.py#L141-L156 | |
atlassian-api/atlassian-python-api | 6d8545a790c3aae10b75bdc225fb5c3a0aee44db | atlassian/confluence.py | python | Confluence.create_page | (
self,
space,
title,
body,
parent_id=None,
type="page",
representation="storage",
editor=None,
) | return response | Create page from scratch
:param space:
:param title:
:param body:
:param parent_id:
:param type:
:param representation: OPTIONAL: either Confluence 'storage' or 'wiki' markup format
:param editor: OPTIONAL: v2 to be created in the new editor
:return: | Create page from scratch
:param space:
:param title:
:param body:
:param parent_id:
:param type:
:param representation: OPTIONAL: either Confluence 'storage' or 'wiki' markup format
:param editor: OPTIONAL: v2 to be created in the new editor
:return: | [
"Create",
"page",
"from",
"scratch",
":",
"param",
"space",
":",
":",
"param",
"title",
":",
":",
"param",
"body",
":",
":",
"param",
"parent_id",
":",
":",
"param",
"type",
":",
":",
"param",
"representation",
":",
"OPTIONAL",
":",
"either",
"Confluence... | def create_page(
self,
space,
title,
body,
parent_id=None,
type="page",
representation="storage",
editor=None,
):
"""
Create page from scratch
:param space:
:param title:
:param body:
:param parent_id:
... | [
"def",
"create_page",
"(",
"self",
",",
"space",
",",
"title",
",",
"body",
",",
"parent_id",
"=",
"None",
",",
"type",
"=",
"\"page\"",
",",
"representation",
"=",
"\"storage\"",
",",
"editor",
"=",
"None",
",",
")",
":",
"log",
".",
"info",
"(",
"'... | https://github.com/atlassian-api/atlassian-python-api/blob/6d8545a790c3aae10b75bdc225fb5c3a0aee44db/atlassian/confluence.py#L607-L651 | |
HazyResearch/metal | b54631e9b94a3dcf55f6043c53ec181e12f29eb1 | metal/classifier.py | python | Classifier._to_numpy | (Z) | Converts a None, list, np.ndarray, or torch.Tensor to np.ndarray;
also handles converting sparse input to dense. | Converts a None, list, np.ndarray, or torch.Tensor to np.ndarray;
also handles converting sparse input to dense. | [
"Converts",
"a",
"None",
"list",
"np",
".",
"ndarray",
"or",
"torch",
".",
"Tensor",
"to",
"np",
".",
"ndarray",
";",
"also",
"handles",
"converting",
"sparse",
"input",
"to",
"dense",
"."
] | def _to_numpy(Z):
"""Converts a None, list, np.ndarray, or torch.Tensor to np.ndarray;
also handles converting sparse input to dense."""
if Z is None:
return Z
elif issparse(Z):
return Z.toarray()
elif isinstance(Z, np.ndarray):
return Z
... | [
"def",
"_to_numpy",
"(",
"Z",
")",
":",
"if",
"Z",
"is",
"None",
":",
"return",
"Z",
"elif",
"issparse",
"(",
"Z",
")",
":",
"return",
"Z",
".",
"toarray",
"(",
")",
"elif",
"isinstance",
"(",
"Z",
",",
"np",
".",
"ndarray",
")",
":",
"return",
... | https://github.com/HazyResearch/metal/blob/b54631e9b94a3dcf55f6043c53ec181e12f29eb1/metal/classifier.py#L638-L656 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/mrs/v20200910/models.py | python | ImageToObjectResponse.__init__ | (self) | r"""
:param Template: 报告结构化结果
注意:此字段可能返回 null,表示取不到有效值。
:type Template: :class:`tencentcloud.mrs.v20200910.models.Template`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | r"""
:param Template: 报告结构化结果
注意:此字段可能返回 null,表示取不到有效值。
:type Template: :class:`tencentcloud.mrs.v20200910.models.Template`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | [
"r",
":",
"param",
"Template",
":",
"报告结构化结果",
"注意:此字段可能返回",
"null,表示取不到有效值。",
":",
"type",
"Template",
":",
":",
"class",
":",
"tencentcloud",
".",
"mrs",
".",
"v20200910",
".",
"models",
".",
"Template",
":",
"param",
"RequestId",
":",
"唯一请求",
"ID,每次请求都会返回... | def __init__(self):
r"""
:param Template: 报告结构化结果
注意:此字段可能返回 null,表示取不到有效值。
:type Template: :class:`tencentcloud.mrs.v20200910.models.Template`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Template = None
self.... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"Template",
"=",
"None",
"self",
".",
"RequestId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/mrs/v20200910/models.py#L1311-L1320 | ||
pyqt/examples | 843bb982917cecb2350b5f6d7f42c9b7fb142ec1 | src/pyqt-official/multimediawidgets/player.py | python | Player.durationChanged | (self, duration) | [] | def durationChanged(self, duration):
duration /= 1000
self.duration = duration
self.slider.setMaximum(duration) | [
"def",
"durationChanged",
"(",
"self",
",",
"duration",
")",
":",
"duration",
"/=",
"1000",
"self",
".",
"duration",
"=",
"duration",
"self",
".",
"slider",
".",
"setMaximum",
"(",
"duration",
")"
] | https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/multimediawidgets/player.py#L518-L522 | ||||
meejah/txtorcon | 7da6ad6f91c395951be1b4e7e1011baa2f7a689f | txtorcon/_microdesc_parser.py | python | MicrodescriptorParser.feed_line | (self, line) | A line has been received. | A line has been received. | [
"A",
"line",
"has",
"been",
"received",
"."
] | def feed_line(self, line):
"""
A line has been received.
"""
self._machine.process(line) | [
"def",
"feed_line",
"(",
"self",
",",
"line",
")",
":",
"self",
".",
"_machine",
".",
"process",
"(",
"line",
")"
] | https://github.com/meejah/txtorcon/blob/7da6ad6f91c395951be1b4e7e1011baa2f7a689f/txtorcon/_microdesc_parser.py#L64-L68 | ||
brython-dev/brython | 9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3 | www/src/Lib/textwrap.py | python | TextWrapper._munge_whitespace | (self, text) | return text | _munge_whitespace(text : string) -> string
Munge whitespace in text: expand tabs and convert all other
whitespace characters to spaces. Eg. " foo\\tbar\\n\\nbaz"
becomes " foo bar baz". | _munge_whitespace(text : string) -> string | [
"_munge_whitespace",
"(",
"text",
":",
"string",
")",
"-",
">",
"string"
] | def _munge_whitespace(self, text):
"""_munge_whitespace(text : string) -> string
Munge whitespace in text: expand tabs and convert all other
whitespace characters to spaces. Eg. " foo\\tbar\\n\\nbaz"
becomes " foo bar baz".
"""
if self.expand_tabs:
text ... | [
"def",
"_munge_whitespace",
"(",
"self",
",",
"text",
")",
":",
"if",
"self",
".",
"expand_tabs",
":",
"text",
"=",
"text",
".",
"expandtabs",
"(",
"self",
".",
"tabsize",
")",
"if",
"self",
".",
"replace_whitespace",
":",
"text",
"=",
"text",
".",
"tr... | https://github.com/brython-dev/brython/blob/9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3/www/src/Lib/textwrap.py#L146-L157 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/pricing/v1/messaging/__init__.py | python | MessagingList.__repr__ | (self) | return '<Twilio.Pricing.V1.MessagingList>' | 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.Pricing.V1.MessagingList>' | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'<Twilio.Pricing.V1.MessagingList>'"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/pricing/v1/messaging/__init__.py#L46-L53 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/site-packages/gdata/alt/appengine.py | python | AppEngineTokenStore.remove_token | (self, token) | return token_found | Removes the token from the current user's collection in the datastore.
Returns:
False if the token was not removed, this could be because the token was
not in the datastore, or because there is no current user. | Removes the token from the current user's collection in the datastore.
Returns:
False if the token was not removed, this could be because the token was
not in the datastore, or because there is no current user. | [
"Removes",
"the",
"token",
"from",
"the",
"current",
"user",
"s",
"collection",
"in",
"the",
"datastore",
".",
"Returns",
":",
"False",
"if",
"the",
"token",
"was",
"not",
"removed",
"this",
"could",
"be",
"because",
"the",
"token",
"was",
"not",
"in",
"... | def remove_token(self, token):
"""Removes the token from the current user's collection in the datastore.
Returns:
False if the token was not removed, this could be because the token was
not in the datastore, or because there is no current user.
"""
token_found = False
scopes_to_dele... | [
"def",
"remove_token",
"(",
"self",
",",
"token",
")",
":",
"token_found",
"=",
"False",
"scopes_to_delete",
"=",
"[",
"]",
"tokens",
"=",
"load_auth_tokens",
"(",
"self",
".",
"user",
")",
"for",
"scope",
",",
"stored_token",
"in",
"tokens",
".",
"iterite... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/gdata/alt/appengine.py#L252-L270 | |
andialbrecht/sqlparse | 3bc7d93254cbef71bdef91905f1814201a1b1f02 | sqlparse/sql.py | python | TokenList.token_prev | (self, idx, skip_ws=True, skip_cm=False) | return self.token_next(idx, skip_ws, skip_cm, _reverse=True) | Returns the previous token relative to *idx*.
If *skip_ws* is ``True`` (the default) whitespace tokens are ignored.
If *skip_cm* is ``True`` comments are ignored.
``None`` is returned if there's no previous token. | Returns the previous token relative to *idx*. | [
"Returns",
"the",
"previous",
"token",
"relative",
"to",
"*",
"idx",
"*",
"."
] | def token_prev(self, idx, skip_ws=True, skip_cm=False):
"""Returns the previous token relative to *idx*.
If *skip_ws* is ``True`` (the default) whitespace tokens are ignored.
If *skip_cm* is ``True`` comments are ignored.
``None`` is returned if there's no previous token.
"""
... | [
"def",
"token_prev",
"(",
"self",
",",
"idx",
",",
"skip_ws",
"=",
"True",
",",
"skip_cm",
"=",
"False",
")",
":",
"return",
"self",
".",
"token_next",
"(",
"idx",
",",
"skip_ws",
",",
"skip_cm",
",",
"_reverse",
"=",
"True",
")"
] | https://github.com/andialbrecht/sqlparse/blob/3bc7d93254cbef71bdef91905f1814201a1b1f02/sqlparse/sql.py#L276-L283 | |
guildai/guildai | 1665985a3d4d788efc1a3180ca51cc417f71ca78 | guild/external/setuptools/msvc.py | python | msvc14_get_vc_env | (plat_spec) | Patched "distutils._msvccompiler._get_vc_env" for support extra
Microsoft Visual C++ 14.X compilers.
Set environment without use of "vcvarsall.bat".
Parameters
----------
plat_spec: str
Target architecture.
Return
------
dict
environment | Patched "distutils._msvccompiler._get_vc_env" for support extra
Microsoft Visual C++ 14.X compilers. | [
"Patched",
"distutils",
".",
"_msvccompiler",
".",
"_get_vc_env",
"for",
"support",
"extra",
"Microsoft",
"Visual",
"C",
"++",
"14",
".",
"X",
"compilers",
"."
] | def msvc14_get_vc_env(plat_spec):
"""
Patched "distutils._msvccompiler._get_vc_env" for support extra
Microsoft Visual C++ 14.X compilers.
Set environment without use of "vcvarsall.bat".
Parameters
----------
plat_spec: str
Target architecture.
Return
------
dict
... | [
"def",
"msvc14_get_vc_env",
"(",
"plat_spec",
")",
":",
"# Try to get environment from vcvarsall.bat (Classical way)",
"try",
":",
"return",
"get_unpatched",
"(",
"msvc14_get_vc_env",
")",
"(",
"plat_spec",
")",
"except",
"distutils",
".",
"errors",
".",
"DistutilsPlatfor... | https://github.com/guildai/guildai/blob/1665985a3d4d788efc1a3180ca51cc417f71ca78/guild/external/setuptools/msvc.py#L145-L174 | ||
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/tkinter/__init__.py | python | Canvas.focus | (self, *args) | return self.tk.call((self._w, 'focus') + args) | Set focus to the first item specified in ARGS. | Set focus to the first item specified in ARGS. | [
"Set",
"focus",
"to",
"the",
"first",
"item",
"specified",
"in",
"ARGS",
"."
] | def focus(self, *args):
"""Set focus to the first item specified in ARGS."""
return self.tk.call((self._w, 'focus') + args) | [
"def",
"focus",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"(",
"self",
".",
"_w",
",",
"'focus'",
")",
"+",
"args",
")"
] | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/tkinter/__init__.py#L2896-L2898 | |
datafolklabs/cement | 2d44d2c1821bda6bdfcfe605d244dc2dfb0b19a6 | cement/cli/contrib/jinja2/ext.py | python | Extension.attr | (self, name, lineno=None) | return nodes.ExtensionAttribute(self.identifier, name, lineno=lineno) | Return an attribute node for the current extension. This is useful
to pass constants on extensions to generated template code.
::
self.attr('_my_attribute', lineno=lineno) | Return an attribute node for the current extension. This is useful
to pass constants on extensions to generated template code. | [
"Return",
"an",
"attribute",
"node",
"for",
"the",
"current",
"extension",
".",
"This",
"is",
"useful",
"to",
"pass",
"constants",
"on",
"extensions",
"to",
"generated",
"template",
"code",
"."
] | def attr(self, name, lineno=None):
"""Return an attribute node for the current extension. This is useful
to pass constants on extensions to generated template code.
::
self.attr('_my_attribute', lineno=lineno)
"""
return nodes.ExtensionAttribute(self.identifier, na... | [
"def",
"attr",
"(",
"self",
",",
"name",
",",
"lineno",
"=",
"None",
")",
":",
"return",
"nodes",
".",
"ExtensionAttribute",
"(",
"self",
".",
"identifier",
",",
"name",
",",
"lineno",
"=",
"lineno",
")"
] | https://github.com/datafolklabs/cement/blob/2d44d2c1821bda6bdfcfe605d244dc2dfb0b19a6/cement/cli/contrib/jinja2/ext.py#L109-L117 | |
apache/libcloud | 90971e17bfd7b6bb97b2489986472c531cc8e140 | libcloud/compute/drivers/openstack.py | python | OpenStack_1_0_NodeDriver.ex_limits | (self) | return {"rate": rate, "absolute": absolute} | Extra call to get account's limits, such as
rates (for example amount of POST requests per day)
and absolute limits like total amount of available
RAM to be used by servers.
:return: dict with keys 'rate' and 'absolute'
:rtype: ``dict`` | Extra call to get account's limits, such as
rates (for example amount of POST requests per day)
and absolute limits like total amount of available
RAM to be used by servers. | [
"Extra",
"call",
"to",
"get",
"account",
"s",
"limits",
"such",
"as",
"rates",
"(",
"for",
"example",
"amount",
"of",
"POST",
"requests",
"per",
"day",
")",
"and",
"absolute",
"limits",
"like",
"total",
"amount",
"of",
"available",
"RAM",
"to",
"be",
"us... | def ex_limits(self):
"""
Extra call to get account's limits, such as
rates (for example amount of POST requests per day)
and absolute limits like total amount of available
RAM to be used by servers.
:return: dict with keys 'rate' and 'absolute'
:rtype: ``dict``
... | [
"def",
"ex_limits",
"(",
"self",
")",
":",
"def",
"_to_rate",
"(",
"el",
")",
":",
"rate",
"=",
"{",
"}",
"for",
"item",
"in",
"list",
"(",
"el",
".",
"items",
"(",
")",
")",
":",
"rate",
"[",
"item",
"[",
"0",
"]",
"]",
"=",
"item",
"[",
"... | https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/compute/drivers/openstack.py#L1094-L1123 | |
Wildog/Ariafred | 8b9d611fb8661945e286e10aaeae308c1d3517eb | src/workflow/update.py | python | wf | () | return _wf | Lazy `Workflow` object. | Lazy `Workflow` object. | [
"Lazy",
"Workflow",
"object",
"."
] | def wf():
"""Lazy `Workflow` object."""
global _wf
if _wf is None:
_wf = workflow.Workflow()
return _wf | [
"def",
"wf",
"(",
")",
":",
"global",
"_wf",
"if",
"_wf",
"is",
"None",
":",
"_wf",
"=",
"workflow",
".",
"Workflow",
"(",
")",
"return",
"_wf"
] | https://github.com/Wildog/Ariafred/blob/8b9d611fb8661945e286e10aaeae308c1d3517eb/src/workflow/update.py#L43-L48 | |
securityclippy/elasticintel | aa08d3e9f5ab1c000128e95161139ce97ff0e334 | intelbot/requests/utils.py | python | is_valid_cidr | (string_network) | return True | Very simple check of the cidr format in no_proxy variable | Very simple check of the cidr format in no_proxy variable | [
"Very",
"simple",
"check",
"of",
"the",
"cidr",
"format",
"in",
"no_proxy",
"variable"
] | def is_valid_cidr(string_network):
"""Very simple check of the cidr format in no_proxy variable"""
if string_network.count('/') == 1:
try:
mask = int(string_network.split('/')[1])
except ValueError:
return False
if mask < 1 or mask > 32:
return False
... | [
"def",
"is_valid_cidr",
"(",
"string_network",
")",
":",
"if",
"string_network",
".",
"count",
"(",
"'/'",
")",
"==",
"1",
":",
"try",
":",
"mask",
"=",
"int",
"(",
"string_network",
".",
"split",
"(",
"'/'",
")",
"[",
"1",
"]",
")",
"except",
"Value... | https://github.com/securityclippy/elasticintel/blob/aa08d3e9f5ab1c000128e95161139ce97ff0e334/intelbot/requests/utils.py#L493-L510 | |
geekan/scrapy-examples | edb1cb116bd6def65a6ef01f953b58eb43e54305 | linkedin/linkedin/linkedin/pipelines.py | python | MongoDBPipeline.__get_uniq_key | (self) | return settings['MONGODB_UNIQ_KEY'] | [] | def __get_uniq_key(self):
if not settings['MONGODB_UNIQ_KEY'] or settings['MONGODB_UNIQ_KEY'] == "":
return None
return settings['MONGODB_UNIQ_KEY'] | [
"def",
"__get_uniq_key",
"(",
"self",
")",
":",
"if",
"not",
"settings",
"[",
"'MONGODB_UNIQ_KEY'",
"]",
"or",
"settings",
"[",
"'MONGODB_UNIQ_KEY'",
"]",
"==",
"\"\"",
":",
"return",
"None",
"return",
"settings",
"[",
"'MONGODB_UNIQ_KEY'",
"]"
] | https://github.com/geekan/scrapy-examples/blob/edb1cb116bd6def65a6ef01f953b58eb43e54305/linkedin/linkedin/linkedin/pipelines.py#L48-L51 | |||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/asyncio/events.py | python | get_running_loop | () | return loop | Return the running event loop. Raise a RuntimeError if there is none.
This function is thread-specific. | Return the running event loop. Raise a RuntimeError if there is none. | [
"Return",
"the",
"running",
"event",
"loop",
".",
"Raise",
"a",
"RuntimeError",
"if",
"there",
"is",
"none",
"."
] | def get_running_loop():
"""Return the running event loop. Raise a RuntimeError if there is none.
This function is thread-specific.
"""
# NOTE: this function is implemented in C (see _asynciomodule.c)
loop = _get_running_loop()
if loop is None:
raise RuntimeError('no running event loop'... | [
"def",
"get_running_loop",
"(",
")",
":",
"# NOTE: this function is implemented in C (see _asynciomodule.c)",
"loop",
"=",
"_get_running_loop",
"(",
")",
"if",
"loop",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"'no running event loop'",
")",
"return",
"loop"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/asyncio/events.py#L694-L703 | |
AlessandroZ/LaZagne | 30623c9138e2387d10f6631007f954f2a4ead06d | Windows/lazagne/softwares/memory/libkeepass/kdb4.py | python | KDB4File._decrypt | (self, stream) | Build the master key from header settings and key-hash list.
Start reading from `stream` after the header and decrypt all the data.
Remove padding as needed and feed into hashed block reader, set as
in-buffer. | Build the master key from header settings and key-hash list.
Start reading from `stream` after the header and decrypt all the data.
Remove padding as needed and feed into hashed block reader, set as
in-buffer. | [
"Build",
"the",
"master",
"key",
"from",
"header",
"settings",
"and",
"key",
"-",
"hash",
"list",
".",
"Start",
"reading",
"from",
"stream",
"after",
"the",
"header",
"and",
"decrypt",
"all",
"the",
"data",
".",
"Remove",
"padding",
"as",
"needed",
"and",
... | def _decrypt(self, stream):
"""
Build the master key from header settings and key-hash list.
Start reading from `stream` after the header and decrypt all the data.
Remove padding as needed and feed into hashed block reader, set as
in-buffer.
"""
super(KDB... | [
"def",
"_decrypt",
"(",
"self",
",",
"stream",
")",
":",
"super",
"(",
"KDB4File",
",",
"self",
")",
".",
"_decrypt",
"(",
"stream",
")",
"data",
"=",
"aes_cbc_decrypt",
"(",
"stream",
".",
"read",
"(",
")",
",",
"self",
".",
"master_key",
",",
"self... | https://github.com/AlessandroZ/LaZagne/blob/30623c9138e2387d10f6631007f954f2a4ead06d/Windows/lazagne/softwares/memory/libkeepass/kdb4.py#L171-L192 | ||
TengXiaoDai/DistributedCrawling | f5c2439e6ce68dd9b49bde084d76473ff9ed4963 | Lib/site-packages/setuptools/sandbox.py | python | save_modules | () | Context in which imported modules are saved.
Translates exceptions internal to the context into the equivalent exception
outside the context. | Context in which imported modules are saved. | [
"Context",
"in",
"which",
"imported",
"modules",
"are",
"saved",
"."
] | def save_modules():
"""
Context in which imported modules are saved.
Translates exceptions internal to the context into the equivalent exception
outside the context.
"""
saved = sys.modules.copy()
with ExceptionSaver() as saved_exc:
yield saved
sys.modules.update(saved)
# r... | [
"def",
"save_modules",
"(",
")",
":",
"saved",
"=",
"sys",
".",
"modules",
".",
"copy",
"(",
")",
"with",
"ExceptionSaver",
"(",
")",
"as",
"saved_exc",
":",
"yield",
"saved",
"sys",
".",
"modules",
".",
"update",
"(",
"saved",
")",
"# remove any modules... | https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/site-packages/setuptools/sandbox.py#L148-L169 | ||
PyTorchLightning/pytorch-lightning | 5914fb748fb53d826ab337fc2484feab9883a104 | pytorch_lightning/loggers/base.py | python | LightningLoggerBase._reduce_agg_metrics | (self) | return self._prev_step, agg_mets | Aggregate accumulated metrics. | Aggregate accumulated metrics. | [
"Aggregate",
"accumulated",
"metrics",
"."
] | def _reduce_agg_metrics(self):
"""Aggregate accumulated metrics."""
# compute the metrics
if not self._metrics_to_agg:
agg_mets = None
elif len(self._metrics_to_agg) == 1:
agg_mets = self._metrics_to_agg[0]
else:
agg_mets = merge_dicts(self._me... | [
"def",
"_reduce_agg_metrics",
"(",
"self",
")",
":",
"# compute the metrics",
"if",
"not",
"self",
".",
"_metrics_to_agg",
":",
"agg_mets",
"=",
"None",
"elif",
"len",
"(",
"self",
".",
"_metrics_to_agg",
")",
"==",
"1",
":",
"agg_mets",
"=",
"self",
".",
... | https://github.com/PyTorchLightning/pytorch-lightning/blob/5914fb748fb53d826ab337fc2484feab9883a104/pytorch_lightning/loggers/base.py#L135-L144 | |
hzy46/Deep-Learning-21-Examples | 15c2d9edccad090cd67b033f24a43c544e5cba3e | chapter_16/nmt/model_helper.py | python | _single_cell | (unit_type, num_units, forget_bias, dropout,
mode, residual_connection=False, device_str=None) | return single_cell | Create an instance of a single RNN cell. | Create an instance of a single RNN cell. | [
"Create",
"an",
"instance",
"of",
"a",
"single",
"RNN",
"cell",
"."
] | def _single_cell(unit_type, num_units, forget_bias, dropout,
mode, residual_connection=False, device_str=None):
"""Create an instance of a single RNN cell."""
# dropout (= 1 - keep_prob) is set to 0 during eval and infer
dropout = dropout if mode == tf.contrib.learn.ModeKeys.TRAIN else 0.0
# C... | [
"def",
"_single_cell",
"(",
"unit_type",
",",
"num_units",
",",
"forget_bias",
",",
"dropout",
",",
"mode",
",",
"residual_connection",
"=",
"False",
",",
"device_str",
"=",
"None",
")",
":",
"# dropout (= 1 - keep_prob) is set to 0 during eval and infer",
"dropout",
... | https://github.com/hzy46/Deep-Learning-21-Examples/blob/15c2d9edccad090cd67b033f24a43c544e5cba3e/chapter_16/nmt/model_helper.py#L107-L150 | |
colinskow/move37 | f57afca9d15ce0233b27b2b0d6508b99b46d4c7f | dqn/lib/dqn_model.py | python | DQN._get_conv_out | (self, shape) | return int(np.prod(o.size())) | [] | def _get_conv_out(self, shape):
o = self.conv(torch.zeros(1, *shape))
return int(np.prod(o.size())) | [
"def",
"_get_conv_out",
"(",
"self",
",",
"shape",
")",
":",
"o",
"=",
"self",
".",
"conv",
"(",
"torch",
".",
"zeros",
"(",
"1",
",",
"*",
"shape",
")",
")",
"return",
"int",
"(",
"np",
".",
"prod",
"(",
"o",
".",
"size",
"(",
")",
")",
")"
... | https://github.com/colinskow/move37/blob/f57afca9d15ce0233b27b2b0d6508b99b46d4c7f/dqn/lib/dqn_model.py#L29-L31 | |||
owid/covid-19-data | 936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92 | scripts/src/cowidev/vax/incremental/thailand.py | python | Thailand.pipe_location | (self, df: pd.DataFrame) | return df.assign(location=self.location) | [] | def pipe_location(self, df: pd.DataFrame) -> pd.DataFrame:
return df.assign(location=self.location) | [
"def",
"pipe_location",
"(",
"self",
",",
"df",
":",
"pd",
".",
"DataFrame",
")",
"->",
"pd",
".",
"DataFrame",
":",
"return",
"df",
".",
"assign",
"(",
"location",
"=",
"self",
".",
"location",
")"
] | https://github.com/owid/covid-19-data/blob/936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92/scripts/src/cowidev/vax/incremental/thailand.py#L148-L149 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/whoosh/matching/mcore.py | python | Matcher.skip_to | (self, id) | Moves this matcher to the first posting with an ID equal to or
greater than the given ID. | Moves this matcher to the first posting with an ID equal to or
greater than the given ID. | [
"Moves",
"this",
"matcher",
"to",
"the",
"first",
"posting",
"with",
"an",
"ID",
"equal",
"to",
"or",
"greater",
"than",
"the",
"given",
"ID",
"."
] | def skip_to(self, id):
"""Moves this matcher to the first posting with an ID equal to or
greater than the given ID.
"""
while self.is_active() and self.id() < id:
self.next() | [
"def",
"skip_to",
"(",
"self",
",",
"id",
")",
":",
"while",
"self",
".",
"is_active",
"(",
")",
"and",
"self",
".",
"id",
"(",
")",
"<",
"id",
":",
"self",
".",
"next",
"(",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/matching/mcore.py#L293-L299 | ||
rbarrois/python-semanticversion | 81a4730778fba6b5c76242d3c8da6dace7e2ec0a | semantic_version/base.py | python | Always.__hash__ | (self) | return hash((Always,)) | [] | def __hash__(self):
return hash((Always,)) | [
"def",
"__hash__",
"(",
"self",
")",
":",
"return",
"hash",
"(",
"(",
"Always",
",",
")",
")"
] | https://github.com/rbarrois/python-semanticversion/blob/81a4730778fba6b5c76242d3c8da6dace7e2ec0a/semantic_version/base.py#L880-L881 | |||
materialsproject/fireworks | 83a907c19baf2a5c9fdcf63996f9797c3c85b785 | fireworks/queue/queue_launcher.py | python | rapidfire | (
launchpad,
fworker,
qadapter,
launch_dir=".",
block_dir=None,
nlaunches=0,
njobs_queue=0,
njobs_block=500,
sleep_time=None,
reserve=False,
strm_lvl="INFO",
timeout=None,
fill_mode=False,
) | Submit many jobs to the queue.
Args:
launchpad (LaunchPad)
fworker (FWorker)
qadapter (QueueAdapterBase)
launch_dir (str): directory where we want to write the blocks
block_dir (str): directory to use as block dir. Can be a new or existing block. Dirname must
sta... | Submit many jobs to the queue. | [
"Submit",
"many",
"jobs",
"to",
"the",
"queue",
"."
] | def rapidfire(
launchpad,
fworker,
qadapter,
launch_dir=".",
block_dir=None,
nlaunches=0,
njobs_queue=0,
njobs_block=500,
sleep_time=None,
reserve=False,
strm_lvl="INFO",
timeout=None,
fill_mode=False,
):
"""
Submit many jobs to the queue.
Args:
l... | [
"def",
"rapidfire",
"(",
"launchpad",
",",
"fworker",
",",
"qadapter",
",",
"launch_dir",
"=",
"\".\"",
",",
"block_dir",
"=",
"None",
",",
"nlaunches",
"=",
"0",
",",
"njobs_queue",
"=",
"0",
",",
"njobs_block",
"=",
"500",
",",
"sleep_time",
"=",
"None... | https://github.com/materialsproject/fireworks/blob/83a907c19baf2a5c9fdcf63996f9797c3c85b785/fireworks/queue/queue_launcher.py#L175-L297 | ||
CATIA-Systems/FMPy | fde192346c36eb69dbaca60a96e80cdc8ef37b89 | fmpy/util.py | python | validate_result | (result, reference, stop_time=None) | return rel_out | Validate a simulation result against a reference result
Parameters:
result structured NumPy array where the first column is the time
reference same as result
Returns:
rel_out the largest relative deviation of all signals | Validate a simulation result against a reference result | [
"Validate",
"a",
"simulation",
"result",
"against",
"a",
"reference",
"result"
] | def validate_result(result, reference, stop_time=None):
""" Validate a simulation result against a reference result
Parameters:
result structured NumPy array where the first column is the time
reference same as result
Returns:
rel_out the largest relative deviation of al... | [
"def",
"validate_result",
"(",
"result",
",",
"reference",
",",
"stop_time",
"=",
"None",
")",
":",
"t_ref",
"=",
"reference",
"[",
"reference",
".",
"dtype",
".",
"names",
"[",
"0",
"]",
"]",
"t_res",
"=",
"result",
"[",
"result",
".",
"dtype",
".",
... | https://github.com/CATIA-Systems/FMPy/blob/fde192346c36eb69dbaca60a96e80cdc8ef37b89/fmpy/util.py#L194-L229 | |
scrapy/scrapyd | 9fae00bb76813359af6d709a343df0f46f529eda | scrapyd/interfaces.py | python | IEggStorage.put | (eggfile, project, version) | Store the egg (passed in the file object) under the given project and
version | Store the egg (passed in the file object) under the given project and
version | [
"Store",
"the",
"egg",
"(",
"passed",
"in",
"the",
"file",
"object",
")",
"under",
"the",
"given",
"project",
"and",
"version"
] | def put(eggfile, project, version):
"""Store the egg (passed in the file object) under the given project and
version""" | [
"def",
"put",
"(",
"eggfile",
",",
"project",
",",
"version",
")",
":"
] | https://github.com/scrapy/scrapyd/blob/9fae00bb76813359af6d709a343df0f46f529eda/scrapyd/interfaces.py#L6-L8 | ||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/arrow/locales.py | python | EsperantoLocale._ordinal_number | (self, n: int) | return f"{n}a" | [] | def _ordinal_number(self, n: int) -> str:
return f"{n}a" | [
"def",
"_ordinal_number",
"(",
"self",
",",
"n",
":",
"int",
")",
"->",
"str",
":",
"return",
"f\"{n}a\""
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/arrow/locales.py#L3832-L3833 | |||
Netflix/repokid | 376aa82ed31fe66ac4b1aecc3c22b0fc4fcfc0ea | repokid/plugin.py | python | Singleton.__call__ | (cls, *args: Any, **kwargs: Any) | return cls._instances[cls.__name__] | [] | def __call__(cls, *args: Any, **kwargs: Any) -> Singleton:
if cls.__name__ not in cls._instances:
cls._instances[cls.__name__] = super(Singleton, cls).__call__(
*args, **kwargs
)
return cls._instances[cls.__name__] | [
"def",
"__call__",
"(",
"cls",
",",
"*",
"args",
":",
"Any",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Singleton",
":",
"if",
"cls",
".",
"__name__",
"not",
"in",
"cls",
".",
"_instances",
":",
"cls",
".",
"_instances",
"[",
"cls",
".",
"_... | https://github.com/Netflix/repokid/blob/376aa82ed31fe66ac4b1aecc3c22b0fc4fcfc0ea/repokid/plugin.py#L42-L47 | |||
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | source/openerp/tools/graph.py | python | graph.process | (self, starting_node) | Process the graph to find ranks and order of the nodes
@param starting_node node from where to start the graph search | Process the graph to find ranks and order of the nodes | [
"Process",
"the",
"graph",
"to",
"find",
"ranks",
"and",
"order",
"of",
"the",
"nodes"
] | def process(self, starting_node):
"""Process the graph to find ranks and order of the nodes
@param starting_node node from where to start the graph search
"""
self.start_nodes = starting_node or []
self.partial_order = {}
self.links = []
self.tree_list = {}
... | [
"def",
"process",
"(",
"self",
",",
"starting_node",
")",
":",
"self",
".",
"start_nodes",
"=",
"starting_node",
"or",
"[",
"]",
"self",
".",
"partial_order",
"=",
"{",
"}",
"self",
".",
"links",
"=",
"[",
"]",
"self",
".",
"tree_list",
"=",
"{",
"}"... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/source/openerp/tools/graph.py#L660-L696 | ||
Cadene/tensorflow-model-zoo.torch | 990b10ffc22d4c8eacb2a502f20415b4f70c74c2 | models/research/object_detection/utils/ops.py | python | position_sensitive_crop_regions | (image,
boxes,
box_ind,
crop_size,
num_spatial_bins,
global_pool,
extrapolation_value=None) | return position_sensitive_features | Position-sensitive crop and pool rectangular regions from a feature grid.
The output crops are split into `spatial_bins_y` vertical bins
and `spatial_bins_x` horizontal bins. For each intersection of a vertical
and a horizontal bin the output values are gathered by performing
`tf.image.crop_and_resize` (biline... | Position-sensitive crop and pool rectangular regions from a feature grid. | [
"Position",
"-",
"sensitive",
"crop",
"and",
"pool",
"rectangular",
"regions",
"from",
"a",
"feature",
"grid",
"."
] | def position_sensitive_crop_regions(image,
boxes,
box_ind,
crop_size,
num_spatial_bins,
global_pool,
ext... | [
"def",
"position_sensitive_crop_regions",
"(",
"image",
",",
"boxes",
",",
"box_ind",
",",
"crop_size",
",",
"num_spatial_bins",
",",
"global_pool",
",",
"extrapolation_value",
"=",
"None",
")",
":",
"total_bins",
"=",
"1",
"bin_crop_size",
"=",
"[",
"]",
"for",... | https://github.com/Cadene/tensorflow-model-zoo.torch/blob/990b10ffc22d4c8eacb2a502f20415b4f70c74c2/models/research/object_detection/utils/ops.py#L506-L653 | |
sr-gi/bitcoin_tools | 0f6ea45b6368200e481982982822f0416e0c438d | bitcoin_tools/core/script.py | python | OutputScript.P2PKH | (cls, data, network='test', hash160=False) | Pay-to-PubKeyHash template 'constructor'. Builds a P2PKH OutputScript from a given Bitcoin address / hash160
of a Bitcoin address and network.
:param data: Bitcoin address or hash160 of a Bitcoin address to which the transaction output will be locked to.
:type data: hex str
:param netwo... | Pay-to-PubKeyHash template 'constructor'. Builds a P2PKH OutputScript from a given Bitcoin address / hash160
of a Bitcoin address and network. | [
"Pay",
"-",
"to",
"-",
"PubKeyHash",
"template",
"constructor",
".",
"Builds",
"a",
"P2PKH",
"OutputScript",
"from",
"a",
"given",
"Bitcoin",
"address",
"/",
"hash160",
"of",
"a",
"Bitcoin",
"address",
"and",
"network",
"."
] | def P2PKH(cls, data, network='test', hash160=False):
""" Pay-to-PubKeyHash template 'constructor'. Builds a P2PKH OutputScript from a given Bitcoin address / hash160
of a Bitcoin address and network.
:param data: Bitcoin address or hash160 of a Bitcoin address to which the transaction output wi... | [
"def",
"P2PKH",
"(",
"cls",
",",
"data",
",",
"network",
"=",
"'test'",
",",
"hash160",
"=",
"False",
")",
":",
"if",
"network",
"in",
"[",
"'testnet'",
",",
"'test'",
",",
"'mainnet'",
",",
"'main'",
"]",
":",
"script",
"=",
"cls",
"(",
")",
"if",... | https://github.com/sr-gi/bitcoin_tools/blob/0f6ea45b6368200e481982982822f0416e0c438d/bitcoin_tools/core/script.py#L239-L264 | ||
zeffii/mesh_tiny_cad | 7ae38b9713c1c155c89ac5bca791d9a553449e6d | cad_module.py | python | find_intersecting_edges | (bm, pt, idx1, idx2) | return [idx for edge, idx in zip(edges, idxs) if point_on_edge(pt, edge)] | > pt: Vector
> idx1, ix2: edge indices
< returns the list of edge indices where pt is on those edges | > pt: Vector
> idx1, ix2: edge indices
< returns the list of edge indices where pt is on those edges | [
">",
"pt",
":",
"Vector",
">",
"idx1",
"ix2",
":",
"edge",
"indices",
"<",
"returns",
"the",
"list",
"of",
"edge",
"indices",
"where",
"pt",
"is",
"on",
"those",
"edges"
] | def find_intersecting_edges(bm, pt, idx1, idx2):
'''
> pt: Vector
> idx1, ix2: edge indices
< returns the list of edge indices where pt is on those edges
'''
if not pt:
return []
idxs = [idx1, idx2]
edges = [coords_tuple_from_edge_idx(bm, idx) for idx in idxs]
re... | [
"def",
"find_intersecting_edges",
"(",
"bm",
",",
"pt",
",",
"idx1",
",",
"idx2",
")",
":",
"if",
"not",
"pt",
":",
"return",
"[",
"]",
"idxs",
"=",
"[",
"idx1",
",",
"idx2",
"]",
"edges",
"=",
"[",
"coords_tuple_from_edge_idx",
"(",
"bm",
",",
"idx"... | https://github.com/zeffii/mesh_tiny_cad/blob/7ae38b9713c1c155c89ac5bca791d9a553449e6d/cad_module.py#L153-L163 | |
viblo/pymunk | 77647ca037d5ceabd728f20f37d2da8a3bfb73a0 | pymunk/body.py | python | Body.velocity_at_world_point | (self, point: Tuple[float, float]) | return Vec2d(v.x, v.y) | Get the absolute velocity of the rigid body at the given world
point
It's often useful to know the absolute velocity of a point on the
surface of a body since the angular velocity affects everything
except the center of gravity. | Get the absolute velocity of the rigid body at the given world
point | [
"Get",
"the",
"absolute",
"velocity",
"of",
"the",
"rigid",
"body",
"at",
"the",
"given",
"world",
"point"
] | def velocity_at_world_point(self, point: Tuple[float, float]) -> Vec2d:
"""Get the absolute velocity of the rigid body at the given world
point
It's often useful to know the absolute velocity of a point on the
surface of a body since the angular velocity affects everything
excep... | [
"def",
"velocity_at_world_point",
"(",
"self",
",",
"point",
":",
"Tuple",
"[",
"float",
",",
"float",
"]",
")",
"->",
"Vec2d",
":",
"assert",
"len",
"(",
"point",
")",
"==",
"2",
"v",
"=",
"lib",
".",
"cpBodyGetVelocityAtWorldPoint",
"(",
"self",
".",
... | https://github.com/viblo/pymunk/blob/77647ca037d5ceabd728f20f37d2da8a3bfb73a0/pymunk/body.py#L726-L736 | |
ponty/PyVirtualDisplay | ec8ec5f7ae5503ebfa4af77a7b8048644270129b | pyvirtualdisplay/abstractdisplay.py | python | _lock_files | () | return ls | [] | def _lock_files():
tmpdir = "/tmp"
try:
ls = os.listdir(tmpdir)
except FileNotFoundError:
log.warning("missing /tmp")
return []
pattern = ".X*-lock"
names = fnmatch.filter(ls, pattern)
ls = [os.path.join(tmpdir, child) for child in names]
ls = [p for p in ls if os.pat... | [
"def",
"_lock_files",
"(",
")",
":",
"tmpdir",
"=",
"\"/tmp\"",
"try",
":",
"ls",
"=",
"os",
".",
"listdir",
"(",
"tmpdir",
")",
"except",
"FileNotFoundError",
":",
"log",
".",
"warning",
"(",
"\"missing /tmp\"",
")",
"return",
"[",
"]",
"pattern",
"=",
... | https://github.com/ponty/PyVirtualDisplay/blob/ec8ec5f7ae5503ebfa4af77a7b8048644270129b/pyvirtualdisplay/abstractdisplay.py#L43-L54 | |||
bokeh/bokeh | a00e59da76beb7b9f83613533cfd3aced1df5f06 | bokeh/settings.py | python | Settings.bokehjsdir | (self) | return bokehjsdir(self.dev) | The location of the BokehJS source tree. | The location of the BokehJS source tree. | [
"The",
"location",
"of",
"the",
"BokehJS",
"source",
"tree",
"."
] | def bokehjsdir(self) -> str:
''' The location of the BokehJS source tree.
'''
return bokehjsdir(self.dev) | [
"def",
"bokehjsdir",
"(",
"self",
")",
"->",
"str",
":",
"return",
"bokehjsdir",
"(",
"self",
".",
"dev",
")"
] | https://github.com/bokeh/bokeh/blob/a00e59da76beb7b9f83613533cfd3aced1df5f06/bokeh/settings.py#L742-L746 | |
pypa/setuptools | 9f37366aab9cd8f6baa23e6a77cfdb8daf97757e | pkg_resources/_vendor/pyparsing.py | python | ParserElement.leaveWhitespace | ( self ) | return self | Disables the skipping of whitespace before matching the characters in the
C{ParserElement}'s defined pattern. This is normally only used internally by
the pyparsing module, but may be needed in some whitespace-sensitive grammars. | Disables the skipping of whitespace before matching the characters in the
C{ParserElement}'s defined pattern. This is normally only used internally by
the pyparsing module, but may be needed in some whitespace-sensitive grammars. | [
"Disables",
"the",
"skipping",
"of",
"whitespace",
"before",
"matching",
"the",
"characters",
"in",
"the",
"C",
"{",
"ParserElement",
"}",
"s",
"defined",
"pattern",
".",
"This",
"is",
"normally",
"only",
"used",
"internally",
"by",
"the",
"pyparsing",
"module... | def leaveWhitespace( self ):
"""
Disables the skipping of whitespace before matching the characters in the
C{ParserElement}'s defined pattern. This is normally only used internally by
the pyparsing module, but may be needed in some whitespace-sensitive grammars.
"""
self... | [
"def",
"leaveWhitespace",
"(",
"self",
")",
":",
"self",
".",
"skipWhitespace",
"=",
"False",
"return",
"self"
] | https://github.com/pypa/setuptools/blob/9f37366aab9cd8f6baa23e6a77cfdb8daf97757e/pkg_resources/_vendor/pyparsing.py#L2052-L2059 | |
etetoolkit/ete | 2b207357dc2a40ccad7bfd8f54964472c72e4726 | ete3/tools/ete_build_lib/configcheck.py | python | check_type | (blocktype, attr, v) | [] | def check_type(blocktype, attr, v):
tag = (blocktype, attr)
if tag in CHECKERS:
tester, kargs, required = CHECKERS[tag]
return tester(v, **kargs)
else:
return v | [
"def",
"check_type",
"(",
"blocktype",
",",
"attr",
",",
"v",
")",
":",
"tag",
"=",
"(",
"blocktype",
",",
"attr",
")",
"if",
"tag",
"in",
"CHECKERS",
":",
"tester",
",",
"kargs",
",",
"required",
"=",
"CHECKERS",
"[",
"tag",
"]",
"return",
"tester",... | https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/tools/ete_build_lib/configcheck.py#L226-L232 | ||||
inkandswitch/livebook | 93c8d467734787366ad084fc3566bf5cbe249c51 | public/pypyjs/modules/cgi.py | python | FieldStorage.__contains__ | (self, key) | return any(item.name == key for item in self.list) | Dictionary style __contains__ method. | Dictionary style __contains__ method. | [
"Dictionary",
"style",
"__contains__",
"method",
"."
] | def __contains__(self, key):
"""Dictionary style __contains__ method."""
if self.list is None:
raise TypeError, "not indexable"
return any(item.name == key for item in self.list) | [
"def",
"__contains__",
"(",
"self",
",",
"key",
")",
":",
"if",
"self",
".",
"list",
"is",
"None",
":",
"raise",
"TypeError",
",",
"\"not indexable\"",
"return",
"any",
"(",
"item",
".",
"name",
"==",
"key",
"for",
"item",
"in",
"self",
".",
"list",
... | https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/cgi.py#L591-L595 | |
MeanEYE/Sunflower | 1024bbdde3b8e202ddad3553b321a7b6230bffc9 | sunflower/widgets/thumbnail_view.py | python | ThumbnailView.hide | (self) | Hide tooltip. | Hide tooltip. | [
"Hide",
"tooltip",
"."
] | def hide(self):
"""Hide tooltip."""
self.popover.hide() | [
"def",
"hide",
"(",
"self",
")",
":",
"self",
".",
"popover",
".",
"hide",
"(",
")"
] | https://github.com/MeanEYE/Sunflower/blob/1024bbdde3b8e202ddad3553b321a7b6230bffc9/sunflower/widgets/thumbnail_view.py#L52-L54 | ||
unknown-horizons/unknown-horizons | 7397fb333006d26c3d9fe796c7bd9cb8c3b43a49 | horizons/util/changelistener.py | python | ChangeListener._changed | (self) | Calls every listener when an object changed | Calls every listener when an object changed | [
"Calls",
"every",
"listener",
"when",
"an",
"object",
"changed"
] | def _changed(self):
"""Calls every listener when an object changed"""
self.__call_listeners(self.__listeners) | [
"def",
"_changed",
"(",
"self",
")",
":",
"self",
".",
"__call_listeners",
"(",
"self",
".",
"__listeners",
")"
] | https://github.com/unknown-horizons/unknown-horizons/blob/7397fb333006d26c3d9fe796c7bd9cb8c3b43a49/horizons/util/changelistener.py#L110-L112 | ||
Georce/lepus | 5b01bae82b5dc1df00c9e058989e2eb9b89ff333 | lepus/pymongo-2.7/pymongo/common.py | python | validate_positive_integer_or_none | (option, value) | return validate_positive_integer(option, value) | Validate that 'value' is a positive integer or None. | Validate that 'value' is a positive integer or None. | [
"Validate",
"that",
"value",
"is",
"a",
"positive",
"integer",
"or",
"None",
"."
] | def validate_positive_integer_or_none(option, value):
"""Validate that 'value' is a positive integer or None.
"""
if value is None:
return value
return validate_positive_integer(option, value) | [
"def",
"validate_positive_integer_or_none",
"(",
"option",
",",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"value",
"return",
"validate_positive_integer",
"(",
"option",
",",
"value",
")"
] | https://github.com/Georce/lepus/blob/5b01bae82b5dc1df00c9e058989e2eb9b89ff333/lepus/pymongo-2.7/pymongo/common.py#L128-L133 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/html2text.py | python | google_has_height | (style) | return False | check if the style of the element has the 'height' attribute
explicitly defined | check if the style of the element has the 'height' attribute
explicitly defined | [
"check",
"if",
"the",
"style",
"of",
"the",
"element",
"has",
"the",
"height",
"attribute",
"explicitly",
"defined"
] | def google_has_height(style):
"""check if the style of the element has the 'height' attribute
explicitly defined"""
if 'height' in style:
return True
return False | [
"def",
"google_has_height",
"(",
"style",
")",
":",
"if",
"'height'",
"in",
"style",
":",
"return",
"True",
"return",
"False"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/html2text.py#L159-L164 | |
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/fate_arch/federation/rabbitmq/_mq_channel.py | python | MQChannel.basic_ack | (self, delivery_tag) | return self._channel.basic_ack(delivery_tag=delivery_tag) | [] | def basic_ack(self, delivery_tag):
self._get_channel()
return self._channel.basic_ack(delivery_tag=delivery_tag) | [
"def",
"basic_ack",
"(",
"self",
",",
"delivery_tag",
")",
":",
"self",
".",
"_get_channel",
"(",
")",
"return",
"self",
".",
"_channel",
".",
"basic_ack",
"(",
"delivery_tag",
"=",
"delivery_tag",
")"
] | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/fate_arch/federation/rabbitmq/_mq_channel.py#L79-L81 | |||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-windows/x86/PIL/ImageFilter.py | python | MaxFilter.__init__ | (self, size=3) | [] | def __init__(self, size=3):
self.size = size
self.rank = size * size - 1 | [
"def",
"__init__",
"(",
"self",
",",
"size",
"=",
"3",
")",
":",
"self",
".",
"size",
"=",
"size",
"self",
".",
"rank",
"=",
"size",
"*",
"size",
"-",
"1"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/PIL/ImageFilter.py#L133-L135 | ||||
tableau/document-api-python | 5ddf93f35f4b20765b30279cb3dd5b9a7eee9a36 | tableaudocumentapi/field.py | python | Field.from_column_xml | (cls, xmldata) | return cls(column_xml=xmldata) | [] | def from_column_xml(cls, xmldata):
return cls(column_xml=xmldata) | [
"def",
"from_column_xml",
"(",
"cls",
",",
"xmldata",
")",
":",
"return",
"cls",
"(",
"column_xml",
"=",
"xmldata",
")"
] | https://github.com/tableau/document-api-python/blob/5ddf93f35f4b20765b30279cb3dd5b9a7eee9a36/tableaudocumentapi/field.py#L95-L96 | |||
pik-copan/pyunicorn | b18316fc08ef34b434a1a4d69dfe3e57e24435ee | pyunicorn/core/network.py | python | Network.sp_Aplus | (self) | return self.sp_A + sp.identity(self.N, dtype=self.sp_dtype) | A^+ = A + Id. matrix used in n.s.i. measures | A^+ = A + Id. matrix used in n.s.i. measures | [
"A^",
"+",
"=",
"A",
"+",
"Id",
".",
"matrix",
"used",
"in",
"n",
".",
"s",
".",
"i",
".",
"measures"
] | def sp_Aplus(self):
"""A^+ = A + Id. matrix used in n.s.i. measures"""
return self.sp_A + sp.identity(self.N, dtype=self.sp_dtype) | [
"def",
"sp_Aplus",
"(",
"self",
")",
":",
"return",
"self",
".",
"sp_A",
"+",
"sp",
".",
"identity",
"(",
"self",
".",
"N",
",",
"dtype",
"=",
"self",
".",
"sp_dtype",
")"
] | https://github.com/pik-copan/pyunicorn/blob/b18316fc08ef34b434a1a4d69dfe3e57e24435ee/pyunicorn/core/network.py#L534-L536 | |
bendmorris/static-python | 2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473 | Lib/distutils/spawn.py | python | _nt_quote_args | (args) | return args | Quote command-line arguments for DOS/Windows conventions.
Just wraps every argument which contains blanks in double quotes, and
returns a new argument list. | Quote command-line arguments for DOS/Windows conventions. | [
"Quote",
"command",
"-",
"line",
"arguments",
"for",
"DOS",
"/",
"Windows",
"conventions",
"."
] | def _nt_quote_args(args):
"""Quote command-line arguments for DOS/Windows conventions.
Just wraps every argument which contains blanks in double quotes, and
returns a new argument list.
"""
# XXX this doesn't seem very robust to me -- but if the Windows guys
# say it'll work, I guess I'll have ... | [
"def",
"_nt_quote_args",
"(",
"args",
")",
":",
"# XXX this doesn't seem very robust to me -- but if the Windows guys",
"# say it'll work, I guess I'll have to accept it. (What if an arg",
"# contains quotes? What other magic characters, other than spaces,",
"# have to be escaped? Is there an e... | https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/distutils/spawn.py#L39-L53 | |
Yelp/data_pipeline | e143a4031b0940e17b22cdf36db0b677b46e3975 | data_pipeline/registrar.py | python | Registrar.start | (self) | Start periodically sending registration messages after threshold amount of time | Start periodically sending registration messages after threshold amount of time | [
"Start",
"periodically",
"sending",
"registration",
"messages",
"after",
"threshold",
"amount",
"of",
"time"
] | def start(self):
"""Start periodically sending registration messages after threshold amount of time"""
if not self.send_messages:
self.send_messages = True
self.current_thread = threading.Timer(self.threshold, self._wake)
self.current_thread.start() | [
"def",
"start",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"send_messages",
":",
"self",
".",
"send_messages",
"=",
"True",
"self",
".",
"current_thread",
"=",
"threading",
".",
"Timer",
"(",
"self",
".",
"threshold",
",",
"self",
".",
"_wake",
"... | https://github.com/Yelp/data_pipeline/blob/e143a4031b0940e17b22cdf36db0b677b46e3975/data_pipeline/registrar.py#L162-L167 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_version.py | python | OpenShiftCLI._process | (self, template_name, create=False, params=None, template_data=None) | return self.openshift_cmd(['create', '-f', fname]) | process a template
template_name: the name of the template to process
create: whether to send to oc create after processing
params: the parameters for the template
template_data: the incoming template's data; instead of a file | process a template | [
"process",
"a",
"template"
] | def _process(self, template_name, create=False, params=None, template_data=None): # noqa: E501
'''process a template
template_name: the name of the template to process
create: whether to send to oc create after processing
params: the parameters for the template
temp... | [
"def",
"_process",
"(",
"self",
",",
"template_name",
",",
"create",
"=",
"False",
",",
"params",
"=",
"None",
",",
"template_data",
"=",
"None",
")",
":",
"# noqa: E501",
"cmd",
"=",
"[",
"'process'",
"]",
"if",
"template_data",
":",
"cmd",
".",
"extend... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_version.py#L927-L956 | |
pbugnion/gmaps | 9f37193e6daf6b7020481d15f7461a76cb3fc14e | gmaps/figure.py | python | FigureLayout._default_height | (self) | return '420px' | [] | def _default_height(self):
return '420px' | [
"def",
"_default_height",
"(",
"self",
")",
":",
"return",
"'420px'"
] | https://github.com/pbugnion/gmaps/blob/9f37193e6daf6b7020481d15f7461a76cb3fc14e/gmaps/figure.py#L23-L24 | |||
linhaow/TextClassify | aa479ae0941c008602631c50124d8c07d159bfb1 | pytorch_transformers/tokenization_bert.py | python | BasicTokenizer._run_split_on_punc | (self, text, never_split=None) | return ["".join(x) for x in output] | Splits punctuation on a piece of text. | Splits punctuation on a piece of text. | [
"Splits",
"punctuation",
"on",
"a",
"piece",
"of",
"text",
"."
] | def _run_split_on_punc(self, text, never_split=None):
"""Splits punctuation on a piece of text."""
if never_split is not None and text in never_split:
return [text]
chars = list(text)
i = 0
start_new_word = True
output = []
while i < len(chars):
... | [
"def",
"_run_split_on_punc",
"(",
"self",
",",
"text",
",",
"never_split",
"=",
"None",
")",
":",
"if",
"never_split",
"is",
"not",
"None",
"and",
"text",
"in",
"never_split",
":",
"return",
"[",
"text",
"]",
"chars",
"=",
"list",
"(",
"text",
")",
"i"... | https://github.com/linhaow/TextClassify/blob/aa479ae0941c008602631c50124d8c07d159bfb1/pytorch_transformers/tokenization_bert.py#L286-L306 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/IPython/lib/demo.py | python | Demo.show | (self,index=None) | Show a single block on screen | Show a single block on screen | [
"Show",
"a",
"single",
"block",
"on",
"screen"
] | def show(self,index=None):
"""Show a single block on screen"""
index = self._get_index(index)
if index is None:
return
print(self.marquee('<%s> block # %s (%s remaining)' %
(self.title,index,self.nblocks-index-1)))
print(self.src_blocks_co... | [
"def",
"show",
"(",
"self",
",",
"index",
"=",
"None",
")",
":",
"index",
"=",
"self",
".",
"_get_index",
"(",
"index",
")",
"if",
"index",
"is",
"None",
":",
"return",
"print",
"(",
"self",
".",
"marquee",
"(",
"'<%s> block # %s (%s remaining)'",
"%",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/IPython/lib/demo.py#L416-L426 | ||
matrix1001/heapinspect | 1b2f31c99357da8b8db7b4d0a99328b24e45adb1 | heapinspect/proc.py | python | Proc.path | (self) | return os.path.realpath("/proc/{}/exe".format(self.pid)) | str: The path to the binary of the process. | str: The path to the binary of the process. | [
"str",
":",
"The",
"path",
"to",
"the",
"binary",
"of",
"the",
"process",
"."
] | def path(self):
'''str: The path to the binary of the process.
'''
return os.path.realpath("/proc/{}/exe".format(self.pid)) | [
"def",
"path",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"realpath",
"(",
"\"/proc/{}/exe\"",
".",
"format",
"(",
"self",
".",
"pid",
")",
")"
] | https://github.com/matrix1001/heapinspect/blob/1b2f31c99357da8b8db7b4d0a99328b24e45adb1/heapinspect/proc.py#L104-L107 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py | python | SQLCompiler.visit_istrue_unary_operator | (self, element, operator, **kw) | [] | def visit_istrue_unary_operator(self, element, operator, **kw):
if self.dialect.supports_native_boolean:
return self.process(element.element, **kw)
else:
return "%s = 1" % self.process(element.element, **kw) | [
"def",
"visit_istrue_unary_operator",
"(",
"self",
",",
"element",
",",
"operator",
",",
"*",
"*",
"kw",
")",
":",
"if",
"self",
".",
"dialect",
".",
"supports_native_boolean",
":",
"return",
"self",
".",
"process",
"(",
"element",
".",
"element",
",",
"*"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py#L1021-L1025 | ||||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/plat-mac/FrameWork.py | python | Window.do_update | (self, window, event) | [] | def do_update(self, window, event):
if DEBUG:
import time
for i in range(8):
time.sleep(0.1)
InvertRgn(window.GetWindowPort().visRgn)
FillRgn(window.GetWindowPort().visRgn, GetQDGlobalsGray())
else:
EraseRgn(window.GetWindow... | [
"def",
"do_update",
"(",
"self",
",",
"window",
",",
"event",
")",
":",
"if",
"DEBUG",
":",
"import",
"time",
"for",
"i",
"in",
"range",
"(",
"8",
")",
":",
"time",
".",
"sleep",
"(",
"0.1",
")",
"InvertRgn",
"(",
"window",
".",
"GetWindowPort",
"(... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/plat-mac/FrameWork.py#L852-L860 | ||||
mne-tools/mne-python | f90b303ce66a8415e64edd4605b09ac0179c1ebf | mne/source_estimate.py | python | _BaseVolSourceEstimate.as_volume | (self, src, dest='mri', mri_resolution=False,
format='nifti1') | return _interpolate_data(data, src, mri_resolution=mri_resolution,
mri_space=True, output=format) | Export volume source estimate as a nifti object.
Parameters
----------
src : instance of SourceSpaces
The source spaces (should all be of type volume, or part of a
mixed source space).
dest : 'mri' | 'surf'
If 'mri' the volume is defined in the coordi... | Export volume source estimate as a nifti object. | [
"Export",
"volume",
"source",
"estimate",
"as",
"a",
"nifti",
"object",
"."
] | def as_volume(self, src, dest='mri', mri_resolution=False,
format='nifti1'):
"""Export volume source estimate as a nifti object.
Parameters
----------
src : instance of SourceSpaces
The source spaces (should all be of type volume, or part of a
m... | [
"def",
"as_volume",
"(",
"self",
",",
"src",
",",
"dest",
"=",
"'mri'",
",",
"mri_resolution",
"=",
"False",
",",
"format",
"=",
"'nifti1'",
")",
":",
"from",
".",
"morph",
"import",
"_interpolate_data",
"data",
"=",
"self",
".",
"magnitude",
"(",
")",
... | https://github.com/mne-tools/mne-python/blob/f90b303ce66a8415e64edd4605b09ac0179c1ebf/mne/source_estimate.py#L2104-L2137 | |
jtibaquira/nsearch | bd8205b761fac4b05e331196ce84275940cc61bc | console.py | python | Console.do_run | (self, args) | Command to run templetes | Command to run templetes | [
"Command",
"to",
"run",
"templetes"
] | def do_run(self, args):
''' Command to run templetes '''
nmap = helpernmap.HelperNmap(args)
nmap.process() | [
"def",
"do_run",
"(",
"self",
",",
"args",
")",
":",
"nmap",
"=",
"helpernmap",
".",
"HelperNmap",
"(",
"args",
")",
"nmap",
".",
"process",
"(",
")"
] | https://github.com/jtibaquira/nsearch/blob/bd8205b761fac4b05e331196ce84275940cc61bc/console.py#L234-L237 | ||
azavea/raster-vision | fc181a6f31f085affa1ee12f0204bdbc5a6bf85a | rastervision_core/rastervision/core/data/crs_transformer/crs_transformer.py | python | CRSTransformer.map_to_pixel | (self, map_point) | Transform point from map to pixel-based coordinates.
Args:
map_point: (x, y) tuple in map coordinates (eg. lon/lat). x and y can be
single values or array-like.
Returns:
(x, y) tuple in pixel coordinates | Transform point from map to pixel-based coordinates. | [
"Transform",
"point",
"from",
"map",
"to",
"pixel",
"-",
"based",
"coordinates",
"."
] | def map_to_pixel(self, map_point):
"""Transform point from map to pixel-based coordinates.
Args:
map_point: (x, y) tuple in map coordinates (eg. lon/lat). x and y can be
single values or array-like.
Returns:
(x, y) tuple in pixel coordinates
"""
... | [
"def",
"map_to_pixel",
"(",
"self",
",",
"map_point",
")",
":",
"pass"
] | https://github.com/azavea/raster-vision/blob/fc181a6f31f085affa1ee12f0204bdbc5a6bf85a/rastervision_core/rastervision/core/data/crs_transformer/crs_transformer.py#L18-L28 | ||
realpython/book2-exercises | cde325eac8e6d8cff2316601c2e5b36bb46af7d0 | py2manager/gluon/contrib/ipaddr.py | python | _BaseV4.is_unspecified | (self) | return self in IPv4Network('0.0.0.0') | Test if the address is unspecified.
Returns:
A boolean, True if this is the unspecified address as defined in
RFC 5735 3. | Test if the address is unspecified. | [
"Test",
"if",
"the",
"address",
"is",
"unspecified",
"."
] | def is_unspecified(self):
"""Test if the address is unspecified.
Returns:
A boolean, True if this is the unspecified address as defined in
RFC 5735 3.
"""
return self in IPv4Network('0.0.0.0') | [
"def",
"is_unspecified",
"(",
"self",
")",
":",
"return",
"self",
"in",
"IPv4Network",
"(",
"'0.0.0.0'",
")"
] | https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/py2manager/gluon/contrib/ipaddr.py#L1188-L1196 | |
leancloud/satori | 701caccbd4fe45765001ca60435c0cb499477c03 | satori-rules/plugin/libs/pymongo/command_cursor.py | python | CommandCursor.__enter__ | (self) | return self | [] | def __enter__(self):
return self | [
"def",
"__enter__",
"(",
"self",
")",
":",
"return",
"self"
] | https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/pymongo/command_cursor.py#L241-L242 | |||
gnome-terminator/terminator | ca335e45eb1a4ea7c22fe0d515bb270e9a0e12a1 | terminatorlib/signalman.py | python | Signalman.__init__ | (self) | Class initialiser | Class initialiser | [
"Class",
"initialiser"
] | def __init__(self):
"""Class initialiser"""
self.cnxids = {} | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"cnxids",
"=",
"{",
"}"
] | https://github.com/gnome-terminator/terminator/blob/ca335e45eb1a4ea7c22fe0d515bb270e9a0e12a1/terminatorlib/signalman.py#L12-L14 | ||
deepinsight/insightface | c0b25f998a649f662c7136eb389abcacd7900e9d | python-package/insightface/thirdparty/face3d/mesh/transform.py | python | matrix2angle | (R) | return rx, ry, rz | get three Euler angles from Rotation Matrix
Args:
R: (3,3). rotation matrix
Returns:
x: pitch
y: yaw
z: roll | get three Euler angles from Rotation Matrix
Args:
R: (3,3). rotation matrix
Returns:
x: pitch
y: yaw
z: roll | [
"get",
"three",
"Euler",
"angles",
"from",
"Rotation",
"Matrix",
"Args",
":",
"R",
":",
"(",
"3",
"3",
")",
".",
"rotation",
"matrix",
"Returns",
":",
"x",
":",
"pitch",
"y",
":",
"yaw",
"z",
":",
"roll"
] | def matrix2angle(R):
''' get three Euler angles from Rotation Matrix
Args:
R: (3,3). rotation matrix
Returns:
x: pitch
y: yaw
z: roll
'''
assert(isRotationMatrix)
sy = math.sqrt(R[0,0] * R[0,0] + R[1,0] * R[1,0])
singular = sy < 1e-6
if not singu... | [
"def",
"matrix2angle",
"(",
"R",
")",
":",
"assert",
"(",
"isRotationMatrix",
")",
"sy",
"=",
"math",
".",
"sqrt",
"(",
"R",
"[",
"0",
",",
"0",
"]",
"*",
"R",
"[",
"0",
",",
"0",
"]",
"+",
"R",
"[",
"1",
",",
"0",
"]",
"*",
"R",
"[",
"1"... | https://github.com/deepinsight/insightface/blob/c0b25f998a649f662c7136eb389abcacd7900e9d/python-package/insightface/thirdparty/face3d/mesh/transform.py#L331-L356 | |
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/site-packages/pkg_resources/__init__.py | python | Distribution._filter_extras | (dm) | return dm | Given a mapping of extras to dependencies, strip off
environment markers and filter out any dependencies
not matching the markers. | Given a mapping of extras to dependencies, strip off
environment markers and filter out any dependencies
not matching the markers. | [
"Given",
"a",
"mapping",
"of",
"extras",
"to",
"dependencies",
"strip",
"off",
"environment",
"markers",
"and",
"filter",
"out",
"any",
"dependencies",
"not",
"matching",
"the",
"markers",
"."
] | def _filter_extras(dm):
"""
Given a mapping of extras to dependencies, strip off
environment markers and filter out any dependencies
not matching the markers.
"""
for extra in list(filter(None, dm)):
new_extra = extra
reqs = dm.pop(extra)
... | [
"def",
"_filter_extras",
"(",
"dm",
")",
":",
"for",
"extra",
"in",
"list",
"(",
"filter",
"(",
"None",
",",
"dm",
")",
")",
":",
"new_extra",
"=",
"extra",
"reqs",
"=",
"dm",
".",
"pop",
"(",
"extra",
")",
"new_extra",
",",
"_",
",",
"marker",
"... | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/site-packages/pkg_resources/__init__.py#L2706-L2725 | |
ClusterLabs/pcs | 1f225199e02c8d20456bb386f4c913c3ff21ac78 | pcs/stonith.py | python | _print_per_node_option | (config_list, config_option) | Commandline options: no options | Commandline options: no options | [
"Commandline",
"options",
":",
"no",
"options"
] | def _print_per_node_option(config_list, config_option):
"""
Commandline options: no options
"""
unknown_value = "<unknown>"
for config in config_list:
value = unknown_value
if config["config"] is not None:
value = config["config"].get(config_option, unknown_value)
... | [
"def",
"_print_per_node_option",
"(",
"config_list",
",",
"config_option",
")",
":",
"unknown_value",
"=",
"\"<unknown>\"",
"for",
"config",
"in",
"config_list",
":",
"value",
"=",
"unknown_value",
"if",
"config",
"[",
"\"config\"",
"]",
"is",
"not",
"None",
":"... | https://github.com/ClusterLabs/pcs/blob/1f225199e02c8d20456bb386f4c913c3ff21ac78/pcs/stonith.py#L747-L756 | ||
bayespy/bayespy | 0e6e6130c888a4295cc9421d61d4ad27b2960ebb | bayespy/inference/vmp/transformations.py | python | RotateVaryingMarkovChain._computations_for_A_and_X | (self, XpXn, XpXp) | return (A_XpXn, A_XpXp_A, CovA_XpXp) | [] | def _computations_for_A_and_X(self, XpXn, XpXp):
# Get moments of B and S
(B, BB) = self.B_node.get_moments()
CovB = BB - B[...,:,:,None,None]*B[...,None,None,:,:]
u_S = self.S_node.get_moments()
S = u_S[0]
SS = u_S[1]
#
# Expectations with resp... | [
"def",
"_computations_for_A_and_X",
"(",
"self",
",",
"XpXn",
",",
"XpXp",
")",
":",
"# Get moments of B and S",
"(",
"B",
",",
"BB",
")",
"=",
"self",
".",
"B_node",
".",
"get_moments",
"(",
")",
"CovB",
"=",
"BB",
"-",
"B",
"[",
"...",
",",
":",
",... | https://github.com/bayespy/bayespy/blob/0e6e6130c888a4295cc9421d61d4ad27b2960ebb/bayespy/inference/vmp/transformations.py#L1489-L1541 | |||
frappe/frappe | b64cab6867dfd860f10ccaf41a4ec04bc890b583 | frappe/data_migration/doctype/data_migration_run/data_migration_run.py | python | DataMigrationRun._push_insert | (self) | Inserts new local docs on remote | Inserts new local docs on remote | [
"Inserts",
"new",
"local",
"docs",
"on",
"remote"
] | def _push_insert(self):
'''Inserts new local docs on remote'''
mapping = self.get_mapping(self.current_mapping)
connection = self.get_connection()
data = self.get_new_local_data()
for d in data:
# pre process before insert
doc = self.pre_process_doc(d)
doc = mapping.get_mapped_record(doc)
try:
... | [
"def",
"_push_insert",
"(",
"self",
")",
":",
"mapping",
"=",
"self",
".",
"get_mapping",
"(",
"self",
".",
"current_mapping",
")",
"connection",
"=",
"self",
".",
"get_connection",
"(",
")",
"data",
"=",
"self",
".",
"get_new_local_data",
"(",
")",
"for",... | https://github.com/frappe/frappe/blob/b64cab6867dfd860f10ccaf41a4ec04bc890b583/frappe/data_migration/doctype/data_migration_run/data_migration_run.py#L290-L324 | ||
miguelgrinberg/python-socketio | 4ee3649514b98c50cc0bf70d3f269389da52772d | src/socketio/exceptions.py | python | ConnectionRefusedError.__init__ | (self, *args) | [] | def __init__(self, *args):
if len(args) == 0:
self.error_args = {'message': 'Connection rejected by server'}
elif len(args) == 1:
self.error_args = {'message': str(args[0])}
else:
self.error_args = {'message': str(args[0])}
if len(args) == 2:
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"self",
".",
"error_args",
"=",
"{",
"'message'",
":",
"'Connection rejected by server'",
"}",
"elif",
"len",
"(",
"args",
")",
"==",
"1",
":",... | https://github.com/miguelgrinberg/python-socketio/blob/4ee3649514b98c50cc0bf70d3f269389da52772d/src/socketio/exceptions.py#L16-L26 | ||||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | lib-python/2.7/SimpleXMLRPCServer.py | python | SimpleXMLRPCDispatcher._marshaled_dispatch | (self, data, dispatch_method = None, path = None) | return response | Dispatches an XML-RPC method from marshalled (XML) data.
XML-RPC methods are dispatched from the marshalled (XML) data
using the _dispatch method and the result is returned as
marshalled data. For backwards compatibility, a dispatch
function can be provided as an argument (see comment i... | Dispatches an XML-RPC method from marshalled (XML) data. | [
"Dispatches",
"an",
"XML",
"-",
"RPC",
"method",
"from",
"marshalled",
"(",
"XML",
")",
"data",
"."
] | def _marshaled_dispatch(self, data, dispatch_method = None, path = None):
"""Dispatches an XML-RPC method from marshalled (XML) data.
XML-RPC methods are dispatched from the marshalled (XML) data
using the _dispatch method and the result is returned as
marshalled data. For backwards com... | [
"def",
"_marshaled_dispatch",
"(",
"self",
",",
"data",
",",
"dispatch_method",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"try",
":",
"params",
",",
"method",
"=",
"xmlrpclib",
".",
"loads",
"(",
"data",
")",
"# generate response",
"if",
"dispatch_m... | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/SimpleXMLRPCServer.py#L241-L276 | |
lovelylain/pyctp | fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d | futures2/ctp/__init__.py | python | TraderApi.OnRspQrySecAgentACIDMap | (self, pSecAgentACIDMap, pRspInfo, nRequestID, bIsLast) | 请求查询二级代理操作员银期权限响应 | 请求查询二级代理操作员银期权限响应 | [
"请求查询二级代理操作员银期权限响应"
] | def OnRspQrySecAgentACIDMap(self, pSecAgentACIDMap, pRspInfo, nRequestID, bIsLast):
"""请求查询二级代理操作员银期权限响应""" | [
"def",
"OnRspQrySecAgentACIDMap",
"(",
"self",
",",
"pSecAgentACIDMap",
",",
"pRspInfo",
",",
"nRequestID",
",",
"bIsLast",
")",
":"
] | https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/futures2/ctp/__init__.py#L647-L648 | ||
gkrizek/bash-lambda-layer | 703b0ade8174022d44779d823172ab7ac33a5505 | bin/docutils/writers/manpage.py | python | Translator.comment_begin | (self, text) | return out_text | Return commented version of the passed text WITHOUT end of
line/comment. | Return commented version of the passed text WITHOUT end of
line/comment. | [
"Return",
"commented",
"version",
"of",
"the",
"passed",
"text",
"WITHOUT",
"end",
"of",
"line",
"/",
"comment",
"."
] | def comment_begin(self, text):
"""Return commented version of the passed text WITHOUT end of
line/comment."""
prefix = '.\\" '
out_text = ''.join(
[(prefix + in_line + '\n')
for in_line in text.split('\n')])
return out_text | [
"def",
"comment_begin",
"(",
"self",
",",
"text",
")",
":",
"prefix",
"=",
"'.\\\\\" '",
"out_text",
"=",
"''",
".",
"join",
"(",
"[",
"(",
"prefix",
"+",
"in_line",
"+",
"'\\n'",
")",
"for",
"in_line",
"in",
"text",
".",
"split",
"(",
"'\\n'",
")",
... | https://github.com/gkrizek/bash-lambda-layer/blob/703b0ade8174022d44779d823172ab7ac33a5505/bin/docutils/writers/manpage.py#L234-L241 | |
pazz/alot | 52f11f089df19cf336ad0983368e880dc5364149 | alot/utils/configobj.py | python | width_tuple | (value) | return res | test if value is a valid width indicator (for a sub-widget in a column).
This can either be
('fit', min, max): use the length actually needed for the content, padded
to use at least width min, and cut of at width max.
Here, min and max are positive integers or 0 to ... | test if value is a valid width indicator (for a sub-widget in a column).
This can either be
('fit', min, max): use the length actually needed for the content, padded
to use at least width min, and cut of at width max.
Here, min and max are positive integers or 0 to ... | [
"test",
"if",
"value",
"is",
"a",
"valid",
"width",
"indicator",
"(",
"for",
"a",
"sub",
"-",
"widget",
"in",
"a",
"column",
")",
".",
"This",
"can",
"either",
"be",
"(",
"fit",
"min",
"max",
")",
":",
"use",
"the",
"length",
"actually",
"needed",
... | def width_tuple(value):
"""
test if value is a valid width indicator (for a sub-widget in a column).
This can either be
('fit', min, max): use the length actually needed for the content, padded
to use at least width min, and cut of at width max.
Here, min an... | [
"def",
"width_tuple",
"(",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"res",
"=",
"'fit'",
",",
"0",
",",
"0",
"elif",
"not",
"isinstance",
"(",
"value",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"raise",
"VdtTypeError",
"(",
"value"... | https://github.com/pazz/alot/blob/52f11f089df19cf336ad0983368e880dc5364149/alot/utils/configobj.py#L62-L87 | |
aws/serverless-application-model | ab6943a340a3f489af62b8c70c1366242b2887fe | samtranslator/yaml_helper.py | python | yaml_parse | (yamlstr) | return yaml.safe_load(yamlstr) | Parse a yaml string | Parse a yaml string | [
"Parse",
"a",
"yaml",
"string"
] | def yaml_parse(yamlstr):
"""Parse a yaml string"""
yaml.SafeLoader.add_multi_constructor("!", intrinsics_multi_constructor)
return yaml.safe_load(yamlstr) | [
"def",
"yaml_parse",
"(",
"yamlstr",
")",
":",
"yaml",
".",
"SafeLoader",
".",
"add_multi_constructor",
"(",
"\"!\"",
",",
"intrinsics_multi_constructor",
")",
"return",
"yaml",
".",
"safe_load",
"(",
"yamlstr",
")"
] | https://github.com/aws/serverless-application-model/blob/ab6943a340a3f489af62b8c70c1366242b2887fe/samtranslator/yaml_helper.py#L9-L12 | |
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/plugins/attack/db/sqlmap/thirdparty/xdot/xdot.py | python | DotWindow.__init__ | (self, widget=None) | [] | def __init__(self, widget=None):
gtk.Window.__init__(self)
self.graph = Graph()
window = self
window.set_title(self.base_title)
window.set_default_size(512, 512)
vbox = gtk.VBox()
window.add(vbox)
self.widget = widget or DotWidget()
# Create a... | [
"def",
"__init__",
"(",
"self",
",",
"widget",
"=",
"None",
")",
":",
"gtk",
".",
"Window",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"graph",
"=",
"Graph",
"(",
")",
"window",
"=",
"self",
"window",
".",
"set_title",
"(",
"self",
".",
"base_... | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/db/sqlmap/thirdparty/xdot/xdot.py#L1907-L1973 | ||||
espnet/espnet | ea411f3f627b8f101c211e107d0ff7053344ac80 | espnet/nets/asr_interface.py | python | ASRInterface.calculate_all_attentions | (self, xs, ilens, ys) | Calculate attention.
:param list xs: list of padded input sequences [(T1, idim), (T2, idim), ...]
:param ndarray ilens: batch of lengths of input sequences (B)
:param list ys: list of character id sequence tensor [(L1), (L2), (L3), ...]
:return: attention weights (B, Lmax, Tmax)
... | Calculate attention. | [
"Calculate",
"attention",
"."
] | def calculate_all_attentions(self, xs, ilens, ys):
"""Calculate attention.
:param list xs: list of padded input sequences [(T1, idim), (T2, idim), ...]
:param ndarray ilens: batch of lengths of input sequences (B)
:param list ys: list of character id sequence tensor [(L1), (L2), (L3), .... | [
"def",
"calculate_all_attentions",
"(",
"self",
",",
"xs",
",",
"ilens",
",",
"ys",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"calculate_all_attentions method is not implemented\"",
")"
] | https://github.com/espnet/espnet/blob/ea411f3f627b8f101c211e107d0ff7053344ac80/espnet/nets/asr_interface.py#L79-L88 | ||
PaddlePaddle/ERNIE | 15eddb022ce1beb281777e9ab8807a1bdfa7a76e | propeller/data/feature_column.py | python | Column.__init__ | (self, name) | doc | doc | [
"doc"
] | def __init__(self, name):
"""doc"""
pass | [
"def",
"__init__",
"(",
"self",
",",
"name",
")",
":",
"pass"
] | https://github.com/PaddlePaddle/ERNIE/blob/15eddb022ce1beb281777e9ab8807a1bdfa7a76e/propeller/data/feature_column.py#L55-L57 | ||
statsmodels/statsmodels | debbe7ea6ba28fe5bdb78f09f8cac694bef98722 | statsmodels/stats/robust_compare.py | python | TrimmedMean.ttest_mean | (self, value=0, transform='trimmed',
alternative='two-sided') | return res + (df,) | One sample ttest for trimmed or Winsorized mean
Parameters
----------
value : float
Value of the mean under the Null hypothesis
transform : {'trimmed', 'winsorized'}
Specified whether the mean test is based on trimmed or winsorized
data.
alter... | One sample ttest for trimmed or Winsorized mean | [
"One",
"sample",
"ttest",
"for",
"trimmed",
"or",
"Winsorized",
"mean"
] | def ttest_mean(self, value=0, transform='trimmed',
alternative='two-sided'):
"""
One sample ttest for trimmed or Winsorized mean
Parameters
----------
value : float
Value of the mean under the Null hypothesis
transform : {'trimmed', 'winsor... | [
"def",
"ttest_mean",
"(",
"self",
",",
"value",
"=",
"0",
",",
"transform",
"=",
"'trimmed'",
",",
"alternative",
"=",
"'two-sided'",
")",
":",
"import",
"statsmodels",
".",
"stats",
".",
"weightstats",
"as",
"smws",
"df",
"=",
"self",
".",
"nobs_reduced",... | https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/stats/robust_compare.py#L189-L223 | |
open-mmlab/mmpose | 0376d51efdd93b3c8f3338211130753fed808bb9 | mmpose/datasets/datasets/base/kpt_2d_sview_rgb_img_bottom_up_dataset.py | python | Kpt2dSviewRgbImgBottomUpDataset._get_mapping_id_name | (imgs) | return id2name, name2id | Args:
imgs (dict): dict of image info.
Returns:
tuple: Image name & id mapping dicts.
- id2name (dict): Mapping image id to name.
- name2id (dict): Mapping image name to id. | Args:
imgs (dict): dict of image info. | [
"Args",
":",
"imgs",
"(",
"dict",
")",
":",
"dict",
"of",
"image",
"info",
"."
] | def _get_mapping_id_name(imgs):
"""
Args:
imgs (dict): dict of image info.
Returns:
tuple: Image name & id mapping dicts.
- id2name (dict): Mapping image id to name.
- name2id (dict): Mapping image name to id.
"""
id2name = {}
... | [
"def",
"_get_mapping_id_name",
"(",
"imgs",
")",
":",
"id2name",
"=",
"{",
"}",
"name2id",
"=",
"{",
"}",
"for",
"image_id",
",",
"image",
"in",
"imgs",
".",
"items",
"(",
")",
":",
"file_name",
"=",
"image",
"[",
"'file_name'",
"]",
"id2name",
"[",
... | https://github.com/open-mmlab/mmpose/blob/0376d51efdd93b3c8f3338211130753fed808bb9/mmpose/datasets/datasets/base/kpt_2d_sview_rgb_img_bottom_up_dataset.py#L115-L133 | |
rietveld-codereview/rietveld | 82e415f6a291c58c714d3869c7a1de818546c7d5 | third_party/gflags.py | python | FlagValues._FlagIsRegistered | (self, flag_obj) | return False | Checks whether a Flag object is registered under some name.
Note: this is non trivial: in addition to its normal name, a flag
may have a short name too. In self.FlagDict(), both the normal and
the short name are mapped to the same flag object. E.g., calling
only "del FLAGS.short_name" is not unregist... | Checks whether a Flag object is registered under some name. | [
"Checks",
"whether",
"a",
"Flag",
"object",
"is",
"registered",
"under",
"some",
"name",
"."
] | def _FlagIsRegistered(self, flag_obj):
"""Checks whether a Flag object is registered under some name.
Note: this is non trivial: in addition to its normal name, a flag
may have a short name too. In self.FlagDict(), both the normal and
the short name are mapped to the same flag object. E.g., calling
... | [
"def",
"_FlagIsRegistered",
"(",
"self",
",",
"flag_obj",
")",
":",
"flag_dict",
"=",
"self",
".",
"FlagDict",
"(",
")",
"# Check whether flag_obj is registered under its long name.",
"name",
"=",
"flag_obj",
".",
"name",
"if",
"flag_dict",
".",
"get",
"(",
"name"... | https://github.com/rietveld-codereview/rietveld/blob/82e415f6a291c58c714d3869c7a1de818546c7d5/third_party/gflags.py#L1095-L1122 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/encodings/bz2_codec.py | python | IncrementalDecoder.reset | (self) | [] | def reset(self):
self.decompressobj = bz2.BZ2Decompressor() | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"decompressobj",
"=",
"bz2",
".",
"BZ2Decompressor",
"(",
")"
] | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/encodings/bz2_codec.py#L57-L58 | ||||
facebookresearch/SymbolicMathematics | 4596d070e1a9a1c2239c923d7d68fda577c8c007 | src/envs/char_sp.py | python | CharSPEnvironment.rewrite_sympy_expr | (self, expr) | return expr_rw | Rewrite a SymPy expression. | Rewrite a SymPy expression. | [
"Rewrite",
"a",
"SymPy",
"expression",
"."
] | def rewrite_sympy_expr(self, expr):
"""
Rewrite a SymPy expression.
"""
expr_rw = expr
for f in self.rewrite_functions:
if f == 'expand':
expr_rw = sp.expand(expr_rw)
elif f == 'factor':
expr_rw = sp.factor(expr_rw)
... | [
"def",
"rewrite_sympy_expr",
"(",
"self",
",",
"expr",
")",
":",
"expr_rw",
"=",
"expr",
"for",
"f",
"in",
"self",
".",
"rewrite_functions",
":",
"if",
"f",
"==",
"'expand'",
":",
"expr_rw",
"=",
"sp",
".",
"expand",
"(",
"expr_rw",
")",
"elif",
"f",
... | https://github.com/facebookresearch/SymbolicMathematics/blob/4596d070e1a9a1c2239c923d7d68fda577c8c007/src/envs/char_sp.py#L638-L656 | |
pudo/opensanctions | c642b4f29c7d6ce2eabb758f2020ee75ca9a8e7f | opensanctions/exporters/common.py | python | write_json | (data, fh) | Write a JSON object to the given open file handle. | Write a JSON object to the given open file handle. | [
"Write",
"a",
"JSON",
"object",
"to",
"the",
"given",
"open",
"file",
"handle",
"."
] | async def write_json(data, fh):
"""Write a JSON object to the given open file handle."""
json_data = json.dumps(data, sort_keys=True, indent=2, cls=JSONEncoder)
await fh.write(json_data) | [
"async",
"def",
"write_json",
"(",
"data",
",",
"fh",
")",
":",
"json_data",
"=",
"json",
".",
"dumps",
"(",
"data",
",",
"sort_keys",
"=",
"True",
",",
"indent",
"=",
"2",
",",
"cls",
"=",
"JSONEncoder",
")",
"await",
"fh",
".",
"write",
"(",
"jso... | https://github.com/pudo/opensanctions/blob/c642b4f29c7d6ce2eabb758f2020ee75ca9a8e7f/opensanctions/exporters/common.py#L62-L65 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.