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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/twisted/web/xmlrpc.py | python | Proxy.callRemote | (self, method, *args) | return factory.deferred | Call remote XML-RPC C{method} with given arguments.
@return: a L{defer.Deferred} that will fire with the method response,
or a failure if the method failed. Generally, the failure type will
be L{Fault}, but you can also have an C{IndexError} on some buggy
servers giving empt... | Call remote XML-RPC C{method} with given arguments. | [
"Call",
"remote",
"XML",
"-",
"RPC",
"C",
"{",
"method",
"}",
"with",
"given",
"arguments",
"."
] | def callRemote(self, method, *args):
"""
Call remote XML-RPC C{method} with given arguments.
@return: a L{defer.Deferred} that will fire with the method response,
or a failure if the method failed. Generally, the failure type will
be L{Fault}, but you can also have an C{... | [
"def",
"callRemote",
"(",
"self",
",",
"method",
",",
"*",
"args",
")",
":",
"def",
"cancel",
"(",
"d",
")",
":",
"factory",
".",
"deferred",
"=",
"None",
"connector",
".",
"disconnect",
"(",
")",
"factory",
"=",
"self",
".",
"queryFactory",
"(",
"se... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/web/xmlrpc.py#L555-L585 | |
nilearn/nilearn | 9edba4471747efacf21260bf470a346307f52706 | nilearn/externals/tempita/__init__.py | python | TemplateObjectGetter.__init__ | (self, template_obj) | [] | def __init__(self, template_obj):
self.__template_obj = template_obj | [
"def",
"__init__",
"(",
"self",
",",
"template_obj",
")",
":",
"self",
".",
"__template_obj",
"=",
"template_obj"
] | https://github.com/nilearn/nilearn/blob/9edba4471747efacf21260bf470a346307f52706/nilearn/externals/tempita/__init__.py#L611-L612 | ||||
Calysto/calysto_scheme | 15bf81987870bcae1264e5a0a06feb9a8ee12b8b | calysto_scheme/scheme.py | python | b_cont2_9_d | (name, formals, info, k) | [] | def b_cont2_9_d(name, formals, info, k):
if (False if (((list_q(formals)) and (not(association_q(formals)))) is False) else True):
GLOBALS['value1_reg'] = trace_lambda_aexp(name, formals, value1_reg, info)
GLOBALS['k_reg'] = k
GLOBALS['pc'] = apply_cont2
else:
GLOBALS['value1_reg... | [
"def",
"b_cont2_9_d",
"(",
"name",
",",
"formals",
",",
"info",
",",
"k",
")",
":",
"if",
"(",
"False",
"if",
"(",
"(",
"(",
"list_q",
"(",
"formals",
")",
")",
"and",
"(",
"not",
"(",
"association_q",
"(",
"formals",
")",
")",
")",
")",
"is",
... | https://github.com/Calysto/calysto_scheme/blob/15bf81987870bcae1264e5a0a06feb9a8ee12b8b/calysto_scheme/scheme.py#L2381-L2389 | ||||
mongodb/mongo-python-driver | c760f900f2e4109a247c2ffc8ad3549362007772 | bson/__init__.py | python | _encode_int | (name, value, dummy0, dummy1) | Encode a python int. | Encode a python int. | [
"Encode",
"a",
"python",
"int",
"."
] | def _encode_int(name, value, dummy0, dummy1):
"""Encode a python int."""
if -2147483648 <= value <= 2147483647:
return b"\x10" + name + _PACK_INT(value)
else:
try:
return b"\x12" + name + _PACK_LONG(value)
except struct.error:
raise OverflowError("BSON can onl... | [
"def",
"_encode_int",
"(",
"name",
",",
"value",
",",
"dummy0",
",",
"dummy1",
")",
":",
"if",
"-",
"2147483648",
"<=",
"value",
"<=",
"2147483647",
":",
"return",
"b\"\\x10\"",
"+",
"name",
"+",
"_PACK_INT",
"(",
"value",
")",
"else",
":",
"try",
":",... | https://github.com/mongodb/mongo-python-driver/blob/c760f900f2e4109a247c2ffc8ad3549362007772/bson/__init__.py#L640-L648 | ||
rpm-software-management/dnf | a96abad2cde8c46f7f36d7774d9d86f2d94715db | dnf/cli/term.py | python | Term.sub_mode | (self, haystack, mode, needles, **kwds) | return self.sub_norm(haystack, self.MODE[mode], needles, **kwds) | Search the string *haystack* for all occurrences of any
string in the list *needles*. Prefix each occurrence with
self.MODE[*mode*], and postfix each occurrence with
self.MODE['normal'], then return the modified string. This
will return a string that when printed to the terminal will
... | Search the string *haystack* for all occurrences of any
string in the list *needles*. Prefix each occurrence with
self.MODE[*mode*], and postfix each occurrence with
self.MODE['normal'], then return the modified string. This
will return a string that when printed to the terminal will
... | [
"Search",
"the",
"string",
"*",
"haystack",
"*",
"for",
"all",
"occurrences",
"of",
"any",
"string",
"in",
"the",
"list",
"*",
"needles",
"*",
".",
"Prefix",
"each",
"occurrence",
"with",
"self",
".",
"MODE",
"[",
"*",
"mode",
"*",
"]",
"and",
"postfix... | def sub_mode(self, haystack, mode, needles, **kwds):
"""Search the string *haystack* for all occurrences of any
string in the list *needles*. Prefix each occurrence with
self.MODE[*mode*], and postfix each occurrence with
self.MODE['normal'], then return the modified string. This
... | [
"def",
"sub_mode",
"(",
"self",
",",
"haystack",
",",
"mode",
",",
"needles",
",",
"*",
"*",
"kwds",
")",
":",
"return",
"self",
".",
"sub_norm",
"(",
"haystack",
",",
"self",
".",
"MODE",
"[",
"mode",
"]",
",",
"needles",
",",
"*",
"*",
"kwds",
... | https://github.com/rpm-software-management/dnf/blob/a96abad2cde8c46f7f36d7774d9d86f2d94715db/dnf/cli/term.py#L313-L331 | |
Pyomo/pyomo | dbd4faee151084f343b893cc2b0c04cf2b76fd92 | pyomo/contrib/fbbt/interval.py | python | inv | (xl, xu, feasibility_tol) | return lb, ub | The case where xl is very slightly positive but should be very slightly negative (or xu is very slightly negative
but should be very slightly positive) should not be an issue. Suppose xu is 2 and xl is 1e-15 but should be -1e-15.
The bounds obtained from this function will be [0.5, 1e15] or [0.5, inf), dependin... | The case where xl is very slightly positive but should be very slightly negative (or xu is very slightly negative
but should be very slightly positive) should not be an issue. Suppose xu is 2 and xl is 1e-15 but should be -1e-15.
The bounds obtained from this function will be [0.5, 1e15] or [0.5, inf), dependin... | [
"The",
"case",
"where",
"xl",
"is",
"very",
"slightly",
"positive",
"but",
"should",
"be",
"very",
"slightly",
"negative",
"(",
"or",
"xu",
"is",
"very",
"slightly",
"negative",
"but",
"should",
"be",
"very",
"slightly",
"positive",
")",
"should",
"not",
"... | def inv(xl, xu, feasibility_tol):
"""
The case where xl is very slightly positive but should be very slightly negative (or xu is very slightly negative
but should be very slightly positive) should not be an issue. Suppose xu is 2 and xl is 1e-15 but should be -1e-15.
The bounds obtained from this functi... | [
"def",
"inv",
"(",
"xl",
",",
"xu",
",",
"feasibility_tol",
")",
":",
"if",
"xu",
"-",
"xl",
"<=",
"-",
"feasibility_tol",
":",
"raise",
"InfeasibleConstraintException",
"(",
"f'lower bound is greater than upper bound in inv; xl: {xl}; xu: {xu}'",
")",
"elif",
"xu",
... | https://github.com/Pyomo/pyomo/blob/dbd4faee151084f343b893cc2b0c04cf2b76fd92/pyomo/contrib/fbbt/interval.py#L42-L79 | |
wandb/client | 3963364d8112b7dedb928fa423b6878ea1b467d9 | wandb/vendor/graphql-core-1.1/graphql/language/parser.py | python | parse_type_system_definition | (parser) | TypeSystemDefinition :
- SchemaDefinition
- TypeDefinition
- TypeExtensionDefinition
- DirectiveDefinition
TypeDefinition :
- ScalarTypeDefinition
- ObjectTypeDefinition
- InterfaceTypeDefinition
- UnionTypeDefinition
- EnumTypeDefinition
- Inpu... | TypeSystemDefinition :
- SchemaDefinition
- TypeDefinition
- TypeExtensionDefinition
- DirectiveDefinition | [
"TypeSystemDefinition",
":",
"-",
"SchemaDefinition",
"-",
"TypeDefinition",
"-",
"TypeExtensionDefinition",
"-",
"DirectiveDefinition"
] | def parse_type_system_definition(parser):
'''
TypeSystemDefinition :
- SchemaDefinition
- TypeDefinition
- TypeExtensionDefinition
- DirectiveDefinition
TypeDefinition :
- ScalarTypeDefinition
- ObjectTypeDefinition
- InterfaceTypeDefinition
- Uni... | [
"def",
"parse_type_system_definition",
"(",
"parser",
")",
":",
"if",
"not",
"peek",
"(",
"parser",
",",
"TokenKind",
".",
"NAME",
")",
":",
"raise",
"unexpected",
"(",
"parser",
")",
"name",
"=",
"parser",
".",
"token",
".",
"value",
"if",
"name",
"==",... | https://github.com/wandb/client/blob/3963364d8112b7dedb928fa423b6878ea1b467d9/wandb/vendor/graphql-core-1.1/graphql/language/parser.py#L520-L568 | ||
O365/python-o365 | 7f77005c3cee8177d0141e79b8eda8a7b60c5124 | O365/drive.py | python | Drive._classifier | (item) | Subclass to change factory classes | Subclass to change factory classes | [
"Subclass",
"to",
"change",
"factory",
"classes"
] | def _classifier(item):
""" Subclass to change factory classes """
if 'folder' in item:
return Folder
elif 'image' in item:
return Image
elif 'photo' in item:
return Photo
else:
return File | [
"def",
"_classifier",
"(",
"item",
")",
":",
"if",
"'folder'",
"in",
"item",
":",
"return",
"Folder",
"elif",
"'image'",
"in",
"item",
":",
"return",
"Image",
"elif",
"'photo'",
"in",
"item",
":",
"return",
"Photo",
"else",
":",
"return",
"File"
] | https://github.com/O365/python-o365/blob/7f77005c3cee8177d0141e79b8eda8a7b60c5124/O365/drive.py#L1682-L1691 | ||
WeblateOrg/weblate | 8126f3dda9d24f2846b755955132a8b8410866c8 | weblate/legal/pipeline.py | python | tos_confirm | (strategy, backend, user, current_partial, **kwargs) | return None | Force authentication when adding new association. | Force authentication when adding new association. | [
"Force",
"authentication",
"when",
"adding",
"new",
"association",
"."
] | def tos_confirm(strategy, backend, user, current_partial, **kwargs):
"""Force authentication when adding new association."""
agreement = Agreement.objects.get_or_create(user=user)[0]
if not agreement.is_current():
if user:
strategy.request.session["tos_user"] = user.pk
url = "{}?... | [
"def",
"tos_confirm",
"(",
"strategy",
",",
"backend",
",",
"user",
",",
"current_partial",
",",
"*",
"*",
"kwargs",
")",
":",
"agreement",
"=",
"Agreement",
".",
"objects",
".",
"get_or_create",
"(",
"user",
"=",
"user",
")",
"[",
"0",
"]",
"if",
"not... | https://github.com/WeblateOrg/weblate/blob/8126f3dda9d24f2846b755955132a8b8410866c8/weblate/legal/pipeline.py#L29-L42 | |
xmengli/H-DenseUNet | 06cc436a43196310fe933d114a353839907cc176 | Keras-2.0.8/keras/backend/common.py | python | set_image_data_format | (data_format) | Sets the value of the data format convention.
# Arguments
data_format: string. `'channels_first'` or `'channels_last'`.
# Example
```python
>>> from keras import backend as K
>>> K.image_data_format()
'channels_first'
>>> K.set_image_data_format('channels_last')
... | Sets the value of the data format convention. | [
"Sets",
"the",
"value",
"of",
"the",
"data",
"format",
"convention",
"."
] | def set_image_data_format(data_format):
"""Sets the value of the data format convention.
# Arguments
data_format: string. `'channels_first'` or `'channels_last'`.
# Example
```python
>>> from keras import backend as K
>>> K.image_data_format()
'channels_first'
>... | [
"def",
"set_image_data_format",
"(",
"data_format",
")",
":",
"global",
"_IMAGE_DATA_FORMAT",
"if",
"data_format",
"not",
"in",
"{",
"'channels_last'",
",",
"'channels_first'",
"}",
":",
"raise",
"ValueError",
"(",
"'Unknown data_format:'",
",",
"data_format",
")",
... | https://github.com/xmengli/H-DenseUNet/blob/06cc436a43196310fe933d114a353839907cc176/Keras-2.0.8/keras/backend/common.py#L124-L143 | ||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/distlib/database.py | python | DependencyGraph.to_dot | (self, f, skip_disconnected=True) | Writes a DOT output for the graph to the provided file *f*.
If *skip_disconnected* is set to ``True``, then all distributions
that are not dependent on any other distribution are skipped.
:type f: has to support ``file``-like operations
:type skip_disconnected: ``bool`` | Writes a DOT output for the graph to the provided file *f*. | [
"Writes",
"a",
"DOT",
"output",
"for",
"the",
"graph",
"to",
"the",
"provided",
"file",
"*",
"f",
"*",
"."
] | def to_dot(self, f, skip_disconnected=True):
"""Writes a DOT output for the graph to the provided file *f*.
If *skip_disconnected* is set to ``True``, then all distributions
that are not dependent on any other distribution are skipped.
:type f: has to support ``file``-like operations
... | [
"def",
"to_dot",
"(",
"self",
",",
"f",
",",
"skip_disconnected",
"=",
"True",
")",
":",
"disconnected",
"=",
"[",
"]",
"f",
".",
"write",
"(",
"\"digraph dependencies {\\n\"",
")",
"for",
"dist",
",",
"adjs",
"in",
"self",
".",
"adjacency_list",
".",
"i... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/distlib/database.py#L1127-L1157 | ||
barseghyanartur/django-fobi | a998feae007d7fe3637429a80e42952ec7cda79f | examples/simple/factories/factory_faker.py | python | SpacelessPostalcodeProvider.postcode_spaceless | (self) | return self.bothify('%###??').upper() | Spaceless postal code. | Spaceless postal code. | [
"Spaceless",
"postal",
"code",
"."
] | def postcode_spaceless(self):
"""Spaceless postal code."""
return self.bothify('%###??').upper() | [
"def",
"postcode_spaceless",
"(",
"self",
")",
":",
"return",
"self",
".",
"bothify",
"(",
"'%###??'",
")",
".",
"upper",
"(",
")"
] | https://github.com/barseghyanartur/django-fobi/blob/a998feae007d7fe3637429a80e42952ec7cda79f/examples/simple/factories/factory_faker.py#L29-L31 | |
HackThisSite/CTF-Writeups | d9a63fb11838d9be61953d9dc927b4b5fdf4e50e | 2017/Boston Key Party/RSA Buffets/Factorizer.py | python | Factorizer.extended_gcd | (self,aa, bb) | return lastremainder, lastx * (-1 if aa < 0 else 1), lasty * (-1 if bb < 0 else 1) | Extended Euclidean Algorithm,
from https://rosettacode.org/wiki/Modular_inverse#Python | Extended Euclidean Algorithm,
from https://rosettacode.org/wiki/Modular_inverse#Python | [
"Extended",
"Euclidean",
"Algorithm",
"from",
"https",
":",
"//",
"rosettacode",
".",
"org",
"/",
"wiki",
"/",
"Modular_inverse#Python"
] | def extended_gcd(self,aa, bb):
"""Extended Euclidean Algorithm,
from https://rosettacode.org/wiki/Modular_inverse#Python
"""
lastremainder, remainder = abs(aa), abs(bb)
x, lastx, y, lasty = 0, 1, 1, 0
while remainder:
lastremainder, (quotient, remainder) = rem... | [
"def",
"extended_gcd",
"(",
"self",
",",
"aa",
",",
"bb",
")",
":",
"lastremainder",
",",
"remainder",
"=",
"abs",
"(",
"aa",
")",
",",
"abs",
"(",
"bb",
")",
"x",
",",
"lastx",
",",
"y",
",",
"lasty",
"=",
"0",
",",
"1",
",",
"1",
",",
"0",
... | https://github.com/HackThisSite/CTF-Writeups/blob/d9a63fb11838d9be61953d9dc927b4b5fdf4e50e/2017/Boston Key Party/RSA Buffets/Factorizer.py#L279-L289 | |
bridgecrewio/checkov | f4f8caead6aa2f1824ae1cc88cd1816b12211629 | checkov/serverless/parsers/parser.py | python | _load_var_data | (
var_type,
var_location,
fallback_var_type,
fallback_var_location,
file_cache,
self_data_source,
service_file_directory
) | return value | Load data based on the type/path (see param_lookup_function parameter of process_variables for more info).
:param var_type: Either the type of the variable (see process_variables function) or None to
indicate that var_location is a raw value.
:param var_location: Either th... | Load data based on the type/path (see param_lookup_function parameter of process_variables for more info). | [
"Load",
"data",
"based",
"on",
"the",
"type",
"/",
"path",
"(",
"see",
"param_lookup_function",
"parameter",
"of",
"process_variables",
"for",
"more",
"info",
")",
"."
] | def _load_var_data(
var_type,
var_location,
fallback_var_type,
fallback_var_location,
file_cache,
self_data_source,
service_file_directory
):
"""
Load data based on the type/path (see param_lookup_function parameter of process_variables for more info).
:param var_type: Either... | [
"def",
"_load_var_data",
"(",
"var_type",
",",
"var_location",
",",
"fallback_var_type",
",",
"fallback_var_location",
",",
"file_cache",
",",
"self_data_source",
",",
"service_file_directory",
")",
":",
"value",
"=",
"None",
"if",
"var_type",
"is",
"None",
":",
"... | https://github.com/bridgecrewio/checkov/blob/f4f8caead6aa2f1824ae1cc88cd1816b12211629/checkov/serverless/parsers/parser.py#L182-L218 | |
lovelylain/pyctp | fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d | example/pyctp2/trader/position.py | python | BaseCloser.id | (self) | return self._id | [] | def id(self):
return self._id | [
"def",
"id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_id"
] | https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/example/pyctp2/trader/position.py#L789-L790 | |||
lbryio/lbry-sdk | f78e3825ca0f130834d3876a824f9d380501ced8 | lbry/wallet/server/daemon.py | python | LBCDaemon.getclaimbyid | (self, claim_id) | return await self._send_single('getclaimbyid', (claim_id,)) | Given a claim id, retrieves claim information. | Given a claim id, retrieves claim information. | [
"Given",
"a",
"claim",
"id",
"retrieves",
"claim",
"information",
"."
] | async def getclaimbyid(self, claim_id):
'''Given a claim id, retrieves claim information.'''
return await self._send_single('getclaimbyid', (claim_id,)) | [
"async",
"def",
"getclaimbyid",
"(",
"self",
",",
"claim_id",
")",
":",
"return",
"await",
"self",
".",
"_send_single",
"(",
"'getclaimbyid'",
",",
"(",
"claim_id",
",",
")",
")"
] | https://github.com/lbryio/lbry-sdk/blob/f78e3825ca0f130834d3876a824f9d380501ced8/lbry/wallet/server/daemon.py#L338-L340 | |
anchore/anchore | 35d45722e6a97fb4172a607e8c7f57810b615119 | anchore/util/scripting.py | python | ScriptSetExecutor.check | (self, init_if_missing=False) | Check the path and construct if not found and init_if_missing=True
:param init_if_missing: create the path if not found
:return: true if exists false if not | Check the path and construct if not found and init_if_missing=True
:param init_if_missing: create the path if not found
:return: true if exists false if not | [
"Check",
"the",
"path",
"and",
"construct",
"if",
"not",
"found",
"and",
"init_if_missing",
"=",
"True",
":",
"param",
"init_if_missing",
":",
"create",
"the",
"path",
"if",
"not",
"found",
":",
"return",
":",
"true",
"if",
"exists",
"false",
"if",
"not"
] | def check(self, init_if_missing=False):
"""
Check the path and construct if not found and init_if_missing=True
:param init_if_missing: create the path if not found
:return: true if exists false if not
"""
for d in self.path_overrides + [self.inputdir]:
... | [
"def",
"check",
"(",
"self",
",",
"init_if_missing",
"=",
"False",
")",
":",
"for",
"d",
"in",
"self",
".",
"path_overrides",
"+",
"[",
"self",
".",
"inputdir",
"]",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"d",
")",
":",
"self",
".",
"a... | https://github.com/anchore/anchore/blob/35d45722e6a97fb4172a607e8c7f57810b615119/anchore/util/scripting.py#L116-L130 | ||
mdiazcl/fuzzbunch-debian | 2b76c2249ade83a389ae3badb12a1bd09901fd2c | windows/Resources/Python/Core/Lib/sgmllib.py | python | SGMLParser.setliteral | (self, *args) | Enter literal mode (CDATA).
Intended for derived classes only. | Enter literal mode (CDATA).
Intended for derived classes only. | [
"Enter",
"literal",
"mode",
"(",
"CDATA",
")",
".",
"Intended",
"for",
"derived",
"classes",
"only",
"."
] | def setliteral(self, *args):
"""Enter literal mode (CDATA).
Intended for derived classes only.
"""
self.literal = 1 | [
"def",
"setliteral",
"(",
"self",
",",
"*",
"args",
")",
":",
"self",
".",
"literal",
"=",
"1"
] | https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/sgmllib.py#L57-L62 | ||
eirannejad/pyRevit | 49c0b7eb54eb343458ce1365425e6552d0c47d44 | site-packages/sqlalchemy/sql/compiler.py | python | IdentifierPreparer._requires_quotes | (self, value) | return (lc_value in self.reserved_words
or value[0] in self.illegal_initial_characters
or not self.legal_characters.match(util.text_type(value))
or (lc_value != value)) | Return True if the given identifier requires quoting. | Return True if the given identifier requires quoting. | [
"Return",
"True",
"if",
"the",
"given",
"identifier",
"requires",
"quoting",
"."
] | def _requires_quotes(self, value):
"""Return True if the given identifier requires quoting."""
lc_value = value.lower()
return (lc_value in self.reserved_words
or value[0] in self.illegal_initial_characters
or not self.legal_characters.match(util.text_type(value))... | [
"def",
"_requires_quotes",
"(",
"self",
",",
"value",
")",
":",
"lc_value",
"=",
"value",
".",
"lower",
"(",
")",
"return",
"(",
"lc_value",
"in",
"self",
".",
"reserved_words",
"or",
"value",
"[",
"0",
"]",
"in",
"self",
".",
"illegal_initial_characters",... | https://github.com/eirannejad/pyRevit/blob/49c0b7eb54eb343458ce1365425e6552d0c47d44/site-packages/sqlalchemy/sql/compiler.py#L2882-L2888 | |
frappe/erpnext | 9d36e30ef7043b391b5ed2523b8288bf46c45d18 | erpnext/regional/report/uae_vat_201/uae_vat_201.py | python | get_tourist_tax_return_tax | (filters) | Returns the sum of the tax of each Sales invoice with non zero tourist_tax_return. | Returns the sum of the tax of each Sales invoice with non zero tourist_tax_return. | [
"Returns",
"the",
"sum",
"of",
"the",
"tax",
"of",
"each",
"Sales",
"invoice",
"with",
"non",
"zero",
"tourist_tax_return",
"."
] | def get_tourist_tax_return_tax(filters):
"""Returns the sum of the tax of each Sales invoice with non zero tourist_tax_return."""
query_filters = get_filters(filters)
query_filters.append(['tourist_tax_return', '>', 0])
query_filters.append(['docstatus', '=', 1])
try:
return frappe.db.get_all('Sales Invoice',
... | [
"def",
"get_tourist_tax_return_tax",
"(",
"filters",
")",
":",
"query_filters",
"=",
"get_filters",
"(",
"filters",
")",
"query_filters",
".",
"append",
"(",
"[",
"'tourist_tax_return'",
",",
"'>'",
",",
"0",
"]",
")",
"query_filters",
".",
"append",
"(",
"[",... | https://github.com/frappe/erpnext/blob/9d36e30ef7043b391b5ed2523b8288bf46c45d18/erpnext/regional/report/uae_vat_201/uae_vat_201.py#L282-L295 | ||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/scattergeo/marker/_colorbar.py | python | ColorBar.ticklen | (self) | return self["ticklen"] | Sets the tick length (in px).
The 'ticklen' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float | Sets the tick length (in px).
The 'ticklen' property is a number and may be specified as:
- An int or float in the interval [0, inf] | [
"Sets",
"the",
"tick",
"length",
"(",
"in",
"px",
")",
".",
"The",
"ticklen",
"property",
"is",
"a",
"number",
"and",
"may",
"be",
"specified",
"as",
":",
"-",
"An",
"int",
"or",
"float",
"in",
"the",
"interval",
"[",
"0",
"inf",
"]"
] | def ticklen(self):
"""
Sets the tick length (in px).
The 'ticklen' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["ticklen"] | [
"def",
"ticklen",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ticklen\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/scattergeo/marker/_colorbar.py#L928-L939 | |
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/utils/dummy_tokenizers_objects.py | python | RetriBertTokenizerFast.__init__ | (self, *args, **kwargs) | [] | def __init__(self, *args, **kwargs):
requires_backends(self, ["tokenizers"]) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"requires_backends",
"(",
"self",
",",
"[",
"\"tokenizers\"",
"]",
")"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/utils/dummy_tokenizers_objects.py#L321-L322 | ||||
bungnoid/glTools | 8ff0899de43784a18bd4543285655e68e28fb5e5 | utils/nDynamics.py | python | isNRigid | (nRigid) | return isNType(nRigid,'nRigid') | Check if the specified object is an nRigid node
@param nRigid: Object to query
@type nRigid: str | Check if the specified object is an nRigid node | [
"Check",
"if",
"the",
"specified",
"object",
"is",
"an",
"nRigid",
"node"
] | def isNRigid(nRigid):
'''
Check if the specified object is an nRigid node
@param nRigid: Object to query
@type nRigid: str
'''
return isNType(nRigid,'nRigid') | [
"def",
"isNRigid",
"(",
"nRigid",
")",
":",
"return",
"isNType",
"(",
"nRigid",
",",
"'nRigid'",
")"
] | https://github.com/bungnoid/glTools/blob/8ff0899de43784a18bd4543285655e68e28fb5e5/utils/nDynamics.py#L77-L83 | |
gem/oq-engine | 1bdb88f3914e390abcbd285600bfd39477aae47c | openquake/hmtk/faults/fault_models.py | python | mtkActiveFault.generate_fault_source_model | (self) | return source_model, model_weight | Creates a resulting `openquake.hmtk` fault source set.
:returns:
source_model - list of instances of either the :class:
`openquake.hmtk.sources.simple_fault_source.mtkSimpleFaultSource`
or :class:
`openquake.hmtk.sources.complex_fault_source.mtkComplexFaultSource... | Creates a resulting `openquake.hmtk` fault source set. | [
"Creates",
"a",
"resulting",
"openquake",
".",
"hmtk",
"fault",
"source",
"set",
"."
] | def generate_fault_source_model(self):
'''
Creates a resulting `openquake.hmtk` fault source set.
:returns:
source_model - list of instances of either the :class:
`openquake.hmtk.sources.simple_fault_source.mtkSimpleFaultSource`
or :class:
`openqu... | [
"def",
"generate_fault_source_model",
"(",
"self",
")",
":",
"source_model",
"=",
"[",
"]",
"model_weight",
"=",
"[",
"]",
"for",
"iloc",
"in",
"range",
"(",
"0",
",",
"self",
".",
"get_number_mfd_models",
"(",
")",
")",
":",
"model_mfd",
"=",
"EvenlyDiscr... | https://github.com/gem/oq-engine/blob/1bdb88f3914e390abcbd285600bfd39477aae47c/openquake/hmtk/faults/fault_models.py#L512-L560 | |
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | Lib/xml/sax/saxlib.py | python | Attributes.items | (self) | Return a list of (attribute_name, value) pairs. | Return a list of (attribute_name, value) pairs. | [
"Return",
"a",
"list",
"of",
"(",
"attribute_name",
"value",
")",
"pairs",
"."
] | def items(self):
"Return a list of (attribute_name, value) pairs."
raise NotImplementedError("This method must be implemented!") | [
"def",
"items",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"This method must be implemented!\"",
")"
] | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/Lib/xml/sax/saxlib.py#L132-L134 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/translations/app_translations/download.py | python | get_module_detail_enum_rows | (langs, detail, list_or_detail) | return rows | [] | def get_module_detail_enum_rows(langs, detail, list_or_detail):
if not re.search(r'\benum\b', detail.format):
return []
rows = []
for mapping in detail.enum:
rows.append(
(
mapping.key + " (ID Mapping Value)",
list_or_detail
) + tuple(... | [
"def",
"get_module_detail_enum_rows",
"(",
"langs",
",",
"detail",
",",
"list_or_detail",
")",
":",
"if",
"not",
"re",
".",
"search",
"(",
"r'\\benum\\b'",
",",
"detail",
".",
"format",
")",
":",
"return",
"[",
"]",
"rows",
"=",
"[",
"]",
"for",
"mapping... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/translations/app_translations/download.py#L286-L301 | |||
drckf/paysage | 85ef951be2750e13c0b42121b40e530689bdc1f4 | paysage/penalties.py | python | Penalty.grad | (self, tensor) | The value of the gradient of the penalty function on a tensor.
Args:
tensor
Returns:
tensor | The value of the gradient of the penalty function on a tensor. | [
"The",
"value",
"of",
"the",
"gradient",
"of",
"the",
"penalty",
"function",
"on",
"a",
"tensor",
"."
] | def grad(self, tensor):
"""
The value of the gradient of the penalty function on a tensor.
Args:
tensor
Returns:
tensor
"""
raise NotImplementedError | [
"def",
"grad",
"(",
"self",
",",
"tensor",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/drckf/paysage/blob/85ef951be2750e13c0b42121b40e530689bdc1f4/paysage/penalties.py#L41-L52 | ||
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/chapters/admin.py | python | ChapterAdmin.save_formset | (self, request, form, formset, change) | Associate the user to each instance saved. | Associate the user to each instance saved. | [
"Associate",
"the",
"user",
"to",
"each",
"instance",
"saved",
"."
] | def save_formset(self, request, form, formset, change):
"""
Associate the user to each instance saved.
"""
instances = formset.save(commit=False)
for instance in instances:
instance.content_type = ContentType.objects.get_for_model(instance.chapter)
instanc... | [
"def",
"save_formset",
"(",
"self",
",",
"request",
",",
"form",
",",
"formset",
",",
"change",
")",
":",
"instances",
"=",
"formset",
".",
"save",
"(",
"commit",
"=",
"False",
")",
"for",
"instance",
"in",
"instances",
":",
"instance",
".",
"content_typ... | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/chapters/admin.py#L616-L626 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/ihooks.py | python | Hooks.is_builtin | (self, name) | return imp.is_builtin(name) | [] | def is_builtin(self, name): return imp.is_builtin(name) | [
"def",
"is_builtin",
"(",
"self",
",",
"name",
")",
":",
"return",
"imp",
".",
"is_builtin",
"(",
"name",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/ihooks.py#L164-L164 | |||
datawire/forge | d501be4571dcef5691804c7db7008ee877933c8d | forge/docker.py | python | DockerBase.clean | (self, name) | [] | def clean(self, name):
for id, bname in self.find_builders(name):
Builder(self, id).kill() | [
"def",
"clean",
"(",
"self",
",",
"name",
")",
":",
"for",
"id",
",",
"bname",
"in",
"self",
".",
"find_builders",
"(",
"name",
")",
":",
"Builder",
"(",
"self",
",",
"id",
")",
".",
"kill",
"(",
")"
] | https://github.com/datawire/forge/blob/d501be4571dcef5691804c7db7008ee877933c8d/forge/docker.py#L165-L167 | ||||
paulgb/runipy | d48c4c522bd1d66dcc5c1c09e70a92bfb58360fe | runipy/notebook_runner.py | python | NotebookRunner.iter_code_cells | (self) | Iterate over the notebook cells containing code. | Iterate over the notebook cells containing code. | [
"Iterate",
"over",
"the",
"notebook",
"cells",
"containing",
"code",
"."
] | def iter_code_cells(self):
"""Iterate over the notebook cells containing code."""
for ws in self.nb.worksheets:
for cell in ws.cells:
if cell.cell_type == 'code':
yield cell | [
"def",
"iter_code_cells",
"(",
"self",
")",
":",
"for",
"ws",
"in",
"self",
".",
"nb",
".",
"worksheets",
":",
"for",
"cell",
"in",
"ws",
".",
"cells",
":",
"if",
"cell",
".",
"cell_type",
"==",
"'code'",
":",
"yield",
"cell"
] | https://github.com/paulgb/runipy/blob/d48c4c522bd1d66dcc5c1c09e70a92bfb58360fe/runipy/notebook_runner.py#L228-L233 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/ipaddress.py | python | IPv6Network.__init__ | (self, address, strict=True) | Instantiate a new IPv6 Network object.
Args:
address: A string or integer representing the IPv6 network or the
IP and prefix/netmask.
'2001:db8::/128'
'2001:db8:0000:0000:0000:0000:0000:0000/128'
'2001:db8::'
are all functionally... | Instantiate a new IPv6 Network object. | [
"Instantiate",
"a",
"new",
"IPv6",
"Network",
"object",
"."
] | def __init__(self, address, strict=True):
"""Instantiate a new IPv6 Network object.
Args:
address: A string or integer representing the IPv6 network or the
IP and prefix/netmask.
'2001:db8::/128'
'2001:db8:0000:0000:0000:0000:0000:0000/128'
... | [
"def",
"__init__",
"(",
"self",
",",
"address",
",",
"strict",
"=",
"True",
")",
":",
"_BaseNetwork",
".",
"__init__",
"(",
"self",
",",
"address",
")",
"# Constructing from a packed address or integer",
"if",
"isinstance",
"(",
"address",
",",
"(",
"int",
","... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/ipaddress.py#L2160-L2220 | ||
colour-science/colour | 38782ac059e8ddd91939f3432bf06811c16667f0 | colour/temperature/ohno2013.py | python | planckian_table | (uv, cmfs, start, end, count) | return table | Returns a planckian table from given *CIE UCS* colourspace *uv*
chromaticity coordinates, colour matching functions and temperature range
using *Ohno (2013)* method.
Parameters
----------
uv : array_like
*uv* chromaticity coordinates.
cmfs : XYZ_ColourMatchingFunctions
Standard ... | Returns a planckian table from given *CIE UCS* colourspace *uv*
chromaticity coordinates, colour matching functions and temperature range
using *Ohno (2013)* method. | [
"Returns",
"a",
"planckian",
"table",
"from",
"given",
"*",
"CIE",
"UCS",
"*",
"colourspace",
"*",
"uv",
"*",
"chromaticity",
"coordinates",
"colour",
"matching",
"functions",
"and",
"temperature",
"range",
"using",
"*",
"Ohno",
"(",
"2013",
")",
"*",
"metho... | def planckian_table(uv, cmfs, start, end, count):
"""
Returns a planckian table from given *CIE UCS* colourspace *uv*
chromaticity coordinates, colour matching functions and temperature range
using *Ohno (2013)* method.
Parameters
----------
uv : array_like
*uv* chromaticity coordin... | [
"def",
"planckian_table",
"(",
"uv",
",",
"cmfs",
",",
"start",
",",
"end",
",",
"count",
")",
":",
"ux",
",",
"vx",
"=",
"uv",
"cmfs",
",",
"_illuminant",
"=",
"handle_spectral_arguments",
"(",
"cmfs",
")",
"table",
"=",
"[",
"]",
"for",
"Ti",
"in",... | https://github.com/colour-science/colour/blob/38782ac059e8ddd91939f3432bf06811c16667f0/colour/temperature/ohno2013.py#L62-L133 | |
apprenticeharper/DeDRM_tools | 776f146ca00d11b24575f4fd6e8202df30a2b7ea | Obok_plugin/action.py | python | InterfacePluginAction.show_help | (self) | Extract on demand the help file resource | Extract on demand the help file resource | [
"Extract",
"on",
"demand",
"the",
"help",
"file",
"resource"
] | def show_help(self):
'''
Extract on demand the help file resource
'''
def get_help_file_resource():
# We will write the help file out every time, in case the user upgrades the plugin zip
# and there is a newer help file contained within it.
file_path =... | [
"def",
"show_help",
"(",
"self",
")",
":",
"def",
"get_help_file_resource",
"(",
")",
":",
"# We will write the help file out every time, in case the user upgrades the plugin zip",
"# and there is a newer help file contained within it.",
"file_path",
"=",
"os",
".",
"path",
".",
... | https://github.com/apprenticeharper/DeDRM_tools/blob/776f146ca00d11b24575f4fd6e8202df30a2b7ea/Obok_plugin/action.py#L192-L205 | ||
CSAILVision/NetDissect-Lite | 2163454ebeb5b15aac64e5cbd4ed8876c5c200df | loader/data_loader.py | python | SegmentationPrefetcher.fetch_tensor_batch | (self, bgr_mean=None, global_labels=False) | return self.form_caffe_tensors(batch, bgr_mean, global_labels) | Iterator for batches as arrays of tensors. | Iterator for batches as arrays of tensors. | [
"Iterator",
"for",
"batches",
"as",
"arrays",
"of",
"tensors",
"."
] | def fetch_tensor_batch(self, bgr_mean=None, global_labels=False):
'''Iterator for batches as arrays of tensors.'''
batch = self.fetch_batch()
return self.form_caffe_tensors(batch, bgr_mean, global_labels) | [
"def",
"fetch_tensor_batch",
"(",
"self",
",",
"bgr_mean",
"=",
"None",
",",
"global_labels",
"=",
"False",
")",
":",
"batch",
"=",
"self",
".",
"fetch_batch",
"(",
")",
"return",
"self",
".",
"form_caffe_tensors",
"(",
"batch",
",",
"bgr_mean",
",",
"glob... | https://github.com/CSAILVision/NetDissect-Lite/blob/2163454ebeb5b15aac64e5cbd4ed8876c5c200df/loader/data_loader.py#L533-L536 | |
ialbert/biostar-central | 2dc7bd30691a50b2da9c2833ba354056bc686afa | biostar/recipes/models.py | python | Project.json_text | (self) | return hjson.dumps(self.api_data) | [] | def json_text(self):
return hjson.dumps(self.api_data) | [
"def",
"json_text",
"(",
"self",
")",
":",
"return",
"hjson",
".",
"dumps",
"(",
"self",
".",
"api_data",
")"
] | https://github.com/ialbert/biostar-central/blob/2dc7bd30691a50b2da9c2833ba354056bc686afa/biostar/recipes/models.py#L215-L216 | |||
mckinziebrandon/DeepChatModels | 4fef8a6ce00d92235a2fb0e427d2ec60833022d2 | chatbot/components/base/_rnn.py | python | BasicRNNCell.__call__ | (self, inputs, state, scope=None) | return output, output | Most basic RNN. Define as:
output = new_state = act(W * input + U * state + B). | Most basic RNN. Define as:
output = new_state = act(W * input + U * state + B). | [
"Most",
"basic",
"RNN",
".",
"Define",
"as",
":",
"output",
"=",
"new_state",
"=",
"act",
"(",
"W",
"*",
"input",
"+",
"U",
"*",
"state",
"+",
"B",
")",
"."
] | def __call__(self, inputs, state, scope=None):
"""Most basic RNN. Define as:
output = new_state = act(W * input + U * state + B).
"""
output = tf.tanh(bot_ops.linear_map(
args=[inputs, state],
output_size=self._num_units,
bias=True))
return... | [
"def",
"__call__",
"(",
"self",
",",
"inputs",
",",
"state",
",",
"scope",
"=",
"None",
")",
":",
"output",
"=",
"tf",
".",
"tanh",
"(",
"bot_ops",
".",
"linear_map",
"(",
"args",
"=",
"[",
"inputs",
",",
"state",
"]",
",",
"output_size",
"=",
"sel... | https://github.com/mckinziebrandon/DeepChatModels/blob/4fef8a6ce00d92235a2fb0e427d2ec60833022d2/chatbot/components/base/_rnn.py#L347-L355 | |
pallets-eco/flask-openid | 56824a27046451d7a09d1ed2a861c8bf942ad104 | flask_openid.py | python | OpenID.try_login | (self, identity_url, ask_for=None, ask_for_optional=None,
extensions=None, immediate=False) | return redirect(auth_request.redirectURL(trust_root,
self.get_success_url(),
immediate=immediate)) | This tries to login with the given identity URL. This function
must be called from the login_handler. The `ask_for` and
`ask_for_optional`parameter can be a set of values to be asked
from the openid provider, where keys in `ask_for` are marked as
required, and keys in `ask_for_optional... | This tries to login with the given identity URL. This function
must be called from the login_handler. The `ask_for` and
`ask_for_optional`parameter can be a set of values to be asked
from the openid provider, where keys in `ask_for` are marked as
required, and keys in `ask_for_optional... | [
"This",
"tries",
"to",
"login",
"with",
"the",
"given",
"identity",
"URL",
".",
"This",
"function",
"must",
"be",
"called",
"from",
"the",
"login_handler",
".",
"The",
"ask_for",
"and",
"ask_for_optional",
"parameter",
"can",
"be",
"a",
"set",
"of",
"values"... | def try_login(self, identity_url, ask_for=None, ask_for_optional=None,
extensions=None, immediate=False):
"""This tries to login with the given identity URL. This function
must be called from the login_handler. The `ask_for` and
`ask_for_optional`parameter can be a set of val... | [
"def",
"try_login",
"(",
"self",
",",
"identity_url",
",",
"ask_for",
"=",
"None",
",",
"ask_for_optional",
"=",
"None",
",",
"extensions",
"=",
"None",
",",
"immediate",
"=",
"False",
")",
":",
"if",
"ask_for",
"and",
"__debug__",
":",
"for",
"key",
"in... | https://github.com/pallets-eco/flask-openid/blob/56824a27046451d7a09d1ed2a861c8bf942ad104/flask_openid.py#L519-L572 | |
wistbean/fxxkpython | 88e16d79d8dd37236ba6ecd0d0ff11d63143968c | vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/_backport/sysconfig.py | python | _init_non_posix | (vars) | Initialize the module as appropriate for NT | Initialize the module as appropriate for NT | [
"Initialize",
"the",
"module",
"as",
"appropriate",
"for",
"NT"
] | def _init_non_posix(vars):
"""Initialize the module as appropriate for NT"""
# set basic install directories
vars['LIBDEST'] = get_path('stdlib')
vars['BINLIBDEST'] = get_path('platstdlib')
vars['INCLUDEPY'] = get_path('include')
vars['SO'] = '.pyd'
vars['EXE'] = '.exe'
vars['VERSION'] =... | [
"def",
"_init_non_posix",
"(",
"vars",
")",
":",
"# set basic install directories",
"vars",
"[",
"'LIBDEST'",
"]",
"=",
"get_path",
"(",
"'stdlib'",
")",
"vars",
"[",
"'BINLIBDEST'",
"]",
"=",
"get_path",
"(",
"'platstdlib'",
")",
"vars",
"[",
"'INCLUDEPY'",
"... | https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/_backport/sysconfig.py#L372-L381 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/logging/handlers.py | python | TimedRotatingFileHandler.doRollover | (self) | do a rollover; in this case, a date/time stamp is appended to the filename
when the rollover happens. However, you want the file to be named for the
start of the interval, not the current time. If there is a backup count,
then we have to get a list of matching filenames, sort them and remove
... | do a rollover; in this case, a date/time stamp is appended to the filename
when the rollover happens. However, you want the file to be named for the
start of the interval, not the current time. If there is a backup count,
then we have to get a list of matching filenames, sort them and remove
... | [
"do",
"a",
"rollover",
";",
"in",
"this",
"case",
"a",
"date",
"/",
"time",
"stamp",
"is",
"appended",
"to",
"the",
"filename",
"when",
"the",
"rollover",
"happens",
".",
"However",
"you",
"want",
"the",
"file",
"to",
"be",
"named",
"for",
"the",
"star... | def doRollover(self):
"""
do a rollover; in this case, a date/time stamp is appended to the filename
when the rollover happens. However, you want the file to be named for the
start of the interval, not the current time. If there is a backup count,
then we have to get a list of ... | [
"def",
"doRollover",
"(",
"self",
")",
":",
"if",
"self",
".",
"stream",
":",
"self",
".",
"stream",
".",
"close",
"(",
")",
"self",
".",
"stream",
"=",
"None",
"# get the time that this sequence started at and make it a TimeTuple",
"t",
"=",
"self",
".",
"rol... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/logging/handlers.py#L318-L363 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/networkx/classes/multigraph.py | python | MultiGraph.remove_edges_from | (self, ebunch) | Remove all edges specified in ebunch.
Parameters
----------
ebunch: list or container of edge tuples
Each edge given in the list or container will be removed
from the graph. The edges can be:
- 2-tuples (u, v) All edges between u and v are removed.
... | Remove all edges specified in ebunch. | [
"Remove",
"all",
"edges",
"specified",
"in",
"ebunch",
"."
] | def remove_edges_from(self, ebunch):
"""Remove all edges specified in ebunch.
Parameters
----------
ebunch: list or container of edge tuples
Each edge given in the list or container will be removed
from the graph. The edges can be:
- 2-tuples (u,... | [
"def",
"remove_edges_from",
"(",
"self",
",",
"ebunch",
")",
":",
"for",
"e",
"in",
"ebunch",
":",
"try",
":",
"self",
".",
"remove_edge",
"(",
"*",
"e",
"[",
":",
"3",
"]",
")",
"except",
"NetworkXError",
":",
"pass"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/networkx/classes/multigraph.py#L608-L650 | ||
selfteaching/selfteaching-python-camp | 9982ee964b984595e7d664b07c389cddaf158f1e | 19100205/Ceasar1978/pip-19.0.3/src/pip/_vendor/pyparsing.py | python | ParserElement.__rsub__ | (self, other ) | return other - self | Implementation of - operator when left operand is not a :class:`ParserElement` | Implementation of - operator when left operand is not a :class:`ParserElement` | [
"Implementation",
"of",
"-",
"operator",
"when",
"left",
"operand",
"is",
"not",
"a",
":",
"class",
":",
"ParserElement"
] | def __rsub__(self, other ):
"""
Implementation of - operator when left operand is not a :class:`ParserElement`
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.wa... | [
"def",
"__rsub__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElemen... | https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/19100205/Ceasar1978/pip-19.0.3/src/pip/_vendor/pyparsing.py#L2038-L2048 | |
ydkhatri/mac_apt | 729630c8bbe7a73cce3ca330305d3301a919cb07 | plugins/helpers/common.py | python | CommonFunctions.GetTableNames | (db_conn) | return '' | Retrieve all table names in an sqlite database | Retrieve all table names in an sqlite database | [
"Retrieve",
"all",
"table",
"names",
"in",
"an",
"sqlite",
"database"
] | def GetTableNames(db_conn):
'''Retrieve all table names in an sqlite database'''
try:
cursor = db_conn.execute("SELECT group_concat(name) from sqlite_master WHERE type='table'")
for row in cursor:
return row[0]
except sqlite3Error as ex:
log.er... | [
"def",
"GetTableNames",
"(",
"db_conn",
")",
":",
"try",
":",
"cursor",
"=",
"db_conn",
".",
"execute",
"(",
"\"SELECT group_concat(name) from sqlite_master WHERE type='table'\"",
")",
"for",
"row",
"in",
"cursor",
":",
"return",
"row",
"[",
"0",
"]",
"except",
... | https://github.com/ydkhatri/mac_apt/blob/729630c8bbe7a73cce3ca330305d3301a919cb07/plugins/helpers/common.py#L206-L214 | |
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/mutagen/monkeysaudio.py | python | MonkeysAudioInfo.__init__ | (self, fileobj) | Raises MonkeysAudioHeaderError | Raises MonkeysAudioHeaderError | [
"Raises",
"MonkeysAudioHeaderError"
] | def __init__(self, fileobj):
"""Raises MonkeysAudioHeaderError"""
header = fileobj.read(76)
if len(header) != 76 or not header.startswith(b"MAC "):
raise MonkeysAudioHeaderError("not a Monkey's Audio file")
self.version = cdata.ushort_le(header[4:6])
if self.version ... | [
"def",
"__init__",
"(",
"self",
",",
"fileobj",
")",
":",
"header",
"=",
"fileobj",
".",
"read",
"(",
"76",
")",
"if",
"len",
"(",
"header",
")",
"!=",
"76",
"or",
"not",
"header",
".",
"startswith",
"(",
"b\"MAC \"",
")",
":",
"raise",
"MonkeysAudio... | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/mutagen/monkeysaudio.py#L45-L74 | ||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/pyparsing/helpers.py | python | replace_html_entity | (t) | return _htmlEntityMap.get(t.entity) | Helper parser action to replace common HTML entities with their special characters | Helper parser action to replace common HTML entities with their special characters | [
"Helper",
"parser",
"action",
"to",
"replace",
"common",
"HTML",
"entities",
"with",
"their",
"special",
"characters"
] | def replace_html_entity(t):
"""Helper parser action to replace common HTML entities with their special characters"""
return _htmlEntityMap.get(t.entity) | [
"def",
"replace_html_entity",
"(",
"t",
")",
":",
"return",
"_htmlEntityMap",
".",
"get",
"(",
"t",
".",
"entity",
")"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/pyparsing/helpers.py#L683-L685 | |
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/pip/_vendor/requests/cookies.py | python | create_cookie | (name, value, **kwargs) | return cookielib.Cookie(**result) | Make a cookie from underspecified parameters.
By default, the pair of `name` and `value` will be set for the domain ''
and sent on every request (this is sometimes called a "supercookie"). | Make a cookie from underspecified parameters. | [
"Make",
"a",
"cookie",
"from",
"underspecified",
"parameters",
"."
] | def create_cookie(name, value, **kwargs):
"""Make a cookie from underspecified parameters.
By default, the pair of `name` and `value` will be set for the domain ''
and sent on every request (this is sometimes called a "supercookie").
"""
result = {
'version': 0,
'name': name,
... | [
"def",
"create_cookie",
"(",
"name",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"{",
"'version'",
":",
"0",
",",
"'name'",
":",
"name",
",",
"'value'",
":",
"value",
",",
"'port'",
":",
"None",
",",
"'domain'",
":",
"''",
",",
... | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_vendor/requests/cookies.py#L441-L474 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/src/lib/deploymentconfig.py | python | DeploymentConfig.delete_env_var | (self, keys) | return False | delete a list of keys | delete a list of keys | [
"delete",
"a",
"list",
"of",
"keys"
] | def delete_env_var(self, keys):
'''delete a list of keys '''
if not isinstance(keys, list):
keys = [keys]
env_vars_array = self.get_env_vars()
modified = False
idx = None
for key in keys:
for env_idx, env_var in enumerate(env_vars_array):
... | [
"def",
"delete_env_var",
"(",
"self",
",",
"keys",
")",
":",
"if",
"not",
"isinstance",
"(",
"keys",
",",
"list",
")",
":",
"keys",
"=",
"[",
"keys",
"]",
"env_vars_array",
"=",
"self",
".",
"get_env_vars",
"(",
")",
"modified",
"=",
"False",
"idx",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/src/lib/deploymentconfig.py#L128-L149 | |
MeanEYE/Sunflower | 1024bbdde3b8e202ddad3553b321a7b6230bffc9 | sunflower/plugins/file_list/file_list.py | python | FileList._clear_sort_function | (self) | Clear sort settings | Clear sort settings | [
"Clear",
"sort",
"settings"
] | def _clear_sort_function(self):
"""Clear sort settings"""
self._store.set_sort_column_id(Gtk.TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, True) | [
"def",
"_clear_sort_function",
"(",
"self",
")",
":",
"self",
".",
"_store",
".",
"set_sort_column_id",
"(",
"Gtk",
".",
"TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID",
",",
"True",
")"
] | https://github.com/MeanEYE/Sunflower/blob/1024bbdde3b8e202ddad3553b321a7b6230bffc9/sunflower/plugins/file_list/file_list.py#L1185-L1187 | ||
twiddli/happypanda | 6acf2560404cb23385c7c0a3c07797035301ad75 | version/gallerydb.py | python | default_chap_exec | (gallery_or_id, chap, only_values=False) | return execute | Pass a Gallery object or gallery id and a Chapter object | Pass a Gallery object or gallery id and a Chapter object | [
"Pass",
"a",
"Gallery",
"object",
"or",
"gallery",
"id",
"and",
"a",
"Chapter",
"object"
] | def default_chap_exec(gallery_or_id, chap, only_values=False):
"Pass a Gallery object or gallery id and a Chapter object"
if isinstance(gallery_or_id, Gallery):
gid = gallery_or_id.id
in_archive = gallery_or_id.is_archive
else:
gid = gallery_or_id
in_archive = chap.in_archive... | [
"def",
"default_chap_exec",
"(",
"gallery_or_id",
",",
"chap",
",",
"only_values",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"gallery_or_id",
",",
"Gallery",
")",
":",
"gid",
"=",
"gallery_or_id",
".",
"id",
"in_archive",
"=",
"gallery_or_id",
".",
"i... | https://github.com/twiddli/happypanda/blob/6acf2560404cb23385c7c0a3c07797035301ad75/version/gallerydb.py#L175-L196 | |
matthiask/plata | a743b8ef3838c1c2764620b18c394afc9708c4d5 | plata/shop/views.py | python | Shop.render_confirmation | (self, request, context) | return self.render(
request, self.confirmation_template, self.get_context(request, context)
) | Renders the confirmation page | Renders the confirmation page | [
"Renders",
"the",
"confirmation",
"page"
] | def render_confirmation(self, request, context):
"""Renders the confirmation page"""
return self.render(
request, self.confirmation_template, self.get_context(request, context)
) | [
"def",
"render_confirmation",
"(",
"self",
",",
"request",
",",
"context",
")",
":",
"return",
"self",
".",
"render",
"(",
"request",
",",
"self",
".",
"confirmation_template",
",",
"self",
".",
"get_context",
"(",
"request",
",",
"context",
")",
")"
] | https://github.com/matthiask/plata/blob/a743b8ef3838c1c2764620b18c394afc9708c4d5/plata/shop/views.py#L641-L645 | |
asappresearch/flambe | 98f10f859fe9223fd2d1d76d430f77cdbddc0956 | flambe/experiment/utils.py | python | local_has_gpu | () | return torch.cuda.is_available() | Returns is local process has GPU
Returns
-------
bool | Returns is local process has GPU | [
"Returns",
"is",
"local",
"process",
"has",
"GPU"
] | def local_has_gpu() -> bool:
"""Returns is local process has GPU
Returns
-------
bool
"""
return torch.cuda.is_available() | [
"def",
"local_has_gpu",
"(",
")",
"->",
"bool",
":",
"return",
"torch",
".",
"cuda",
".",
"is_available",
"(",
")"
] | https://github.com/asappresearch/flambe/blob/98f10f859fe9223fd2d1d76d430f77cdbddc0956/flambe/experiment/utils.py#L491-L499 | |
yandex/yandex-tank | b41bcc04396c4ed46fc8b28a261197320854fd33 | yandextank/plugins/Phantom/reader.py | python | PhantomStatsReader._format_chunk | (self, chunk) | return list(itt.chain(*(self._decode_stat_data(chunk) for chunk in chunks))) | [] | def _format_chunk(self, chunk):
chunks = [json.loads('{%s}}' % s) for s in chunk.split('\n},')]
return list(itt.chain(*(self._decode_stat_data(chunk) for chunk in chunks))) | [
"def",
"_format_chunk",
"(",
"self",
",",
"chunk",
")",
":",
"chunks",
"=",
"[",
"json",
".",
"loads",
"(",
"'{%s}}'",
"%",
"s",
")",
"for",
"s",
"in",
"chunk",
".",
"split",
"(",
"'\\n},'",
")",
"]",
"return",
"list",
"(",
"itt",
".",
"chain",
"... | https://github.com/yandex/yandex-tank/blob/b41bcc04396c4ed46fc8b28a261197320854fd33/yandextank/plugins/Phantom/reader.py#L145-L147 | |||
ronf/asyncssh | ee1714c598d8c2ea6f5484e465443f38b68714aa | asyncssh/process.py | python | SSHProcess.set_writer | (self, writer: Optional[_WriterProtocol[AnyStr]],
datatype: DataType) | Set a writer used to forward data from the channel | Set a writer used to forward data from the channel | [
"Set",
"a",
"writer",
"used",
"to",
"forward",
"data",
"from",
"the",
"channel"
] | def set_writer(self, writer: Optional[_WriterProtocol[AnyStr]],
datatype: DataType) -> None:
"""Set a writer used to forward data from the channel"""
old_writer = self._writers.get(datatype)
if old_writer:
old_writer.close()
self.clear_writer(datatype... | [
"def",
"set_writer",
"(",
"self",
",",
"writer",
":",
"Optional",
"[",
"_WriterProtocol",
"[",
"AnyStr",
"]",
"]",
",",
"datatype",
":",
"DataType",
")",
"->",
"None",
":",
"old_writer",
"=",
"self",
".",
"_writers",
".",
"get",
"(",
"datatype",
")",
"... | https://github.com/ronf/asyncssh/blob/ee1714c598d8c2ea6f5484e465443f38b68714aa/asyncssh/process.py#L1007-L1018 | ||
quip/quip-api | 19f3b32a05ed092a70dc2c616e214aaff8a06de2 | samples/wordpress/quip.py | python | QuipClient.add_thread_members | (self, thread_id, member_ids) | return self._fetch_json("threads/add-members", post_data={
"thread_id": thread_id,
"member_ids": ",".join(member_ids),
}) | Adds the given folder or user IDs to the given thread. | Adds the given folder or user IDs to the given thread. | [
"Adds",
"the",
"given",
"folder",
"or",
"user",
"IDs",
"to",
"the",
"given",
"thread",
"."
] | def add_thread_members(self, thread_id, member_ids):
"""Adds the given folder or user IDs to the given thread."""
return self._fetch_json("threads/add-members", post_data={
"thread_id": thread_id,
"member_ids": ",".join(member_ids),
}) | [
"def",
"add_thread_members",
"(",
"self",
",",
"thread_id",
",",
"member_ids",
")",
":",
"return",
"self",
".",
"_fetch_json",
"(",
"\"threads/add-members\"",
",",
"post_data",
"=",
"{",
"\"thread_id\"",
":",
"thread_id",
",",
"\"member_ids\"",
":",
"\",\"",
"."... | https://github.com/quip/quip-api/blob/19f3b32a05ed092a70dc2c616e214aaff8a06de2/samples/wordpress/quip.py#L268-L273 | |
guofei9987/scikit-opt | e0886ed3aa3bc9023d1408816c32125d2b90c76c | sko/demo_func.py | python | griewank | (p) | return np.sum(part1) - np.prod(part2) + 1 | 存在多个局部最小值点,数目与问题的维度有关。
此函数是典型的非线性多模态函数,具有广泛的搜索空间,是优化算法很难处理的复杂多模态问题。
在(0,...,0)处取的全局最小值0
-600<=xi<=600 | 存在多个局部最小值点,数目与问题的维度有关。
此函数是典型的非线性多模态函数,具有广泛的搜索空间,是优化算法很难处理的复杂多模态问题。
在(0,...,0)处取的全局最小值0
-600<=xi<=600 | [
"存在多个局部最小值点,数目与问题的维度有关。",
"此函数是典型的非线性多模态函数,具有广泛的搜索空间,是优化算法很难处理的复杂多模态问题。",
"在",
"(",
"0",
"...",
"0",
")",
"处取的全局最小值0",
"-",
"600<",
"=",
"xi<",
"=",
"600"
] | def griewank(p):
'''
存在多个局部最小值点,数目与问题的维度有关。
此函数是典型的非线性多模态函数,具有广泛的搜索空间,是优化算法很难处理的复杂多模态问题。
在(0,...,0)处取的全局最小值0
-600<=xi<=600
'''
part1 = [np.square(x) / 4000 for x in p]
part2 = [np.cos(x / np.sqrt(i + 1)) for i, x in enumerate(p)]
return np.sum(part1) - np.prod(part2) + 1 | [
"def",
"griewank",
"(",
"p",
")",
":",
"part1",
"=",
"[",
"np",
".",
"square",
"(",
"x",
")",
"/",
"4000",
"for",
"x",
"in",
"p",
"]",
"part2",
"=",
"[",
"np",
".",
"cos",
"(",
"x",
"/",
"np",
".",
"sqrt",
"(",
"i",
"+",
"1",
")",
")",
... | https://github.com/guofei9987/scikit-opt/blob/e0886ed3aa3bc9023d1408816c32125d2b90c76c/sko/demo_func.py#L59-L68 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/integrals/manualintegrate.py | python | tansec_pattern | (symbol) | return pattern, a, b, m, n | [] | def tansec_pattern(symbol):
a, b, m, n = make_wilds(symbol)
pattern = sympy.tan(a*symbol)**m * sympy.sec(b*symbol)**n
return pattern, a, b, m, n | [
"def",
"tansec_pattern",
"(",
"symbol",
")",
":",
"a",
",",
"b",
",",
"m",
",",
"n",
"=",
"make_wilds",
"(",
"symbol",
")",
"pattern",
"=",
"sympy",
".",
"tan",
"(",
"a",
"*",
"symbol",
")",
"**",
"m",
"*",
"sympy",
".",
"sec",
"(",
"b",
"*",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/integrals/manualintegrate.py#L538-L542 | |||
theislab/scanpy | b69015e9e7007193c9ac461d5c6fbf845b3d6962 | scanpy/tools/_paga.py | python | paga_compare_paths | (
adata1: AnnData,
adata2: AnnData,
adjacency_key: str = 'connectivities',
adjacency_key2: Optional[str] = None,
) | return PAGAComparePathsResult(
frac_steps=n_agreeing_steps / n_steps if n_steps > 0 else np.nan,
n_steps=n_steps if n_steps > 0 else np.nan,
frac_paths=n_agreeing_paths / n_paths if n_steps > 0 else np.nan,
n_paths=n_paths if n_steps > 0 else np.nan,
) | Compare paths in abstracted graphs in two datasets.
Compute the fraction of consistent paths between leafs, a measure for the
topological similarity between graphs.
By increasing the verbosity to level 4 and 5, the paths that do not agree
and the paths that agree are written to the output, respectivel... | Compare paths in abstracted graphs in two datasets. | [
"Compare",
"paths",
"in",
"abstracted",
"graphs",
"in",
"two",
"datasets",
"."
] | def paga_compare_paths(
adata1: AnnData,
adata2: AnnData,
adjacency_key: str = 'connectivities',
adjacency_key2: Optional[str] = None,
) -> PAGAComparePathsResult:
"""Compare paths in abstracted graphs in two datasets.
Compute the fraction of consistent paths between leafs, a measure for the
... | [
"def",
"paga_compare_paths",
"(",
"adata1",
":",
"AnnData",
",",
"adata2",
":",
"AnnData",
",",
"adjacency_key",
":",
"str",
"=",
"'connectivities'",
",",
"adjacency_key2",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
")",
"->",
"PAGAComparePathsResult"... | https://github.com/theislab/scanpy/blob/b69015e9e7007193c9ac461d5c6fbf845b3d6962/scanpy/tools/_paga.py#L438-L610 | |
reddit-archive/reddit | 753b17407e9a9dca09558526805922de24133d53 | r2/r2/lib/traffic/traffic.py | python | _report_interval | (interval) | Read aggregated traffic from S3 and write to postgres. | Read aggregated traffic from S3 and write to postgres. | [
"Read",
"aggregated",
"traffic",
"from",
"S3",
"and",
"write",
"to",
"postgres",
"."
] | def _report_interval(interval):
"""Read aggregated traffic from S3 and write to postgres."""
from sqlalchemy.orm import scoped_session, sessionmaker
from r2.models.traffic import engine
Session = scoped_session(sessionmaker(bind=engine))
# determine interval_type from YYYY-MM[-DD][-HH]
pieces =... | [
"def",
"_report_interval",
"(",
"interval",
")",
":",
"from",
"sqlalchemy",
".",
"orm",
"import",
"scoped_session",
",",
"sessionmaker",
"from",
"r2",
".",
"models",
".",
"traffic",
"import",
"engine",
"Session",
"=",
"scoped_session",
"(",
"sessionmaker",
"(",
... | https://github.com/reddit-archive/reddit/blob/753b17407e9a9dca09558526805922de24133d53/r2/r2/lib/traffic/traffic.py#L170-L229 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/asyncio/selector_events.py | python | BaseSelectorEventLoop._add_reader | (self, fd, callback, *args) | [] | def _add_reader(self, fd, callback, *args):
self._check_closed()
handle = events.Handle(callback, args, self, None)
try:
key = self._selector.get_key(fd)
except KeyError:
self._selector.register(fd, selectors.EVENT_READ,
(handle... | [
"def",
"_add_reader",
"(",
"self",
",",
"fd",
",",
"callback",
",",
"*",
"args",
")",
":",
"self",
".",
"_check_closed",
"(",
")",
"handle",
"=",
"events",
".",
"Handle",
"(",
"callback",
",",
"args",
",",
"self",
",",
"None",
")",
"try",
":",
"key... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/asyncio/selector_events.py#L255-L268 | ||||
Pylons/webob | 259230aa2b8b9cf675c996e157c5cf021c256059 | src/webob/request.py | python | BaseRequest._json_body__get | (self) | return json.loads(self.body.decode(self.charset)) | Access the body of the request as JSON | Access the body of the request as JSON | [
"Access",
"the",
"body",
"of",
"the",
"request",
"as",
"JSON"
] | def _json_body__get(self):
"""Access the body of the request as JSON"""
return json.loads(self.body.decode(self.charset)) | [
"def",
"_json_body__get",
"(",
"self",
")",
":",
"return",
"json",
".",
"loads",
"(",
"self",
".",
"body",
".",
"decode",
"(",
"self",
".",
"charset",
")",
")"
] | https://github.com/Pylons/webob/blob/259230aa2b8b9cf675c996e157c5cf021c256059/src/webob/request.py#L730-L733 | |
naver/sqlova | fc68af6008fd2fd5839210e4b06a352007f609b6 | bert/convert_tf_checkpoint_to_pytorch.py | python | convert | () | [] | def convert():
# Initialise PyTorch model
config = BertConfig.from_json_file(args.bert_config_file)
model = BertModel(config)
# Load weights from TF model
path = args.tf_checkpoint_path
print("Converting TensorFlow checkpoint from {}".format(path))
init_vars = tf.train.list_variables(path)... | [
"def",
"convert",
"(",
")",
":",
"# Initialise PyTorch model",
"config",
"=",
"BertConfig",
".",
"from_json_file",
"(",
"args",
".",
"bert_config_file",
")",
"model",
"=",
"BertModel",
"(",
"config",
")",
"# Load weights from TF model",
"path",
"=",
"args",
".",
... | https://github.com/naver/sqlova/blob/fc68af6008fd2fd5839210e4b06a352007f609b6/bert/convert_tf_checkpoint_to_pytorch.py#L51-L102 | ||||
jacobandreas/nmn2 | 7e42dd98420f9580fd34185ba670490a5d86fb04 | misc/util.py | python | Struct.__repr__ | (self) | return "Struct(%r)" % self.__dict__ | [] | def __repr__(self):
return "Struct(%r)" % self.__dict__ | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"\"Struct(%r)\"",
"%",
"self",
".",
"__dict__"
] | https://github.com/jacobandreas/nmn2/blob/7e42dd98420f9580fd34185ba670490a5d86fb04/misc/util.py#L33-L34 | |||
mdiazcl/fuzzbunch-debian | 2b76c2249ade83a389ae3badb12a1bd09901fd2c | windows/Resources/Python/Core/Lib/lib-tk/Tkinter.py | python | Canvas.dtag | (self, *args) | Delete tag or id given as last arguments in ARGS from items
identified by first argument in ARGS. | Delete tag or id given as last arguments in ARGS from items
identified by first argument in ARGS. | [
"Delete",
"tag",
"or",
"id",
"given",
"as",
"last",
"arguments",
"in",
"ARGS",
"from",
"items",
"identified",
"by",
"first",
"argument",
"in",
"ARGS",
"."
] | def dtag(self, *args):
"""Delete tag or id given as last arguments in ARGS from items
identified by first argument in ARGS."""
self.tk.call((self._w, 'dtag') + args) | [
"def",
"dtag",
"(",
"self",
",",
"*",
"args",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"(",
"self",
".",
"_w",
",",
"'dtag'",
")",
"+",
"args",
")"
] | https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/lib-tk/Tkinter.py#L2463-L2466 | ||
pyca/pyopenssl | fb26edde0aa27670c7bb24c0daeb05516e83d7b0 | src/OpenSSL/crypto.py | python | X509.has_expired | (self) | return not_after < datetime.datetime.utcnow() | Check whether the certificate has expired.
:return: ``True`` if the certificate has expired, ``False`` otherwise.
:rtype: bool | Check whether the certificate has expired. | [
"Check",
"whether",
"the",
"certificate",
"has",
"expired",
"."
] | def has_expired(self):
"""
Check whether the certificate has expired.
:return: ``True`` if the certificate has expired, ``False`` otherwise.
:rtype: bool
"""
time_string = self.get_notAfter().decode("utf-8")
not_after = datetime.datetime.strptime(time_string, "%Y... | [
"def",
"has_expired",
"(",
"self",
")",
":",
"time_string",
"=",
"self",
".",
"get_notAfter",
"(",
")",
".",
"decode",
"(",
"\"utf-8\"",
")",
"not_after",
"=",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"time_string",
",",
"\"%Y%m%d%H%M%SZ\"",
")",
... | https://github.com/pyca/pyopenssl/blob/fb26edde0aa27670c7bb24c0daeb05516e83d7b0/src/OpenSSL/crypto.py#L1376-L1386 | |
HewlettPackard/dlcookbook-dlbs | 863ac1d7e72ad2fcafc78d8a13f67d35bc00c235 | python/dlbs/utils.py | python | IOUtils.check_file_extensions | (file_name, extensions) | Checks that `file_name` has one of the provided extensions.
Args:
file_name (str): The file name to check.
extensions (tuple): A tuple of file extensions to use.
Raises:
ValueError: If `file_name` does not end with one of the extensions. | Checks that `file_name` has one of the provided extensions. | [
"Checks",
"that",
"file_name",
"has",
"one",
"of",
"the",
"provided",
"extensions",
"."
] | def check_file_extensions(file_name, extensions):
"""Checks that `file_name` has one of the provided extensions.
Args:
file_name (str): The file name to check.
extensions (tuple): A tuple of file extensions to use.
Raises:
ValueError: If `file_name` does not... | [
"def",
"check_file_extensions",
"(",
"file_name",
",",
"extensions",
")",
":",
"if",
"file_name",
"is",
"None",
":",
"return",
"assert",
"isinstance",
"(",
"extensions",
",",
"tuple",
")",
",",
"\"The 'extensions' must be a tuple.\"",
"if",
"not",
"file_name",
"."... | https://github.com/HewlettPackard/dlcookbook-dlbs/blob/863ac1d7e72ad2fcafc78d8a13f67d35bc00c235/python/dlbs/utils.py#L333-L347 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/vpc/v20170312/models.py | python | AddBandwidthPackageResourcesRequest.__init__ | (self) | r"""
:param ResourceIds: 资源唯一ID,当前支持EIP资源和LB资源,形如'eip-xxxx', 'lb-xxxx'
:type ResourceIds: list of str
:param BandwidthPackageId: 带宽包唯一标识ID,形如'bwp-xxxx'
:type BandwidthPackageId: str
:param NetworkType: 带宽包类型,当前支持'BGP'类型,表示内部资源是BGP IP。
:type NetworkType: str
:param... | r"""
:param ResourceIds: 资源唯一ID,当前支持EIP资源和LB资源,形如'eip-xxxx', 'lb-xxxx'
:type ResourceIds: list of str
:param BandwidthPackageId: 带宽包唯一标识ID,形如'bwp-xxxx'
:type BandwidthPackageId: str
:param NetworkType: 带宽包类型,当前支持'BGP'类型,表示内部资源是BGP IP。
:type NetworkType: str
:param... | [
"r",
":",
"param",
"ResourceIds",
":",
"资源唯一ID,当前支持EIP资源和LB资源,形如",
"eip",
"-",
"xxxx",
"lb",
"-",
"xxxx",
":",
"type",
"ResourceIds",
":",
"list",
"of",
"str",
":",
"param",
"BandwidthPackageId",
":",
"带宽包唯一标识ID,形如",
"bwp",
"-",
"xxxx",
":",
"type",
"Bandwid... | def __init__(self):
r"""
:param ResourceIds: 资源唯一ID,当前支持EIP资源和LB资源,形如'eip-xxxx', 'lb-xxxx'
:type ResourceIds: list of str
:param BandwidthPackageId: 带宽包唯一标识ID,形如'bwp-xxxx'
:type BandwidthPackageId: str
:param NetworkType: 带宽包类型,当前支持'BGP'类型,表示内部资源是BGP IP。
:type Net... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"ResourceIds",
"=",
"None",
"self",
".",
"BandwidthPackageId",
"=",
"None",
"self",
".",
"NetworkType",
"=",
"None",
"self",
".",
"ResourceType",
"=",
"None",
"self",
".",
"Protocol",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/vpc/v20170312/models.py#L104-L121 | ||
isce-framework/isce2 | 0e5114a8bede3caf1d533d98e44dfe4b983e3f48 | components/isceobj/RtcProc/RtcProc.py | python | RtcProc.getValidPolarizationList | (self, inlist) | return validlist | Used to get list of swaths left after applying all filters - e.g, region of interest. | Used to get list of swaths left after applying all filters - e.g, region of interest. | [
"Used",
"to",
"get",
"list",
"of",
"swaths",
"left",
"after",
"applying",
"all",
"filters",
"-",
"e",
".",
"g",
"region",
"of",
"interest",
"."
] | def getValidPolarizationList(self, inlist):
'''
Used to get list of swaths left after applying all filters - e.g, region of interest.
'''
checklist = self.getInputPolarizationList(inlist)
validlist = [x for x in checklist if x in self.polarizations]
return validlist | [
"def",
"getValidPolarizationList",
"(",
"self",
",",
"inlist",
")",
":",
"checklist",
"=",
"self",
".",
"getInputPolarizationList",
"(",
"inlist",
")",
"validlist",
"=",
"[",
"x",
"for",
"x",
"in",
"checklist",
"if",
"x",
"in",
"self",
".",
"polarizations",
... | https://github.com/isce-framework/isce2/blob/0e5114a8bede3caf1d533d98e44dfe4b983e3f48/components/isceobj/RtcProc/RtcProc.py#L198-L207 | |
yaqwsx/PcbDraw | 09720d46f3fdb8b01c2b0e2eca39d964552e94a0 | versioneer.py | python | render_pep440 | (pieces) | return rendered | Build up version string, with post-release "local version identifier".
Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
Exceptions:
1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] | Build up version string, with post-release "local version identifier". | [
"Build",
"up",
"version",
"string",
"with",
"post",
"-",
"release",
"local",
"version",
"identifier",
"."
] | def render_pep440(pieces):
"""Build up version string, with post-release "local version identifier".
Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
Exceptions:
1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHE... | [
"def",
"render_pep440",
"(",
"pieces",
")",
":",
"if",
"pieces",
"[",
"\"closest-tag\"",
"]",
":",
"rendered",
"=",
"pieces",
"[",
"\"closest-tag\"",
"]",
"if",
"pieces",
"[",
"\"distance\"",
"]",
"or",
"pieces",
"[",
"\"dirty\"",
"]",
":",
"rendered",
"+=... | https://github.com/yaqwsx/PcbDraw/blob/09720d46f3fdb8b01c2b0e2eca39d964552e94a0/versioneer.py#L1236-L1258 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/layout/scene/_yaxis.py | python | YAxis.linecolor | (self) | return self["linecolor"] | Sets the axis line color.
The 'linecolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- ... | Sets the axis line color.
The 'linecolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- ... | [
"Sets",
"the",
"axis",
"line",
"color",
".",
"The",
"linecolor",
"property",
"is",
"a",
"color",
"and",
"may",
"be",
"specified",
"as",
":",
"-",
"A",
"hex",
"string",
"(",
"e",
".",
"g",
".",
"#ff0000",
")",
"-",
"An",
"rgb",
"/",
"rgba",
"string"... | def linecolor(self):
"""
Sets the axis line color.
The 'linecolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva stri... | [
"def",
"linecolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"linecolor\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/layout/scene/_yaxis.py#L524-L574 | |
dmnfarrell/pandastable | 9c268b3e2bfe2e718eaee4a30bd02832a0ad1614 | pandastable/plotting.py | python | PlotViewer.removeSubplot | (self) | return | Remove a specific axis from the grid layout | Remove a specific axis from the grid layout | [
"Remove",
"a",
"specific",
"axis",
"from",
"the",
"grid",
"layout"
] | def removeSubplot(self):
"""Remove a specific axis from the grid layout"""
axname = self.layoutopts.axeslistvar.get()
ax = self.gridaxes[axname]
if ax in self.fig.axes:
self.fig.delaxes(ax)
del self.gridaxes[axname]
self.canvas.show()
self.layoutopts.... | [
"def",
"removeSubplot",
"(",
"self",
")",
":",
"axname",
"=",
"self",
".",
"layoutopts",
".",
"axeslistvar",
".",
"get",
"(",
")",
"ax",
"=",
"self",
".",
"gridaxes",
"[",
"axname",
"]",
"if",
"ax",
"in",
"self",
".",
"fig",
".",
"axes",
":",
"self... | https://github.com/dmnfarrell/pandastable/blob/9c268b3e2bfe2e718eaee4a30bd02832a0ad1614/pandastable/plotting.py#L399-L410 | |
zaiweizhang/H3DNet | e69f2855634807b37ae12e6db5963c924e64d3e7 | utils/eval_det.py | python | eval_det | (pred_all, gt_all, ovthresh=0.25, use_07_metric=False, get_iou_func=get_iou) | return rec, prec, ap | Generic functions to compute precision/recall for object detection
for multiple classes.
Input:
pred_all: map of {img_id: [(classname, bbox, score)]}
gt_all: map of {img_id: [(classname, bbox)]}
ovthresh: scalar, iou threshold
use_07_metric: bool, if true ... | Generic functions to compute precision/recall for object detection
for multiple classes.
Input:
pred_all: map of {img_id: [(classname, bbox, score)]}
gt_all: map of {img_id: [(classname, bbox)]}
ovthresh: scalar, iou threshold
use_07_metric: bool, if true ... | [
"Generic",
"functions",
"to",
"compute",
"precision",
"/",
"recall",
"for",
"object",
"detection",
"for",
"multiple",
"classes",
".",
"Input",
":",
"pred_all",
":",
"map",
"of",
"{",
"img_id",
":",
"[",
"(",
"classname",
"bbox",
"score",
")",
"]",
"}",
"... | def eval_det(pred_all, gt_all, ovthresh=0.25, use_07_metric=False, get_iou_func=get_iou):
""" Generic functions to compute precision/recall for object detection
for multiple classes.
Input:
pred_all: map of {img_id: [(classname, bbox, score)]}
gt_all: map of {img_id: [(classn... | [
"def",
"eval_det",
"(",
"pred_all",
",",
"gt_all",
",",
"ovthresh",
"=",
"0.25",
",",
"use_07_metric",
"=",
"False",
",",
"get_iou_func",
"=",
"get_iou",
")",
":",
"pred",
"=",
"{",
"}",
"# map {classname: pred}",
"gt",
"=",
"{",
"}",
"# map {classname: gt}"... | https://github.com/zaiweizhang/H3DNet/blob/e69f2855634807b37ae12e6db5963c924e64d3e7/utils/eval_det.py#L168-L207 | |
hydroshare/hydroshare | 7ba563b55412f283047fb3ef6da367d41dec58c6 | hs_core/models.py | python | BaseResource.bag_checksum | (self) | get checksum of resource bag. Currently only published resources have bag checksums computed and saved
:return: checksum if bag checksum exists; empty string '' otherwise | get checksum of resource bag. Currently only published resources have bag checksums computed and saved
:return: checksum if bag checksum exists; empty string '' otherwise | [
"get",
"checksum",
"of",
"resource",
"bag",
".",
"Currently",
"only",
"published",
"resources",
"have",
"bag",
"checksums",
"computed",
"and",
"saved",
":",
"return",
":",
"checksum",
"if",
"bag",
"checksum",
"exists",
";",
"empty",
"string",
"otherwise"
] | def bag_checksum(self):
"""
get checksum of resource bag. Currently only published resources have bag checksums computed and saved
:return: checksum if bag checksum exists; empty string '' otherwise
"""
extra_data = self.extra_data
if 'bag_checksum' in extra_data and extr... | [
"def",
"bag_checksum",
"(",
"self",
")",
":",
"extra_data",
"=",
"self",
".",
"extra_data",
"if",
"'bag_checksum'",
"in",
"extra_data",
"and",
"extra_data",
"[",
"'bag_checksum'",
"]",
":",
"return",
"extra_data",
"[",
"'bag_checksum'",
"]",
".",
"strip",
"(",... | https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/hs_core/models.py#L3498-L3507 | ||
har07/PySastrawi | 01afc81c579bde14dcb41c33686b26af8afab121 | src/Sastrawi/Morphology/Disambiguator/DisambiguatorPrefixRule4.py | python | DisambiguatorPrefixRule4.disambiguate | (self, word) | Disambiguate Prefix Rule 4
Rule 4 : belajar -> bel-ajar | Disambiguate Prefix Rule 4
Rule 4 : belajar -> bel-ajar | [
"Disambiguate",
"Prefix",
"Rule",
"4",
"Rule",
"4",
":",
"belajar",
"-",
">",
"bel",
"-",
"ajar"
] | def disambiguate(self, word):
"""Disambiguate Prefix Rule 4
Rule 4 : belajar -> bel-ajar
"""
if word == 'belajar':
return 'ajar' | [
"def",
"disambiguate",
"(",
"self",
",",
"word",
")",
":",
"if",
"word",
"==",
"'belajar'",
":",
"return",
"'ajar'"
] | https://github.com/har07/PySastrawi/blob/01afc81c579bde14dcb41c33686b26af8afab121/src/Sastrawi/Morphology/Disambiguator/DisambiguatorPrefixRule4.py#L6-L11 | ||
accel-brain/accel-brain-code | 86f489dc9be001a3bae6d053f48d6b57c0bedb95 | Automatic-Summarization/pysummarization/abstractablesemantics/_mxnet/observing_media.py | python | ObservingMedia.learn | (self) | Learning. | Learning. | [
"Learning",
"."
] | def learn(self):
'''
Learning.
'''
self.transformer_controller.learn(self.transformer_iterator) | [
"def",
"learn",
"(",
"self",
")",
":",
"self",
".",
"transformer_controller",
".",
"learn",
"(",
"self",
".",
"transformer_iterator",
")"
] | https://github.com/accel-brain/accel-brain-code/blob/86f489dc9be001a3bae6d053f48d6b57c0bedb95/Automatic-Summarization/pysummarization/abstractablesemantics/_mxnet/observing_media.py#L105-L109 | ||
privacyidea/privacyidea | 9490c12ddbf77a34ac935b082d09eb583dfafa2c | privacyidea/api/realm.py | python | set_realm_api | (realm=None) | return send_result({"added": added,
"failed": failed}) | This call creates a new realm or reconfigures a realm.
The realm contains a list of resolvers.
In the result it returns a list of added resolvers and a list of
resolvers, that could not be added.
:param realm: The unique name of the realm
:param resolvers: A comma separated list of unique resolver... | This call creates a new realm or reconfigures a realm.
The realm contains a list of resolvers. | [
"This",
"call",
"creates",
"a",
"new",
"realm",
"or",
"reconfigures",
"a",
"realm",
".",
"The",
"realm",
"contains",
"a",
"list",
"of",
"resolvers",
"."
] | def set_realm_api(realm=None):
"""
This call creates a new realm or reconfigures a realm.
The realm contains a list of resolvers.
In the result it returns a list of added resolvers and a list of
resolvers, that could not be added.
:param realm: The unique name of the realm
:param resolvers... | [
"def",
"set_realm_api",
"(",
"realm",
"=",
"None",
")",
":",
"param",
"=",
"request",
".",
"all_data",
"resolvers",
"=",
"getParam",
"(",
"param",
",",
"\"resolvers\"",
",",
"required",
")",
"priority",
"=",
"get_priority_from_param",
"(",
"param",
")",
"if"... | https://github.com/privacyidea/privacyidea/blob/9490c12ddbf77a34ac935b082d09eb583dfafa2c/privacyidea/api/realm.py#L80-L148 | |
inspurer/WorkAttendanceSystem | 1221e2d67bdf5bb15fe99517cc3ded58ccb066df | V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/req/req_uninstall.py | python | UninstallPathSet._permitted | (self, path) | return is_local(path) | Return True if the given path is one we are permitted to
remove/modify, False otherwise. | Return True if the given path is one we are permitted to
remove/modify, False otherwise. | [
"Return",
"True",
"if",
"the",
"given",
"path",
"is",
"one",
"we",
"are",
"permitted",
"to",
"remove",
"/",
"modify",
"False",
"otherwise",
"."
] | def _permitted(self, path):
"""
Return True if the given path is one we are permitted to
remove/modify, False otherwise.
"""
return is_local(path) | [
"def",
"_permitted",
"(",
"self",
",",
"path",
")",
":",
"return",
"is_local",
"(",
"path",
")"
] | https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/req/req_uninstall.py#L27-L33 | |
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/discovery_v1_endpoint_port.py | python | DiscoveryV1EndpointPort.__eq__ | (self, other) | return self.to_dict() == other.to_dict() | Returns true if both objects are equal | Returns true if both objects are equal | [
"Returns",
"true",
"if",
"both",
"objects",
"are",
"equal"
] | def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, DiscoveryV1EndpointPort):
return False
return self.to_dict() == other.to_dict() | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"DiscoveryV1EndpointPort",
")",
":",
"return",
"False",
"return",
"self",
".",
"to_dict",
"(",
")",
"==",
"other",
".",
"to_dict",
"(",
")"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/discovery_v1_endpoint_port.py#L194-L199 | |
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/vendor/packaging/markers.py | python | Marker.__str__ | (self) | return _format_marker(self._markers) | [] | def __str__(self) -> str:
return _format_marker(self._markers) | [
"def",
"__str__",
"(",
"self",
")",
"->",
"str",
":",
"return",
"_format_marker",
"(",
"self",
".",
"_markers",
")"
] | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/packaging/markers.py#L285-L286 | |||
wanggrun/Adaptively-Connected-Neural-Networks | e27066ef52301bdafa5932f43af8feeb23647edb | tensorpack-installed/tensorpack/tfutils/symbolic_functions.py | python | get_scalar_var | (name, init_value, summary=False, trainable=False) | return ret | Get a scalar float variable with certain initial value.
You can just call `tf.get_variable(name, initializer=init_value, trainable=False)` instead.
Args:
name (str): name of the variable.
init_value (float): initial value.
summary (bool): whether to summary this variable.
traina... | Get a scalar float variable with certain initial value.
You can just call `tf.get_variable(name, initializer=init_value, trainable=False)` instead. | [
"Get",
"a",
"scalar",
"float",
"variable",
"with",
"certain",
"initial",
"value",
".",
"You",
"can",
"just",
"call",
"tf",
".",
"get_variable",
"(",
"name",
"initializer",
"=",
"init_value",
"trainable",
"=",
"False",
")",
"instead",
"."
] | def get_scalar_var(name, init_value, summary=False, trainable=False):
"""
Get a scalar float variable with certain initial value.
You can just call `tf.get_variable(name, initializer=init_value, trainable=False)` instead.
Args:
name (str): name of the variable.
init_value (float): initi... | [
"def",
"get_scalar_var",
"(",
"name",
",",
"init_value",
",",
"summary",
"=",
"False",
",",
"trainable",
"=",
"False",
")",
":",
"ret",
"=",
"tf",
".",
"get_variable",
"(",
"name",
",",
"initializer",
"=",
"float",
"(",
"init_value",
")",
",",
"trainable... | https://github.com/wanggrun/Adaptively-Connected-Neural-Networks/blob/e27066ef52301bdafa5932f43af8feeb23647edb/tensorpack-installed/tensorpack/tfutils/symbolic_functions.py#L91-L109 | |
SheffieldML/GPy | bb1bc5088671f9316bc92a46d356734e34c2d5c0 | GPy/likelihoods/poisson.py | python | Poisson.pdf_link | (self, link_f, y, Y_metadata=None) | return np.exp(self.logpdf_link(link_f, y, Y_metadata)) | Likelihood function given link(f)
.. math::
p(y_{i}|\\lambda(f_{i})) = \\frac{\\lambda(f_{i})^{y_{i}}}{y_{i}!}e^{-\\lambda(f_{i})}
:param link_f: latent variables link(f)
:type link_f: Nx1 array
:param y: data
:type y: Nx1 array
:param Y_metadata: Y_metadata... | Likelihood function given link(f) | [
"Likelihood",
"function",
"given",
"link",
"(",
"f",
")"
] | def pdf_link(self, link_f, y, Y_metadata=None):
"""
Likelihood function given link(f)
.. math::
p(y_{i}|\\lambda(f_{i})) = \\frac{\\lambda(f_{i})^{y_{i}}}{y_{i}!}e^{-\\lambda(f_{i})}
:param link_f: latent variables link(f)
:type link_f: Nx1 array
:param y: d... | [
"def",
"pdf_link",
"(",
"self",
",",
"link_f",
",",
"y",
",",
"Y_metadata",
"=",
"None",
")",
":",
"assert",
"np",
".",
"atleast_1d",
"(",
"link_f",
")",
".",
"shape",
"==",
"np",
".",
"atleast_1d",
"(",
"y",
")",
".",
"shape",
"return",
"np",
".",... | https://github.com/SheffieldML/GPy/blob/bb1bc5088671f9316bc92a46d356734e34c2d5c0/GPy/likelihoods/poisson.py#L33-L49 | |
nengo/nengo | f5a88ba6b42b39a722299db6e889a5d034fcfeda | nengo/ensemble.py | python | Neurons.size_out | (self) | return self.ensemble.n_neurons | (int) The number of neurons in the population. | (int) The number of neurons in the population. | [
"(",
"int",
")",
"The",
"number",
"of",
"neurons",
"in",
"the",
"population",
"."
] | def size_out(self):
"""(int) The number of neurons in the population."""
if isinstance(self.ensemble.neuron_type, Direct):
# This will prevent users from connecting/probing Direct neurons
# (since there aren't actually any neurons being simulated).
return 0
re... | [
"def",
"size_out",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"ensemble",
".",
"neuron_type",
",",
"Direct",
")",
":",
"# This will prevent users from connecting/probing Direct neurons",
"# (since there aren't actually any neurons being simulated).",
"return... | https://github.com/nengo/nengo/blob/f5a88ba6b42b39a722299db6e889a5d034fcfeda/nengo/ensemble.py#L259-L265 | |
captainhammy/Houdini-Toolbox | a4e61c3c0296b3a3a153a8dd42297c316be1b0f3 | python/houdini_toolbox/ui/aovs/widgets.py | python | AOVsToAddWidget.apply_as_parms | (self) | Apply AOVs and AOVGroups as multi parms. | Apply AOVs and AOVGroups as multi parms. | [
"Apply",
"AOVs",
"and",
"AOVGroups",
"as",
"multi",
"parms",
"."
] | def apply_as_parms(self):
"""Apply AOVs and AOVGroups as multi parms."""
if self.node is not None:
nodes = [self.node]
else:
nodes = utils.get_selected_mantra_nodes()
if not nodes:
return
elements = self.tree.get_elements_to_add()
u... | [
"def",
"apply_as_parms",
"(",
"self",
")",
":",
"if",
"self",
".",
"node",
"is",
"not",
"None",
":",
"nodes",
"=",
"[",
"self",
".",
"node",
"]",
"else",
":",
"nodes",
"=",
"utils",
".",
"get_selected_mantra_nodes",
"(",
")",
"if",
"not",
"nodes",
":... | https://github.com/captainhammy/Houdini-Toolbox/blob/a4e61c3c0296b3a3a153a8dd42297c316be1b0f3/python/houdini_toolbox/ui/aovs/widgets.py#L1468-L1481 | ||
khalim19/gimp-plugin-export-layers | b37255f2957ad322f4d332689052351cdea6e563 | export_layers/update.py | python | handle_update | (settings, update_handlers, previous_version, current_version) | [] | def handle_update(settings, update_handlers, previous_version, current_version):
for version_str, update_handler in update_handlers.items():
if previous_version < pg.version.Version.parse(version_str) <= current_version:
update_handler(settings) | [
"def",
"handle_update",
"(",
"settings",
",",
"update_handlers",
",",
"previous_version",
",",
"current_version",
")",
":",
"for",
"version_str",
",",
"update_handler",
"in",
"update_handlers",
".",
"items",
"(",
")",
":",
"if",
"previous_version",
"<",
"pg",
".... | https://github.com/khalim19/gimp-plugin-export-layers/blob/b37255f2957ad322f4d332689052351cdea6e563/export_layers/update.py#L109-L112 | ||||
realpython/book2-exercises | cde325eac8e6d8cff2316601c2e5b36bb46af7d0 | web2py/gluon/validators.py | python | LazyCrypt.__eq__ | (self, stored_password) | return temp_pass == stored_password | compares the current lazy crypted password with a stored password | compares the current lazy crypted password with a stored password | [
"compares",
"the",
"current",
"lazy",
"crypted",
"password",
"with",
"a",
"stored",
"password"
] | def __eq__(self, stored_password):
"""
compares the current lazy crypted password with a stored password
"""
# LazyCrypt objects comparison
if isinstance(stored_password, self.__class__):
return ((self is stored_password) or
((self.crypt.key == st... | [
"def",
"__eq__",
"(",
"self",
",",
"stored_password",
")",
":",
"# LazyCrypt objects comparison",
"if",
"isinstance",
"(",
"stored_password",
",",
"self",
".",
"__class__",
")",
":",
"return",
"(",
"(",
"self",
"is",
"stored_password",
")",
"or",
"(",
"(",
"... | https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/gluon/validators.py#L2755-L2786 | |
vyos/vyos-1x | 6e8a8934a7d4e1b21d7c828e372303683b499b56 | python/vyos/util.py | python | read_json | (fname, defaultonfailure=None) | read and json decode the content of a file
should defaultonfailure be not None, it is returned on failure to read | read and json decode the content of a file
should defaultonfailure be not None, it is returned on failure to read | [
"read",
"and",
"json",
"decode",
"the",
"content",
"of",
"a",
"file",
"should",
"defaultonfailure",
"be",
"not",
"None",
"it",
"is",
"returned",
"on",
"failure",
"to",
"read"
] | def read_json(fname, defaultonfailure=None):
"""
read and json decode the content of a file
should defaultonfailure be not None, it is returned on failure to read
"""
import json
try:
with open(fname, 'r') as f:
data = json.load(f)
return data
except Exception as ... | [
"def",
"read_json",
"(",
"fname",
",",
"defaultonfailure",
"=",
"None",
")",
":",
"import",
"json",
"try",
":",
"with",
"open",
"(",
"fname",
",",
"'r'",
")",
"as",
"f",
":",
"data",
"=",
"json",
".",
"load",
"(",
"f",
")",
"return",
"data",
"excep... | https://github.com/vyos/vyos-1x/blob/6e8a8934a7d4e1b21d7c828e372303683b499b56/python/vyos/util.py#L225-L238 | ||
pm4py/pm4py-core | 7807b09a088b02199cd0149d724d0e28793971bf | pm4py/objects/transition_system/utils.py | python | remove_arc_from_to | (name, fr, to, ts) | Removes a transition with a specific name from a state to another state in some transition system.
Assumes from and to are in the transition system!
Parameters
----------
name: name of the transition
fr: state from
to: state to
ts: transition system to use
Returns
-------
None | Removes a transition with a specific name from a state to another state in some transition system.
Assumes from and to are in the transition system! | [
"Removes",
"a",
"transition",
"with",
"a",
"specific",
"name",
"from",
"a",
"state",
"to",
"another",
"state",
"in",
"some",
"transition",
"system",
".",
"Assumes",
"from",
"and",
"to",
"are",
"in",
"the",
"transition",
"system!"
] | def remove_arc_from_to(name, fr, to, ts):
"""
Removes a transition with a specific name from a state to another state in some transition system.
Assumes from and to are in the transition system!
Parameters
----------
name: name of the transition
fr: state from
to: state to
ts: tran... | [
"def",
"remove_arc_from_to",
"(",
"name",
",",
"fr",
",",
"to",
",",
"ts",
")",
":",
"ts",
".",
"transitions",
"=",
"[",
"t",
"for",
"t",
"in",
"ts",
".",
"transitions",
"if",
"t",
".",
"name",
"!=",
"name",
"]",
"fr",
".",
"outgoing",
"=",
"[",
... | https://github.com/pm4py/pm4py-core/blob/7807b09a088b02199cd0149d724d0e28793971bf/pm4py/objects/transition_system/utils.py#L43-L61 | ||
HaoZhang95/Python24 | b897224b8a0e6a5734f408df8c24846a98c553bf | 00Python/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/pkg_resources/__init__.py | python | resolve_egg_link | (path) | return next(dist_groups, ()) | Given a path to an .egg-link, resolve distributions
present in the referenced path. | Given a path to an .egg-link, resolve distributions
present in the referenced path. | [
"Given",
"a",
"path",
"to",
"an",
".",
"egg",
"-",
"link",
"resolve",
"distributions",
"present",
"in",
"the",
"referenced",
"path",
"."
] | def resolve_egg_link(path):
"""
Given a path to an .egg-link, resolve distributions
present in the referenced path.
"""
referenced_paths = non_empty_lines(path)
resolved_paths = (
os.path.join(os.path.dirname(path), ref)
for ref in referenced_paths
)
dist_groups = map(fin... | [
"def",
"resolve_egg_link",
"(",
"path",
")",
":",
"referenced_paths",
"=",
"non_empty_lines",
"(",
"path",
")",
"resolved_paths",
"=",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
",",
"ref",
")",
"for"... | https://github.com/HaoZhang95/Python24/blob/b897224b8a0e6a5734f408df8c24846a98c553bf/00Python/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/pkg_resources/__init__.py#L2049-L2060 | |
guildai/guildai | 1665985a3d4d788efc1a3180ca51cc417f71ca78 | guild/external/pip/_vendor/distlib/_backport/tarfile.py | python | TarInfo.create_ustar_header | (self, info, encoding, errors) | return self._create_header(info, USTAR_FORMAT, encoding, errors) | Return the object as a ustar header block. | Return the object as a ustar header block. | [
"Return",
"the",
"object",
"as",
"a",
"ustar",
"header",
"block",
"."
] | def create_ustar_header(self, info, encoding, errors):
"""Return the object as a ustar header block.
"""
info["magic"] = POSIX_MAGIC
if len(info["linkname"]) > LENGTH_LINK:
raise ValueError("linkname is too long")
if len(info["name"]) > LENGTH_NAME:
info... | [
"def",
"create_ustar_header",
"(",
"self",
",",
"info",
",",
"encoding",
",",
"errors",
")",
":",
"info",
"[",
"\"magic\"",
"]",
"=",
"POSIX_MAGIC",
"if",
"len",
"(",
"info",
"[",
"\"linkname\"",
"]",
")",
">",
"LENGTH_LINK",
":",
"raise",
"ValueError",
... | https://github.com/guildai/guildai/blob/1665985a3d4d788efc1a3180ca51cc417f71ca78/guild/external/pip/_vendor/distlib/_backport/tarfile.py#L1016-L1027 | |
meetbill/zabbix_manager | 739e5b51facf19cc6bda2b50f29108f831cf833e | ZabbixTool/lib_zabbix/w_lib/XLSWriter.py | python | XLSWriter.cell | (self, s) | return s | [] | def cell(self, s):
if isinstance(s, basestring):
if not isinstance(s, unicode):
s = s.decode(self.encoding)
elif s is None:
s = ''
else:
s = str(s)
return s | [
"def",
"cell",
"(",
"self",
",",
"s",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"basestring",
")",
":",
"if",
"not",
"isinstance",
"(",
"s",
",",
"unicode",
")",
":",
"s",
"=",
"s",
".",
"decode",
"(",
"self",
".",
"encoding",
")",
"elif",
"... | https://github.com/meetbill/zabbix_manager/blob/739e5b51facf19cc6bda2b50f29108f831cf833e/ZabbixTool/lib_zabbix/w_lib/XLSWriter.py#L107-L115 | |||
PySimpleGUI/PySimpleGUI | 6c0d1fb54f493d45e90180b322fbbe70f7a5af3c | DemoPrograms/Demo_MIDI_Player.py | python | main | () | [] | def main():
def GetCurrentTime():
'''
Get the current system time in milliseconds
:return: milliseconds
'''
return int(round(time.time() * 1000))
pback = PlayerGUI()
button, values = pback.PlayerChooseSongGUI()
if button != 'PLAY':
sg.popup_cancel('Cance... | [
"def",
"main",
"(",
")",
":",
"def",
"GetCurrentTime",
"(",
")",
":",
"'''\n Get the current system time in milliseconds\n :return: milliseconds\n '''",
"return",
"int",
"(",
"round",
"(",
"time",
".",
"time",
"(",
")",
"*",
"1000",
")",
")",
"p... | https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/DemoPrograms/Demo_MIDI_Player.py#L121-L237 | ||||
tryton/trytond | 9fc68232536d0707b73614eab978bd6f813e3677 | trytond/pool.py | python | Pool.database_list | (cls) | :return: database list | :return: database list | [
":",
"return",
":",
"database",
"list"
] | def database_list(cls):
'''
:return: database list
'''
with cls._lock:
databases = []
for database in cls._pool.keys():
if cls._locks.get(database):
if cls._locks[database].acquire(False):
databases.appen... | [
"def",
"database_list",
"(",
"cls",
")",
":",
"with",
"cls",
".",
"_lock",
":",
"databases",
"=",
"[",
"]",
"for",
"database",
"in",
"cls",
".",
"_pool",
".",
"keys",
"(",
")",
":",
"if",
"cls",
".",
"_locks",
".",
"get",
"(",
"database",
")",
":... | https://github.com/tryton/trytond/blob/9fc68232536d0707b73614eab978bd6f813e3677/trytond/pool.py#L125-L136 | ||
mne-tools/mne-python | f90b303ce66a8415e64edd4605b09ac0179c1ebf | mne/minimum_norm/time_frequency.py | python | _prepare_tfr | (data, decim, pick_ori, Ws, K, source_ori) | return shape, is_free_ori | Prepare TFR source localization. | Prepare TFR source localization. | [
"Prepare",
"TFR",
"source",
"localization",
"."
] | def _prepare_tfr(data, decim, pick_ori, Ws, K, source_ori):
"""Prepare TFR source localization."""
n_times = data[:, :, ::decim].shape[2]
n_freqs = len(Ws)
n_sources = K.shape[0]
is_free_ori = False
if (source_ori == FIFF.FIFFV_MNE_FREE_ORI and pick_ori is None):
is_free_ori = True
... | [
"def",
"_prepare_tfr",
"(",
"data",
",",
"decim",
",",
"pick_ori",
",",
"Ws",
",",
"K",
",",
"source_ori",
")",
":",
"n_times",
"=",
"data",
"[",
":",
",",
":",
",",
":",
":",
"decim",
"]",
".",
"shape",
"[",
"2",
"]",
"n_freqs",
"=",
"len",
"(... | https://github.com/mne-tools/mne-python/blob/f90b303ce66a8415e64edd4605b09ac0179c1ebf/mne/minimum_norm/time_frequency.py#L175-L186 | |
Freeseer/freeseer | 73c53ab6f1f22dfc89a782728f3b3070ee71b690 | src/freeseer/framework/database.py | python | QtDBConnector.__create_recentconn_table | (self) | Creates the recentconn table in the database. Should be used to initialize a new table | Creates the recentconn table in the database. Should be used to initialize a new table | [
"Creates",
"the",
"recentconn",
"table",
"in",
"the",
"database",
".",
"Should",
"be",
"used",
"to",
"initialize",
"a",
"new",
"table"
] | def __create_recentconn_table(self):
"""Creates the recentconn table in the database. Should be used to initialize a new table"""
QtSql.QSqlQuery('''CREATE TABLE IF NOT EXISTS recentconn
(host varchar(255),
port int,
... | [
"def",
"__create_recentconn_table",
"(",
"self",
")",
":",
"QtSql",
".",
"QSqlQuery",
"(",
"'''CREATE TABLE IF NOT EXISTS recentconn\n (host varchar(255),\n port int,\n passphra... | https://github.com/Freeseer/freeseer/blob/73c53ab6f1f22dfc89a782728f3b3070ee71b690/src/freeseer/framework/database.py#L580-L586 | ||
rizar/attention-lvcsr | 1ae52cafdd8419874846f9544a299eef9c758f3b | libs/Theano/theano/tensor/extra_ops.py | python | fill_diagonal | (a, val) | return fill_diagonal_(a, val) | Returns a copy of an array with all
elements of the main diagonal set to a specified scalar value.
.. versionadded:: 0.6
Parameters
----------
a
Rectangular array of at least two dimensions.
val
Scalar value to fill the diagonal whose type must be
compatible with that o... | Returns a copy of an array with all
elements of the main diagonal set to a specified scalar value. | [
"Returns",
"a",
"copy",
"of",
"an",
"array",
"with",
"all",
"elements",
"of",
"the",
"main",
"diagonal",
"set",
"to",
"a",
"specified",
"scalar",
"value",
"."
] | def fill_diagonal(a, val):
"""
Returns a copy of an array with all
elements of the main diagonal set to a specified scalar value.
.. versionadded:: 0.6
Parameters
----------
a
Rectangular array of at least two dimensions.
val
Scalar value to fill the diagonal whose type... | [
"def",
"fill_diagonal",
"(",
"a",
",",
"val",
")",
":",
"return",
"fill_diagonal_",
"(",
"a",
",",
"val",
")"
] | https://github.com/rizar/attention-lvcsr/blob/1ae52cafdd8419874846f9544a299eef9c758f3b/libs/Theano/theano/tensor/extra_ops.py#L887-L917 | |
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/Python3/tracemalloc.py | python | Snapshot.load | (filename) | Load a snapshot from a file. | Load a snapshot from a file. | [
"Load",
"a",
"snapshot",
"from",
"a",
"file",
"."
] | def load(filename):
"""
Load a snapshot from a file.
"""
with open(filename, "rb") as fp:
return pickle.load(fp) | [
"def",
"load",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"\"rb\"",
")",
"as",
"fp",
":",
"return",
"pickle",
".",
"load",
"(",
"fp",
")"
] | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/tracemalloc.py#L398-L403 | ||
wandb/client | 3963364d8112b7dedb928fa423b6878ea1b467d9 | wandb/vendor/graphql-core-1.1/graphql/validation/rules/fields_on_correct_type.py | python | get_suggested_type_names | (schema, output_type, field_name) | return [] | Go through all of the implementations of type, as well as the interfaces
that they implement. If any of those types include the provided field,
suggest them, sorted by how often the type is referenced, starting
with Interfaces. | Go through all of the implementations of type, as well as the interfaces
that they implement. If any of those types include the provided field,
suggest them, sorted by how often the type is referenced, starting
with Interfaces. | [
"Go",
"through",
"all",
"of",
"the",
"implementations",
"of",
"type",
"as",
"well",
"as",
"the",
"interfaces",
"that",
"they",
"implement",
".",
"If",
"any",
"of",
"those",
"types",
"include",
"the",
"provided",
"field",
"suggest",
"them",
"sorted",
"by",
... | def get_suggested_type_names(schema, output_type, field_name):
'''Go through all of the implementations of type, as well as the interfaces
that they implement. If any of those types include the provided field,
suggest them, sorted by how often the type is referenced, starting
with Interfaces.'''
... | [
"def",
"get_suggested_type_names",
"(",
"schema",
",",
"output_type",
",",
"field_name",
")",
":",
"if",
"isinstance",
"(",
"output_type",
",",
"(",
"GraphQLInterfaceType",
",",
"GraphQLUnionType",
")",
")",
":",
"suggested_object_types",
"=",
"[",
"]",
"interface... | https://github.com/wandb/client/blob/3963364d8112b7dedb928fa423b6878ea1b467d9/wandb/vendor/graphql-core-1.1/graphql/validation/rules/fields_on_correct_type.py#L67-L100 | |
openstack/nova | b49b7663e1c3073917d5844b81d38db8e86d05c4 | nova/api/openstack/urlmap.py | python | parse_list_header | (value) | return result | Parse lists as described by RFC 2068 Section 2.
In particular, parse comma-separated lists where the elements of
the list may include quoted-strings. A quoted-string could
contain a comma. A non-quoted string could have quotes in the
middle. Quotes are removed automatically after parsing.
The r... | Parse lists as described by RFC 2068 Section 2. | [
"Parse",
"lists",
"as",
"described",
"by",
"RFC",
"2068",
"Section",
"2",
"."
] | def parse_list_header(value):
"""Parse lists as described by RFC 2068 Section 2.
In particular, parse comma-separated lists where the elements of
the list may include quoted-strings. A quoted-string could
contain a comma. A non-quoted string could have quotes in the
middle. Quotes are removed au... | [
"def",
"parse_list_header",
"(",
"value",
")",
":",
"result",
"=",
"[",
"]",
"for",
"item",
"in",
"urllib2",
".",
"parse_http_list",
"(",
"value",
")",
":",
"if",
"item",
"[",
":",
"1",
"]",
"==",
"item",
"[",
"-",
"1",
":",
"]",
"==",
"'\"'",
":... | https://github.com/openstack/nova/blob/b49b7663e1c3073917d5844b81d38db8e86d05c4/nova/api/openstack/urlmap.py#L50-L71 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/PyYAML-5.4.1/lib3/yaml/__init__.py | python | add_multi_representer | (data_type, multi_representer, Dumper=Dumper) | Add a representer for the given type.
Multi-representer is a function accepting a Dumper instance
and an instance of the given data type or subtype
and producing the corresponding representation node. | Add a representer for the given type.
Multi-representer is a function accepting a Dumper instance
and an instance of the given data type or subtype
and producing the corresponding representation node. | [
"Add",
"a",
"representer",
"for",
"the",
"given",
"type",
".",
"Multi",
"-",
"representer",
"is",
"a",
"function",
"accepting",
"a",
"Dumper",
"instance",
"and",
"an",
"instance",
"of",
"the",
"given",
"data",
"type",
"or",
"subtype",
"and",
"producing",
"... | def add_multi_representer(data_type, multi_representer, Dumper=Dumper):
"""
Add a representer for the given type.
Multi-representer is a function accepting a Dumper instance
and an instance of the given data type or subtype
and producing the corresponding representation node.
"""
Dumper.add_... | [
"def",
"add_multi_representer",
"(",
"data_type",
",",
"multi_representer",
",",
"Dumper",
"=",
"Dumper",
")",
":",
"Dumper",
".",
"add_multi_representer",
"(",
"data_type",
",",
"multi_representer",
")"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/PyYAML-5.4.1/lib3/yaml/__init__.py#L375-L382 | ||
sqlalchemy/sqlalchemy | eb716884a4abcabae84a6aaba105568e925b7d27 | lib/sqlalchemy/sql/elements.py | python | literal | (value, type_=None) | return coercions.expect(roles.LiteralValueRole, value, type_=type_) | r"""Return a literal clause, bound to a bind parameter.
Literal clauses are created automatically when non-
:class:`_expression.ClauseElement` objects (such as strings, ints, dates,
etc.) are
used in a comparison operation with a :class:`_expression.ColumnElement`
subclass,
such as a :class:`~s... | r"""Return a literal clause, bound to a bind parameter. | [
"r",
"Return",
"a",
"literal",
"clause",
"bound",
"to",
"a",
"bind",
"parameter",
"."
] | def literal(value, type_=None):
r"""Return a literal clause, bound to a bind parameter.
Literal clauses are created automatically when non-
:class:`_expression.ClauseElement` objects (such as strings, ints, dates,
etc.) are
used in a comparison operation with a :class:`_expression.ColumnElement`
... | [
"def",
"literal",
"(",
"value",
",",
"type_",
"=",
"None",
")",
":",
"return",
"coercions",
".",
"expect",
"(",
"roles",
".",
"LiteralValueRole",
",",
"value",
",",
"type_",
"=",
"type_",
")"
] | https://github.com/sqlalchemy/sqlalchemy/blob/eb716884a4abcabae84a6aaba105568e925b7d27/lib/sqlalchemy/sql/elements.py#L71-L90 | |
luyishisi/Anti-Anti-Spider | dd9ed296fdf9e7efa7eaf4ef9b5eef52b5f7f864 | 原Anti-Anti-Spider/6.爬虫项目源码/11.百家号/id_to_excel/get_id_mysql.py | python | ConnectDB | () | return connect, cursor | Connect MySQLdb and Print version. | Connect MySQLdb and Print version. | [
"Connect",
"MySQLdb",
"and",
"Print",
"version",
"."
] | def ConnectDB():
"Connect MySQLdb and Print version."
connect, cursor = None, None
count = 0
while True:
try :
connect = MySQLdb.connect(host=HOST, user=USER, passwd=PASSWD, db=DB, port = PORT, charset ='utf8')
cursor = connect.cursor()
break
except My... | [
"def",
"ConnectDB",
"(",
")",
":",
"connect",
",",
"cursor",
"=",
"None",
",",
"None",
"count",
"=",
"0",
"while",
"True",
":",
"try",
":",
"connect",
"=",
"MySQLdb",
".",
"connect",
"(",
"host",
"=",
"HOST",
",",
"user",
"=",
"USER",
",",
"passwd"... | https://github.com/luyishisi/Anti-Anti-Spider/blob/dd9ed296fdf9e7efa7eaf4ef9b5eef52b5f7f864/原Anti-Anti-Spider/6.爬虫项目源码/11.百家号/id_to_excel/get_id_mysql.py#L24-L40 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.