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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
VitaliyRodnenko/geeknote | 6bc226133c0d4d2902a76d4d2ac85964aac9bae7 | geeknote/out.py | python | GetUserCredentials | () | return (login, password) | Prompts the user for a username and password. | Prompts the user for a username and password. | [
"Prompts",
"the",
"user",
"for",
"a",
"username",
"and",
"password",
"."
] | def GetUserCredentials():
"""Prompts the user for a username and password."""
try:
login = None
password = None
if login is None:
login = rawInput("Login: ")
if password is None:
password = rawInput("Password: ", True)
except (KeyboardInterrupt, Syste... | [
"def",
"GetUserCredentials",
"(",
")",
":",
"try",
":",
"login",
"=",
"None",
"password",
"=",
"None",
"if",
"login",
"is",
"None",
":",
"login",
"=",
"rawInput",
"(",
"\"Login: \"",
")",
"if",
"password",
"is",
"None",
":",
"password",
"=",
"rawInput",
... | https://github.com/VitaliyRodnenko/geeknote/blob/6bc226133c0d4d2902a76d4d2ac85964aac9bae7/geeknote/out.py#L99-L115 | |
graphbrain/graphbrain | 96cb902d9e22d8dc8c2110ff3176b9aafdeba444 | graphbrain/scripts/generate-parser-training-data.py | python | TrainingDataGenerator.__init__ | (self, lang=None, parser_class=None) | [] | def __init__(self, lang=None, parser_class=None):
self.parser = create_parser(lang=lang, parser_class=parser_class)
self.sentences = set()
self.tokens = 0
self.correct_edges = 0
self.ignored = 0
self.input_files = None
self.sentence = None
self.source =... | [
"def",
"__init__",
"(",
"self",
",",
"lang",
"=",
"None",
",",
"parser_class",
"=",
"None",
")",
":",
"self",
".",
"parser",
"=",
"create_parser",
"(",
"lang",
"=",
"lang",
",",
"parser_class",
"=",
"parser_class",
")",
"self",
".",
"sentences",
"=",
"... | https://github.com/graphbrain/graphbrain/blob/96cb902d9e22d8dc8c2110ff3176b9aafdeba444/graphbrain/scripts/generate-parser-training-data.py#L22-L36 | ||||
learningequality/ka-lite | 571918ea668013dcf022286ea85eff1c5333fb8b | kalite/packages/bundled/django/core/files/uploadhandler.py | python | FileUploadHandler.handle_raw_input | (self, input_data, META, content_length, boundary, encoding=None) | Handle the raw input from the client.
Parameters:
:input_data:
An object that supports reading via .read().
:META:
``request.META``.
:content_length:
The (integer) value of the Content-Length header from the
cl... | Handle the raw input from the client. | [
"Handle",
"the",
"raw",
"input",
"from",
"the",
"client",
"."
] | def handle_raw_input(self, input_data, META, content_length, boundary, encoding=None):
"""
Handle the raw input from the client.
Parameters:
:input_data:
An object that supports reading via .read().
:META:
``request.META``.
:c... | [
"def",
"handle_raw_input",
"(",
"self",
",",
"input_data",
",",
"META",
",",
"content_length",
",",
"boundary",
",",
"encoding",
"=",
"None",
")",
":",
"pass"
] | https://github.com/learningequality/ka-lite/blob/571918ea668013dcf022286ea85eff1c5333fb8b/kalite/packages/bundled/django/core/files/uploadhandler.py#L70-L86 | ||
TDAmeritrade/stumpy | 7c97df98cb4095afae775ab71870d4d5a14776c7 | stumpy/maamp.py | python | _get_first_maamp_profile | (
start, T_A, T_B, m, excl_zone, T_B_subseq_isfinite, include=None, discords=False
) | return P, I | Multi-dimensional wrapper to compute the non-normalized (i.e., without
z-normalization multi-dimensional matrix profile and multi-dimensional matrix
profile index for a given window within the times series or sequence that is denoted
by the `start` index. Essentially, this is a convenience wrapper around
... | Multi-dimensional wrapper to compute the non-normalized (i.e., without
z-normalization multi-dimensional matrix profile and multi-dimensional matrix
profile index for a given window within the times series or sequence that is denoted
by the `start` index. Essentially, this is a convenience wrapper around
... | [
"Multi",
"-",
"dimensional",
"wrapper",
"to",
"compute",
"the",
"non",
"-",
"normalized",
"(",
"i",
".",
"e",
".",
"without",
"z",
"-",
"normalization",
"multi",
"-",
"dimensional",
"matrix",
"profile",
"and",
"multi",
"-",
"dimensional",
"matrix",
"profile"... | def _get_first_maamp_profile(
start, T_A, T_B, m, excl_zone, T_B_subseq_isfinite, include=None, discords=False
):
"""
Multi-dimensional wrapper to compute the non-normalized (i.e., without
z-normalization multi-dimensional matrix profile and multi-dimensional matrix
profile index for a given window ... | [
"def",
"_get_first_maamp_profile",
"(",
"start",
",",
"T_A",
",",
"T_B",
",",
"m",
",",
"excl_zone",
",",
"T_B_subseq_isfinite",
",",
"include",
"=",
"None",
",",
"discords",
"=",
"False",
")",
":",
"D",
"=",
"_maamp_multi_distance_profile",
"(",
"start",
",... | https://github.com/TDAmeritrade/stumpy/blob/7c97df98cb4095afae775ab71870d4d5a14776c7/stumpy/maamp.py#L252-L325 | |
RaphielGang/Telegram-Paperplane | d9e6c466902dd573ddf8c805e9dc484f972a62f1 | userbot/modules/dbhelper.py | python | block_pm | (userid) | return True | [] | async def block_pm(userid):
if await approval(userid) is False:
return False
MONGO.pmpermit.update_one({"user_id": userid}, {"$set": {"approval": False}})
return True | [
"async",
"def",
"block_pm",
"(",
"userid",
")",
":",
"if",
"await",
"approval",
"(",
"userid",
")",
"is",
"False",
":",
"return",
"False",
"MONGO",
".",
"pmpermit",
".",
"update_one",
"(",
"{",
"\"user_id\"",
":",
"userid",
"}",
",",
"{",
"\"$set\"",
"... | https://github.com/RaphielGang/Telegram-Paperplane/blob/d9e6c466902dd573ddf8c805e9dc484f972a62f1/userbot/modules/dbhelper.py#L259-L265 | |||
UCL-INGI/INGInious | 60f10cb4c375ce207471043e76bd813220b95399 | inginious/frontend/pages/course_admin/utils.py | python | make_csv | (data) | return response | Returns the content of a CSV file with the data of the dict/list data | Returns the content of a CSV file with the data of the dict/list data | [
"Returns",
"the",
"content",
"of",
"a",
"CSV",
"file",
"with",
"the",
"data",
"of",
"the",
"dict",
"/",
"list",
"data"
] | def make_csv(data):
""" Returns the content of a CSV file with the data of the dict/list data """
# Convert sub-dicts to news cols
for entry in data:
rval = entry
if isinstance(data, dict):
rval = data[entry]
todel = []
toadd = {}
for key, val in rval.item... | [
"def",
"make_csv",
"(",
"data",
")",
":",
"# Convert sub-dicts to news cols",
"for",
"entry",
"in",
"data",
":",
"rval",
"=",
"entry",
"if",
"isinstance",
"(",
"data",
",",
"dict",
")",
":",
"rval",
"=",
"data",
"[",
"entry",
"]",
"todel",
"=",
"[",
"]... | https://github.com/UCL-INGI/INGInious/blob/60f10cb4c375ce207471043e76bd813220b95399/inginious/frontend/pages/course_admin/utils.py#L280-L337 | |
scipy/scipy | e0a749f01e79046642ccfdc419edbf9e7ca141ad | scipy/io/_idl.py | python | _read_arraydesc | (f) | return arraydesc | Function to read in an array descriptor | Function to read in an array descriptor | [
"Function",
"to",
"read",
"in",
"an",
"array",
"descriptor"
] | def _read_arraydesc(f):
'''Function to read in an array descriptor'''
arraydesc = {'arrstart': _read_long(f)}
if arraydesc['arrstart'] == 8:
_skip_bytes(f, 4)
arraydesc['nbytes'] = _read_long(f)
arraydesc['nelements'] = _read_long(f)
arraydesc['ndims'] = _read_long(f)
... | [
"def",
"_read_arraydesc",
"(",
"f",
")",
":",
"arraydesc",
"=",
"{",
"'arrstart'",
":",
"_read_long",
"(",
"f",
")",
"}",
"if",
"arraydesc",
"[",
"'arrstart'",
"]",
"==",
"8",
":",
"_skip_bytes",
"(",
"f",
",",
"4",
")",
"arraydesc",
"[",
"'nbytes'",
... | https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/io/_idl.py#L444-L488 | |
PyCQA/astroid | a815443f62faae05249621a396dcf0afd884a619 | astroid/nodes/scoped_nodes/scoped_nodes.py | python | ClassDef.implicit_locals | (self) | return locals_ | Get implicitly defined class definition locals.
:returns: the the name and Const pair for each local
:rtype: tuple(tuple(str, node_classes.Const), ...) | Get implicitly defined class definition locals. | [
"Get",
"implicitly",
"defined",
"class",
"definition",
"locals",
"."
] | def implicit_locals(self):
"""Get implicitly defined class definition locals.
:returns: the the name and Const pair for each local
:rtype: tuple(tuple(str, node_classes.Const), ...)
"""
locals_ = (("__module__", self.special_attributes.attr___module__),)
# __qualname__ i... | [
"def",
"implicit_locals",
"(",
"self",
")",
":",
"locals_",
"=",
"(",
"(",
"\"__module__\"",
",",
"self",
".",
"special_attributes",
".",
"attr___module__",
")",
",",
")",
"# __qualname__ is defined in PEP3155",
"locals_",
"+=",
"(",
"(",
"\"__qualname__\"",
",",
... | https://github.com/PyCQA/astroid/blob/a815443f62faae05249621a396dcf0afd884a619/astroid/nodes/scoped_nodes/scoped_nodes.py#L2271-L2280 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.4/django/utils/translation/trans_real.py | python | ngettext | (singular, plural, number) | return do_ntranslate(singular, plural, number, 'ngettext') | Returns a UTF-8 bytestring of the translation of either the singular or
plural, based on the number. | Returns a UTF-8 bytestring of the translation of either the singular or
plural, based on the number. | [
"Returns",
"a",
"UTF",
"-",
"8",
"bytestring",
"of",
"the",
"translation",
"of",
"either",
"the",
"singular",
"or",
"plural",
"based",
"on",
"the",
"number",
"."
] | def ngettext(singular, plural, number):
"""
Returns a UTF-8 bytestring of the translation of either the singular or
plural, based on the number.
"""
return do_ntranslate(singular, plural, number, 'ngettext') | [
"def",
"ngettext",
"(",
"singular",
",",
"plural",
",",
"number",
")",
":",
"return",
"do_ntranslate",
"(",
"singular",
",",
"plural",
",",
"number",
",",
"'ngettext'",
")"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.4/django/utils/translation/trans_real.py#L308-L313 | |
gmate/gmate | 83312e64e0c115a9842500e4eb8617d3f5f4025b | plugins/gedit2/zencoding/zencoding/filters/html.py | python | make_attributes_string | (tag, profile) | return attrs | Creates HTML attributes string from tag according to profile settings
@type tag: ZenNode
@type profile: dict | Creates HTML attributes string from tag according to profile settings | [
"Creates",
"HTML",
"attributes",
"string",
"from",
"tag",
"according",
"to",
"profile",
"settings"
] | def make_attributes_string(tag, profile):
"""
Creates HTML attributes string from tag according to profile settings
@type tag: ZenNode
@type profile: dict
"""
# make attribute string
attrs = ''
attr_quote = profile['attr_quotes'] == 'single' and "'" or '"'
cursor = profile['place_cursor'] and zen_coding.get_ca... | [
"def",
"make_attributes_string",
"(",
"tag",
",",
"profile",
")",
":",
"# make attribute string",
"attrs",
"=",
"''",
"attr_quote",
"=",
"profile",
"[",
"'attr_quotes'",
"]",
"==",
"'single'",
"and",
"\"'\"",
"or",
"'\"'",
"cursor",
"=",
"profile",
"[",
"'plac... | https://github.com/gmate/gmate/blob/83312e64e0c115a9842500e4eb8617d3f5f4025b/plugins/gedit2/zencoding/zencoding/filters/html.py#L13-L29 | |
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | openedx/core/djangoapps/content/block_structure/transformer_registry.py | python | TransformerRegistry.get_write_version_hash | (cls) | return b64encode(hash_obj.digest()).decode('utf-8') | Returns a deterministic hash value of the WRITE_VERSION of all
registered transformers. | Returns a deterministic hash value of the WRITE_VERSION of all
registered transformers. | [
"Returns",
"a",
"deterministic",
"hash",
"value",
"of",
"the",
"WRITE_VERSION",
"of",
"all",
"registered",
"transformers",
"."
] | def get_write_version_hash(cls):
"""
Returns a deterministic hash value of the WRITE_VERSION of all
registered transformers.
"""
hash_obj = sha1()
sorted_transformers = sorted(cls.get_registered_transformers(), key=lambda t: t.name())
for transformer in sorted_tr... | [
"def",
"get_write_version_hash",
"(",
"cls",
")",
":",
"hash_obj",
"=",
"sha1",
"(",
")",
"sorted_transformers",
"=",
"sorted",
"(",
"cls",
".",
"get_registered_transformers",
"(",
")",
",",
"key",
"=",
"lambda",
"t",
":",
"t",
".",
"name",
"(",
")",
")"... | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/openedx/core/djangoapps/content/block_structure/transformer_registry.py#L42-L54 | |
JonathonLuiten/PReMVOS | 2666acaae0f1b4bd7d88a0cfb9b7cf5c5de12a4b | code/proposal_net/viz.py | python | draw_mask | (im, mask, alpha=0.5, color=None) | return im | Overlay a mask on top of the image.
Args:
im: a 3-channel uint8 image in BGR
mask: a binary 1-channel image of the same size
color: if None, will choose automatically | Overlay a mask on top of the image. | [
"Overlay",
"a",
"mask",
"on",
"top",
"of",
"the",
"image",
"."
] | def draw_mask(im, mask, alpha=0.5, color=None):
"""
Overlay a mask on top of the image.
Args:
im: a 3-channel uint8 image in BGR
mask: a binary 1-channel image of the same size
color: if None, will choose automatically
"""
if color is None:
color = PALETTE_RGB[np.ran... | [
"def",
"draw_mask",
"(",
"im",
",",
"mask",
",",
"alpha",
"=",
"0.5",
",",
"color",
"=",
"None",
")",
":",
"if",
"color",
"is",
"None",
":",
"color",
"=",
"PALETTE_RGB",
"[",
"np",
".",
"random",
".",
"choice",
"(",
"len",
"(",
"PALETTE_RGB",
")",
... | https://github.com/JonathonLuiten/PReMVOS/blob/2666acaae0f1b4bd7d88a0cfb9b7cf5c5de12a4b/code/proposal_net/viz.py#L93-L107 | |
SforAiDl/Neural-Voice-Cloning-With-Few-Samples | 33fb609427657c9492f46507184ecba4dcc272b0 | train_dv3.py | python | TextDataSource.__init__ | (self, data_root, speaker_id=None) | [] | def __init__(self, data_root, speaker_id=None):
self.data_root = data_root
self.speaker_ids = None
self.multi_speaker = False
# If not None, filter by speaker_id
self.speaker_id = speaker_id | [
"def",
"__init__",
"(",
"self",
",",
"data_root",
",",
"speaker_id",
"=",
"None",
")",
":",
"self",
".",
"data_root",
"=",
"data_root",
"self",
".",
"speaker_ids",
"=",
"None",
"self",
".",
"multi_speaker",
"=",
"False",
"# If not None, filter by speaker_id",
... | https://github.com/SforAiDl/Neural-Voice-Cloning-With-Few-Samples/blob/33fb609427657c9492f46507184ecba4dcc272b0/train_dv3.py#L98-L103 | ||||
trakt/Plex-Trakt-Scrobbler | aeb0bfbe62fad4b06c164f1b95581da7f35dce0b | Trakttv.bundle/Contents/Libraries/Linux/aarch64/ucs2/cryptography/hazmat/primitives/asymmetric/rsa.py | python | rsa_crt_dmp1 | (private_exponent, p) | return private_exponent % (p - 1) | Compute the CRT private_exponent % (p - 1) value from the RSA
private_exponent (d) and p. | Compute the CRT private_exponent % (p - 1) value from the RSA
private_exponent (d) and p. | [
"Compute",
"the",
"CRT",
"private_exponent",
"%",
"(",
"p",
"-",
"1",
")",
"value",
"from",
"the",
"RSA",
"private_exponent",
"(",
"d",
")",
"and",
"p",
"."
] | def rsa_crt_dmp1(private_exponent, p):
"""
Compute the CRT private_exponent % (p - 1) value from the RSA
private_exponent (d) and p.
"""
return private_exponent % (p - 1) | [
"def",
"rsa_crt_dmp1",
"(",
"private_exponent",
",",
"p",
")",
":",
"return",
"private_exponent",
"%",
"(",
"p",
"-",
"1",
")"
] | https://github.com/trakt/Plex-Trakt-Scrobbler/blob/aeb0bfbe62fad4b06c164f1b95581da7f35dce0b/Trakttv.bundle/Contents/Libraries/Linux/aarch64/ucs2/cryptography/hazmat/primitives/asymmetric/rsa.py#L199-L204 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/PIL/MpoImagePlugin.py | python | _accept | (prefix) | return JpegImagePlugin._accept(prefix) | [] | def _accept(prefix):
return JpegImagePlugin._accept(prefix) | [
"def",
"_accept",
"(",
"prefix",
")",
":",
"return",
"JpegImagePlugin",
".",
"_accept",
"(",
"prefix",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/PIL/MpoImagePlugin.py#L26-L27 | |||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/rings/polynomial/multi_polynomial_element.py | python | MPolynomial_element._lmul_ | (self, a) | return self.__class__(self.parent(),self.__element.scalar_lmult(a)) | Left Scalar Multiplication
EXAMPLES:
Note that it is not really possible to do a meaningful
example since sage mpoly rings refuse to have non-commutative
bases.
::
sage: R.<x,y> = QQbar[]
sage: f = (x + y)
sage: 3*f
3*x + 3*y | Left Scalar Multiplication | [
"Left",
"Scalar",
"Multiplication"
] | def _lmul_(self, a):
"""
Left Scalar Multiplication
EXAMPLES:
Note that it is not really possible to do a meaningful
example since sage mpoly rings refuse to have non-commutative
bases.
::
sage: R.<x,y> = QQbar[]
sage: f = (x + y)
... | [
"def",
"_lmul_",
"(",
"self",
",",
"a",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"self",
".",
"parent",
"(",
")",
",",
"self",
".",
"__element",
".",
"scalar_lmult",
"(",
"a",
")",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/polynomial/multi_polynomial_element.py#L264-L281 | |
coderSkyChen/Action_Recognition_Zoo | 92ec5ec3efeee852aec5c057798298cd3a8e58ae | model_zoo/models/slim/deployment/model_deploy.py | python | DeploymentConfig.variables_device | (self) | Returns the device to use for variables created inside the clone.
Returns:
A value suitable for `tf.device()`. | Returns the device to use for variables created inside the clone. | [
"Returns",
"the",
"device",
"to",
"use",
"for",
"variables",
"created",
"inside",
"the",
"clone",
"."
] | def variables_device(self):
"""Returns the device to use for variables created inside the clone.
Returns:
A value suitable for `tf.device()`.
"""
device = ''
if self._num_ps_tasks > 0:
device += self._ps_device
device += '/device:CPU:0'
class _PSDeviceChooser(object):
"""... | [
"def",
"variables_device",
"(",
"self",
")",
":",
"device",
"=",
"''",
"if",
"self",
".",
"_num_ps_tasks",
">",
"0",
":",
"device",
"+=",
"self",
".",
"_ps_device",
"device",
"+=",
"'/device:CPU:0'",
"class",
"_PSDeviceChooser",
"(",
"object",
")",
":",
"\... | https://github.com/coderSkyChen/Action_Recognition_Zoo/blob/92ec5ec3efeee852aec5c057798298cd3a8e58ae/model_zoo/models/slim/deployment/model_deploy.py#L646-L681 | ||
atlassian-api/atlassian-python-api | 6d8545a790c3aae10b75bdc225fb5c3a0aee44db | atlassian/bamboo.py | python | Bamboo.get_groups | (self, start=0, limit=25) | return self.get(url, params=params) | Retrieve a paginated list of groups.
The authenticated user must have restricted administrative permission or higher to use this resource.
:param start:
:param limit:
:return: | Retrieve a paginated list of groups.
The authenticated user must have restricted administrative permission or higher to use this resource.
:param start:
:param limit:
:return: | [
"Retrieve",
"a",
"paginated",
"list",
"of",
"groups",
".",
"The",
"authenticated",
"user",
"must",
"have",
"restricted",
"administrative",
"permission",
"or",
"higher",
"to",
"use",
"this",
"resource",
".",
":",
"param",
"start",
":",
":",
"param",
"limit",
... | def get_groups(self, start=0, limit=25):
"""
Retrieve a paginated list of groups.
The authenticated user must have restricted administrative permission or higher to use this resource.
:param start:
:param limit:
:return:
"""
params = {"limit": limit, "star... | [
"def",
"get_groups",
"(",
"self",
",",
"start",
"=",
"0",
",",
"limit",
"=",
"25",
")",
":",
"params",
"=",
"{",
"\"limit\"",
":",
"limit",
",",
"\"start\"",
":",
"start",
"}",
"url",
"=",
"\"rest/api/latest/admin/groups\"",
"return",
"self",
".",
"get",... | https://github.com/atlassian-api/atlassian-python-api/blob/6d8545a790c3aae10b75bdc225fb5c3a0aee44db/atlassian/bamboo.py#L673-L683 | |
subuser-security/subuser | 8072271f8fc3dded60b048c2dee878f9840c126a | subuserlib/classes/subuserSubmodules/run/runReadyImage.py | python | RunReadyImage.generateImagePreparationDockerfile | (self) | return dockerfileContents | There is still some preparation that needs to be done before an image is ready to be run. But this preparation requires run time information, so we cannot preform that preparation at build time. | There is still some preparation that needs to be done before an image is ready to be run. But this preparation requires run time information, so we cannot preform that preparation at build time. | [
"There",
"is",
"still",
"some",
"preparation",
"that",
"needs",
"to",
"be",
"done",
"before",
"an",
"image",
"is",
"ready",
"to",
"be",
"run",
".",
"But",
"this",
"preparation",
"requires",
"run",
"time",
"information",
"so",
"we",
"cannot",
"preform",
"th... | def generateImagePreparationDockerfile(self):
"""
There is still some preparation that needs to be done before an image is ready to be run. But this preparation requires run time information, so we cannot preform that preparation at build time.
"""
dockerfileContents = "FROM "+self.subuser.imageId+"\n... | [
"def",
"generateImagePreparationDockerfile",
"(",
"self",
")",
":",
"dockerfileContents",
"=",
"\"FROM \"",
"+",
"self",
".",
"subuser",
".",
"imageId",
"+",
"\"\\n\"",
"dockerfileContents",
"+=",
"\"RUN useradd --uid=\"",
"+",
"str",
"(",
"self",
".",
"user",
"."... | https://github.com/subuser-security/subuser/blob/8072271f8fc3dded60b048c2dee878f9840c126a/subuserlib/classes/subuserSubmodules/run/runReadyImage.py#L48-L62 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/modules/free_module.py | python | FreeModule_submodule_field.has_user_basis | (self) | return False | Return ``True`` if the basis of this free module is
specified by the user, as opposed to being the default echelon
form.
EXAMPLES::
sage: V = QQ^3
sage: W = V.subspace([[2,'1/2', 1]])
sage: W.has_user_basis()
False
sage: W = V.subspac... | Return ``True`` if the basis of this free module is
specified by the user, as opposed to being the default echelon
form. | [
"Return",
"True",
"if",
"the",
"basis",
"of",
"this",
"free",
"module",
"is",
"specified",
"by",
"the",
"user",
"as",
"opposed",
"to",
"being",
"the",
"default",
"echelon",
"form",
"."
] | def has_user_basis(self):
"""
Return ``True`` if the basis of this free module is
specified by the user, as opposed to being the default echelon
form.
EXAMPLES::
sage: V = QQ^3
sage: W = V.subspace([[2,'1/2', 1]])
sage: W.has_user_basis()
... | [
"def",
"has_user_basis",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/modules/free_module.py#L7335-L7351 | |
nathanborror/django-basic-apps | 3a90090857549ea4198a72c44f45f6edb238e2a8 | basic/blog/templatetags/blog.py | python | get_blogroll | (parser, token) | return BlogRolls(var_name) | Gets all blogroll links.
Syntax::
{% get_blogroll as [var_name] %}
Example usage::
{% get_blogroll as blogroll_list %} | Gets all blogroll links. | [
"Gets",
"all",
"blogroll",
"links",
"."
] | def get_blogroll(parser, token):
"""
Gets all blogroll links.
Syntax::
{% get_blogroll as [var_name] %}
Example usage::
{% get_blogroll as blogroll_list %}
"""
try:
tag_name, arg = token.contents.split(None, 1)
except ValueError:
raise template.TemplateSyn... | [
"def",
"get_blogroll",
"(",
"parser",
",",
"token",
")",
":",
"try",
":",
"tag_name",
",",
"arg",
"=",
"token",
".",
"contents",
".",
"split",
"(",
"None",
",",
"1",
")",
"except",
"ValueError",
":",
"raise",
"template",
".",
"TemplateSyntaxError",
",",
... | https://github.com/nathanborror/django-basic-apps/blob/3a90090857549ea4198a72c44f45f6edb238e2a8/basic/blog/templatetags/blog.py#L120-L140 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/sets/sets.py | python | FiniteSet._eval_evalf | (self, prec) | return FiniteSet(elem.evalf(prec) for elem in self) | [] | def _eval_evalf(self, prec):
return FiniteSet(elem.evalf(prec) for elem in self) | [
"def",
"_eval_evalf",
"(",
"self",
",",
"prec",
")",
":",
"return",
"FiniteSet",
"(",
"elem",
".",
"evalf",
"(",
"prec",
")",
"for",
"elem",
"in",
"self",
")"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/sets/sets.py#L1590-L1591 | |||
wireservice/leather | a10c27e0c073a6307133a7a2ad4db0268f02bf4b | leather/chart.py | python | Chart.set_x_axis | (self, axis) | Set an :class:`.Axis` class for this chart. | Set an :class:`.Axis` class for this chart. | [
"Set",
"an",
":",
"class",
":",
".",
"Axis",
"class",
"for",
"this",
"chart",
"."
] | def set_x_axis(self, axis):
"""
Set an :class:`.Axis` class for this chart.
"""
self._axes[X] = axis | [
"def",
"set_x_axis",
"(",
"self",
",",
"axis",
")",
":",
"self",
".",
"_axes",
"[",
"X",
"]",
"=",
"axis"
] | https://github.com/wireservice/leather/blob/a10c27e0c073a6307133a7a2ad4db0268f02bf4b/leather/chart.py#L82-L86 | ||
graalvm/mx | 29c0debab406352df3af246be2f8973be5db69ae | mx_bisect.py | python | _update_cmd_if_stripped | (cmd_to_update) | return cmd_to_update | [] | def _update_cmd_if_stripped(cmd_to_update):
if mx._opts.strip_jars and cmd_to_update.find('--strip-jars') == -1:
cmd_to_update = re.sub(r'\b(mx)\b', 'mx --strip-jars', cmd_to_update)
return cmd_to_update | [
"def",
"_update_cmd_if_stripped",
"(",
"cmd_to_update",
")",
":",
"if",
"mx",
".",
"_opts",
".",
"strip_jars",
"and",
"cmd_to_update",
".",
"find",
"(",
"'--strip-jars'",
")",
"==",
"-",
"1",
":",
"cmd_to_update",
"=",
"re",
".",
"sub",
"(",
"r'\\b(mx)\\b'",... | https://github.com/graalvm/mx/blob/29c0debab406352df3af246be2f8973be5db69ae/mx_bisect.py#L92-L95 | |||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/commands/search.py | python | SearchCommand.__init__ | (self, *args, **kw) | [] | def __init__(self, *args, **kw):
super(SearchCommand, self).__init__(*args, **kw)
self.cmd_opts.add_option(
'-i', '--index',
dest='index',
metavar='URL',
default=PyPI.pypi_url,
help='Base URL of Python Package Index (default %default)')
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"super",
"(",
"SearchCommand",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"args",
",",
"*",
"*",
"kw",
")",
"self",
".",
"cmd_opts",
".",
"add_option",
"(",
"'-i'"... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/commands/search.py#L30-L39 | ||||
kennethreitz-archive/requests3 | 69eb662703b40db58fdc6c095d0fe130c56649bb | requests3/_hooks.py | python | dispatch_hook | (key, hooks, hook_data, **kwargs) | return hook_data | Dispatches a hook dictionary on a given piece of data. | Dispatches a hook dictionary on a given piece of data. | [
"Dispatches",
"a",
"hook",
"dictionary",
"on",
"a",
"given",
"piece",
"of",
"data",
"."
] | def dispatch_hook(key, hooks, hook_data, **kwargs):
"""Dispatches a hook dictionary on a given piece of data."""
hooks = hooks or {}
hooks = hooks.get(key)
if hooks:
if hasattr(hooks, "__call__"):
hooks = [hooks]
for hook in hooks:
_hook_data = hook(hook_data, **k... | [
"def",
"dispatch_hook",
"(",
"key",
",",
"hooks",
",",
"hook_data",
",",
"*",
"*",
"kwargs",
")",
":",
"hooks",
"=",
"hooks",
"or",
"{",
"}",
"hooks",
"=",
"hooks",
".",
"get",
"(",
"key",
")",
"if",
"hooks",
":",
"if",
"hasattr",
"(",
"hooks",
"... | https://github.com/kennethreitz-archive/requests3/blob/69eb662703b40db58fdc6c095d0fe130c56649bb/requests3/_hooks.py#L21-L32 | |
Mingtzge/2019-CCF-BDCI-OCR-MCZJ-OCR-IdentificationIDElement | 42ad9686f3c3bde0d29a8bc6bcb0e3afb35fb3c3 | pytorch-CycleGAN-and-pix2pix/util/html.py | python | HTML.add_images | (self, ims, txts, links, width=400) | add images to the HTML file
Parameters:
ims (str list) -- a list of image paths
txts (str list) -- a list of image names shown on the website
links (str list) -- a list of hyperref links; when you click an image, it will redirect you to a new page | add images to the HTML file | [
"add",
"images",
"to",
"the",
"HTML",
"file"
] | def add_images(self, ims, txts, links, width=400):
"""add images to the HTML file
Parameters:
ims (str list) -- a list of image paths
txts (str list) -- a list of image names shown on the website
links (str list) -- a list of hyperref links; when you click an ima... | [
"def",
"add_images",
"(",
"self",
",",
"ims",
",",
"txts",
",",
"links",
",",
"width",
"=",
"400",
")",
":",
"self",
".",
"t",
"=",
"table",
"(",
"border",
"=",
"1",
",",
"style",
"=",
"\"table-layout: fixed;\"",
")",
"# Insert a table",
"self",
".",
... | https://github.com/Mingtzge/2019-CCF-BDCI-OCR-MCZJ-OCR-IdentificationIDElement/blob/42ad9686f3c3bde0d29a8bc6bcb0e3afb35fb3c3/pytorch-CycleGAN-and-pix2pix/util/html.py#L48-L66 | ||
pyRiemann/pyRiemann | 30c2cd7204d19f1a60d3b7945dfd8ee3c46a8df8 | pyriemann/utils/mean.py | python | mean_covariance | (covmats, metric='riemann', sample_weight=None, *args) | return C | Return the mean covariance matrix according to the metric
:param covmats: Covariance matrices, (n_matrices, n_channels, n_channels)
:param metric: the metric (default 'riemann'), can be : 'riemann',
'logeuclid', 'euclid', 'logdet', 'identity', 'wasserstein', 'ale',
'alm', 'harmonic', 'kullback_... | Return the mean covariance matrix according to the metric | [
"Return",
"the",
"mean",
"covariance",
"matrix",
"according",
"to",
"the",
"metric"
] | def mean_covariance(covmats, metric='riemann', sample_weight=None, *args):
"""Return the mean covariance matrix according to the metric
:param covmats: Covariance matrices, (n_matrices, n_channels, n_channels)
:param metric: the metric (default 'riemann'), can be : 'riemann',
'logeuclid', 'euclid',... | [
"def",
"mean_covariance",
"(",
"covmats",
",",
"metric",
"=",
"'riemann'",
",",
"sample_weight",
"=",
"None",
",",
"*",
"args",
")",
":",
"if",
"callable",
"(",
"metric",
")",
":",
"C",
"=",
"metric",
"(",
"covmats",
",",
"sample_weight",
"=",
"sample_we... | https://github.com/pyRiemann/pyRiemann/blob/30c2cd7204d19f1a60d3b7945dfd8ee3c46a8df8/pyriemann/utils/mean.py#L380-L396 | |
PyHDI/veriloggen | 2382d200deabf59cfcfd741f5eba371010aaf2bb | veriloggen/seq/seq.py | python | Seq.Delay | (self, delay) | return self | [] | def Delay(self, delay):
self.next_kwargs['delay'] = delay
return self | [
"def",
"Delay",
"(",
"self",
",",
"delay",
")",
":",
"self",
".",
"next_kwargs",
"[",
"'delay'",
"]",
"=",
"delay",
"return",
"self"
] | https://github.com/PyHDI/veriloggen/blob/2382d200deabf59cfcfd741f5eba371010aaf2bb/veriloggen/seq/seq.py#L276-L278 | |||
pdm-project/pdm | 34ba2ea48bf079044b0ca8c0017f3c0e7d9e198b | pdm/models/specifiers.py | python | PySpecSet.is_impossible | (self) | return self._lower_bound >= self._upper_bound | Check whether the specifierset contains any valid versions. | Check whether the specifierset contains any valid versions. | [
"Check",
"whether",
"the",
"specifierset",
"contains",
"any",
"valid",
"versions",
"."
] | def is_impossible(self) -> bool:
"""Check whether the specifierset contains any valid versions."""
if self._lower_bound == Version.MIN or self._upper_bound == Version.MAX:
return False
return self._lower_bound >= self._upper_bound | [
"def",
"is_impossible",
"(",
"self",
")",
"->",
"bool",
":",
"if",
"self",
".",
"_lower_bound",
"==",
"Version",
".",
"MIN",
"or",
"self",
".",
"_upper_bound",
"==",
"Version",
".",
"MAX",
":",
"return",
"False",
"return",
"self",
".",
"_lower_bound",
">... | https://github.com/pdm-project/pdm/blob/34ba2ea48bf079044b0ca8c0017f3c0e7d9e198b/pdm/models/specifiers.py#L199-L203 | |
Diaoul/subliminal | e25589dbcc5b2455bf9f0b49cf2083bb0eae449f | subliminal/score.py | python | compute_score | (subtitle, video, hearing_impaired=None) | return score | Compute the score of the `subtitle` against the `video` with `hearing_impaired` preference.
:func:`compute_score` uses the :meth:`Subtitle.get_matches <subliminal.subtitle.Subtitle.get_matches>` method and
applies the scores (either from :data:`episode_scores` or :data:`movie_scores`) after some processing.
... | Compute the score of the `subtitle` against the `video` with `hearing_impaired` preference. | [
"Compute",
"the",
"score",
"of",
"the",
"subtitle",
"against",
"the",
"video",
"with",
"hearing_impaired",
"preference",
"."
] | def compute_score(subtitle, video, hearing_impaired=None):
"""Compute the score of the `subtitle` against the `video` with `hearing_impaired` preference.
:func:`compute_score` uses the :meth:`Subtitle.get_matches <subliminal.subtitle.Subtitle.get_matches>` method and
applies the scores (either from :data:`... | [
"def",
"compute_score",
"(",
"subtitle",
",",
"video",
",",
"hearing_impaired",
"=",
"None",
")",
":",
"logger",
".",
"info",
"(",
"'Computing score of %r for video %r with %r'",
",",
"subtitle",
",",
"video",
",",
"dict",
"(",
"hearing_impaired",
"=",
"hearing_im... | https://github.com/Diaoul/subliminal/blob/e25589dbcc5b2455bf9f0b49cf2083bb0eae449f/subliminal/score.py#L90-L154 | |
cogeotiff/rio-tiler | d045ac953238a4246de3cab0361cd1755dab0e90 | rio_tiler/mosaic/methods/defaults.py | python | LastBandHigh.data | (self) | Return data and mask. | Return data and mask. | [
"Return",
"data",
"and",
"mask",
"."
] | def data(self):
"""Return data and mask."""
if self.tile is not None:
return (
self.tile.data[:-1],
(~self.tile.mask[0] * 255).astype(self.tile.dtype),
)
else:
return None, None | [
"def",
"data",
"(",
"self",
")",
":",
"if",
"self",
".",
"tile",
"is",
"not",
"None",
":",
"return",
"(",
"self",
".",
"tile",
".",
"data",
"[",
":",
"-",
"1",
"]",
",",
"(",
"~",
"self",
".",
"tile",
".",
"mask",
"[",
"0",
"]",
"*",
"255",... | https://github.com/cogeotiff/rio-tiler/blob/d045ac953238a4246de3cab0361cd1755dab0e90/rio_tiler/mosaic/methods/defaults.py#L137-L145 | ||
sagemath/sagenb | 67a73cbade02639bc08265f28f3165442113ad4d | sagenb/notebook/worksheet.py | python | Worksheet.basic | (self) | return d | Output a dictionary of basic Python objects that defines the
configuration of this worksheet, except the actual cells and
the data files in the DATA directory and images and other data
in the individual cell directories.
EXAMPLES::
sage: import sagenb.notebook.worksheet
... | Output a dictionary of basic Python objects that defines the
configuration of this worksheet, except the actual cells and
the data files in the DATA directory and images and other data
in the individual cell directories. | [
"Output",
"a",
"dictionary",
"of",
"basic",
"Python",
"objects",
"that",
"defines",
"the",
"configuration",
"of",
"this",
"worksheet",
"except",
"the",
"actual",
"cells",
"and",
"the",
"data",
"files",
"in",
"the",
"DATA",
"directory",
"and",
"images",
"and",
... | def basic(self):
"""
Output a dictionary of basic Python objects that defines the
configuration of this worksheet, except the actual cells and
the data files in the DATA directory and images and other data
in the individual cell directories.
EXAMPLES::
sage:... | [
"def",
"basic",
"(",
"self",
")",
":",
"try",
":",
"published_id_number",
"=",
"int",
"(",
"os",
".",
"path",
".",
"split",
"(",
"self",
".",
"__published_version",
")",
"[",
"1",
"]",
")",
"except",
"AttributeError",
":",
"published_id_number",
"=",
"No... | https://github.com/sagemath/sagenb/blob/67a73cbade02639bc08265f28f3165442113ad4d/sagenb/notebook/worksheet.py#L285-L374 | |
enzienaudio/hvcc | 30e47328958d600c54889e2a254c3f17f2b2fd06 | generators/ir2c/SignalLorenz.py | python | SignalLorenz.get_C_header_set | (clazz) | return {"HvSignalLorenz.h"} | [] | def get_C_header_set(clazz):
return {"HvSignalLorenz.h"} | [
"def",
"get_C_header_set",
"(",
"clazz",
")",
":",
"return",
"{",
"\"HvSignalLorenz.h\"",
"}"
] | https://github.com/enzienaudio/hvcc/blob/30e47328958d600c54889e2a254c3f17f2b2fd06/generators/ir2c/SignalLorenz.py#L24-L25 | |||
Blockstream/satellite | ceb46a00e176c43a6b4170359f6948663a0616bb | blocksatcli/update.py | python | UpdateCache.has_update | (self) | return 'cli_update' in self.data and \
self.data['cli_update'] is not None | Returns whether there is an update available for the CLI | Returns whether there is an update available for the CLI | [
"Returns",
"whether",
"there",
"is",
"an",
"update",
"available",
"for",
"the",
"CLI"
] | def has_update(self):
"""Returns whether there is an update available for the CLI"""
return 'cli_update' in self.data and \
self.data['cli_update'] is not None | [
"def",
"has_update",
"(",
"self",
")",
":",
"return",
"'cli_update'",
"in",
"self",
".",
"data",
"and",
"self",
".",
"data",
"[",
"'cli_update'",
"]",
"is",
"not",
"None"
] | https://github.com/Blockstream/satellite/blob/ceb46a00e176c43a6b4170359f6948663a0616bb/blocksatcli/update.py#L50-L53 | |
NetEaseGame/iOS-private-api-checker | c9dc24bda7398c0d33553dce2c968d308ee968e7 | app/dbs/inc/Redis.py | python | RedisQueue.put | (self, item) | return self.__db.rpush(self.key, item) | Put item into the queue. | Put item into the queue. | [
"Put",
"item",
"into",
"the",
"queue",
"."
] | def put(self, item):
"""Put item into the queue."""
return self.__db.rpush(self.key, item) | [
"def",
"put",
"(",
"self",
",",
"item",
")",
":",
"return",
"self",
".",
"__db",
".",
"rpush",
"(",
"self",
".",
"key",
",",
"item",
")"
] | https://github.com/NetEaseGame/iOS-private-api-checker/blob/c9dc24bda7398c0d33553dce2c968d308ee968e7/app/dbs/inc/Redis.py#L112-L114 | |
home-assistant-libs/pytradfri | ef2614b0ccdf628abc3b9559dc00b95ec6e4bd72 | examples/debug_info.py | python | bold | (str) | return "\033[1;30m%s\033[0;0m" % str | Bold. | Bold. | [
"Bold",
"."
] | def bold(str):
"""Bold."""
return "\033[1;30m%s\033[0;0m" % str | [
"def",
"bold",
"(",
"str",
")",
":",
"return",
"\"\\033[1;30m%s\\033[0;0m\"",
"%",
"str"
] | https://github.com/home-assistant-libs/pytradfri/blob/ef2614b0ccdf628abc3b9559dc00b95ec6e4bd72/examples/debug_info.py#L103-L105 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_openshift_3.2/library/oc_secret.py | python | Yedit.delete | (self, path) | return (True, self.yaml_dict) | remove path from a dict | remove path from a dict | [
"remove",
"path",
"from",
"a",
"dict"
] | def delete(self, path):
''' remove path from a dict'''
try:
entry = Yedit.get_entry(self.yaml_dict, path, self.separator)
except KeyError as _:
entry = None
if entry == None:
return (False, self.yaml_dict)
result = Yedit.remove_entry(self.ya... | [
"def",
"delete",
"(",
"self",
",",
"path",
")",
":",
"try",
":",
"entry",
"=",
"Yedit",
".",
"get_entry",
"(",
"self",
".",
"yaml_dict",
",",
"path",
",",
"self",
".",
"separator",
")",
"except",
"KeyError",
"as",
"_",
":",
"entry",
"=",
"None",
"i... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_openshift_3.2/library/oc_secret.py#L759-L773 | |
sciter-sdk/pysciter | f3f4cfe6fd774d2e045b23e79326086cd7288fc6 | sciter/dom.py | python | Element.clear | (self) | return self | Clear content of the element. | Clear content of the element. | [
"Clear",
"content",
"of",
"the",
"element",
"."
] | def clear(self):
"""Clear content of the element."""
ok = _api.SciterSetElementText(self, None, 0)
self._throw_if(ok)
return self | [
"def",
"clear",
"(",
"self",
")",
":",
"ok",
"=",
"_api",
".",
"SciterSetElementText",
"(",
"self",
",",
"None",
",",
"0",
")",
"self",
".",
"_throw_if",
"(",
"ok",
")",
"return",
"self"
] | https://github.com/sciter-sdk/pysciter/blob/f3f4cfe6fd774d2e045b23e79326086cd7288fc6/sciter/dom.py#L428-L432 | |
evilhero/mylar | dbee01d7e48e8c717afa01b2de1946c5d0b956cb | lib/requests/models.py | python | Response.json | (self, **kwargs) | return json.loads(self.text, **kwargs) | Returns the json-encoded content of a response, if any.
:param \*\*kwargs: Optional arguments that ``json.loads`` takes. | Returns the json-encoded content of a response, if any. | [
"Returns",
"the",
"json",
"-",
"encoded",
"content",
"of",
"a",
"response",
"if",
"any",
"."
] | def json(self, **kwargs):
"""Returns the json-encoded content of a response, if any.
:param \*\*kwargs: Optional arguments that ``json.loads`` takes.
"""
if not self.encoding and len(self.content) > 3:
# No encoding set. JSON RFC 4627 section 3 states we should expect
... | [
"def",
"json",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"encoding",
"and",
"len",
"(",
"self",
".",
"content",
")",
">",
"3",
":",
"# No encoding set. JSON RFC 4627 section 3 states we should expect",
"# UTF-8, -16 or -32. Detect w... | https://github.com/evilhero/mylar/blob/dbee01d7e48e8c717afa01b2de1946c5d0b956cb/lib/requests/models.py#L798-L819 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/xml/dom/expatbuilder.py | python | FragmentBuilder.external_entity_ref_handler | (self, context, base, systemId, publicId) | [] | def external_entity_ref_handler(self, context, base, systemId, publicId):
if systemId == _FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID:
# this entref is the one that we made to put the subtree
# in; all of our given input is parsed in here.
old_document = self.document
old... | [
"def",
"external_entity_ref_handler",
"(",
"self",
",",
"context",
",",
"base",
",",
"systemId",
",",
"publicId",
")",
":",
"if",
"systemId",
"==",
"_FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID",
":",
"# this entref is the one that we made to put the subtree",
"# in; all of our given... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/xml/dom/expatbuilder.py#L688-L708 | ||||
amirzed/provisionpad | 51d2a886f46b5090b6fb8b91c18c3043ec36ae42 | src/provisionpad/aws/aws_sg.py | python | AWSsgFuncs.set_sg_http_egress | (self, sgid) | modifies the security group to only ssh ingress and
no egress
Parameters:
sgid (str): the id of the security group
Returns:
- | modifies the security group to only ssh ingress and
no egress | [
"modifies",
"the",
"security",
"group",
"to",
"only",
"ssh",
"ingress",
"and",
"no",
"egress"
] | def set_sg_http_egress(self, sgid):
'''
modifies the security group to only ssh ingress and
no egress
Parameters:
sgid (str): the id of the security group
Returns:
-
'''
securitygroup = self.ec2.SecurityGroup(sgid)
securitygroup.a... | [
"def",
"set_sg_http_egress",
"(",
"self",
",",
"sgid",
")",
":",
"securitygroup",
"=",
"self",
".",
"ec2",
".",
"SecurityGroup",
"(",
"sgid",
")",
"securitygroup",
".",
"authorize_egress",
"(",
"IpPermissions",
"=",
"[",
"{",
"'IpProtocol'",
":",
"'tcp'",
",... | https://github.com/amirzed/provisionpad/blob/51d2a886f46b5090b6fb8b91c18c3043ec36ae42/src/provisionpad/aws/aws_sg.py#L46-L71 | ||
1012598167/flask_mongodb_game | 60c7e0351586656ec38f851592886338e50b4110 | python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/urllib3/util/timeout.py | python | Timeout.connect_timeout | (self) | return min(self._connect, self.total) | Get the value to use when setting a connection timeout.
This will be a positive float or integer, the value None
(never timeout), or the default system timeout.
:return: Connect timeout.
:rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None | Get the value to use when setting a connection timeout. | [
"Get",
"the",
"value",
"to",
"use",
"when",
"setting",
"a",
"connection",
"timeout",
"."
] | def connect_timeout(self):
""" Get the value to use when setting a connection timeout.
This will be a positive float or integer, the value None
(never timeout), or the default system timeout.
:return: Connect timeout.
:rtype: int, float, :attr:`Timeout.DEFAULT_TIMEOUT` or None
... | [
"def",
"connect_timeout",
"(",
"self",
")",
":",
"if",
"self",
".",
"total",
"is",
"None",
":",
"return",
"self",
".",
"_connect",
"if",
"self",
".",
"_connect",
"is",
"None",
"or",
"self",
".",
"_connect",
"is",
"self",
".",
"DEFAULT_TIMEOUT",
":",
"r... | https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/urllib3/util/timeout.py#L196-L211 | |
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/fate_arch/abc/_storage.py | python | StorageSessionABC.get_table | (self, name, namespace) | [] | def get_table(self, name, namespace) -> StorageTableABC:
... | [
"def",
"get_table",
"(",
"self",
",",
"name",
",",
"namespace",
")",
"->",
"StorageTableABC",
":",
"..."
] | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/fate_arch/abc/_storage.py#L209-L210 | ||||
cylc/cylc-flow | 5ec221143476c7c616c156b74158edfbcd83794a | cylc/flow/network/graphql.py | python | AstDocArguments.has_arg_val | (self, arg_name, arg_value) | return False | Search through document definitions for argument value.
Args:
arg_name (str): Field argument to search for.
arg_value (Any): Argument value required.
Returns:
Boolean | Search through document definitions for argument value. | [
"Search",
"through",
"document",
"definitions",
"for",
"argument",
"value",
"."
] | def has_arg_val(self, arg_name, arg_value):
"""Search through document definitions for argument value.
Args:
arg_name (str): Field argument to search for.
arg_value (Any): Argument value required.
Returns:
Boolean
"""
for components in self... | [
"def",
"has_arg_val",
"(",
"self",
",",
"arg_name",
",",
"arg_value",
")",
":",
"for",
"components",
"in",
"self",
".",
"operation_defs",
".",
"values",
"(",
")",
":",
"defn",
"=",
"components",
"[",
"'definition'",
"]",
"if",
"(",
"defn",
".",
"operatio... | https://github.com/cylc/cylc-flow/blob/5ec221143476c7c616c156b74158edfbcd83794a/cylc/flow/network/graphql.py#L184-L212 | |
pynag/pynag | e72cf7ce2395263e2b3080cae0ece2b03dbbfa27 | pynag/Utils/states.py | python | service_state_to_int | (state) | Converts from strings like OK to states like 0.
Args:
State: string. Can be in the form of 'ok', 'warning', 'critical', '1', etc.
Returns:
Integer. A nagios corresponding to the free text state inputted.
Raises:
UnknownState: If no match can be found for 'state'.
Examples:
... | Converts from strings like OK to states like 0. | [
"Converts",
"from",
"strings",
"like",
"OK",
"to",
"states",
"like",
"0",
"."
] | def service_state_to_int(state):
"""Converts from strings like OK to states like 0.
Args:
State: string. Can be in the form of 'ok', 'warning', 'critical', '1', etc.
Returns:
Integer. A nagios corresponding to the free text state inputted.
Raises:
UnknownState: If no match can... | [
"def",
"service_state_to_int",
"(",
"state",
")",
":",
"text",
"=",
"str",
"(",
"state",
")",
".",
"lower",
"(",
")",
"try",
":",
"return",
"_SERVICE_TEXT_TO_INT",
"[",
"text",
"]",
"except",
"KeyError",
":",
"raise",
"UnknownState",
"(",
"'Do not know how t... | https://github.com/pynag/pynag/blob/e72cf7ce2395263e2b3080cae0ece2b03dbbfa27/pynag/Utils/states.py#L67-L106 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/tools/sqli/plugins/dbms/access/enumeration.py | python | Enumeration.searchTable | (self) | return [] | [] | def searchTable(self):
warnMsg = "on Microsoft Access it is not possible to search tables"
logger.warn(warnMsg)
return [] | [
"def",
"searchTable",
"(",
"self",
")",
":",
"warnMsg",
"=",
"\"on Microsoft Access it is not possible to search tables\"",
"logger",
".",
"warn",
"(",
"warnMsg",
")",
"return",
"[",
"]"
] | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/sqli/plugins/dbms/access/enumeration.py#L63-L67 | |||
DeepX-inc/machina | f93bb6f5aca1feccd71fc509bd6370d2015e2d85 | machina/logger.py | python | _type | (string, has_invisible=True) | The least generic type (type(None), int, float, str, unicode).
>>> _type(None) is type(None)
True
>>> _type("foo") is type("")
True
>>> _type("1") is type(1)
True
>>> _type('\x1b[31m42\x1b[0m') is type(42)
True
>>> _type('\x1b[31m42\x1b[0m') is type(42)
True | The least generic type (type(None), int, float, str, unicode). | [
"The",
"least",
"generic",
"type",
"(",
"type",
"(",
"None",
")",
"int",
"float",
"str",
"unicode",
")",
"."
] | def _type(string, has_invisible=True):
"""The least generic type (type(None), int, float, str, unicode).
>>> _type(None) is type(None)
True
>>> _type("foo") is type("")
True
>>> _type("1") is type(1)
True
>>> _type('\x1b[31m42\x1b[0m') is type(42)
True
>>> _type('\x1b[31m42\x1b[... | [
"def",
"_type",
"(",
"string",
",",
"has_invisible",
"=",
"True",
")",
":",
"if",
"has_invisible",
"and",
"(",
"isinstance",
"(",
"string",
",",
"_text_type",
")",
"or",
"isinstance",
"(",
"string",
",",
"_binary_type",
")",
")",
":",
"string",
"=",
"_st... | https://github.com/DeepX-inc/machina/blob/f93bb6f5aca1feccd71fc509bd6370d2015e2d85/machina/logger.py#L296-L327 | ||
pyqt/examples | 843bb982917cecb2350b5f6d7f42c9b7fb142ec1 | src/pyqt-official/richtext/textedit/textedit.py | python | TextEdit.closeEvent | (self, e) | [] | def closeEvent(self, e):
if self.maybeSave():
e.accept()
else:
e.ignore() | [
"def",
"closeEvent",
"(",
"self",
",",
"e",
")",
":",
"if",
"self",
".",
"maybeSave",
"(",
")",
":",
"e",
".",
"accept",
"(",
")",
"else",
":",
"e",
".",
"ignore",
"(",
")"
] | https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/richtext/textedit/textedit.py#L121-L125 | ||||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.5/django/core/servers/basehttp.py | python | ServerHandler.write | (self, data) | write()' callable as specified by PEP 3333 | write()' callable as specified by PEP 3333 | [
"write",
"()",
"callable",
"as",
"specified",
"by",
"PEP",
"3333"
] | def write(self, data):
"""'write()' callable as specified by PEP 3333"""
assert isinstance(data, bytes), "write() argument must be bytestring"
if not self.status:
raise AssertionError("write() before start_response()")
elif not self.headers_sent:
# Before the f... | [
"def",
"write",
"(",
"self",
",",
"data",
")",
":",
"assert",
"isinstance",
"(",
"data",
",",
"bytes",
")",
",",
"\"write() argument must be bytestring\"",
"if",
"not",
"self",
".",
"status",
":",
"raise",
"AssertionError",
"(",
"\"write() before start_response()\... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.5/django/core/servers/basehttp.py#L77-L106 | ||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/re.py | python | _compile_repl | (repl, pattern) | return sre_parse.parse_template(repl, pattern) | [] | def _compile_repl(repl, pattern):
# internal: compile replacement pattern
return sre_parse.parse_template(repl, pattern) | [
"def",
"_compile_repl",
"(",
"repl",
",",
"pattern",
")",
":",
"# internal: compile replacement pattern",
"return",
"sre_parse",
".",
"parse_template",
"(",
"repl",
",",
"pattern",
")"
] | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/re.py#L315-L317 | |||
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/PM/PM_MolecularModelingKit.py | python | PM_MolecularModelingKit.updateElementViewer | (self) | return | Update the view in the element viewer (if present) | Update the view in the element viewer (if present) | [
"Update",
"the",
"view",
"in",
"the",
"element",
"viewer",
"(",
"if",
"present",
")"
] | def updateElementViewer(self):
"""
Update the view in the element viewer (if present)
"""
if not self.elementViewer:
return
from graphics.widgets.ThumbView import MMKitView
assert isinstance(self.elementViewer, MMKitView)
self.elementViewer.resetView(... | [
"def",
"updateElementViewer",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"elementViewer",
":",
"return",
"from",
"graphics",
".",
"widgets",
".",
"ThumbView",
"import",
"MMKitView",
"assert",
"isinstance",
"(",
"self",
".",
"elementViewer",
",",
"MMKitVi... | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/PM/PM_MolecularModelingKit.py#L180-L192 | |
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/sklearn/multiclass.py | python | _partial_fit_ovo_binary | (estimator, X, y, i, j) | return _partial_fit_binary(estimator, X[cond], y_binary) | Partially fit a single binary estimator(one-vs-one). | Partially fit a single binary estimator(one-vs-one). | [
"Partially",
"fit",
"a",
"single",
"binary",
"estimator",
"(",
"one",
"-",
"vs",
"-",
"one",
")",
"."
] | def _partial_fit_ovo_binary(estimator, X, y, i, j):
"""Partially fit a single binary estimator(one-vs-one)."""
cond = np.logical_or(y == i, y == j)
y = y[cond]
y_binary = np.zeros_like(y)
y_binary[y == j] = 1
return _partial_fit_binary(estimator, X[cond], y_binary) | [
"def",
"_partial_fit_ovo_binary",
"(",
"estimator",
",",
"X",
",",
"y",
",",
"i",
",",
"j",
")",
":",
"cond",
"=",
"np",
".",
"logical_or",
"(",
"y",
"==",
"i",
",",
"y",
"==",
"j",
")",
"y",
"=",
"y",
"[",
"cond",
"]",
"y_binary",
"=",
"np",
... | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/sklearn/multiclass.py#L422-L429 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/werkzeug/formparser.py | python | is_valid_multipart_boundary | (boundary) | return _multipart_boundary_re.match(boundary) is not None | Checks if the string given is a valid multipart boundary. | Checks if the string given is a valid multipart boundary. | [
"Checks",
"if",
"the",
"string",
"given",
"is",
"a",
"valid",
"multipart",
"boundary",
"."
] | def is_valid_multipart_boundary(boundary):
"""Checks if the string given is a valid multipart boundary."""
return _multipart_boundary_re.match(boundary) is not None | [
"def",
"is_valid_multipart_boundary",
"(",
"boundary",
")",
":",
"return",
"_multipart_boundary_re",
".",
"match",
"(",
"boundary",
")",
"is",
"not",
"None"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/werkzeug/formparser.py#L243-L245 | |
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/site-packages/django/template/defaultfilters.py | python | last | (value) | Returns the last item in a list | Returns the last item in a list | [
"Returns",
"the",
"last",
"item",
"in",
"a",
"list"
] | def last(value):
"Returns the last item in a list"
try:
return value[-1]
except IndexError:
return u'' | [
"def",
"last",
"(",
"value",
")",
":",
"try",
":",
"return",
"value",
"[",
"-",
"1",
"]",
"except",
"IndexError",
":",
"return",
"u''"
] | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/template/defaultfilters.py#L532-L537 | ||
mozman/ezdxf | 59d0fc2ea63f5cf82293428f5931da7e9f9718e9 | src/ezdxf/entities/appdata.py | python | AppData.__contains__ | (self, appid: str) | return uniform_appid(appid) in self.data | Returns ``True`` if application-defined data exist for `appid`. | Returns ``True`` if application-defined data exist for `appid`. | [
"Returns",
"True",
"if",
"application",
"-",
"defined",
"data",
"exist",
"for",
"appid",
"."
] | def __contains__(self, appid: str) -> bool:
"""Returns ``True`` if application-defined data exist for `appid`."""
return uniform_appid(appid) in self.data | [
"def",
"__contains__",
"(",
"self",
",",
"appid",
":",
"str",
")",
"->",
"bool",
":",
"return",
"uniform_appid",
"(",
"appid",
")",
"in",
"self",
".",
"data"
] | https://github.com/mozman/ezdxf/blob/59d0fc2ea63f5cf82293428f5931da7e9f9718e9/src/ezdxf/entities/appdata.py#L36-L38 | |
brendano/tweetmotif | 1b0b1e3a941745cd5a26eba01f554688b7c4b27e | everything_else/djfrontend/django-1.0.2/contrib/localflavor/is_/forms.py | python | ISIdNumberField._format | (self, value) | return smart_unicode(value[:6]+'-'+value[6:]) | Takes in the value in canonical form and returns it in the common
display format. | Takes in the value in canonical form and returns it in the common
display format. | [
"Takes",
"in",
"the",
"value",
"in",
"canonical",
"form",
"and",
"returns",
"it",
"in",
"the",
"common",
"display",
"format",
"."
] | def _format(self, value):
"""
Takes in the value in canonical form and returns it in the common
display format.
"""
return smart_unicode(value[:6]+'-'+value[6:]) | [
"def",
"_format",
"(",
"self",
",",
"value",
")",
":",
"return",
"smart_unicode",
"(",
"value",
"[",
":",
"6",
"]",
"+",
"'-'",
"+",
"value",
"[",
"6",
":",
"]",
")"
] | https://github.com/brendano/tweetmotif/blob/1b0b1e3a941745cd5a26eba01f554688b7c4b27e/everything_else/djfrontend/django-1.0.2/contrib/localflavor/is_/forms.py#L51-L56 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/powerwall/binary_sensor.py | python | PowerWallGridServicesActiveSensor.is_on | (self) | return self.coordinator.data[POWERWALL_API_GRID_SERVICES_ACTIVE] | Grid services is active. | Grid services is active. | [
"Grid",
"services",
"is",
"active",
"."
] | def is_on(self):
"""Grid services is active."""
return self.coordinator.data[POWERWALL_API_GRID_SERVICES_ACTIVE] | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
"[",
"POWERWALL_API_GRID_SERVICES_ACTIVE",
"]"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/powerwall/binary_sensor.py#L125-L127 | |
exaile/exaile | a7b58996c5c15b3aa7b9975ac13ee8f784ef4689 | plugins/minimode/controls.py | python | RatingControl.do_rating_changed | (self, rating) | Updates the rating of the currently playing track | Updates the rating of the currently playing track | [
"Updates",
"the",
"rating",
"of",
"the",
"currently",
"playing",
"track"
] | def do_rating_changed(self, rating):
"""
Updates the rating of the currently playing track
"""
if player.PLAYER.current is not None:
player.PLAYER.current.set_rating(rating)
maximum = settings.get_option('rating/maximum', 5)
event.log_event('rating_cha... | [
"def",
"do_rating_changed",
"(",
"self",
",",
"rating",
")",
":",
"if",
"player",
".",
"PLAYER",
".",
"current",
"is",
"not",
"None",
":",
"player",
".",
"PLAYER",
".",
"current",
".",
"set_rating",
"(",
"rating",
")",
"maximum",
"=",
"settings",
".",
... | https://github.com/exaile/exaile/blob/a7b58996c5c15b3aa7b9975ac13ee8f784ef4689/plugins/minimode/controls.py#L562-L569 | ||
mcedit/pymclevel | 8bf7b3d76479e007a51f3055198a8bcddb626c84 | gprof2dot.py | python | Main.compress_function_name | (self, name) | return name | Compress function name according to the user preferences. | Compress function name according to the user preferences. | [
"Compress",
"function",
"name",
"according",
"to",
"the",
"user",
"preferences",
"."
] | def compress_function_name(self, name):
"""Compress function name according to the user preferences."""
if self.options.strip:
name = self.strip_function_name(name)
if self.options.wrap:
name = self.wrap_function_name(name)
# TODO: merge functions with same res... | [
"def",
"compress_function_name",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"options",
".",
"strip",
":",
"name",
"=",
"self",
".",
"strip_function_name",
"(",
"name",
")",
"if",
"self",
".",
"options",
".",
"wrap",
":",
"name",
"=",
"self"... | https://github.com/mcedit/pymclevel/blob/8bf7b3d76479e007a51f3055198a8bcddb626c84/gprof2dot.py#L2579-L2590 | |
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/models/speech_to_text_2/processing_speech_to_text_2.py | python | Speech2Text2Processor.from_pretrained | (cls, pretrained_model_name_or_path, **kwargs) | return cls(feature_extractor=feature_extractor, tokenizer=tokenizer) | r"""
Instantiate a [`Speech2Text2Processor`] from a pretrained Speech2Text2 processor.
<Tip>
This class method is simply calling AutoFeatureExtractor's [`~PreTrainedFeatureExtractor.from_pretrained`] and
Speech2Text2Tokenizer's [`~tokenization_utils_base.PreTrainedTokenizer.from_pretra... | r"""
Instantiate a [`Speech2Text2Processor`] from a pretrained Speech2Text2 processor. | [
"r",
"Instantiate",
"a",
"[",
"Speech2Text2Processor",
"]",
"from",
"a",
"pretrained",
"Speech2Text2",
"processor",
"."
] | def from_pretrained(cls, pretrained_model_name_or_path, **kwargs):
r"""
Instantiate a [`Speech2Text2Processor`] from a pretrained Speech2Text2 processor.
<Tip>
This class method is simply calling AutoFeatureExtractor's [`~PreTrainedFeatureExtractor.from_pretrained`] and
Speech2... | [
"def",
"from_pretrained",
"(",
"cls",
",",
"pretrained_model_name_or_path",
",",
"*",
"*",
"kwargs",
")",
":",
"feature_extractor",
"=",
"AutoFeatureExtractor",
".",
"from_pretrained",
"(",
"pretrained_model_name_or_path",
",",
"*",
"*",
"kwargs",
")",
"tokenizer",
... | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/speech_to_text_2/processing_speech_to_text_2.py#L78-L108 | |
AllenInstitute/bmtk | 9c02811a4e1e8695c25de658301d9477bb289298 | bmtk/simulator/core/simulation_config.py | python | SimulationConfig.build_env | (self, force=False) | Creates the folder(s) set in 'output' section, sets up logging and copies over the configuration | Creates the folder(s) set in 'output' section, sets up logging and copies over the configuration | [
"Creates",
"the",
"folder",
"(",
"s",
")",
"set",
"in",
"output",
"section",
"sets",
"up",
"logging",
"and",
"copies",
"over",
"the",
"configuration"
] | def build_env(self, force=False):
"""Creates the folder(s) set in 'output' section, sets up logging and copies over the configuration"""
if self.env_built and not force:
return
self._set_logging()
self.io.setup_output_dir(self.output_dir, self.log_file, self.overwrite_output... | [
"def",
"build_env",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"if",
"self",
".",
"env_built",
"and",
"not",
"force",
":",
"return",
"self",
".",
"_set_logging",
"(",
")",
"self",
".",
"io",
".",
"setup_output_dir",
"(",
"self",
".",
"output_di... | https://github.com/AllenInstitute/bmtk/blob/9c02811a4e1e8695c25de658301d9477bb289298/bmtk/simulator/core/simulation_config.py#L91-L99 | ||
fab-jul/imgcomp-cvpr | f03ce0bfa846f7ba1bf9b7ba415b082efe5c192c | code/other_codecs.py | python | bpg_image_info | (p) | Relevant format spec:
magic number 4 bytes
header stuff 2 bytes
width variable, ue7
height variable, ue7
picture_data_length variable, ue7. If zero: remaining data is image | Relevant format spec:
magic number 4 bytes
header stuff 2 bytes
width variable, ue7
height variable, ue7
picture_data_length variable, ue7. If zero: remaining data is image | [
"Relevant",
"format",
"spec",
":",
"magic",
"number",
"4",
"bytes",
"header",
"stuff",
"2",
"bytes",
"width",
"variable",
"ue7",
"height",
"variable",
"ue7",
"picture_data_length",
"variable",
"ue7",
".",
"If",
"zero",
":",
"remaining",
"data",
"is",
"image"
] | def bpg_image_info(p):
"""
Relevant format spec:
magic number 4 bytes
header stuff 2 bytes
width variable, ue7
height variable, ue7
picture_data_length variable, ue7. If zero: remaining data is image
"""
with open(p, 'rb') as f:
... | [
"def",
"bpg_image_info",
"(",
"p",
")",
":",
"with",
"open",
"(",
"p",
",",
"'rb'",
")",
"as",
"f",
":",
"magic",
"=",
"f",
".",
"read",
"(",
"4",
")",
"expected_magic",
"=",
"bytearray",
".",
"fromhex",
"(",
"'425047fb'",
")",
"assert",
"magic",
"... | https://github.com/fab-jul/imgcomp-cvpr/blob/f03ce0bfa846f7ba1bf9b7ba415b082efe5c192c/code/other_codecs.py#L422-L440 | ||
pydata/xarray | 9226c7ac87b3eb246f7a7e49f8f0f23d68951624 | xarray/core/indexing.py | python | create_mask | (indexer, shape, data=None) | return mask | Create a mask for indexing with a fill-value.
Parameters
----------
indexer : ExplicitIndexer
Indexer with -1 in integer or ndarray value to indicate locations in
the result that should be masked.
shape : tuple
Shape of the array being indexed.
data : optional
Data f... | Create a mask for indexing with a fill-value. | [
"Create",
"a",
"mask",
"for",
"indexing",
"with",
"a",
"fill",
"-",
"value",
"."
] | def create_mask(indexer, shape, data=None):
"""Create a mask for indexing with a fill-value.
Parameters
----------
indexer : ExplicitIndexer
Indexer with -1 in integer or ndarray value to indicate locations in
the result that should be masked.
shape : tuple
Shape of the arra... | [
"def",
"create_mask",
"(",
"indexer",
",",
"shape",
",",
"data",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"indexer",
",",
"OuterIndexer",
")",
":",
"key",
"=",
"_outer_to_vectorized_indexer",
"(",
"indexer",
",",
"shape",
")",
".",
"tuple",
"assert"... | https://github.com/pydata/xarray/blob/9226c7ac87b3eb246f7a7e49f8f0f23d68951624/xarray/core/indexing.py#L1014-L1056 | |
USEPA/WNTR | 2f92bab5736da6ef3591fc4b0229ec1ac6cd6fcc | wntr/network/model.py | python | LinkRegistry.psvs | (self) | Generator to get all PSVs
Yields
------
name : str
The name of the valve
link : PSValve
The valve object | Generator to get all PSVs
Yields
------
name : str
The name of the valve
link : PSValve
The valve object | [
"Generator",
"to",
"get",
"all",
"PSVs",
"Yields",
"------",
"name",
":",
"str",
"The",
"name",
"of",
"the",
"valve",
"link",
":",
"PSValve",
"The",
"valve",
"object"
] | def psvs(self):
"""Generator to get all PSVs
Yields
------
name : str
The name of the valve
link : PSValve
The valve object
"""
for name in self._psvs:
yield name, self._data[name] | [
"def",
"psvs",
"(",
"self",
")",
":",
"for",
"name",
"in",
"self",
".",
"_psvs",
":",
"yield",
"name",
",",
"self",
".",
"_data",
"[",
"name",
"]"
] | https://github.com/USEPA/WNTR/blob/2f92bab5736da6ef3591fc4b0229ec1ac6cd6fcc/wntr/network/model.py#L2547-L2559 | ||
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/twisted/python/util.py | python | IntervalDifferential.__init__ | (self, intervals, default=60) | @type intervals: C{list} of C{int}, C{long}, or C{float} param
@param intervals: The intervals between instants.
@type default: C{int}, C{long}, or C{float}
@param default: The duration to generate if the intervals list
becomes empty. | @type intervals: C{list} of C{int}, C{long}, or C{float} param
@param intervals: The intervals between instants. | [
"@type",
"intervals",
":",
"C",
"{",
"list",
"}",
"of",
"C",
"{",
"int",
"}",
"C",
"{",
"long",
"}",
"or",
"C",
"{",
"float",
"}",
"param",
"@param",
"intervals",
":",
"The",
"intervals",
"between",
"instants",
"."
] | def __init__(self, intervals, default=60):
"""
@type intervals: C{list} of C{int}, C{long}, or C{float} param
@param intervals: The intervals between instants.
@type default: C{int}, C{long}, or C{float}
@param default: The duration to generate if the intervals list
beco... | [
"def",
"__init__",
"(",
"self",
",",
"intervals",
",",
"default",
"=",
"60",
")",
":",
"self",
".",
"intervals",
"=",
"intervals",
"[",
":",
"]",
"self",
".",
"default",
"=",
"default"
] | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/util.py#L519-L529 | ||
dpressel/mead-baseline | 9987e6b37fa6525a4ddc187c305e292a718f59a9 | baseline/reader.py | python | IndexPairLabelReader.convert_to_example_single | (self, vocabs: Dict[str, str], text1: List[str], text2: List[str]) | return example_dict | Convert to a concatenated vector. Useful for BERT-style models
:param vocabs: Vocabs to use
:param text1: First text
:param text2: Second text
:return: An example dict | Convert to a concatenated vector. Useful for BERT-style models | [
"Convert",
"to",
"a",
"concatenated",
"vector",
".",
"Useful",
"for",
"BERT",
"-",
"style",
"models"
] | def convert_to_example_single(self, vocabs: Dict[str, str], text1: List[str], text2: List[str]) -> Dict[str, object]:
"""Convert to a concatenated vector. Useful for BERT-style models
:param vocabs: Vocabs to use
:param text1: First text
:param text2: Second text
:return: An ex... | [
"def",
"convert_to_example_single",
"(",
"self",
",",
"vocabs",
":",
"Dict",
"[",
"str",
",",
"str",
"]",
",",
"text1",
":",
"List",
"[",
"str",
"]",
",",
"text2",
":",
"List",
"[",
"str",
"]",
")",
"->",
"Dict",
"[",
"str",
",",
"object",
"]",
"... | https://github.com/dpressel/mead-baseline/blob/9987e6b37fa6525a4ddc187c305e292a718f59a9/baseline/reader.py#L1026-L1069 | |
bslatkin/effectivepython | 4ae6f3141291ea137eb29a245bf889dbc8091713 | example_code/item_39.py | python | PathInputData.read | (self) | [] | def read(self):
with open(self.path) as f:
return f.read() | [
"def",
"read",
"(",
"self",
")",
":",
"with",
"open",
"(",
"self",
".",
"path",
")",
"as",
"f",
":",
"return",
"f",
".",
"read",
"(",
")"
] | https://github.com/bslatkin/effectivepython/blob/4ae6f3141291ea137eb29a245bf889dbc8091713/example_code/item_39.py#L159-L161 | ||||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/computation/pytables.py | python | Expr.evaluate | (self) | return self.condition, self.filter | create and return the numexpr condition and filter | create and return the numexpr condition and filter | [
"create",
"and",
"return",
"the",
"numexpr",
"condition",
"and",
"filter"
] | def evaluate(self):
""" create and return the numexpr condition and filter """
try:
self.condition = self.terms.prune(ConditionBinOp)
except AttributeError:
raise ValueError("cannot process expression [{0}], [{1}] is not a "
"valid condition"... | [
"def",
"evaluate",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"condition",
"=",
"self",
".",
"terms",
".",
"prune",
"(",
"ConditionBinOp",
")",
"except",
"AttributeError",
":",
"raise",
"ValueError",
"(",
"\"cannot process expression [{0}], [{1}] is not a \""... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pandas-0.17.0-py3.3-win-amd64.egg/pandas/computation/pytables.py#L576-L590 | |
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | pypy/module/cpyext/cdatetime.py | python | _PyDate_FromDate | (space, year, month, day, w_type) | return space.call_function(
w_type,
space.newint(year), space.newint(month), space.newint(day)) | Return a datetime.date object with the specified year, month and day. | Return a datetime.date object with the specified year, month and day. | [
"Return",
"a",
"datetime",
".",
"date",
"object",
"with",
"the",
"specified",
"year",
"month",
"and",
"day",
"."
] | def _PyDate_FromDate(space, year, month, day, w_type):
"""Return a datetime.date object with the specified year, month and day.
"""
year = rffi.cast(lltype.Signed, year)
month = rffi.cast(lltype.Signed, month)
day = rffi.cast(lltype.Signed, day)
return space.call_function(
w_type,
... | [
"def",
"_PyDate_FromDate",
"(",
"space",
",",
"year",
",",
"month",
",",
"day",
",",
"w_type",
")",
":",
"year",
"=",
"rffi",
".",
"cast",
"(",
"lltype",
".",
"Signed",
",",
"year",
")",
"month",
"=",
"rffi",
".",
"cast",
"(",
"lltype",
".",
"Signe... | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/pypy/module/cpyext/cdatetime.py#L187-L195 | |
kaaedit/kaa | e6a8819a5ecba04b7db8303bd5736b5a7c9b822d | kaa/cursor.py | python | Cursor.refresh | (self, top=None, middle=None, bottom=None,
align_always=False) | [] | def refresh(self, top=None, middle=None, bottom=None,
align_always=False):
self.pos, y, x = self.wnd.locate_cursor(
self.pos, top=top, middle=middle, bottom=bottom,
align_always=align_always)
assert self.pos is not None
self.last_screenpos = (x, y) | [
"def",
"refresh",
"(",
"self",
",",
"top",
"=",
"None",
",",
"middle",
"=",
"None",
",",
"bottom",
"=",
"None",
",",
"align_always",
"=",
"False",
")",
":",
"self",
".",
"pos",
",",
"y",
",",
"x",
"=",
"self",
".",
"wnd",
".",
"locate_cursor",
"(... | https://github.com/kaaedit/kaa/blob/e6a8819a5ecba04b7db8303bd5736b5a7c9b822d/kaa/cursor.py#L10-L16 | ||||
Kozea/pygal | 8267b03535ff55789a30bf66b798302adad88623 | pygal/svg.py | python | Svg.serie | (self, serie) | return dict(
plot=self.node(
self.graph.nodes['plot'],
class_='series serie-%d color-%d' % (serie.index, serie.index)
),
overlay=self.node(
self.graph.nodes['overlay'],
class_='series serie-%d color-%d' % (serie.index, s... | Make serie node | Make serie node | [
"Make",
"serie",
"node"
] | def serie(self, serie):
"""Make serie node"""
return dict(
plot=self.node(
self.graph.nodes['plot'],
class_='series serie-%d color-%d' % (serie.index, serie.index)
),
overlay=self.node(
self.graph.nodes['overlay'],
... | [
"def",
"serie",
"(",
"self",
",",
"serie",
")",
":",
"return",
"dict",
"(",
"plot",
"=",
"self",
".",
"node",
"(",
"self",
".",
"graph",
".",
"nodes",
"[",
"'plot'",
"]",
",",
"class_",
"=",
"'series serie-%d color-%d'",
"%",
"(",
"serie",
".",
"inde... | https://github.com/Kozea/pygal/blob/8267b03535ff55789a30bf66b798302adad88623/pygal/svg.py#L225-L240 | |
floooh/fips | 5ce5aebfc7c69778cab03ef5f8830928f2bad6d4 | mod/tools/clion.py | python | write_workspace_settings | (fips_dir, proj_dir, cfg) | write the CLion *.xml files required to open the project | write the CLion *.xml files required to open the project | [
"write",
"the",
"CLion",
"*",
".",
"xml",
"files",
"required",
"to",
"open",
"the",
"project"
] | def write_workspace_settings(fips_dir, proj_dir, cfg):
'''write the CLion *.xml files required to open the project
'''
log.info("=== writing JetBrains CLion config files...")
clion_dir = proj_dir + '/.idea'
if not os.path.isdir(clion_dir):
os.makedirs(clion_dir)
write_clion_module_files(... | [
"def",
"write_workspace_settings",
"(",
"fips_dir",
",",
"proj_dir",
",",
"cfg",
")",
":",
"log",
".",
"info",
"(",
"\"=== writing JetBrains CLion config files...\"",
")",
"clion_dir",
"=",
"proj_dir",
"+",
"'/.idea'",
"if",
"not",
"os",
".",
"path",
".",
"isdir... | https://github.com/floooh/fips/blob/5ce5aebfc7c69778cab03ef5f8830928f2bad6d4/mod/tools/clion.py#L109-L117 | ||
Qiskit/qiskit-terra | b66030e3b9192efdd3eb95cf25c6545fe0a13da4 | qiskit/transpiler/coupling.py | python | CouplingMap.largest_connected_component | (self) | return max(rx.weakly_connected_components(self.graph), key=len) | Return a set of qubits in the largest connected component. | Return a set of qubits in the largest connected component. | [
"Return",
"a",
"set",
"of",
"qubits",
"in",
"the",
"largest",
"connected",
"component",
"."
] | def largest_connected_component(self):
"""Return a set of qubits in the largest connected component."""
return max(rx.weakly_connected_components(self.graph), key=len) | [
"def",
"largest_connected_component",
"(",
"self",
")",
":",
"return",
"max",
"(",
"rx",
".",
"weakly_connected_components",
"(",
"self",
".",
"graph",
")",
",",
"key",
"=",
"len",
")"
] | https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/transpiler/coupling.py#L396-L398 | |
freqtrade/freqtrade | 13651fd3be8d5ce8dcd7c94b920bda4e00b75aca | freqtrade/exchange/exchange.py | python | Exchange._init_ccxt | (self, exchange_config: Dict[str, Any], ccxt_module: CcxtModuleType = ccxt,
ccxt_kwargs: Dict = {}) | return api | Initialize ccxt with given config and return valid
ccxt instance. | Initialize ccxt with given config and return valid
ccxt instance. | [
"Initialize",
"ccxt",
"with",
"given",
"config",
"and",
"return",
"valid",
"ccxt",
"instance",
"."
] | def _init_ccxt(self, exchange_config: Dict[str, Any], ccxt_module: CcxtModuleType = ccxt,
ccxt_kwargs: Dict = {}) -> ccxt.Exchange:
"""
Initialize ccxt with given config and return valid
ccxt instance.
"""
# Find matching class for the given exchange name
... | [
"def",
"_init_ccxt",
"(",
"self",
",",
"exchange_config",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
",",
"ccxt_module",
":",
"CcxtModuleType",
"=",
"ccxt",
",",
"ccxt_kwargs",
":",
"Dict",
"=",
"{",
"}",
")",
"->",
"ccxt",
".",
"Exchange",
":",
"# Find... | https://github.com/freqtrade/freqtrade/blob/13651fd3be8d5ce8dcd7c94b920bda4e00b75aca/freqtrade/exchange/exchange.py#L182-L217 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/Lib/smtplib.py | python | SMTP.rcpt | (self, recip, options=[]) | return self.getreply() | SMTP 'rcpt' command -- indicates 1 recipient for this mail. | SMTP 'rcpt' command -- indicates 1 recipient for this mail. | [
"SMTP",
"rcpt",
"command",
"--",
"indicates",
"1",
"recipient",
"for",
"this",
"mail",
"."
] | def rcpt(self, recip, options=[]):
"""SMTP 'rcpt' command -- indicates 1 recipient for this mail."""
optionlist = ''
if options and self.does_esmtp:
optionlist = ' ' + ' '.join(options)
self.putcmd("rcpt", "TO:%s%s" % (quoteaddr(recip), optionlist))
return self.getrep... | [
"def",
"rcpt",
"(",
"self",
",",
"recip",
",",
"options",
"=",
"[",
"]",
")",
":",
"optionlist",
"=",
"''",
"if",
"options",
"and",
"self",
".",
"does_esmtp",
":",
"optionlist",
"=",
"' '",
"+",
"' '",
".",
"join",
"(",
"options",
")",
"self",
".",... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/smtplib.py#L465-L471 | |
AlessandroZ/LaZagne | 30623c9138e2387d10f6631007f954f2a4ead06d | Windows/lazagne/config/DPAPI/masterkey.py | python | MasterKeyPool.get_password | (self, guid) | return self.keys.get(guid, {}).get('password') | Returns the password found corresponding to the given GUID. | Returns the password found corresponding to the given GUID. | [
"Returns",
"the",
"password",
"found",
"corresponding",
"to",
"the",
"given",
"GUID",
"."
] | def get_password(self, guid):
"""
Returns the password found corresponding to the given GUID.
"""
return self.keys.get(guid, {}).get('password') | [
"def",
"get_password",
"(",
"self",
",",
"guid",
")",
":",
"return",
"self",
".",
"keys",
".",
"get",
"(",
"guid",
",",
"{",
"}",
")",
".",
"get",
"(",
"'password'",
")"
] | https://github.com/AlessandroZ/LaZagne/blob/30623c9138e2387d10f6631007f954f2a4ead06d/Windows/lazagne/config/DPAPI/masterkey.py#L278-L282 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/ndimage/_ni_support.py | python | _normalize_sequence | (input, rank) | return normalized | If input is a scalar, create a sequence of length equal to the
rank by duplicating the input. If input is a sequence,
check if its length is equal to the length of array. | If input is a scalar, create a sequence of length equal to the
rank by duplicating the input. If input is a sequence,
check if its length is equal to the length of array. | [
"If",
"input",
"is",
"a",
"scalar",
"create",
"a",
"sequence",
"of",
"length",
"equal",
"to",
"the",
"rank",
"by",
"duplicating",
"the",
"input",
".",
"If",
"input",
"is",
"a",
"sequence",
"check",
"if",
"its",
"length",
"is",
"equal",
"to",
"the",
"le... | def _normalize_sequence(input, rank):
"""If input is a scalar, create a sequence of length equal to the
rank by duplicating the input. If input is a sequence,
check if its length is equal to the length of array.
"""
is_str = isinstance(input, string_types)
if hasattr(input, '__iter__') and not i... | [
"def",
"_normalize_sequence",
"(",
"input",
",",
"rank",
")",
":",
"is_str",
"=",
"isinstance",
"(",
"input",
",",
"string_types",
")",
"if",
"hasattr",
"(",
"input",
",",
"'__iter__'",
")",
"and",
"not",
"is_str",
":",
"normalized",
"=",
"list",
"(",
"i... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/ndimage/_ni_support.py#L55-L68 | |
aiidateam/aiida-core | c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2 | aiida/orm/nodes/data/array/projection.py | python | ProjectionData.set_orbitals | (self, **kwargs) | This method is inherited from OrbitalData, but is blocked here.
If used will raise a NotImplementedError | This method is inherited from OrbitalData, but is blocked here.
If used will raise a NotImplementedError | [
"This",
"method",
"is",
"inherited",
"from",
"OrbitalData",
"but",
"is",
"blocked",
"here",
".",
"If",
"used",
"will",
"raise",
"a",
"NotImplementedError"
] | def set_orbitals(self, **kwargs): # pylint: disable=arguments-differ
"""
This method is inherited from OrbitalData, but is blocked here.
If used will raise a NotImplementedError
"""
raise NotImplementedError(
'You cannot set orbitals using this class!'
' ... | [
"def",
"set_orbitals",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=arguments-differ",
"raise",
"NotImplementedError",
"(",
"'You cannot set orbitals using this class!'",
"' This class is for setting orbitals and '",
"' projections only!'",
")"
] | https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/orm/nodes/data/array/projection.py#L293-L302 | ||
jbjorne/TEES | caf19a4a1352ac59f5dc13a8684cc42ce4342d9d | configure.py | python | buildMenus | () | return "Configure TEES" | [] | def buildMenus():
Menu("Classifier", None, [
Option("1", "Compile from source", toggle=False),
Option("i", "Install", handler=Classifiers.SVMMultiClassClassifier.install),
Option("s", "Skip")],
svmMenuInitializer)
Menu("Install Directory", None, [
Option("1", "Cha... | [
"def",
"buildMenus",
"(",
")",
":",
"Menu",
"(",
"\"Classifier\"",
",",
"None",
",",
"[",
"Option",
"(",
"\"1\"",
",",
"\"Compile from source\"",
",",
"toggle",
"=",
"False",
")",
",",
"Option",
"(",
"\"i\"",
",",
"\"Install\"",
",",
"handler",
"=",
"Cla... | https://github.com/jbjorne/TEES/blob/caf19a4a1352ac59f5dc13a8684cc42ce4342d9d/configure.py#L313-L403 | |||
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/CPython/27/Lib/lib-tk/ttk.py | python | Treeview.see | (self, item) | Ensure that item is visible.
Sets all of item's ancestors open option to True, and scrolls
the widget if necessary so that item is within the visible
portion of the tree. | Ensure that item is visible. | [
"Ensure",
"that",
"item",
"is",
"visible",
"."
] | def see(self, item):
"""Ensure that item is visible.
Sets all of item's ancestors open option to True, and scrolls
the widget if necessary so that item is within the visible
portion of the tree."""
self.tk.call(self._w, "see", item) | [
"def",
"see",
"(",
"self",
",",
"item",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"\"see\"",
",",
"item",
")"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/lib-tk/ttk.py#L1408-L1414 | ||
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/django_wsgiserver/wsgiserver/wsgiserver2.py | python | WSGIGateway_10.get_environ | (self) | return env | Return a new environ dict targeting the given wsgi.version | Return a new environ dict targeting the given wsgi.version | [
"Return",
"a",
"new",
"environ",
"dict",
"targeting",
"the",
"given",
"wsgi",
".",
"version"
] | def get_environ(self):
"""Return a new environ dict targeting the given wsgi.version"""
req = self.req
env = {
# set a non-standard environ entry so the WSGI app can know what
# the *real* server protocol is (and what features to support).
# See http://www.faq... | [
"def",
"get_environ",
"(",
"self",
")",
":",
"req",
"=",
"self",
".",
"req",
"env",
"=",
"{",
"# set a non-standard environ entry so the WSGI app can know what",
"# the *real* server protocol is (and what features to support).",
"# See http://www.faqs.org/rfcs/rfc2145.html.",
"'ACT... | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django_wsgiserver/wsgiserver/wsgiserver2.py#L2233-L2283 | |
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/ssl.py | python | SSLObject.session | (self) | return self._sslobj.session | The SSLSession for client socket. | The SSLSession for client socket. | [
"The",
"SSLSession",
"for",
"client",
"socket",
"."
] | def session(self):
"""The SSLSession for client socket."""
return self._sslobj.session | [
"def",
"session",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sslobj",
".",
"session"
] | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/ssl.py#L855-L857 | |
pypa/pip | 7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4 | src/pip/_vendor/distlib/_backport/tarfile.py | python | _Stream.write | (self, s) | Write string s to the stream. | Write string s to the stream. | [
"Write",
"string",
"s",
"to",
"the",
"stream",
"."
] | def write(self, s):
"""Write string s to the stream.
"""
if self.comptype == "gz":
self.crc = self.zlib.crc32(s, self.crc)
self.pos += len(s)
if self.comptype != "tar":
s = self.cmp.compress(s)
self.__write(s) | [
"def",
"write",
"(",
"self",
",",
"s",
")",
":",
"if",
"self",
".",
"comptype",
"==",
"\"gz\"",
":",
"self",
".",
"crc",
"=",
"self",
".",
"zlib",
".",
"crc32",
"(",
"s",
",",
"self",
".",
"crc",
")",
"self",
".",
"pos",
"+=",
"len",
"(",
"s"... | https://github.com/pypa/pip/blob/7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4/src/pip/_vendor/distlib/_backport/tarfile.py#L469-L477 | ||
inspurer/WorkAttendanceSystem | 1221e2d67bdf5bb15fe99517cc3ded58ccb066df | V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/html5lib/_inputstream.py | python | EncodingBytes.skip | (self, chars=spaceCharactersBytes) | return None | Skip past a list of characters | Skip past a list of characters | [
"Skip",
"past",
"a",
"list",
"of",
"characters"
] | def skip(self, chars=spaceCharactersBytes):
"""Skip past a list of characters"""
p = self.position # use property for the error-checking
while p < len(self):
c = self[p:p + 1]
if c not in chars:
self._position = p
return c
... | [
"def",
"skip",
"(",
"self",
",",
"chars",
"=",
"spaceCharactersBytes",
")",
":",
"p",
"=",
"self",
".",
"position",
"# use property for the error-checking",
"while",
"p",
"<",
"len",
"(",
"self",
")",
":",
"c",
"=",
"self",
"[",
"p",
":",
"p",
"+",
"1"... | https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/html5lib/_inputstream.py#L640-L650 | |
git-cola/git-cola | b48b8028e0c3baf47faf7b074b9773737358163d | cola/widgets/standard.py | python | WidgetMixin.__init__ | (self) | [] | def __init__(self):
self._unmaximized_rect = {} | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_unmaximized_rect",
"=",
"{",
"}"
] | https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/widgets/standard.py#L28-L29 | ||||
google/clusterfuzz | f358af24f414daa17a3649b143e71ea71871ef59 | src/clusterfuzz/_internal/config/db_config.py | python | get_value_for_job | (data, target_job_type) | return result | Parses a value for a particular job type. If job type is not found,
return the default value. | Parses a value for a particular job type. If job type is not found,
return the default value. | [
"Parses",
"a",
"value",
"for",
"a",
"particular",
"job",
"type",
".",
"If",
"job",
"type",
"is",
"not",
"found",
"return",
"the",
"default",
"value",
"."
] | def get_value_for_job(data, target_job_type):
"""Parses a value for a particular job type. If job type is not found,
return the default value."""
# All data is in a single line, just return that.
if ';' not in data:
return data
result = ''
for line in data.splitlines():
job_type, value = (line.stri... | [
"def",
"get_value_for_job",
"(",
"data",
",",
"target_job_type",
")",
":",
"# All data is in a single line, just return that.",
"if",
"';'",
"not",
"in",
"data",
":",
"return",
"data",
"result",
"=",
"''",
"for",
"line",
"in",
"data",
".",
"splitlines",
"(",
")"... | https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/clusterfuzz/_internal/config/db_config.py#L49-L62 | |
CvvT/dumpDex | 92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1 | python/idaapi.py | python | unregister_custom_data_format | (*args) | return _idaapi.unregister_custom_data_format(*args) | unregister_custom_data_format(dtid, dfid) -> bool
Unregisters a custom data format
@param dtid: data type id
@param dfid: data format id
@return: Boolean | unregister_custom_data_format(dtid, dfid) -> bool | [
"unregister_custom_data_format",
"(",
"dtid",
"dfid",
")",
"-",
">",
"bool"
] | def unregister_custom_data_format(*args):
"""
unregister_custom_data_format(dtid, dfid) -> bool
Unregisters a custom data format
@param dtid: data type id
@param dfid: data format id
@return: Boolean
"""
return _idaapi.unregister_custom_data_format(*args) | [
"def",
"unregister_custom_data_format",
"(",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"unregister_custom_data_format",
"(",
"*",
"args",
")"
] | https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L23430-L23440 | |
ganeti/ganeti | d340a9ddd12f501bef57da421b5f9b969a4ba905 | lib/cli_opts.py | python | _SplitKeyVal | (opt, data, parse_prefixes) | return kv_dict | Convert a KeyVal string into a dict.
This function will convert a key=val[,...] string into a dict. Empty
values will be converted specially: keys which have the prefix 'no_'
will have the value=False and the prefix stripped, keys with the prefix
"-" will have value=None and the prefix stripped, and the others... | Convert a KeyVal string into a dict. | [
"Convert",
"a",
"KeyVal",
"string",
"into",
"a",
"dict",
"."
] | def _SplitKeyVal(opt, data, parse_prefixes):
"""Convert a KeyVal string into a dict.
This function will convert a key=val[,...] string into a dict. Empty
values will be converted specially: keys which have the prefix 'no_'
will have the value=False and the prefix stripped, keys with the prefix
"-" will have ... | [
"def",
"_SplitKeyVal",
"(",
"opt",
",",
"data",
",",
"parse_prefixes",
")",
":",
"kv_dict",
"=",
"{",
"}",
"if",
"data",
":",
"for",
"elem",
"in",
"utils",
".",
"UnescapeAndSplit",
"(",
"data",
",",
"sep",
"=",
"\",\"",
")",
":",
"if",
"\"=\"",
"in",... | https://github.com/ganeti/ganeti/blob/d340a9ddd12f501bef57da421b5f9b969a4ba905/lib/cli_opts.py#L297-L337 | |
keiffster/program-y | 8c99b56f8c32f01a7b9887b5daae9465619d0385 | src/programy/storage/stores/sql/store/lookups.py | python | SQLLookupsStore.process_line | (self, name, fields, verbose=False) | return False | [] | def process_line(self, name, fields, verbose=False):
if fields and len(fields) == 2:
result = self.add_to_lookup(fields[0].upper(), fields[1].upper())
if verbose is True:
outputLog(self, "Key=[%s], Value={%s]" % (fields[0].upper(), fields[1].upper()))
return r... | [
"def",
"process_line",
"(",
"self",
",",
"name",
",",
"fields",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"fields",
"and",
"len",
"(",
"fields",
")",
"==",
"2",
":",
"result",
"=",
"self",
".",
"add_to_lookup",
"(",
"fields",
"[",
"0",
"]",
"."... | https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/storage/stores/sql/store/lookups.py#L88-L94 | |||
merkremont/LineVodka | c2fa74107cecf00dd17416b62e4eb579e2c7bbaf | LineAlpha/LineThrift/TalkService.py | python | Client.sendChatChecked | (self, seq, consumer, lastMessageId) | Parameters:
- seq
- consumer
- lastMessageId | Parameters:
- seq
- consumer
- lastMessageId | [
"Parameters",
":",
"-",
"seq",
"-",
"consumer",
"-",
"lastMessageId"
] | def sendChatChecked(self, seq, consumer, lastMessageId):
"""
Parameters:
- seq
- consumer
- lastMessageId
"""
self.send_sendChatChecked(seq, consumer, lastMessageId)
self.recv_sendChatChecked() | [
"def",
"sendChatChecked",
"(",
"self",
",",
"seq",
",",
"consumer",
",",
"lastMessageId",
")",
":",
"self",
".",
"send_sendChatChecked",
"(",
"seq",
",",
"consumer",
",",
"lastMessageId",
")",
"self",
".",
"recv_sendChatChecked",
"(",
")"
] | https://github.com/merkremont/LineVodka/blob/c2fa74107cecf00dd17416b62e4eb579e2c7bbaf/LineAlpha/LineThrift/TalkService.py#L6357-L6365 | ||
uqfoundation/dill | 1094a28f685a330181e6894d0294509b1da08f3c | dill/source.py | python | _namespace | (obj) | return qual | _namespace(obj); return namespace hierarchy (as a list of names)
for the given object. For an instance, find the class hierarchy.
For example:
>>> from functools import partial
>>> p = partial(int, base=2)
>>> _namespace(p)
[\'functools\', \'partial\'] | _namespace(obj); return namespace hierarchy (as a list of names)
for the given object. For an instance, find the class hierarchy. | [
"_namespace",
"(",
"obj",
")",
";",
"return",
"namespace",
"hierarchy",
"(",
"as",
"a",
"list",
"of",
"names",
")",
"for",
"the",
"given",
"object",
".",
"For",
"an",
"instance",
"find",
"the",
"class",
"hierarchy",
"."
] | def _namespace(obj):
"""_namespace(obj); return namespace hierarchy (as a list of names)
for the given object. For an instance, find the class hierarchy.
For example:
>>> from functools import partial
>>> p = partial(int, base=2)
>>> _namespace(p)
[\'functools\', \'partial\']
"""
... | [
"def",
"_namespace",
"(",
"obj",
")",
":",
"# mostly for functions and modules and such",
"#FIXME: 'wrong' for decorators and curried functions",
"try",
":",
"#XXX: needs some work and testing on different types",
"module",
"=",
"qual",
"=",
"str",
"(",
"getmodule",
"(",
"obj",... | https://github.com/uqfoundation/dill/blob/1094a28f685a330181e6894d0294509b1da08f3c/dill/source.py#L633-L672 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_openshift_3.2/library/oadm_router.py | python | Yedit.read | (self) | return contents | read from file | read from file | [
"read",
"from",
"file"
] | def read(self):
''' read from file '''
# check if it exists
if self.filename == None or not self.file_exists():
return None
contents = None
with open(self.filename) as yfd:
contents = yfd.read()
return contents | [
"def",
"read",
"(",
"self",
")",
":",
"# check if it exists",
"if",
"self",
".",
"filename",
"==",
"None",
"or",
"not",
"self",
".",
"file_exists",
"(",
")",
":",
"return",
"None",
"contents",
"=",
"None",
"with",
"open",
"(",
"self",
".",
"filename",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_openshift_3.2/library/oadm_router.py#L671-L681 | |
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | src/oci/bds/bds_client.py | python | BdsClient.delete_bds_metastore_configuration | (self, bds_instance_id, metastore_config_id, **kwargs) | Delete the BDS metastore configuration represented by the provided ID.
:param str bds_instance_id: (required)
The OCID of the cluster.
:param str metastore_config_id: (required)
The metastore configuration ID
:param str opc_request_id: (optional)
The clien... | Delete the BDS metastore configuration represented by the provided ID. | [
"Delete",
"the",
"BDS",
"metastore",
"configuration",
"represented",
"by",
"the",
"provided",
"ID",
"."
] | def delete_bds_metastore_configuration(self, bds_instance_id, metastore_config_id, **kwargs):
"""
Delete the BDS metastore configuration represented by the provided ID.
:param str bds_instance_id: (required)
The OCID of the cluster.
:param str metastore_config_id: (require... | [
"def",
"delete_bds_metastore_configuration",
"(",
"self",
",",
"bds_instance_id",
",",
"metastore_config_id",
",",
"*",
"*",
"kwargs",
")",
":",
"resource_path",
"=",
"\"/bdsInstances/{bdsInstanceId}/metastoreConfigs/{metastoreConfigId}\"",
"method",
"=",
"\"DELETE\"",
"# Don... | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/bds/bds_client.py#L1249-L1337 | ||
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/cookielib.py | python | request_host | (request) | return host.lower() | Return request-host, as defined by RFC 2965.
Variation from RFC: returned value is lowercased, for convenient
comparison. | Return request-host, as defined by RFC 2965. | [
"Return",
"request",
"-",
"host",
"as",
"defined",
"by",
"RFC",
"2965",
"."
] | def request_host(request):
"""Return request-host, as defined by RFC 2965.
Variation from RFC: returned value is lowercased, for convenient
comparison.
"""
url = request.get_full_url()
host = urlparse.urlparse(url)[1]
if host == "":
host = request.get_header("Host", "")
# remo... | [
"def",
"request_host",
"(",
"request",
")",
":",
"url",
"=",
"request",
".",
"get_full_url",
"(",
")",
"host",
"=",
"urlparse",
".",
"urlparse",
"(",
"url",
")",
"[",
"1",
"]",
"if",
"host",
"==",
"\"\"",
":",
"host",
"=",
"request",
".",
"get_header... | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/cookielib.py#L598-L612 | |
dmitry-k/yandex_smart_home | 9d068203d80891bc946618a4cc0a435ee9184d74 | custom_components/yandex_smart_home/capability_mode.py | python | ModeCapability.supported | (self) | return bool(self.supported_yandex_modes) | Test if capability is supported. | Test if capability is supported. | [
"Test",
"if",
"capability",
"is",
"supported",
"."
] | def supported(self) -> bool:
"""Test if capability is supported."""
return bool(self.supported_yandex_modes) | [
"def",
"supported",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"self",
".",
"supported_yandex_modes",
")"
] | https://github.com/dmitry-k/yandex_smart_home/blob/9d068203d80891bc946618a4cc0a435ee9184d74/custom_components/yandex_smart_home/capability_mode.py#L35-L37 | |
graalvm/mx | 29c0debab406352df3af246be2f8973be5db69ae | mx.py | python | _tmpPomFile | (dist, versionGetter, validateMetadata='none') | return tmp.name | [] | def _tmpPomFile(dist, versionGetter, validateMetadata='none'):
tmp = tempfile.NamedTemporaryFile('w', suffix='.pom', delete=False)
tmp.write(_genPom(dist, versionGetter, validateMetadata))
tmp.close()
return tmp.name | [
"def",
"_tmpPomFile",
"(",
"dist",
",",
"versionGetter",
",",
"validateMetadata",
"=",
"'none'",
")",
":",
"tmp",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"'w'",
",",
"suffix",
"=",
"'.pom'",
",",
"delete",
"=",
"False",
")",
"tmp",
".",
"write",
... | https://github.com/graalvm/mx/blob/29c0debab406352df3af246be2f8973be5db69ae/mx.py#L11138-L11142 | |||
PaddlePaddle/PaddleSpeech | 26524031d242876b7fdb71582b0b3a7ea45c7d9d | dataset/thchs30/thchs30.py | python | prepare_dataset | (url, md5sum, target_dir, manifest_path, subset) | Download, unpack and create manifest file. | Download, unpack and create manifest file. | [
"Download",
"unpack",
"and",
"create",
"manifest",
"file",
"."
] | def prepare_dataset(url, md5sum, target_dir, manifest_path, subset):
"""Download, unpack and create manifest file."""
datadir = os.path.join(target_dir, subset)
if not os.path.exists(datadir):
filepath = download(url, md5sum, target_dir)
unpack(filepath, target_dir)
else:
print("... | [
"def",
"prepare_dataset",
"(",
"url",
",",
"md5sum",
",",
"target_dir",
",",
"manifest_path",
",",
"subset",
")",
":",
"datadir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"target_dir",
",",
"subset",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",... | https://github.com/PaddlePaddle/PaddleSpeech/blob/26524031d242876b7fdb71582b0b3a7ea45c7d9d/dataset/thchs30/thchs30.py#L156-L167 | ||
determined-ai/determined | f637264493acc14f12e66550cb51c520b5d27f6c | harness/determined/tensorboard/util.py | python | find_tb_files | (base_dir: pathlib.Path) | return [file for filetype in tb_file_types for file in base_dir.rglob(filetype)] | Recursively searches through base_dir and subdirectories to find files
needed by Tensorboard, currently matching by filenames and extensions.
This method is used to sync files generated during training to persistent storage.
:param base_dir: starting directory path
:return: list of filepaths within bas... | Recursively searches through base_dir and subdirectories to find files
needed by Tensorboard, currently matching by filenames and extensions.
This method is used to sync files generated during training to persistent storage. | [
"Recursively",
"searches",
"through",
"base_dir",
"and",
"subdirectories",
"to",
"find",
"files",
"needed",
"by",
"Tensorboard",
"currently",
"matching",
"by",
"filenames",
"and",
"extensions",
".",
"This",
"method",
"is",
"used",
"to",
"sync",
"files",
"generated... | def find_tb_files(base_dir: pathlib.Path) -> List[pathlib.Path]:
"""
Recursively searches through base_dir and subdirectories to find files
needed by Tensorboard, currently matching by filenames and extensions.
This method is used to sync files generated during training to persistent storage.
:para... | [
"def",
"find_tb_files",
"(",
"base_dir",
":",
"pathlib",
".",
"Path",
")",
"->",
"List",
"[",
"pathlib",
".",
"Path",
"]",
":",
"if",
"not",
"base_dir",
".",
"exists",
"(",
")",
":",
"logging",
".",
"warning",
"(",
"f\"{base_dir} directory does not exist.\""... | https://github.com/determined-ai/determined/blob/f637264493acc14f12e66550cb51c520b5d27f6c/harness/determined/tensorboard/util.py#L14-L28 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/chat/v2/service/user/user_binding.py | python | UserBindingInstance.fetch | (self) | return self._proxy.fetch() | Fetch the UserBindingInstance
:returns: The fetched UserBindingInstance
:rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance | Fetch the UserBindingInstance | [
"Fetch",
"the",
"UserBindingInstance"
] | def fetch(self):
"""
Fetch the UserBindingInstance
:returns: The fetched UserBindingInstance
:rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingInstance
"""
return self._proxy.fetch() | [
"def",
"fetch",
"(",
"self",
")",
":",
"return",
"self",
".",
"_proxy",
".",
"fetch",
"(",
")"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/chat/v2/service/user/user_binding.py#L420-L427 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.