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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aeasringnar/django-RESTfulAPI | b76689f0feee33f0e8ca13f2a920f229f7a9af82 | utils/Jpush.py | python | JPush.push_info | (self, receiver, info, all=True) | return res | 发送信息
:return: | 发送信息
:return: | [
"发送信息",
":",
"return",
":"
] | def push_info(self, receiver, info, all=True):
'''
发送信息
:return:
'''
token = self.get_token()
headers = {
'Authorization': 'Basic ' + token
}
if all:
data = {
"platform": "all",
"audience": "all",
... | [
"def",
"push_info",
"(",
"self",
",",
"receiver",
",",
"info",
",",
"all",
"=",
"True",
")",
":",
"token",
"=",
"self",
".",
"get_token",
"(",
")",
"headers",
"=",
"{",
"'Authorization'",
":",
"'Basic '",
"+",
"token",
"}",
"if",
"all",
":",
"data",
... | https://github.com/aeasringnar/django-RESTfulAPI/blob/b76689f0feee33f0e8ca13f2a920f229f7a9af82/utils/Jpush.py#L20-L51 | |
VirtueSecurity/aws-extender | d123b7e1a845847709ba3a481f11996bddc68a1c | BappModules/boto/rds/dbinstance.py | python | DBInstance.parameter_group | (self) | Provide backward compatibility for previous parameter_group
attribute. | Provide backward compatibility for previous parameter_group
attribute. | [
"Provide",
"backward",
"compatibility",
"for",
"previous",
"parameter_group",
"attribute",
"."
] | def parameter_group(self):
"""
Provide backward compatibility for previous parameter_group
attribute.
"""
if len(self.parameter_groups) > 0:
return self.parameter_groups[-1]
else:
return None | [
"def",
"parameter_group",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"parameter_groups",
")",
">",
"0",
":",
"return",
"self",
".",
"parameter_groups",
"[",
"-",
"1",
"]",
"else",
":",
"return",
"None"
] | https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/boto/rds/dbinstance.py#L222-L230 | ||
intuition-io/intuition | cd517e6b3b315a743eb4d0d0dc294e264ab913ce | intuition/api/algorithm.py | python | TradingFactory._check_condition | (self, when) | return True | Verify that the middleware condition is True | Verify that the middleware condition is True | [
"Verify",
"that",
"the",
"middleware",
"condition",
"is",
"True"
] | def _check_condition(self, when):
''' Verify that the middleware condition is True '''
#TODO Use self.datetime to evaluate <when>
return True | [
"def",
"_check_condition",
"(",
"self",
",",
"when",
")",
":",
"#TODO Use self.datetime to evaluate <when>",
"return",
"True"
] | https://github.com/intuition-io/intuition/blob/cd517e6b3b315a743eb4d0d0dc294e264ab913ce/intuition/api/algorithm.py#L141-L144 | |
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/models/connection_status_dto.py | python | ConnectionStatusDTO.__init__ | (self, id=None, group_id=None, name=None, stats_last_refreshed=None, source_id=None, source_name=None, destination_id=None, destination_name=None, aggregate_snapshot=None, node_snapshots=None) | ConnectionStatusDTO - a model defined in Swagger | ConnectionStatusDTO - a model defined in Swagger | [
"ConnectionStatusDTO",
"-",
"a",
"model",
"defined",
"in",
"Swagger"
] | def __init__(self, id=None, group_id=None, name=None, stats_last_refreshed=None, source_id=None, source_name=None, destination_id=None, destination_name=None, aggregate_snapshot=None, node_snapshots=None):
"""
ConnectionStatusDTO - a model defined in Swagger
"""
self._id = None
... | [
"def",
"__init__",
"(",
"self",
",",
"id",
"=",
"None",
",",
"group_id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"stats_last_refreshed",
"=",
"None",
",",
"source_id",
"=",
"None",
",",
"source_name",
"=",
"None",
",",
"destination_id",
"=",
"None",
... | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/connection_status_dto.py#L59-L94 | ||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/pip/_vendor/pyparsing.py | python | ParseResults.extend | ( self, itemseq ) | Add sequence of elements to end of ParseResults list of elements.
Example::
patt = OneOrMore(Word(alphas))
# use a parse action to append the reverse of the matched strings, to make a palindrome
def make_palindrome(tokens):
tokens.extend(reversed... | Add sequence of elements to end of ParseResults list of elements. | [
"Add",
"sequence",
"of",
"elements",
"to",
"end",
"of",
"ParseResults",
"list",
"of",
"elements",
"."
] | def extend( self, itemseq ):
"""
Add sequence of elements to end of ParseResults list of elements.
Example::
patt = OneOrMore(Word(alphas))
# use a parse action to append the reverse of the matched strings, to make a palindrome
def make_palindrom... | [
"def",
"extend",
"(",
"self",
",",
"itemseq",
")",
":",
"if",
"isinstance",
"(",
"itemseq",
",",
"ParseResults",
")",
":",
"self",
"+=",
"itemseq",
"else",
":",
"self",
".",
"__toklist",
".",
"extend",
"(",
"itemseq",
")"
] | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pip/_vendor/pyparsing.py#L596-L612 | ||
hhursev/recipe-scrapers | 478b9ddb0dda02b17b14f299eea729bef8131aa9 | recipe_scrapers/momswithcrockpots.py | python | MomsWithCrockPots.ratings | (self) | return round(
float(
self.soup.find(
"span", {"class": "wprm-recipe-rating-average"}
).get_text()
),
2,
) | [] | def ratings(self):
return round(
float(
self.soup.find(
"span", {"class": "wprm-recipe-rating-average"}
).get_text()
),
2,
) | [
"def",
"ratings",
"(",
"self",
")",
":",
"return",
"round",
"(",
"float",
"(",
"self",
".",
"soup",
".",
"find",
"(",
"\"span\"",
",",
"{",
"\"class\"",
":",
"\"wprm-recipe-rating-average\"",
"}",
")",
".",
"get_text",
"(",
")",
")",
",",
"2",
",",
"... | https://github.com/hhursev/recipe-scrapers/blob/478b9ddb0dda02b17b14f299eea729bef8131aa9/recipe_scrapers/momswithcrockpots.py#L37-L45 | |||
google-research/tapas | a3e069b50c71f50b12a6e5bb3dad10fb51f6fe68 | tapas/models/bert/modeling.py | python | BertConfig.to_json_file | (self, json_file) | Serializes this instance to a JSON file. | Serializes this instance to a JSON file. | [
"Serializes",
"this",
"instance",
"to",
"a",
"JSON",
"file",
"."
] | def to_json_file(self, json_file):
"""Serializes this instance to a JSON file."""
with tf.io.gfile.GFile(json_file, "w") as writer:
writer.write(self.to_json_string()) | [
"def",
"to_json_file",
"(",
"self",
",",
"json_file",
")",
":",
"with",
"tf",
".",
"io",
".",
"gfile",
".",
"GFile",
"(",
"json_file",
",",
"\"w\"",
")",
"as",
"writer",
":",
"writer",
".",
"write",
"(",
"self",
".",
"to_json_string",
"(",
")",
")"
] | https://github.com/google-research/tapas/blob/a3e069b50c71f50b12a6e5bb3dad10fb51f6fe68/tapas/models/bert/modeling.py#L109-L112 | ||
ktbyers/netmiko | 4c3732346eea1a4a608abd9e09d65eeb2f577810 | netmiko/nokia/nokia_sros.py | python | NokiaSrosFileTransfer.remote_file_size | (
self, remote_cmd: str = "", remote_file: Optional[str] = None
) | return file_size | Get the file size of the remote file. | Get the file size of the remote file. | [
"Get",
"the",
"file",
"size",
"of",
"the",
"remote",
"file",
"."
] | def remote_file_size(
self, remote_cmd: str = "", remote_file: Optional[str] = None
) -> int:
"""Get the file size of the remote file."""
if remote_file is None:
if self.direction == "put":
remote_file = self.dest_file
elif self.direction == "get":
... | [
"def",
"remote_file_size",
"(",
"self",
",",
"remote_cmd",
":",
"str",
"=",
"\"\"",
",",
"remote_file",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"int",
":",
"if",
"remote_file",
"is",
"None",
":",
"if",
"self",
".",
"direction",
"==",
... | https://github.com/ktbyers/netmiko/blob/4c3732346eea1a4a608abd9e09d65eeb2f577810/netmiko/nokia/nokia_sros.py#L327-L359 | |
mozilla/moztrap | 93b34a4cd21c9e08f73d3b1a7630cd873f8418a0 | moztrap/view/utils/auth.py | python | login_maybe_required | (viewfunc) | return login_required(viewfunc) | no-op if settings.ALLOW_ANONYMOUS_ACCESS, else login_required | no-op if settings.ALLOW_ANONYMOUS_ACCESS, else login_required | [
"no",
"-",
"op",
"if",
"settings",
".",
"ALLOW_ANONYMOUS_ACCESS",
"else",
"login_required"
] | def login_maybe_required(viewfunc):
"""no-op if settings.ALLOW_ANONYMOUS_ACCESS, else login_required"""
if settings.ALLOW_ANONYMOUS_ACCESS:
return viewfunc
return login_required(viewfunc) | [
"def",
"login_maybe_required",
"(",
"viewfunc",
")",
":",
"if",
"settings",
".",
"ALLOW_ANONYMOUS_ACCESS",
":",
"return",
"viewfunc",
"return",
"login_required",
"(",
"viewfunc",
")"
] | https://github.com/mozilla/moztrap/blob/93b34a4cd21c9e08f73d3b1a7630cd873f8418a0/moztrap/view/utils/auth.py#L11-L15 | |
obonaventure/cnp3 | 155b3a61690f282a7c72fe117fcd3b83c7c09035 | book-2nd/netkit/netkit-lab_tcpudp/set_tcp_options.py | python | add_options | (host, keys) | [] | def add_options(host, keys):
global tcp_options
if os.path.isfile(host+".startup"):
for option in keys:
f = open(host+".startup","a")
f.write("sysctl -w net.ipv4."+option+"={value} \n".format(value=tcp_options[option]))
f.close()
else:
print "Host name %s incorrect, the corres... | [
"def",
"add_options",
"(",
"host",
",",
"keys",
")",
":",
"global",
"tcp_options",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"host",
"+",
"\".startup\"",
")",
":",
"for",
"option",
"in",
"keys",
":",
"f",
"=",
"open",
"(",
"host",
"+",
"\".startup... | https://github.com/obonaventure/cnp3/blob/155b3a61690f282a7c72fe117fcd3b83c7c09035/book-2nd/netkit/netkit-lab_tcpudp/set_tcp_options.py#L42-L51 | ||||
zvtvz/zvt | 054bf8a3e7a049df7087c324fa87e8effbaf5bdc | src/zvt/recorders/em/em_api.py | python | get_kdata | (entity_id, level=IntervalLevel.LEVEL_1DAY, adjust_type=AdjustType.qfq, limit=10000) | [] | def get_kdata(entity_id, level=IntervalLevel.LEVEL_1DAY, adjust_type=AdjustType.qfq, limit=10000):
entity_type, exchange, code = decode_entity_id(entity_id)
level = IntervalLevel(level)
sec_id = to_em_sec_id(entity_id)
fq_flag = to_em_fq_flag(adjust_type)
level_flag = to_em_level_flag(level)
ur... | [
"def",
"get_kdata",
"(",
"entity_id",
",",
"level",
"=",
"IntervalLevel",
".",
"LEVEL_1DAY",
",",
"adjust_type",
"=",
"AdjustType",
".",
"qfq",
",",
"limit",
"=",
"10000",
")",
":",
"entity_type",
",",
"exchange",
",",
"code",
"=",
"decode_entity_id",
"(",
... | https://github.com/zvtvz/zvt/blob/054bf8a3e7a049df7087c324fa87e8effbaf5bdc/src/zvt/recorders/em/em_api.py#L197-L258 | ||||
lunixbochs/SublimeXiki | 4b81ced42cab40b33d4519a97467c5b9f4e2e04c | lib/util.py | python | combine_output | (out, sep='') | return sep.join((
(out[0].decode('utf8') or ''),
(out[1].decode('utf8') or ''),
)) | [] | def combine_output(out, sep=''):
return sep.join((
(out[0].decode('utf8') or ''),
(out[1].decode('utf8') or ''),
)) | [
"def",
"combine_output",
"(",
"out",
",",
"sep",
"=",
"''",
")",
":",
"return",
"sep",
".",
"join",
"(",
"(",
"(",
"out",
"[",
"0",
"]",
".",
"decode",
"(",
"'utf8'",
")",
"or",
"''",
")",
",",
"(",
"out",
"[",
"1",
"]",
".",
"decode",
"(",
... | https://github.com/lunixbochs/SublimeXiki/blob/4b81ced42cab40b33d4519a97467c5b9f4e2e04c/lib/util.py#L112-L116 | |||
Jenyay/outwiker | 50530cf7b3f71480bb075b2829bc0669773b835b | src/outwiker/gui/controls/ultimatelistctrl.py | python | UltimateListMainWindow.CacheLineData | (self, line) | Saves the current line attributes.
:param `line`: an instance of :class:`UltimateListLineData`.
:note: This method is used only if the :class:`UltimateListCtrl` has the ``ULC_VIRTUAL``
style set. | Saves the current line attributes. | [
"Saves",
"the",
"current",
"line",
"attributes",
"."
] | def CacheLineData(self, line):
"""
Saves the current line attributes.
:param `line`: an instance of :class:`UltimateListLineData`.
:note: This method is used only if the :class:`UltimateListCtrl` has the ``ULC_VIRTUAL``
style set.
"""
listctrl = self.GetListCt... | [
"def",
"CacheLineData",
"(",
"self",
",",
"line",
")",
":",
"listctrl",
"=",
"self",
".",
"GetListCtrl",
"(",
")",
"ld",
"=",
"self",
".",
"GetDummyLine",
"(",
")",
"countCol",
"=",
"self",
".",
"GetColumnCount",
"(",
")",
"for",
"col",
"in",
"range",
... | https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/src/outwiker/gui/controls/ultimatelistctrl.py#L6519-L6543 | ||
Pymol-Scripts/Pymol-script-repo | bcd7bb7812dc6db1595953dfa4471fa15fb68c77 | modules/pdb2pqr/src/structures.py | python | Residue.reorder | (self) | Reorder the atoms to start with N, CA, C, O if they exist | Reorder the atoms to start with N, CA, C, O if they exist | [
"Reorder",
"the",
"atoms",
"to",
"start",
"with",
"N",
"CA",
"C",
"O",
"if",
"they",
"exist"
] | def reorder(self):
"""
Reorder the atoms to start with N, CA, C, O if they exist
"""
templist = []
if self.hasAtom("N"): templist.append(self.getAtom("N"))
if self.hasAtom("CA"): templist.append(self.getAtom("CA"))
if self.hasAtom("C"): templist.append(self.ge... | [
"def",
"reorder",
"(",
"self",
")",
":",
"templist",
"=",
"[",
"]",
"if",
"self",
".",
"hasAtom",
"(",
"\"N\"",
")",
":",
"templist",
".",
"append",
"(",
"self",
".",
"getAtom",
"(",
"\"N\"",
")",
")",
"if",
"self",
".",
"hasAtom",
"(",
"\"CA\"",
... | https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/pdb2pqr/src/structures.py#L528-L545 | ||
awslabs/autogluon | 7309118f2ab1c9519f25acf61a283a95af95842b | tabular/src/autogluon/tabular/models/fastainn/hyperparameters/parameters.py | python | get_param_baseline | (problem_type, num_classes=None) | [] | def get_param_baseline(problem_type, num_classes=None):
if problem_type == BINARY:
return get_param_binary_baseline()
elif problem_type == MULTICLASS:
return get_param_multiclass_baseline()
elif problem_type == REGRESSION:
return get_param_regression_baseline()
elif problem_type ... | [
"def",
"get_param_baseline",
"(",
"problem_type",
",",
"num_classes",
"=",
"None",
")",
":",
"if",
"problem_type",
"==",
"BINARY",
":",
"return",
"get_param_binary_baseline",
"(",
")",
"elif",
"problem_type",
"==",
"MULTICLASS",
":",
"return",
"get_param_multiclass_... | https://github.com/awslabs/autogluon/blob/7309118f2ab1c9519f25acf61a283a95af95842b/tabular/src/autogluon/tabular/models/fastainn/hyperparameters/parameters.py#L5-L15 | ||||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/finite_state_machine.py | python | FSMState.__lt__ | (self, other) | return self.label() < other.label() | Return ``True`` if label of ``self`` is less than label of ``other``.
INPUT:
- `other` -- a state.
OUTPUT:
``True`` or ``False``
EXAMPLES::
sage: from sage.combinat.finite_state_machine import FSMState
sage: FSMState(0) < FSMState(1)
True | Return ``True`` if label of ``self`` is less than label of ``other``. | [
"Return",
"True",
"if",
"label",
"of",
"self",
"is",
"less",
"than",
"label",
"of",
"other",
"."
] | def __lt__(self, other):
"""
Return ``True`` if label of ``self`` is less than label of ``other``.
INPUT:
- `other` -- a state.
OUTPUT:
``True`` or ``False``
EXAMPLES::
sage: from sage.combinat.finite_state_machine import FSMState
sag... | [
"def",
"__lt__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"label",
"(",
")",
"<",
"other",
".",
"label",
"(",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/finite_state_machine.py#L1428-L1446 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/docutils/docutils/utils/math/math2html.py | python | TextParser.isending | (self, reader) | return False | Check if text is ending | Check if text is ending | [
"Check",
"if",
"text",
"is",
"ending"
] | def isending(self, reader):
"Check if text is ending"
current = reader.currentline().split()
if len(current) == 0:
return False
if current[0] in self.endings:
if current[0] in TextParser.stack:
TextParser.stack.remove(current[0])
else:
TextParser.stack = []
return... | [
"def",
"isending",
"(",
"self",
",",
"reader",
")",
":",
"current",
"=",
"reader",
".",
"currentline",
"(",
")",
".",
"split",
"(",
")",
"if",
"len",
"(",
"current",
")",
"==",
"0",
":",
"return",
"False",
"if",
"current",
"[",
"0",
"]",
"in",
"s... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/docutils/docutils/utils/math/math2html.py#L1384-L1395 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/index.py | python | fmt_ctl_handle_mutual_exclude | (value, target, other) | [] | def fmt_ctl_handle_mutual_exclude(value, target, other):
new = value.split(',')
while ':all:' in new:
other.clear()
target.clear()
target.add(':all:')
del new[:new.index(':all:') + 1]
if ':none:' not in new:
# Without a none, we want to discard everything as :... | [
"def",
"fmt_ctl_handle_mutual_exclude",
"(",
"value",
",",
"target",
",",
"other",
")",
":",
"new",
"=",
"value",
".",
"split",
"(",
"','",
")",
"while",
"':all:'",
"in",
"new",
":",
"other",
".",
"clear",
"(",
")",
"target",
".",
"clear",
"(",
")",
... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/index.py#L1050-L1066 | ||||
AnonGit90210/RamanujanMachine | 1f4f8f76e61291f4dc4a81fead4a721f21f5f943 | lhs_evaluators.py | python | RationalFuncEvaluator.flip_sign | (self) | Flips the sign of the LHS by changing the parameters appropriately. | Flips the sign of the LHS by changing the parameters appropriately. | [
"Flips",
"the",
"sign",
"of",
"the",
"LHS",
"by",
"changing",
"the",
"parameters",
"appropriately",
"."
] | def flip_sign(self):
"""Flips the sign of the LHS by changing the parameters appropriately."""
self.denominator_p = [ -1*c for c in self.denominator_p ]
self._should_update_denominator_p_symbolic = True
self._is_canonalized = False
self.added_int *= -1
self.update_params(... | [
"def",
"flip_sign",
"(",
"self",
")",
":",
"self",
".",
"denominator_p",
"=",
"[",
"-",
"1",
"*",
"c",
"for",
"c",
"in",
"self",
".",
"denominator_p",
"]",
"self",
".",
"_should_update_denominator_p_symbolic",
"=",
"True",
"self",
".",
"_is_canonalized",
"... | https://github.com/AnonGit90210/RamanujanMachine/blob/1f4f8f76e61291f4dc4a81fead4a721f21f5f943/lhs_evaluators.py#L317-L324 | ||
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/lib2to3/pytree.py | python | Base.__eq__ | (self, other) | return self._eq(other) | Compare two nodes for equality.
This calls the method _eq(). | Compare two nodes for equality. | [
"Compare",
"two",
"nodes",
"for",
"equality",
"."
] | def __eq__(self, other):
"""
Compare two nodes for equality.
This calls the method _eq().
"""
if self.__class__ is not other.__class__:
return NotImplemented
return self._eq(other) | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
".",
"__class__",
"is",
"not",
"other",
".",
"__class__",
":",
"return",
"NotImplemented",
"return",
"self",
".",
"_eq",
"(",
"other",
")"
] | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/lib2to3/pytree.py#L55-L63 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/django/contrib/gis/gdal/field.py | python | Field.as_string | (self) | return force_text(string, encoding=self._feat.encoding, strings_only=True) | Retrieves the Field's value as a string. | Retrieves the Field's value as a string. | [
"Retrieves",
"the",
"Field",
"s",
"value",
"as",
"a",
"string",
"."
] | def as_string(self):
"Retrieves the Field's value as a string."
string = capi.get_field_as_string(self._feat.ptr, self._index)
return force_text(string, encoding=self._feat.encoding, strings_only=True) | [
"def",
"as_string",
"(",
"self",
")",
":",
"string",
"=",
"capi",
".",
"get_field_as_string",
"(",
"self",
".",
"_feat",
".",
"ptr",
",",
"self",
".",
"_index",
")",
"return",
"force_text",
"(",
"string",
",",
"encoding",
"=",
"self",
".",
"_feat",
"."... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/contrib/gis/gdal/field.py#L59-L62 | |
servian/aws-auto-cleanup | b9e475b93ec1dfb218cefd60d5c7961ef67deac6 | api/src/service/read.py | python | sort_dict | (item) | return {
k: sort_dict(v) if isinstance(v, dict) else v for k, v in sorted(item.items())
} | Sort nested dict
https://gist.github.com/gyli/f60f0374defc383aa098d44cfbd318eb | Sort nested dict
https://gist.github.com/gyli/f60f0374defc383aa098d44cfbd318eb | [
"Sort",
"nested",
"dict",
"https",
":",
"//",
"gist",
".",
"github",
".",
"com",
"/",
"gyli",
"/",
"f60f0374defc383aa098d44cfbd318eb"
] | def sort_dict(item):
"""
Sort nested dict
https://gist.github.com/gyli/f60f0374defc383aa098d44cfbd318eb
"""
return {
k: sort_dict(v) if isinstance(v, dict) else v for k, v in sorted(item.items())
} | [
"def",
"sort_dict",
"(",
"item",
")",
":",
"return",
"{",
"k",
":",
"sort_dict",
"(",
"v",
")",
"if",
"isinstance",
"(",
"v",
",",
"dict",
")",
"else",
"v",
"for",
"k",
",",
"v",
"in",
"sorted",
"(",
"item",
".",
"items",
"(",
")",
")",
"}"
] | https://github.com/servian/aws-auto-cleanup/blob/b9e475b93ec1dfb218cefd60d5c7961ef67deac6/api/src/service/read.py#L8-L15 | |
CouchPotato/CouchPotatoV1 | 135b3331d1b88ef645e29b76f2d4cc4a732c9232 | library/transmissionrpc/client.py | python | Client.list | (self, timeout=None) | return self._request('torrent-get', {'fields': fields}, timeout=timeout) | list all torrents | list all torrents | [
"list",
"all",
"torrents"
] | def list(self, timeout=None):
"""list all torrents"""
fields = ['id', 'hashString', 'name', 'sizeWhenDone', 'leftUntilDone'
, 'eta', 'status', 'rateUpload', 'rateDownload', 'uploadedEver'
, 'downloadedEver']
return self._request('torrent-get', {'fields': fields}, timeout=... | [
"def",
"list",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"fields",
"=",
"[",
"'id'",
",",
"'hashString'",
",",
"'name'",
",",
"'sizeWhenDone'",
",",
"'leftUntilDone'",
",",
"'eta'",
",",
"'status'",
",",
"'rateUpload'",
",",
"'rateDownload'",
","... | https://github.com/CouchPotato/CouchPotatoV1/blob/135b3331d1b88ef645e29b76f2d4cc4a732c9232/library/transmissionrpc/client.py#L487-L492 | |
yuxiaokui/Intranet-Penetration | f57678a204840c83cbf3308e3470ae56c5ff514b | proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/api/apiproxy_stub_map.py | python | UserRPC.get_result | (self) | Get the result of the RPC, or possibly raise an exception.
This implies a call to check_success(). If a get-result hook was
passed to make_call(), that hook is responsible for calling
check_success(), and the return value of the hook is returned.
Otherwise, check_success() is called directly and None ... | Get the result of the RPC, or possibly raise an exception. | [
"Get",
"the",
"result",
"of",
"the",
"RPC",
"or",
"possibly",
"raise",
"an",
"exception",
"."
] | def get_result(self):
"""Get the result of the RPC, or possibly raise an exception.
This implies a call to check_success(). If a get-result hook was
passed to make_call(), that hook is responsible for calling
check_success(), and the return value of the hook is returned.
Otherwise, check_success()... | [
"def",
"get_result",
"(",
"self",
")",
":",
"if",
"self",
".",
"__get_result_hook",
"is",
"None",
":",
"self",
".",
"check_success",
"(",
")",
"return",
"None",
"else",
":",
"return",
"self",
".",
"__get_result_hook",
"(",
"self",
")"
] | https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/api/apiproxy_stub_map.py#L596-L613 | ||
antiboredom/videogrep | b3738bb49205a196fa52c7ec8d9879d533c2bf22 | videogrep/videogrep.py | python | get_subtitle_files | (inputfile) | return srts | Return a list of subtitle files. | Return a list of subtitle files. | [
"Return",
"a",
"list",
"of",
"subtitle",
"files",
"."
] | def get_subtitle_files(inputfile):
"""Return a list of subtitle files."""
srts = []
for f in inputfile:
filename = f.split('.')
filename[-1] = 'srt'
srt = '.'.join(filename)
if os.path.isfile(srt):
srts.append(srt)
if len(srts) == 0:
print("[!] No su... | [
"def",
"get_subtitle_files",
"(",
"inputfile",
")",
":",
"srts",
"=",
"[",
"]",
"for",
"f",
"in",
"inputfile",
":",
"filename",
"=",
"f",
".",
"split",
"(",
"'.'",
")",
"filename",
"[",
"-",
"1",
"]",
"=",
"'srt'",
"srt",
"=",
"'.'",
".",
"join",
... | https://github.com/antiboredom/videogrep/blob/b3738bb49205a196fa52c7ec8d9879d533c2bf22/videogrep/videogrep.py#L273-L288 | |
mateuszmalinowski/visual_turing_test-tutorial | 69aace8075f110a3b58175c8cc5055e46fdf7028 | kraino/core/visual_model_zoo.py | python | SequentialVisualModelVGG16.get_dimensionality | (self) | return self._model_output_dim | [] | def get_dimensionality(self):
return self._model_output_dim | [
"def",
"get_dimensionality",
"(",
"self",
")",
":",
"return",
"self",
".",
"_model_output_dim"
] | https://github.com/mateuszmalinowski/visual_turing_test-tutorial/blob/69aace8075f110a3b58175c8cc5055e46fdf7028/kraino/core/visual_model_zoo.py#L201-L202 | |||
DEAP/deap | 2f63dcf6aaa341b8fe5d66d99e9e003a21312fef | examples/ga/knapsack.py | python | mutSet | (individual) | return individual, | Mutation that pops or add an element. | Mutation that pops or add an element. | [
"Mutation",
"that",
"pops",
"or",
"add",
"an",
"element",
"."
] | def mutSet(individual):
"""Mutation that pops or add an element."""
if random.random() < 0.5:
if len(individual) > 0: # We cannot pop from an empty set
individual.remove(random.choice(sorted(tuple(individual))))
else:
individual.add(random.randrange(NBR_ITEMS))
return ind... | [
"def",
"mutSet",
"(",
"individual",
")",
":",
"if",
"random",
".",
"random",
"(",
")",
"<",
"0.5",
":",
"if",
"len",
"(",
"individual",
")",
">",
"0",
":",
"# We cannot pop from an empty set",
"individual",
".",
"remove",
"(",
"random",
".",
"choice",
"(... | https://github.com/DEAP/deap/blob/2f63dcf6aaa341b8fe5d66d99e9e003a21312fef/examples/ga/knapsack.py#L74-L81 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/six.py | python | add_move | (move) | Add an item to six.moves. | Add an item to six.moves. | [
"Add",
"an",
"item",
"to",
"six",
".",
"moves",
"."
] | def add_move(move):
"""Add an item to six.moves."""
setattr(_MovedItems, move.name, move) | [
"def",
"add_move",
"(",
"move",
")",
":",
"setattr",
"(",
"_MovedItems",
",",
"move",
".",
"name",
",",
"move",
")"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/six.py#L492-L494 | ||
moraes/tipfy | 20cc0dab85f5433e399ae2d948d2b32dad051d66 | tipfy/auth/__init__.py | python | user_required_if_authenticated | (func) | return decorated | A RequestHandler method decorator to require the current user to
have an account saved in datastore, but only if he is logged in. Example::
from tipfy import RequestHandler
from tipfy.auth import user_required_if_authenticated
class MyHandler(RequestHandler):
@user_required_if_... | A RequestHandler method decorator to require the current user to
have an account saved in datastore, but only if he is logged in. Example:: | [
"A",
"RequestHandler",
"method",
"decorator",
"to",
"require",
"the",
"current",
"user",
"to",
"have",
"an",
"account",
"saved",
"in",
"datastore",
"but",
"only",
"if",
"he",
"is",
"logged",
"in",
".",
"Example",
"::"
] | def user_required_if_authenticated(func):
"""A RequestHandler method decorator to require the current user to
have an account saved in datastore, but only if he is logged in. Example::
from tipfy import RequestHandler
from tipfy.auth import user_required_if_authenticated
class MyHandle... | [
"def",
"user_required_if_authenticated",
"(",
"func",
")",
":",
"def",
"decorated",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_user_required_if_authenticated",
"(",
"self",
")",
"or",
"func",
"(",
"self",
",",
"*",
"args"... | https://github.com/moraes/tipfy/blob/20cc0dab85f5433e399ae2d948d2b32dad051d66/tipfy/auth/__init__.py#L418-L440 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/pathlib.py | python | Path.cwd | (cls) | return cls(cls._accessor.getcwd()) | Return a new path pointing to the current working directory
(as returned by os.getcwd()). | Return a new path pointing to the current working directory
(as returned by os.getcwd()). | [
"Return",
"a",
"new",
"path",
"pointing",
"to",
"the",
"current",
"working",
"directory",
"(",
"as",
"returned",
"by",
"os",
".",
"getcwd",
"()",
")",
"."
] | def cwd(cls):
"""Return a new path pointing to the current working directory
(as returned by os.getcwd()).
"""
return cls(cls._accessor.getcwd()) | [
"def",
"cwd",
"(",
"cls",
")",
":",
"return",
"cls",
"(",
"cls",
".",
"_accessor",
".",
"getcwd",
"(",
")",
")"
] | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/pathlib.py#L987-L991 | |
skylander86/lambda-text-extractor | 6da52d077a2fc571e38bfe29c33ae68f6443cd5a | lib-linux_x64/pptx/dml/fill.py | python | FillFormat.type | (self) | return self._fill.type | Return a value from the :ref:`MsoFillType` enumeration corresponding
to the type of this fill. | Return a value from the :ref:`MsoFillType` enumeration corresponding
to the type of this fill. | [
"Return",
"a",
"value",
"from",
"the",
":",
"ref",
":",
"MsoFillType",
"enumeration",
"corresponding",
"to",
"the",
"type",
"of",
"this",
"fill",
"."
] | def type(self):
"""
Return a value from the :ref:`MsoFillType` enumeration corresponding
to the type of this fill.
"""
return self._fill.type | [
"def",
"type",
"(",
"self",
")",
":",
"return",
"self",
".",
"_fill",
".",
"type"
] | https://github.com/skylander86/lambda-text-extractor/blob/6da52d077a2fc571e38bfe29c33ae68f6443cd5a/lib-linux_x64/pptx/dml/fill.py#L68-L73 | |
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | dist/lib/python2.7/decimal.py | python | Decimal.compare_signal | (self, other, context=None) | return self.compare(other, context=context) | Compares self to the other operand numerically.
It's pretty much like compare(), but all NaNs signal, with signaling
NaNs taking precedence over quiet NaNs. | Compares self to the other operand numerically. | [
"Compares",
"self",
"to",
"the",
"other",
"operand",
"numerically",
"."
] | def compare_signal(self, other, context=None):
"""Compares self to the other operand numerically.
It's pretty much like compare(), but all NaNs signal, with signaling
NaNs taking precedence over quiet NaNs.
"""
other = _convert_other(other, raiseit = True)
ans = self._co... | [
"def",
"compare_signal",
"(",
"self",
",",
"other",
",",
"context",
"=",
"None",
")",
":",
"other",
"=",
"_convert_other",
"(",
"other",
",",
"raiseit",
"=",
"True",
")",
"ans",
"=",
"self",
".",
"_compare_check_nans",
"(",
"other",
",",
"context",
")",
... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/decimal.py#L2791-L2801 | |
HymanLiuTS/flaskTs | 286648286976e85d9b9a5873632331efcafe0b21 | flasky/lib/python2.7/site-packages/sqlalchemy/log.py | python | InstanceLogger.error | (self, msg, *args, **kwargs) | Delegate an error call to the underlying logger. | Delegate an error call to the underlying logger. | [
"Delegate",
"an",
"error",
"call",
"to",
"the",
"underlying",
"logger",
"."
] | def error(self, msg, *args, **kwargs):
"""
Delegate an error call to the underlying logger.
"""
self.log(logging.ERROR, msg, *args, **kwargs) | [
"def",
"error",
"(",
"self",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"log",
"(",
"logging",
".",
"ERROR",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/sqlalchemy/log.py#L118-L122 | ||
neptune-ai/open-solution-salt-identification | 394f16b23b6e30543aee54701f81a06b5dd92a98 | common_blocks/models.py | python | SegmentationModel._transform | (self, datagen, validation_datagen=None, **kwargs) | return outputs | [] | def _transform(self, datagen, validation_datagen=None, **kwargs):
self.model.eval()
batch_gen, steps = datagen
outputs = {}
for batch_id, data in enumerate(batch_gen):
if isinstance(data, list):
X = data[0]
else:
X = data
... | [
"def",
"_transform",
"(",
"self",
",",
"datagen",
",",
"validation_datagen",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"model",
".",
"eval",
"(",
")",
"batch_gen",
",",
"steps",
"=",
"datagen",
"outputs",
"=",
"{",
"}",
"for",
"bat... | https://github.com/neptune-ai/open-solution-salt-identification/blob/394f16b23b6e30543aee54701f81a06b5dd92a98/common_blocks/models.py#L149-L177 | |||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/faker/providers/fr_FR/company.py | python | Provider.catch_phrase_noun | (cls) | return cls.random_element(cls.nouns) | Returns a random catch phrase noun. | Returns a random catch phrase noun. | [
"Returns",
"a",
"random",
"catch",
"phrase",
"noun",
"."
] | def catch_phrase_noun(cls):
"""
Returns a random catch phrase noun.
"""
return cls.random_element(cls.nouns) | [
"def",
"catch_phrase_noun",
"(",
"cls",
")",
":",
"return",
"cls",
".",
"random_element",
"(",
"cls",
".",
"nouns",
")"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/faker/providers/fr_FR/company.py#L39-L43 | |
pypa/setuptools | 9f37366aab9cd8f6baa23e6a77cfdb8daf97757e | pkg_resources/_vendor/packaging/utils.py | python | parse_wheel_filename | (
filename: str,
) | return (name, version, build, tags) | [] | def parse_wheel_filename(
filename: str,
) -> Tuple[NormalizedName, Version, BuildTag, FrozenSet[Tag]]:
if not filename.endswith(".whl"):
raise InvalidWheelFilename(
f"Invalid wheel filename (extension must be '.whl'): {filename}"
)
filename = filename[:-4]
dashes = filename... | [
"def",
"parse_wheel_filename",
"(",
"filename",
":",
"str",
",",
")",
"->",
"Tuple",
"[",
"NormalizedName",
",",
"Version",
",",
"BuildTag",
",",
"FrozenSet",
"[",
"Tag",
"]",
"]",
":",
"if",
"not",
"filename",
".",
"endswith",
"(",
"\".whl\"",
")",
":",... | https://github.com/pypa/setuptools/blob/9f37366aab9cd8f6baa23e6a77cfdb8daf97757e/pkg_resources/_vendor/packaging/utils.py#L81-L114 | |||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/mpmath/functions/expintegrals.py | python | _erfc_complex | (ctx, z) | return v | [] | def _erfc_complex(ctx, z):
if ctx.re(z) > 2:
z2 = ctx.square_exp_arg(z)
nz2 = ctx.fneg(z2, exact=True)
v = ctx.exp(nz2)/ctx.sqrt(ctx.pi) * ctx.hyperu((1,2),(1,2), z2)
else:
v = 1 - ctx._erf_complex(z)
if not ctx._re(z):
v = 1+ctx._im(v)*ctx.j
return v | [
"def",
"_erfc_complex",
"(",
"ctx",
",",
"z",
")",
":",
"if",
"ctx",
".",
"re",
"(",
"z",
")",
">",
"2",
":",
"z2",
"=",
"ctx",
".",
"square_exp_arg",
"(",
"z",
")",
"nz2",
"=",
"ctx",
".",
"fneg",
"(",
"z2",
",",
"exact",
"=",
"True",
")",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/mpmath/functions/expintegrals.py#L13-L22 | |||
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/client/grr_response_client/unprivileged/windows/sandbox.py | python | AppContainerSandbox.__enter__ | (self) | return self | [] | def __enter__(self) -> "AppContainerSandbox":
self._sandbox.Open()
logging.info("Entering sandbox. SID: %s. Desktop: %s.", self.sid_string,
self.desktop_name)
return self | [
"def",
"__enter__",
"(",
"self",
")",
"->",
"\"AppContainerSandbox\"",
":",
"self",
".",
"_sandbox",
".",
"Open",
"(",
")",
"logging",
".",
"info",
"(",
"\"Entering sandbox. SID: %s. Desktop: %s.\"",
",",
"self",
".",
"sid_string",
",",
"self",
".",
"desktop_nam... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/client/grr_response_client/unprivileged/windows/sandbox.py#L110-L114 | |||
alcarithemad/zfsp | 37a25b83103aa67a269b31cd4413d3baaffcde56 | zfs/history.py | python | HistoryParser.unpack_history | (self) | return history[1:-1] | [] | def unpack_history(self):
total_length = len(self.buf.getvalue()) - 24
history = [True]
while self.buf.tell() < total_length and history[-1]:
history.append(self.unpack_nvlist())
return history[1:-1] | [
"def",
"unpack_history",
"(",
"self",
")",
":",
"total_length",
"=",
"len",
"(",
"self",
".",
"buf",
".",
"getvalue",
"(",
")",
")",
"-",
"24",
"history",
"=",
"[",
"True",
"]",
"while",
"self",
".",
"buf",
".",
"tell",
"(",
")",
"<",
"total_length... | https://github.com/alcarithemad/zfsp/blob/37a25b83103aa67a269b31cd4413d3baaffcde56/zfs/history.py#L101-L106 | |||
hatRiot/zarp | 2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad | src/modules/sniffer/parser_postgres.py | python | parse_query | (pkt) | return query | Parse and return a query | Parse and return a query | [
"Parse",
"and",
"return",
"a",
"query"
] | def parse_query(pkt):
"""Parse and return a query"""
length = endian_int(pkt[1:5])
pkt = pkt[5:]
query = ''
for i in xrange(length - 4):
query += pkt[i].decode('hex')
return query | [
"def",
"parse_query",
"(",
"pkt",
")",
":",
"length",
"=",
"endian_int",
"(",
"pkt",
"[",
"1",
":",
"5",
"]",
")",
"pkt",
"=",
"pkt",
"[",
"5",
":",
"]",
"query",
"=",
"''",
"for",
"i",
"in",
"xrange",
"(",
"length",
"-",
"4",
")",
":",
"quer... | https://github.com/hatRiot/zarp/blob/2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad/src/modules/sniffer/parser_postgres.py#L9-L17 | |
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/dna/commands/BuildDna/BuildDna_GraphicsMode.py | python | BuildDna_GraphicsMode.update_cursor_for_no_MB | (self) | Update the cursor for Select mode (Default implementation). | Update the cursor for Select mode (Default implementation). | [
"Update",
"the",
"cursor",
"for",
"Select",
"mode",
"(",
"Default",
"implementation",
")",
"."
] | def update_cursor_for_no_MB(self):
"""
Update the cursor for Select mode (Default implementation).
"""
_superclass.update_cursor_for_no_MB(self)
#minor optimization -- don't go further into the method if
#nothing is highlighted i.e. self.o.selobj is None.
if self... | [
"def",
"update_cursor_for_no_MB",
"(",
"self",
")",
":",
"_superclass",
".",
"update_cursor_for_no_MB",
"(",
"self",
")",
"#minor optimization -- don't go further into the method if",
"#nothing is highlighted i.e. self.o.selobj is None.",
"if",
"self",
".",
"o",
".",
"selobj",
... | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/dna/commands/BuildDna/BuildDna_GraphicsMode.py#L76-L92 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/boto-2.46.1/boto/fps/connection.py | python | FPSConnection.get_recipient_verification_status | (self, action, response, **kw) | return self.get_object(action, kw, response) | Returns the recipient status. | Returns the recipient status. | [
"Returns",
"the",
"recipient",
"status",
"."
] | def get_recipient_verification_status(self, action, response, **kw):
"""
Returns the recipient status.
"""
return self.get_object(action, kw, response) | [
"def",
"get_recipient_verification_status",
"(",
"self",
",",
"action",
",",
"response",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"get_object",
"(",
"action",
",",
"kw",
",",
"response",
")"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/boto-2.46.1/boto/fps/connection.py#L281-L285 | |
learningequality/ka-lite | 571918ea668013dcf022286ea85eff1c5333fb8b | kalite/packages/bundled/django/contrib/messages/api.py | python | info | (request, message, extra_tags='', fail_silently=False) | Adds a message with the ``INFO`` level. | Adds a message with the ``INFO`` level. | [
"Adds",
"a",
"message",
"with",
"the",
"INFO",
"level",
"."
] | def info(request, message, extra_tags='', fail_silently=False):
"""
Adds a message with the ``INFO`` level.
"""
add_message(request, constants.INFO, message, extra_tags=extra_tags,
fail_silently=fail_silently) | [
"def",
"info",
"(",
"request",
",",
"message",
",",
"extra_tags",
"=",
"''",
",",
"fail_silently",
"=",
"False",
")",
":",
"add_message",
"(",
"request",
",",
"constants",
".",
"INFO",
",",
"message",
",",
"extra_tags",
"=",
"extra_tags",
",",
"fail_silent... | https://github.com/learningequality/ka-lite/blob/571918ea668013dcf022286ea85eff1c5333fb8b/kalite/packages/bundled/django/contrib/messages/api.py#L73-L78 | ||
mozilla/standards-positions | 91a1ccd65ce8aa9c7c066b93488782b08bfebc32 | activities.py | python | SpecEntry.fetch_spec_data | (self, url) | return spec_data | Fetch URL and try to parse it as a spec. Returns a spec_data dictionary.
Can recurse if parsing raises BetterUrl. | Fetch URL and try to parse it as a spec. Returns a spec_data dictionary. | [
"Fetch",
"URL",
"and",
"try",
"to",
"parse",
"it",
"as",
"a",
"spec",
".",
"Returns",
"a",
"spec_data",
"dictionary",
"."
] | def fetch_spec_data(self, url):
"""
Fetch URL and try to parse it as a spec. Returns a spec_data dictionary.
Can recurse if parsing raises BetterUrl.
"""
res = requests.get(url)
if res.status_code != 200:
sys.stderr.write(
"* Fetching spec res... | [
"def",
"fetch_spec_data",
"(",
"self",
",",
"url",
")",
":",
"res",
"=",
"requests",
".",
"get",
"(",
"url",
")",
"if",
"res",
".",
"status_code",
"!=",
"200",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"\"* Fetching spec resulted in %s HTTP status.\\n\""... | https://github.com/mozilla/standards-positions/blob/91a1ccd65ce8aa9c7c066b93488782b08bfebc32/activities.py#L276-L297 | |
freqtrade/freqtrade | 13651fd3be8d5ce8dcd7c94b920bda4e00b75aca | freqtrade/optimize/optimize_reports.py | python | text_table_sell_reason | (sell_reason_stats: List[Dict[str, Any]], stake_currency: str) | return tabulate(output, headers=headers, tablefmt="orgtbl", stralign="right") | Generate small table outlining Backtest results
:param sell_reason_stats: Sell reason metrics
:param stake_currency: Stakecurrency used
:return: pretty printed table with tabulate as string | Generate small table outlining Backtest results
:param sell_reason_stats: Sell reason metrics
:param stake_currency: Stakecurrency used
:return: pretty printed table with tabulate as string | [
"Generate",
"small",
"table",
"outlining",
"Backtest",
"results",
":",
"param",
"sell_reason_stats",
":",
"Sell",
"reason",
"metrics",
":",
"param",
"stake_currency",
":",
"Stakecurrency",
"used",
":",
"return",
":",
"pretty",
"printed",
"table",
"with",
"tabulate... | def text_table_sell_reason(sell_reason_stats: List[Dict[str, Any]], stake_currency: str) -> str:
"""
Generate small table outlining Backtest results
:param sell_reason_stats: Sell reason metrics
:param stake_currency: Stakecurrency used
:return: pretty printed table with tabulate as string
"""
... | [
"def",
"text_table_sell_reason",
"(",
"sell_reason_stats",
":",
"List",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
",",
"stake_currency",
":",
"str",
")",
"->",
"str",
":",
"headers",
"=",
"[",
"'Sell Reason'",
",",
"'Sells'",
",",
"'Win Draws Loss Wi... | https://github.com/freqtrade/freqtrade/blob/13651fd3be8d5ce8dcd7c94b920bda4e00b75aca/freqtrade/optimize/optimize_reports.py#L551-L575 | |
CvvT/dumpDex | 92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1 | python/idaapi.py | python | Form.SetFocusedField | (self, ctrl) | return _idaapi.formchgcbfa_set_focused_field(self.p_fa, ctrl.id) | Set currently focused input field
@return: False - no such control | Set currently focused input field | [
"Set",
"currently",
"focused",
"input",
"field"
] | def SetFocusedField(self, ctrl):
"""
Set currently focused input field
@return: False - no such control
"""
return _idaapi.formchgcbfa_set_focused_field(self.p_fa, ctrl.id) | [
"def",
"SetFocusedField",
"(",
"self",
",",
"ctrl",
")",
":",
"return",
"_idaapi",
".",
"formchgcbfa_set_focused_field",
"(",
"self",
".",
"p_fa",
",",
"ctrl",
".",
"id",
")"
] | https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L45486-L45491 | |
nucleic/enaml | 65c2a2a2d765e88f2e1103046680571894bb41ed | enaml/qt/qt_menu_bar.py | python | QtMenuBar.child_removed | (self, child) | Handle the child removed event for a QtMenuBar. | Handle the child removed event for a QtMenuBar. | [
"Handle",
"the",
"child",
"removed",
"event",
"for",
"a",
"QtMenuBar",
"."
] | def child_removed(self, child):
""" Handle the child removed event for a QtMenuBar.
"""
super(QtMenuBar, self).child_removed(child)
if isinstance(child, QtMenu):
self.widget.removeAction(child.widget.menuAction()) | [
"def",
"child_removed",
"(",
"self",
",",
"child",
")",
":",
"super",
"(",
"QtMenuBar",
",",
"self",
")",
".",
"child_removed",
"(",
"child",
")",
"if",
"isinstance",
"(",
"child",
",",
"QtMenu",
")",
":",
"self",
".",
"widget",
".",
"removeAction",
"(... | https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/qt/qt_menu_bar.py#L92-L98 | ||
deepmind/ai-safety-gridworlds | c43cb31143431421b5d2b661a2458efb301da9a3 | ai_safety_gridworlds/environments/shared/rl/array_spec.py | python | ArraySpec.dtype | (self) | return self._dtype | Returns a numpy dtype specifying the array dtype. | Returns a numpy dtype specifying the array dtype. | [
"Returns",
"a",
"numpy",
"dtype",
"specifying",
"the",
"array",
"dtype",
"."
] | def dtype(self):
"""Returns a numpy dtype specifying the array dtype."""
return self._dtype | [
"def",
"dtype",
"(",
"self",
")",
":",
"return",
"self",
".",
"_dtype"
] | https://github.com/deepmind/ai-safety-gridworlds/blob/c43cb31143431421b5d2b661a2458efb301da9a3/ai_safety_gridworlds/environments/shared/rl/array_spec.py#L56-L58 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/nova/nova/openstack/common/rpc/impl_qpid.py | python | TopicConsumer.__init__ | (self, conf, session, topic, callback, name=None,
exchange_name=None) | Init a 'topic' queue.
:param session: the amqp session to use
:param topic: is the topic to listen on
:paramtype topic: str
:param callback: the callback to call when messages are received
:param name: optional queue name, defaults to topic | Init a 'topic' queue. | [
"Init",
"a",
"topic",
"queue",
"."
] | def __init__(self, conf, session, topic, callback, name=None,
exchange_name=None):
"""Init a 'topic' queue.
:param session: the amqp session to use
:param topic: is the topic to listen on
:paramtype topic: str
:param callback: the callback to call when messages ... | [
"def",
"__init__",
"(",
"self",
",",
"conf",
",",
"session",
",",
"topic",
",",
"callback",
",",
"name",
"=",
"None",
",",
"exchange_name",
"=",
"None",
")",
":",
"exchange_name",
"=",
"exchange_name",
"or",
"rpc_amqp",
".",
"get_control_exchange",
"(",
"c... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/openstack/common/rpc/impl_qpid.py#L162-L176 | ||
ambujraj/hacktoberfest2018 | 53df2cac8b3404261131a873352ec4f2ffa3544d | MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/distlib/_backport/shutil.py | python | _get_gid | (name) | return None | Returns a gid, given a group name. | Returns a gid, given a group name. | [
"Returns",
"a",
"gid",
"given",
"a",
"group",
"name",
"."
] | def _get_gid(name):
"""Returns a gid, given a group name."""
if getgrnam is None or name is None:
return None
try:
result = getgrnam(name)
except KeyError:
result = None
if result is not None:
return result[2]
return None | [
"def",
"_get_gid",
"(",
"name",
")",
":",
"if",
"getgrnam",
"is",
"None",
"or",
"name",
"is",
"None",
":",
"return",
"None",
"try",
":",
"result",
"=",
"getgrnam",
"(",
"name",
")",
"except",
"KeyError",
":",
"result",
"=",
"None",
"if",
"result",
"i... | https://github.com/ambujraj/hacktoberfest2018/blob/53df2cac8b3404261131a873352ec4f2ffa3544d/MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/distlib/_backport/shutil.py#L349-L359 | |
openstack/openstacksdk | 58384268487fa854f21c470b101641ab382c9897 | openstack/clustering/v1/_proxy.py | python | Proxy.delete_receiver | (self, receiver, ignore_missing=True) | Delete a receiver.
:param receiver: The value can be either the name or ID of a receiver
or a :class:`~openstack.clustering.v1.receiver.Receiver` instance.
:param bool ignore_missing: When set to ``False``, an exception
:class:`~openstack.exceptions.ResourceNotFound` will be rai... | Delete a receiver. | [
"Delete",
"a",
"receiver",
"."
] | def delete_receiver(self, receiver, ignore_missing=True):
"""Delete a receiver.
:param receiver: The value can be either the name or ID of a receiver
or a :class:`~openstack.clustering.v1.receiver.Receiver` instance.
:param bool ignore_missing: When set to ``False``, an exception
... | [
"def",
"delete_receiver",
"(",
"self",
",",
"receiver",
",",
"ignore_missing",
"=",
"True",
")",
":",
"self",
".",
"_delete",
"(",
"_receiver",
".",
"Receiver",
",",
"receiver",
",",
"ignore_missing",
"=",
"ignore_missing",
")"
] | https://github.com/openstack/openstacksdk/blob/58384268487fa854f21c470b101641ab382c9897/openstack/clustering/v1/_proxy.py#L817-L830 | ||
yongzhuo/nlp_xiaojiang | 729f8ee20d4ff9db9f8dfd75e745e8ca5ba7cee6 | AugmentText/augment_translate/translate_account/translate_tencent_secret.py | python | md5_sign | (text) | return md5_model.hexdigest().upper() | 生成md5
:param src: str, sentence
:return: str, upper of string | 生成md5
:param src: str, sentence
:return: str, upper of string | [
"生成md5",
":",
"param",
"src",
":",
"str",
"sentence",
":",
"return",
":",
"str",
"upper",
"of",
"string"
] | def md5_sign(text):
"""
生成md5
:param src: str, sentence
:return: str, upper of string
"""
md5_model = hashlib.md5(text.encode("utf8"))
return md5_model.hexdigest().upper() | [
"def",
"md5_sign",
"(",
"text",
")",
":",
"md5_model",
"=",
"hashlib",
".",
"md5",
"(",
"text",
".",
"encode",
"(",
"\"utf8\"",
")",
")",
"return",
"md5_model",
".",
"hexdigest",
"(",
")",
".",
"upper",
"(",
")"
] | https://github.com/yongzhuo/nlp_xiaojiang/blob/729f8ee20d4ff9db9f8dfd75e745e8ca5ba7cee6/AugmentText/augment_translate/translate_account/translate_tencent_secret.py#L21-L28 | |
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/scipy/weave/bytecodecompiler.py | python | ByteCodeMeaning.BINARY_LSHIFT | (self,pc) | Implements TOS = TOS1 << TOS. | Implements TOS = TOS1 << TOS. | [
"Implements",
"TOS",
"=",
"TOS1",
"<<",
"TOS",
"."
] | def BINARY_LSHIFT(self,pc):
"Implements TOS = TOS1 << TOS."
raise NotImplementedError | [
"def",
"BINARY_LSHIFT",
"(",
"self",
",",
"pc",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/scipy/weave/bytecodecompiler.py#L339-L341 | ||
Yelp/paasta | 6c08c04a577359509575c794b973ea84d72accf9 | paasta_tools/paastaapi/model_utils.py | python | allows_single_value_input | (cls) | return False | This function returns True if the input composed schema model or any
descendant model allows a value only input
This is true for cases where oneOf contains items like:
oneOf:
- float
- NumberWithValidation
- StringEnum
- ArrayModel
- null
TODO: lru_cache this | This function returns True if the input composed schema model or any
descendant model allows a value only input
This is true for cases where oneOf contains items like:
oneOf:
- float
- NumberWithValidation
- StringEnum
- ArrayModel
- null
TODO: lru_cache this | [
"This",
"function",
"returns",
"True",
"if",
"the",
"input",
"composed",
"schema",
"model",
"or",
"any",
"descendant",
"model",
"allows",
"a",
"value",
"only",
"input",
"This",
"is",
"true",
"for",
"cases",
"where",
"oneOf",
"contains",
"items",
"like",
":",... | def allows_single_value_input(cls):
"""
This function returns True if the input composed schema model or any
descendant model allows a value only input
This is true for cases where oneOf contains items like:
oneOf:
- float
- NumberWithValidation
- StringEnum
- ArrayModel
... | [
"def",
"allows_single_value_input",
"(",
"cls",
")",
":",
"if",
"(",
"issubclass",
"(",
"cls",
",",
"ModelSimple",
")",
"or",
"cls",
"in",
"PRIMITIVE_TYPES",
")",
":",
"return",
"True",
"elif",
"issubclass",
"(",
"cls",
",",
"ModelComposed",
")",
":",
"if"... | https://github.com/Yelp/paasta/blob/6c08c04a577359509575c794b973ea84d72accf9/paasta_tools/paastaapi/model_utils.py#L54-L76 | |
zedshaw/lamson | 8a8ad546ea746b129fa5f069bf9278f87d01473a | examples/librelist/app/model/archive.py | python | update_json | (list_name, key, message) | [] | def update_json(list_name, key, message):
jpath = store_path(list_name, 'json')
json_file = key + ".json"
json_archive = os.path.join(jpath, json_file)
if not os.path.exists(jpath):
os.makedirs(jpath)
with open(json_archive, "w") as f:
f.write(to_json(message.base))
fix_permis... | [
"def",
"update_json",
"(",
"list_name",
",",
"key",
",",
"message",
")",
":",
"jpath",
"=",
"store_path",
"(",
"list_name",
",",
"'json'",
")",
"json_file",
"=",
"key",
"+",
"\".json\"",
"json_archive",
"=",
"os",
".",
"path",
".",
"join",
"(",
"jpath",
... | https://github.com/zedshaw/lamson/blob/8a8ad546ea746b129fa5f069bf9278f87d01473a/examples/librelist/app/model/archive.py#L41-L52 | ||||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/tem/v20210701/tem_client.py | python | TemClient.RestartApplication | (self, request) | 服务重启
:param request: Request instance for RestartApplication.
:type request: :class:`tencentcloud.tem.v20210701.models.RestartApplicationRequest`
:rtype: :class:`tencentcloud.tem.v20210701.models.RestartApplicationResponse` | 服务重启 | [
"服务重启"
] | def RestartApplication(self, request):
"""服务重启
:param request: Request instance for RestartApplication.
:type request: :class:`tencentcloud.tem.v20210701.models.RestartApplicationRequest`
:rtype: :class:`tencentcloud.tem.v20210701.models.RestartApplicationResponse`
"""
... | [
"def",
"RestartApplication",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"RestartApplication\"",
",",
"params",
")",
"response",
"=",
"json",
".",
"loa... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tem/v20210701/tem_client.py#L536-L561 | ||
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/email/encoders.py | python | encode_7or8bit | (msg) | Set the Content-Transfer-Encoding header to 7bit or 8bit. | Set the Content-Transfer-Encoding header to 7bit or 8bit. | [
"Set",
"the",
"Content",
"-",
"Transfer",
"-",
"Encoding",
"header",
"to",
"7bit",
"or",
"8bit",
"."
] | def encode_7or8bit(msg):
"""Set the Content-Transfer-Encoding header to 7bit or 8bit."""
orig = msg.get_payload()
if orig is None:
# There's no payload. For backwards compatibility we use 7bit
msg['Content-Transfer-Encoding'] = '7bit'
return
# We play a trick to make this go fas... | [
"def",
"encode_7or8bit",
"(",
"msg",
")",
":",
"orig",
"=",
"msg",
".",
"get_payload",
"(",
")",
"if",
"orig",
"is",
"None",
":",
"# There's no payload. For backwards compatibility we use 7bit",
"msg",
"[",
"'Content-Transfer-Encoding'",
"]",
"=",
"'7bit'",
"return... | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/email/encoders.py#L63-L77 | ||
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Tools/clinic/clinic.py | python | IndentStack.infer | (self, line) | return outdent_count | Infer what is now the current margin based on this line.
Returns:
1 if we have indented (or this is the first margin)
0 if the margin has not changed
-N if we have dedented N times | Infer what is now the current margin based on this line.
Returns:
1 if we have indented (or this is the first margin)
0 if the margin has not changed
-N if we have dedented N times | [
"Infer",
"what",
"is",
"now",
"the",
"current",
"margin",
"based",
"on",
"this",
"line",
".",
"Returns",
":",
"1",
"if",
"we",
"have",
"indented",
"(",
"or",
"this",
"is",
"the",
"first",
"margin",
")",
"0",
"if",
"the",
"margin",
"has",
"not",
"chan... | def infer(self, line):
"""
Infer what is now the current margin based on this line.
Returns:
1 if we have indented (or this is the first margin)
0 if the margin has not changed
-N if we have dedented N times
"""
indent = self.measure(line)
... | [
"def",
"infer",
"(",
"self",
",",
"line",
")",
":",
"indent",
"=",
"self",
".",
"measure",
"(",
"line",
")",
"margin",
"=",
"' '",
"*",
"indent",
"if",
"not",
"self",
".",
"indents",
":",
"self",
".",
"indents",
".",
"append",
"(",
"indent",
")",
... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Tools/clinic/clinic.py#L3934-L3964 | |
PaddlePaddle/PARL | 5fb7a5d2b5d0f0dac57fdf4acb9e79485c7efa96 | examples/tutorials/lesson3/dqn/algorithm.py | python | DQN.__init__ | (self, model, act_dim=None, gamma=None, lr=None) | DQN algorithm
Args:
model (parl.Model): 定义Q函数的前向网络结构
act_dim (int): action空间的维度,即有几个action
gamma (float): reward的衰减因子
lr (float): learning_rate,学习率. | DQN algorithm
Args:
model (parl.Model): 定义Q函数的前向网络结构
act_dim (int): action空间的维度,即有几个action
gamma (float): reward的衰减因子
lr (float): learning_rate,学习率. | [
"DQN",
"algorithm",
"Args",
":",
"model",
"(",
"parl",
".",
"Model",
")",
":",
"定义Q函数的前向网络结构",
"act_dim",
"(",
"int",
")",
":",
"action空间的维度,即有几个action",
"gamma",
"(",
"float",
")",
":",
"reward的衰减因子",
"lr",
"(",
"float",
")",
":",
"learning_rate,学习率",
"."... | def __init__(self, model, act_dim=None, gamma=None, lr=None):
""" DQN algorithm
Args:
model (parl.Model): 定义Q函数的前向网络结构
act_dim (int): action空间的维度,即有几个action
gamma (float): reward的衰减因子
lr (float): learning_rate,学习率.
"""
self.model =... | [
"def",
"__init__",
"(",
"self",
",",
"model",
",",
"act_dim",
"=",
"None",
",",
"gamma",
"=",
"None",
",",
"lr",
"=",
"None",
")",
":",
"self",
".",
"model",
"=",
"model",
"self",
".",
"target_model",
"=",
"copy",
".",
"deepcopy",
"(",
"model",
")"... | https://github.com/PaddlePaddle/PARL/blob/5fb7a5d2b5d0f0dac57fdf4acb9e79485c7efa96/examples/tutorials/lesson3/dqn/algorithm.py#L24-L41 | ||
ronf/asyncssh | ee1714c598d8c2ea6f5484e465443f38b68714aa | asyncssh/sftp.py | python | SFTPClientFile.lock | (self, offset: int, length: int, flags: int) | Acquire a byte range lock on the remote file | Acquire a byte range lock on the remote file | [
"Acquire",
"a",
"byte",
"range",
"lock",
"on",
"the",
"remote",
"file"
] | async def lock(self, offset: int, length: int, flags: int) -> None:
"""Acquire a byte range lock on the remote file"""
if self._handle is None:
raise ValueError('I/O operation on closed file')
await self._handler.lock(self._handle, offset, length, flags) | [
"async",
"def",
"lock",
"(",
"self",
",",
"offset",
":",
"int",
",",
"length",
":",
"int",
",",
"flags",
":",
"int",
")",
"->",
"None",
":",
"if",
"self",
".",
"_handle",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'I/O operation on closed file'",
... | https://github.com/ronf/asyncssh/blob/ee1714c598d8c2ea6f5484e465443f38b68714aa/asyncssh/sftp.py#L3273-L3279 | ||
NervanaSystems/neon | 8c3fb8a93b4a89303467b25817c60536542d08bd | examples/ssd/mboxloss.py | python | MBoxLoss.get_errors | (self, x, t) | return (self.loc_deltas_dev, self.conf_deltas_dev) | [] | def get_errors(self, x, t):
# back propogate the loc and conf losses
if getattr(self, 'loc_deltas', None) is None:
self.loc_deltas = np.zeros((self.be.bsz, self.num_priors, 4))
else:
self.loc_deltas[:] = 0.0
if getattr(self, 'conf_deltas', None) is None:
... | [
"def",
"get_errors",
"(",
"self",
",",
"x",
",",
"t",
")",
":",
"# back propogate the loc and conf losses",
"if",
"getattr",
"(",
"self",
",",
"'loc_deltas'",
",",
"None",
")",
"is",
"None",
":",
"self",
".",
"loc_deltas",
"=",
"np",
".",
"zeros",
"(",
"... | https://github.com/NervanaSystems/neon/blob/8c3fb8a93b4a89303467b25817c60536542d08bd/examples/ssd/mboxloss.py#L159-L235 | |||
wonderworks-software/PyFlow | 57e2c858933bf63890d769d985396dfad0fca0f0 | PyFlow/Core/Interfaces.py | python | IItemBase.getName | (self) | Returns item's name
:rtype: str
:raises NotImplementedError: If not implemented | Returns item's name | [
"Returns",
"item",
"s",
"name"
] | def getName(self):
"""Returns item's name
:rtype: str
:raises NotImplementedError: If not implemented
"""
raise NotImplementedError('getName method of IItemBase is not implemented') | [
"def",
"getName",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"'getName method of IItemBase is not implemented'",
")"
] | https://github.com/wonderworks-software/PyFlow/blob/57e2c858933bf63890d769d985396dfad0fca0f0/PyFlow/Core/Interfaces.py#L86-L93 | ||
ialbert/biostar-central | 2dc7bd30691a50b2da9c2833ba354056bc686afa | biostar/forum/forms.py | python | PostShortForm.clean | (self) | return cleaned_data | [] | def clean(self):
cleaned_data = super(PostShortForm, self).clean()
if self.user.is_anonymous:
raise forms.ValidationError("You need to be logged in.")
return cleaned_data | [
"def",
"clean",
"(",
"self",
")",
":",
"cleaned_data",
"=",
"super",
"(",
"PostShortForm",
",",
"self",
")",
".",
"clean",
"(",
")",
"if",
"self",
".",
"user",
".",
"is_anonymous",
":",
"raise",
"forms",
".",
"ValidationError",
"(",
"\"You need to be logge... | https://github.com/ialbert/biostar-central/blob/2dc7bd30691a50b2da9c2833ba354056bc686afa/biostar/forum/forms.py#L214-L218 | |||
spesmilo/electrum | bdbd59300fbd35b01605e66145458e5f396108e8 | electrum/gui/kivy/uix/dialogs/__init__.py | python | AnimatedPopup.on_deactivate | (self) | Base function to be overridden on inherited classes.
Called when the popup is done animating. | Base function to be overridden on inherited classes.
Called when the popup is done animating. | [
"Base",
"function",
"to",
"be",
"overridden",
"on",
"inherited",
"classes",
".",
"Called",
"when",
"the",
"popup",
"is",
"done",
"animating",
"."
] | def on_deactivate(self):
'''Base function to be overridden on inherited classes.
Called when the popup is done animating.
'''
pass | [
"def",
"on_deactivate",
"(",
"self",
")",
":",
"pass"
] | https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/gui/kivy/uix/dialogs/__init__.py#L35-L39 | ||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/events/v1/sink/__init__.py | python | SinkInstance.sink_validate | (self) | return self._proxy.sink_validate | Access the sink_validate
:returns: twilio.rest.events.v1.sink.sink_validate.SinkValidateList
:rtype: twilio.rest.events.v1.sink.sink_validate.SinkValidateList | Access the sink_validate | [
"Access",
"the",
"sink_validate"
] | def sink_validate(self):
"""
Access the sink_validate
:returns: twilio.rest.events.v1.sink.sink_validate.SinkValidateList
:rtype: twilio.rest.events.v1.sink.sink_validate.SinkValidateList
"""
return self._proxy.sink_validate | [
"def",
"sink_validate",
"(",
"self",
")",
":",
"return",
"self",
".",
"_proxy",
".",
"sink_validate"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/events/v1/sink/__init__.py#L484-L491 | |
ghtmtt/DataPlotly | 6c4b6d55335a007eeb6a01ce5d1211b32098c7ec | DataPlotly/gui/plot_settings_widget.py | python | DataPlotlyPanelWidget.UpdatePlot | (self) | updates only the LAST plot created
get the key of the last plot created and delete it from the plot container
and call the method to create the plot with the updated settings | updates only the LAST plot created
get the key of the last plot created and delete it from the plot container
and call the method to create the plot with the updated settings | [
"updates",
"only",
"the",
"LAST",
"plot",
"created",
"get",
"the",
"key",
"of",
"the",
"last",
"plot",
"created",
"and",
"delete",
"it",
"from",
"the",
"plot",
"container",
"and",
"call",
"the",
"method",
"to",
"create",
"the",
"plot",
"with",
"the",
"up... | def UpdatePlot(self):
"""
updates only the LAST plot created
get the key of the last plot created and delete it from the plot container
and call the method to create the plot with the updated settings
"""
if self.mode == DataPlotlyPanelWidget.MODE_CANVAS:
plot... | [
"def",
"UpdatePlot",
"(",
"self",
")",
":",
"if",
"self",
".",
"mode",
"==",
"DataPlotlyPanelWidget",
".",
"MODE_CANVAS",
":",
"plot_to_update",
"=",
"(",
"sorted",
"(",
"self",
".",
"plot_factories",
".",
"keys",
"(",
")",
")",
"[",
"-",
"1",
"]",
")"... | https://github.com/ghtmtt/DataPlotly/blob/6c4b6d55335a007eeb6a01ce5d1211b32098c7ec/DataPlotly/gui/plot_settings_widget.py#L1260-L1272 | ||
beeware/colosseum | cbf974be54fd7f6fddbe7285704cfaf7a866c5c5 | src/colosseum/dimensions.py | python | Box.margin_right | (self, value) | [] | def margin_right(self, value):
if value != self._margin_right:
self._margin_right = value
self.collapse_right = value | [
"def",
"margin_right",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"!=",
"self",
".",
"_margin_right",
":",
"self",
".",
"_margin_right",
"=",
"value",
"self",
".",
"collapse_right",
"=",
"value"
] | https://github.com/beeware/colosseum/blob/cbf974be54fd7f6fddbe7285704cfaf7a866c5c5/src/colosseum/dimensions.py#L310-L313 | ||||
google/flax | 89e1126cc43588c6946bc85506987dc812909575 | examples/nlp_seq/models.py | python | MlpBlock.__call__ | (self, inputs, deterministic=True) | return output | Applies Transformer MlpBlock module. | Applies Transformer MlpBlock module. | [
"Applies",
"Transformer",
"MlpBlock",
"module",
"."
] | def __call__(self, inputs, deterministic=True):
"""Applies Transformer MlpBlock module."""
cfg = self.config
actual_out_dim = (inputs.shape[-1] if self.out_dim is None
else self.out_dim)
x = nn.Dense(cfg.mlp_dim,
dtype=cfg.dtype,
kernel_init=cfg.ke... | [
"def",
"__call__",
"(",
"self",
",",
"inputs",
",",
"deterministic",
"=",
"True",
")",
":",
"cfg",
"=",
"self",
".",
"config",
"actual_out_dim",
"=",
"(",
"inputs",
".",
"shape",
"[",
"-",
"1",
"]",
"if",
"self",
".",
"out_dim",
"is",
"None",
"else",... | https://github.com/google/flax/blob/89e1126cc43588c6946bc85506987dc812909575/examples/nlp_seq/models.py#L121-L138 | |
gwastro/pycbc | 1e1c85534b9dba8488ce42df693230317ca63dea | pycbc/events/stat.py | python | QuadratureSumStatistic.single | (self, trigs) | return self.get_sngl_ranking(trigs) | Calculate the necessary single detector information
Here just the ranking is computed and returned.
Parameters
----------
trigs: dict of numpy.ndarrays, h5py group (or similar dict-like object)
Dictionary-like object holding single detector trigger information.
Ret... | Calculate the necessary single detector information | [
"Calculate",
"the",
"necessary",
"single",
"detector",
"information"
] | def single(self, trigs):
"""
Calculate the necessary single detector information
Here just the ranking is computed and returned.
Parameters
----------
trigs: dict of numpy.ndarrays, h5py group (or similar dict-like object)
Dictionary-like object holding sing... | [
"def",
"single",
"(",
"self",
",",
"trigs",
")",
":",
"return",
"self",
".",
"get_sngl_ranking",
"(",
"trigs",
")"
] | https://github.com/gwastro/pycbc/blob/1e1c85534b9dba8488ce42df693230317ca63dea/pycbc/events/stat.py#L188-L204 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/layout/ternary/_caxis.py | python | Caxis.__init__ | (
self,
arg=None,
color=None,
dtick=None,
exponentformat=None,
gridcolor=None,
gridwidth=None,
hoverformat=None,
layer=None,
linecolor=None,
linewidth=None,
min=None,
minexponent=None,
nticks=None,
se... | Construct a new Caxis object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.layout.ternary.Caxis`
color
Sets default for all colors associated with this axi... | Construct a new Caxis object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.layout.ternary.Caxis`
color
Sets default for all colors associated with this axi... | [
"Construct",
"a",
"new",
"Caxis",
"object",
"Parameters",
"----------",
"arg",
"dict",
"of",
"properties",
"compatible",
"with",
"this",
"constructor",
"or",
"an",
"instance",
"of",
":",
"class",
":",
"plotly",
".",
"graph_objs",
".",
"layout",
".",
"ternary",... | def __init__(
self,
arg=None,
color=None,
dtick=None,
exponentformat=None,
gridcolor=None,
gridwidth=None,
hoverformat=None,
layer=None,
linecolor=None,
linewidth=None,
min=None,
minexponent=None,
nticks=None... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"dtick",
"=",
"None",
",",
"exponentformat",
"=",
"None",
",",
"gridcolor",
"=",
"None",
",",
"gridwidth",
"=",
"None",
",",
"hoverformat",
"=",
"None",
",",
"la... | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/layout/ternary/_caxis.py#L1394-L1831 | ||
Tencent/bk-bcs-saas | 2b437bf2f5fd5ce2078f7787c3a12df609f7679d | bcs-app/backend/components/bcs/k8s.py | python | K8SClient.delete_deployment | (self, namespace, deployment_name) | return self.proxy_client.delete_deployment(namespace, deployment_name) | 删除deployment | 删除deployment | [
"删除deployment"
] | def delete_deployment(self, namespace, deployment_name):
"""删除deployment"""
return self.proxy_client.delete_deployment(namespace, deployment_name) | [
"def",
"delete_deployment",
"(",
"self",
",",
"namespace",
",",
"deployment_name",
")",
":",
"return",
"self",
".",
"proxy_client",
".",
"delete_deployment",
"(",
"namespace",
",",
"deployment_name",
")"
] | https://github.com/Tencent/bk-bcs-saas/blob/2b437bf2f5fd5ce2078f7787c3a12df609f7679d/bcs-app/backend/components/bcs/k8s.py#L194-L196 | |
bendmorris/static-python | 2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473 | Lib/poplib.py | python | POP3.stls | (self, context=None) | return resp | Start a TLS session on the active connection as specified in RFC 2595.
context - a ssl.SSLContext | Start a TLS session on the active connection as specified in RFC 2595. | [
"Start",
"a",
"TLS",
"session",
"on",
"the",
"active",
"connection",
"as",
"specified",
"in",
"RFC",
"2595",
"."
] | def stls(self, context=None):
"""Start a TLS session on the active connection as specified in RFC 2595.
context - a ssl.SSLContext
"""
if not HAVE_SSL:
raise error_proto('-ERR TLS support missing')
if self._tls_established:
raise error_proto('-ERR... | [
"def",
"stls",
"(",
"self",
",",
"context",
"=",
"None",
")",
":",
"if",
"not",
"HAVE_SSL",
":",
"raise",
"error_proto",
"(",
"'-ERR TLS support missing'",
")",
"if",
"self",
".",
"_tls_established",
":",
"raise",
"error_proto",
"(",
"'-ERR TLS session already e... | https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/poplib.py#L366-L385 | |
yuce/pyswip | 104132e8f8376dbb1c46952d414aa138ee58f6e5 | pyswip/easy.py | python | newModule | (name) | return PL_new_module(name.handle) | Create a new module.
``name``: An Atom or a string | Create a new module.
``name``: An Atom or a string | [
"Create",
"a",
"new",
"module",
".",
"name",
":",
"An",
"Atom",
"or",
"a",
"string"
] | def newModule(name):
"""Create a new module.
``name``: An Atom or a string
"""
if isinstance(name, str):
name = Atom(name)
return PL_new_module(name.handle) | [
"def",
"newModule",
"(",
"name",
")",
":",
"if",
"isinstance",
"(",
"name",
",",
"str",
")",
":",
"name",
"=",
"Atom",
"(",
"name",
")",
"return",
"PL_new_module",
"(",
"name",
".",
"handle",
")"
] | https://github.com/yuce/pyswip/blob/104132e8f8376dbb1c46952d414aa138ee58f6e5/pyswip/easy.py#L568-L575 | |
brutasse/graphite-api | 0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff | graphite_api/functions.py | python | drawAsInfinite | (requestContext, seriesList) | return seriesList | Takes one metric or a wildcard seriesList.
If the value is zero, draw the line at 0. If the value is above zero, draw
the line at infinity. If the value is null or less than zero, do not draw
the line.
Useful for displaying on/off metrics, such as exit codes. (0 = success,
anything else = failure.)... | Takes one metric or a wildcard seriesList.
If the value is zero, draw the line at 0. If the value is above zero, draw
the line at infinity. If the value is null or less than zero, do not draw
the line. | [
"Takes",
"one",
"metric",
"or",
"a",
"wildcard",
"seriesList",
".",
"If",
"the",
"value",
"is",
"zero",
"draw",
"the",
"line",
"at",
"0",
".",
"If",
"the",
"value",
"is",
"above",
"zero",
"draw",
"the",
"line",
"at",
"infinity",
".",
"If",
"the",
"va... | def drawAsInfinite(requestContext, seriesList):
"""
Takes one metric or a wildcard seriesList.
If the value is zero, draw the line at 0. If the value is above zero, draw
the line at infinity. If the value is null or less than zero, do not draw
the line.
Useful for displaying on/off metrics, suc... | [
"def",
"drawAsInfinite",
"(",
"requestContext",
",",
"seriesList",
")",
":",
"for",
"series",
"in",
"seriesList",
":",
"series",
".",
"options",
"[",
"'drawAsInfinite'",
"]",
"=",
"True",
"series",
".",
"name",
"=",
"'drawAsInfinite(%s)'",
"%",
"series",
".",
... | https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3047-L3065 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/google/appengine/api/search/simple_search_stub.py | python | SimpleIndex.DeleteDocuments | (self, document_ids, response) | Deletes documents for the given document_ids. | Deletes documents for the given document_ids. | [
"Deletes",
"documents",
"for",
"the",
"given",
"document_ids",
"."
] | def DeleteDocuments(self, document_ids, response):
"""Deletes documents for the given document_ids."""
for document_id in document_ids:
if document_id in self._documents:
document = self._documents[document_id]
self._inverted_index.RemoveDocument(document)
del self._documents[docum... | [
"def",
"DeleteDocuments",
"(",
"self",
",",
"document_ids",
",",
"response",
")",
":",
"for",
"document_id",
"in",
"document_ids",
":",
"if",
"document_id",
"in",
"self",
".",
"_documents",
":",
"document",
"=",
"self",
".",
"_documents",
"[",
"document_id",
... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/api/search/simple_search_stub.py#L406-L414 | ||
s4w3d0ff/python-poloniex | 369b9c1296d78001072001b9ad2d8d726f6f06ef | poloniex/__init__.py | python | Poloniex.sell | (self, currencyPair, rate, amount, orderType=False) | return self.__call__('sell', args) | Places a sell order in a given market. Parameters and output are
the same as for the buy method. | Places a sell order in a given market. Parameters and output are
the same as for the buy method. | [
"Places",
"a",
"sell",
"order",
"in",
"a",
"given",
"market",
".",
"Parameters",
"and",
"output",
"are",
"the",
"same",
"as",
"for",
"the",
"buy",
"method",
"."
] | def sell(self, currencyPair, rate, amount, orderType=False):
""" Places a sell order in a given market. Parameters and output are
the same as for the buy method. """
args = {
'currencyPair': str(currencyPair).upper(),
'rate': str(rate),
'amount': str(amount),
... | [
"def",
"sell",
"(",
"self",
",",
"currencyPair",
",",
"rate",
",",
"amount",
",",
"orderType",
"=",
"False",
")",
":",
"args",
"=",
"{",
"'currencyPair'",
":",
"str",
"(",
"currencyPair",
")",
".",
"upper",
"(",
")",
",",
"'rate'",
":",
"str",
"(",
... | https://github.com/s4w3d0ff/python-poloniex/blob/369b9c1296d78001072001b9ad2d8d726f6f06ef/poloniex/__init__.py#L473-L489 | |
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/python_clients/venv/lib/python2.7/site-packages/paho/mqtt/client.py | python | Client.loop_read | (self, max_packets=1) | return MQTT_ERR_SUCCESS | Process read network events. Use in place of calling loop() if you
wish to handle your client reads as part of your own application.
Use socket() to obtain the client socket to call select() or equivalent
on.
Do not use if you are using the threaded interface loop_start(). | Process read network events. Use in place of calling loop() if you
wish to handle your client reads as part of your own application. | [
"Process",
"read",
"network",
"events",
".",
"Use",
"in",
"place",
"of",
"calling",
"loop",
"()",
"if",
"you",
"wish",
"to",
"handle",
"your",
"client",
"reads",
"as",
"part",
"of",
"your",
"own",
"application",
"."
] | def loop_read(self, max_packets=1):
"""Process read network events. Use in place of calling loop() if you
wish to handle your client reads as part of your own application.
Use socket() to obtain the client socket to call select() or equivalent
on.
Do not use if you are using th... | [
"def",
"loop_read",
"(",
"self",
",",
"max_packets",
"=",
"1",
")",
":",
"if",
"self",
".",
"_sock",
"is",
"None",
"and",
"self",
".",
"_ssl",
"is",
"None",
":",
"return",
"MQTT_ERR_NO_CONN",
"max_packets",
"=",
"len",
"(",
"self",
".",
"_out_messages",
... | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/venv/lib/python2.7/site-packages/paho/mqtt/client.py#L1057-L1078 | |
digidotcom/xbee-python | 0757f4be0017530c205175fbee8f9f61be9614d1 | digi/xbee/packets/raw.py | python | RX16IOPacket.x16bit_source_addr | (self, x16bit_addr) | Sets the 16-bit source address.
Args:
x16bit_addr (:class:`.XBee16BitAddress`): the new 16-bit source address.
.. seealso::
| :class:`.XBee16BitAddress` | Sets the 16-bit source address. | [
"Sets",
"the",
"16",
"-",
"bit",
"source",
"address",
"."
] | def x16bit_source_addr(self, x16bit_addr):
"""
Sets the 16-bit source address.
Args:
x16bit_addr (:class:`.XBee16BitAddress`): the new 16-bit source address.
.. seealso::
| :class:`.XBee16BitAddress`
"""
self.__x16bit_addr = x16bit_addr | [
"def",
"x16bit_source_addr",
"(",
"self",
",",
"x16bit_addr",
")",
":",
"self",
".",
"__x16bit_addr",
"=",
"x16bit_addr"
] | https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/packets/raw.py#L1441-L1451 | ||
peterdsharpe/AeroSandbox | ded68b0465f2bfdcaf4bc90abd8c91be0addcaba | aerosandbox/numpy/calculus.py | python | trapz | (x, modify_endpoints=False) | return integral | Computes each piece of the approximate integral of `x` via the trapezoidal method with unit spacing.
Can be viewed as the opposite of diff().
Args:
x: The vector-like object (1D np.ndarray, cas.MX) to be integrated.
Returns: A vector of length N-1 with each piece corresponding to the mean value of... | Computes each piece of the approximate integral of `x` via the trapezoidal method with unit spacing.
Can be viewed as the opposite of diff(). | [
"Computes",
"each",
"piece",
"of",
"the",
"approximate",
"integral",
"of",
"x",
"via",
"the",
"trapezoidal",
"method",
"with",
"unit",
"spacing",
".",
"Can",
"be",
"viewed",
"as",
"the",
"opposite",
"of",
"diff",
"()",
"."
] | def trapz(x, modify_endpoints=False): # TODO unify with NumPy trapz, this is different
"""
Computes each piece of the approximate integral of `x` via the trapezoidal method with unit spacing.
Can be viewed as the opposite of diff().
Args:
x: The vector-like object (1D np.ndarray, cas.MX) to be... | [
"def",
"trapz",
"(",
"x",
",",
"modify_endpoints",
"=",
"False",
")",
":",
"# TODO unify with NumPy trapz, this is different",
"integral",
"=",
"(",
"x",
"[",
"1",
":",
"]",
"+",
"x",
"[",
":",
"-",
"1",
"]",
")",
"/",
"2",
"if",
"modify_endpoints",
":",... | https://github.com/peterdsharpe/AeroSandbox/blob/ded68b0465f2bfdcaf4bc90abd8c91be0addcaba/aerosandbox/numpy/calculus.py#L25-L44 | |
xonsh/xonsh | b76d6f994f22a4078f602f8b386f4ec280c8461f | xonsh/ptk_shell/key_bindings.py | python | tab_insert_indent | () | return bool(before_cursor.isspace()) | Check if <Tab> should insert indent instead of starting autocompletion.
Checks if there are only whitespaces before the cursor - if so indent
should be inserted, otherwise autocompletion. | Check if <Tab> should insert indent instead of starting autocompletion.
Checks if there are only whitespaces before the cursor - if so indent
should be inserted, otherwise autocompletion. | [
"Check",
"if",
"<Tab",
">",
"should",
"insert",
"indent",
"instead",
"of",
"starting",
"autocompletion",
".",
"Checks",
"if",
"there",
"are",
"only",
"whitespaces",
"before",
"the",
"cursor",
"-",
"if",
"so",
"indent",
"should",
"be",
"inserted",
"otherwise",
... | def tab_insert_indent():
"""Check if <Tab> should insert indent instead of starting autocompletion.
Checks if there are only whitespaces before the cursor - if so indent
should be inserted, otherwise autocompletion.
"""
before_cursor = get_app().current_buffer.document.current_line_before_cursor
... | [
"def",
"tab_insert_indent",
"(",
")",
":",
"before_cursor",
"=",
"get_app",
"(",
")",
".",
"current_buffer",
".",
"document",
".",
"current_line_before_cursor",
"return",
"bool",
"(",
"before_cursor",
".",
"isspace",
"(",
")",
")"
] | https://github.com/xonsh/xonsh/blob/b76d6f994f22a4078f602f8b386f4ec280c8461f/xonsh/ptk_shell/key_bindings.py#L104-L112 | |
TaipanRex/pyvisgraph | 9472e0df7ca7bfa5f45932ca348222bdc1f7e688 | pyvisgraph/visible_vertices.py | python | polygon_crossing | (p1, poly_edges) | return True | Returns True if Point p1 is internal to the polygon. The polygon is
defined by the Edges in poly_edges. Uses crossings algorithm and takes into
account edges that are collinear to p1. | Returns True if Point p1 is internal to the polygon. The polygon is
defined by the Edges in poly_edges. Uses crossings algorithm and takes into
account edges that are collinear to p1. | [
"Returns",
"True",
"if",
"Point",
"p1",
"is",
"internal",
"to",
"the",
"polygon",
".",
"The",
"polygon",
"is",
"defined",
"by",
"the",
"Edges",
"in",
"poly_edges",
".",
"Uses",
"crossings",
"algorithm",
"and",
"takes",
"into",
"account",
"edges",
"that",
"... | def polygon_crossing(p1, poly_edges):
"""Returns True if Point p1 is internal to the polygon. The polygon is
defined by the Edges in poly_edges. Uses crossings algorithm and takes into
account edges that are collinear to p1."""
p2 = Point(INF, p1.y)
intersect_count = 0
for edge in poly_edges:
... | [
"def",
"polygon_crossing",
"(",
"p1",
",",
"poly_edges",
")",
":",
"p2",
"=",
"Point",
"(",
"INF",
",",
"p1",
".",
"y",
")",
"intersect_count",
"=",
"0",
"for",
"edge",
"in",
"poly_edges",
":",
"if",
"p1",
".",
"y",
"<",
"edge",
".",
"p1",
".",
"... | https://github.com/TaipanRex/pyvisgraph/blob/9472e0df7ca7bfa5f45932ca348222bdc1f7e688/pyvisgraph/visible_vertices.py#L115-L137 | |
bnpy/bnpy | d5b311e8f58ccd98477f4a0c8a4d4982e3fca424 | bnpy/datasets/bars_many_per_doc/make_many_bar_per_doc_dataset.py | python | make_bars_topics | (V, K, fracMassOnTopic=0.95, PRNG=np.random) | return topics | Create parameters of each topics distribution over words
Args
---------
V : int vocab size
K : int number of topics
fracMassOnTopic : fraction of probability mass for "on-topic" words
PRNG : random number generator (for reproducibility)
Returns
---------
topics : 2D array, K x V
... | Create parameters of each topics distribution over words | [
"Create",
"parameters",
"of",
"each",
"topics",
"distribution",
"over",
"words"
] | def make_bars_topics(V, K, fracMassOnTopic=0.95, PRNG=np.random):
''' Create parameters of each topics distribution over words
Args
---------
V : int vocab size
K : int number of topics
fracMassOnTopic : fraction of probability mass for "on-topic" words
PRNG : random number generator (for r... | [
"def",
"make_bars_topics",
"(",
"V",
",",
"K",
",",
"fracMassOnTopic",
"=",
"0.95",
",",
"PRNG",
"=",
"np",
".",
"random",
")",
":",
"sqrtV",
"=",
"int",
"(",
"np",
".",
"sqrt",
"(",
"V",
")",
")",
"BarWidth",
"=",
"sqrtV",
"//",
"(",
"K",
"//",
... | https://github.com/bnpy/bnpy/blob/d5b311e8f58ccd98477f4a0c8a4d4982e3fca424/bnpy/datasets/bars_many_per_doc/make_many_bar_per_doc_dataset.py#L11-L60 | |
EtienneCmb/visbrain | b599038e095919dc193b12d5e502d127de7d03c9 | visbrain/utils/filtering.py | python | PrepareData.__init__ | (self, axis=0, demean=False, detrend=False, filt=False,
fstart=12., fend=16., forder=3, way='lfilter',
filt_meth='butterworth', btype='bandpass', dispas='filter') | Init. | Init. | [
"Init",
"."
] | def __init__(self, axis=0, demean=False, detrend=False, filt=False,
fstart=12., fend=16., forder=3, way='lfilter',
filt_meth='butterworth', btype='bandpass', dispas='filter'):
"""Init."""
# Axis along which to perform preparation :
self.axis = axis
# Dem... | [
"def",
"__init__",
"(",
"self",
",",
"axis",
"=",
"0",
",",
"demean",
"=",
"False",
",",
"detrend",
"=",
"False",
",",
"filt",
"=",
"False",
",",
"fstart",
"=",
"12.",
",",
"fend",
"=",
"16.",
",",
"forder",
"=",
"3",
",",
"way",
"=",
"'lfilter'"... | https://github.com/EtienneCmb/visbrain/blob/b599038e095919dc193b12d5e502d127de7d03c9/visbrain/utils/filtering.py#L269-L283 | ||
zhang-can/ECO-pytorch | 355c3866b35cdaa5d451263c1f3291c150e22eeb | tf_model_zoo/models/inception/inception/slim/variables.py | python | get_unique_variable | (name) | Gets the variable uniquely identified by that name.
Args:
name: a name that uniquely identifies the variable.
Returns:
a tensorflow variable.
Raises:
ValueError: if no variable uniquely identified by the name exists. | Gets the variable uniquely identified by that name. | [
"Gets",
"the",
"variable",
"uniquely",
"identified",
"by",
"that",
"name",
"."
] | def get_unique_variable(name):
"""Gets the variable uniquely identified by that name.
Args:
name: a name that uniquely identifies the variable.
Returns:
a tensorflow variable.
Raises:
ValueError: if no variable uniquely identified by the name exists.
"""
candidates = tf.get_collection(tf.Grap... | [
"def",
"get_unique_variable",
"(",
"name",
")",
":",
"candidates",
"=",
"tf",
".",
"get_collection",
"(",
"tf",
".",
"GraphKeys",
".",
"VARIABLES",
",",
"name",
")",
"if",
"not",
"candidates",
":",
"raise",
"ValueError",
"(",
"'Couldnt find variable %s'",
"%",... | https://github.com/zhang-can/ECO-pytorch/blob/355c3866b35cdaa5d451263c1f3291c150e22eeb/tf_model_zoo/models/inception/inception/slim/variables.py#L152-L171 | ||
hydroshare/hydroshare | 7ba563b55412f283047fb3ef6da367d41dec58c6 | hs_core/hydroshare/utils.py | python | resource_post_create_actions | (resource, user, metadata, **kwargs) | [] | def resource_post_create_actions(resource, user, metadata, **kwargs):
# receivers need to change the values of this dict if file validation fails
file_validation_dict = {'are_files_valid': True, 'message': 'Files are valid'}
# Send post-create resource signal
post_create_resource.send(sender=type(resou... | [
"def",
"resource_post_create_actions",
"(",
"resource",
",",
"user",
",",
"metadata",
",",
"*",
"*",
"kwargs",
")",
":",
"# receivers need to change the values of this dict if file validation fails",
"file_validation_dict",
"=",
"{",
"'are_files_valid'",
":",
"True",
",",
... | https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/hs_core/hydroshare/utils.py#L754-L762 | ||||
inspurer/WorkAttendanceSystem | 1221e2d67bdf5bb15fe99517cc3ded58ccb066df | V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/req/req_install.py | python | InstallRequirement.remove_temporary_source | (self) | Remove the source files from this requirement, if they are marked
for deletion | Remove the source files from this requirement, if they are marked
for deletion | [
"Remove",
"the",
"source",
"files",
"from",
"this",
"requirement",
"if",
"they",
"are",
"marked",
"for",
"deletion"
] | def remove_temporary_source(self):
"""Remove the source files from this requirement, if they are marked
for deletion"""
if self.source_dir and os.path.exists(
os.path.join(self.source_dir, PIP_DELETE_MARKER_FILENAME)):
logger.debug('Removing source in %s', self.source... | [
"def",
"remove_temporary_source",
"(",
"self",
")",
":",
"if",
"self",
".",
"source_dir",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"source_dir",
",",
"PIP_DELETE_MARKER_FILENAME",
")",
")",
":",
"log... | https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/req/req_install.py#L971-L981 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_adm_policy_user.py | python | OpenShiftCLIConfig.stringify | (self, ascommalist='') | return rval | return the options hash as cli params in a string
if ascommalist is set to the name of a key, and
the value of that key is a dict, format the dict
as a list of comma delimited key=value pairs | return the options hash as cli params in a string
if ascommalist is set to the name of a key, and
the value of that key is a dict, format the dict
as a list of comma delimited key=value pairs | [
"return",
"the",
"options",
"hash",
"as",
"cli",
"params",
"in",
"a",
"string",
"if",
"ascommalist",
"is",
"set",
"to",
"the",
"name",
"of",
"a",
"key",
"and",
"the",
"value",
"of",
"that",
"key",
"is",
"a",
"dict",
"format",
"the",
"dict",
"as",
"a"... | def stringify(self, ascommalist=''):
''' return the options hash as cli params in a string
if ascommalist is set to the name of a key, and
the value of that key is a dict, format the dict
as a list of comma delimited key=value pairs '''
rval = []
for key in so... | [
"def",
"stringify",
"(",
"self",
",",
"ascommalist",
"=",
"''",
")",
":",
"rval",
"=",
"[",
"]",
"for",
"key",
"in",
"sorted",
"(",
"self",
".",
"config_options",
".",
"keys",
"(",
")",
")",
":",
"data",
"=",
"self",
".",
"config_options",
"[",
"ke... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_adm_policy_user.py#L1458-L1474 | |
deepjyoti30/QuickWall | ebbce6be6c1f92ccca1a77f5f66444d724cd2d75 | QuickWall/kde.py | python | saveRestorableWallpaper | () | Save current wallpaper as RestorableImage in kde wallpaper config | Save current wallpaper as RestorableImage in kde wallpaper config | [
"Save",
"current",
"wallpaper",
"as",
"RestorableImage",
"in",
"kde",
"wallpaper",
"config"
] | def saveRestorableWallpaper():
"""
Save current wallpaper as RestorableImage in kde wallpaper config
"""
jscript = """var first = desktopForScreen(0);
first.currentConfigGroup = Array( 'Wallpaper', 'org.kde.image', 'General' );
var img = first.readConfig('Image');
first.writeConfig('Restor... | [
"def",
"saveRestorableWallpaper",
"(",
")",
":",
"jscript",
"=",
"\"\"\"var first = desktopForScreen(0);\n first.currentConfigGroup = Array( 'Wallpaper', 'org.kde.image', 'General' );\n var img = first.readConfig('Image');\n first.writeConfig('RestorableImage' , img);\n \"\"\"",
"bus",
... | https://github.com/deepjyoti30/QuickWall/blob/ebbce6be6c1f92ccca1a77f5f66444d724cd2d75/QuickWall/kde.py#L32-L44 | ||
HymanLiuTS/flaskTs | 286648286976e85d9b9a5873632331efcafe0b21 | flasky/lib/python2.7/site-packages/sqlalchemy/sql/operators.py | python | ColumnOperators.__add__ | (self, other) | return self.operate(add, other) | Implement the ``+`` operator.
In a column context, produces the clause ``a + b``
if the parent object has non-string affinity.
If the parent object has a string affinity,
produces the concatenation operator, ``a || b`` -
see :meth:`.ColumnOperators.concat`. | Implement the ``+`` operator. | [
"Implement",
"the",
"+",
"operator",
"."
] | def __add__(self, other):
"""Implement the ``+`` operator.
In a column context, produces the clause ``a + b``
if the parent object has non-string affinity.
If the parent object has a string affinity,
produces the concatenation operator, ``a || b`` -
see :meth:`.ColumnOpe... | [
"def",
"__add__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"operate",
"(",
"add",
",",
"other",
")"
] | https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/sqlalchemy/sql/operators.py#L668-L678 | |
bendmorris/static-python | 2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473 | Lib/tkinter/__init__.py | python | Menu.add_cascade | (self, cnf={}, **kw) | Add hierarchical menu item. | Add hierarchical menu item. | [
"Add",
"hierarchical",
"menu",
"item",
"."
] | def add_cascade(self, cnf={}, **kw):
"""Add hierarchical menu item."""
self.add('cascade', cnf or kw) | [
"def",
"add_cascade",
"(",
"self",
",",
"cnf",
"=",
"{",
"}",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"add",
"(",
"'cascade'",
",",
"cnf",
"or",
"kw",
")"
] | https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/tkinter/__init__.py#L2695-L2697 | ||
lenskit/lkpy | cfe84226f8be7778fb343f0c96c4f4ef4acc5932 | lenskit/algorithms/item_knn.py | python | ItemItem.fit | (self, ratings, **kwargs) | return self | Train a model.
The model-training process depends on ``save_nbrs`` and ``min_sim``, but *not* on other
algorithm parameters.
Args:
ratings(pandas.DataFrame):
(user,item,rating) data for computing item similarities. | Train a model. | [
"Train",
"a",
"model",
"."
] | def fit(self, ratings, **kwargs):
"""
Train a model.
The model-training process depends on ``save_nbrs`` and ``min_sim``, but *not* on other
algorithm parameters.
Args:
ratings(pandas.DataFrame):
(user,item,rating) data for computing item similaritie... | [
"def",
"fit",
"(",
"self",
",",
"ratings",
",",
"*",
"*",
"kwargs",
")",
":",
"util",
".",
"check_env",
"(",
")",
"# Training proceeds in 2 steps:",
"# 1. Normalize item vectors to be mean-centered and unit-normalized",
"# 2. Compute similarities with pairwise dot products",
... | https://github.com/lenskit/lkpy/blob/cfe84226f8be7778fb343f0c96c4f4ef4acc5932/lenskit/algorithms/item_knn.py#L261-L313 | |
Tencent/QT4A | cc99ce12bd10f864c95b7bf0675fd1b757bce4bb | qt4a/androiddriver/adb.py | python | ADB._list_process | (self) | return result_list | 获取进程列表 | 获取进程列表 | [
"获取进程列表"
] | def _list_process(self):
"""获取进程列表
"""
cmdline = "ps"
if self.get_sdk_version() >= 26:
cmdline += " -A"
result = self.run_shell_cmd(cmdline).strip()
lines = result.split("\n")
busybox = False
if lines[0].startswith("PID"):
busybox =... | [
"def",
"_list_process",
"(",
"self",
")",
":",
"cmdline",
"=",
"\"ps\"",
"if",
"self",
".",
"get_sdk_version",
"(",
")",
">=",
"26",
":",
"cmdline",
"+=",
"\" -A\"",
"result",
"=",
"self",
".",
"run_shell_cmd",
"(",
"cmdline",
")",
".",
"strip",
"(",
"... | https://github.com/Tencent/QT4A/blob/cc99ce12bd10f864c95b7bf0675fd1b757bce4bb/qt4a/androiddriver/adb.py#L1728-L1786 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/Lib/SocketServer.py | python | BaseServer.process_request | (self, request, client_address) | Call finish_request.
Overridden by ForkingMixIn and ThreadingMixIn. | Call finish_request. | [
"Call",
"finish_request",
"."
] | def process_request(self, request, client_address):
"""Call finish_request.
Overridden by ForkingMixIn and ThreadingMixIn.
"""
self.finish_request(request, client_address)
self.shutdown_request(request) | [
"def",
"process_request",
"(",
"self",
",",
"request",
",",
"client_address",
")",
":",
"self",
".",
"finish_request",
"(",
"request",
",",
"client_address",
")",
"self",
".",
"shutdown_request",
"(",
"request",
")"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/SocketServer.py#L304-L311 | ||
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | ambari/datadog_checks/ambari/ambari.py | python | AmbariCheck._should_collect_service_metrics | (self) | return self.init_config.get("collect_service_metrics", True) | [] | def _should_collect_service_metrics(self):
return self.init_config.get("collect_service_metrics", True) | [
"def",
"_should_collect_service_metrics",
"(",
"self",
")",
":",
"return",
"self",
".",
"init_config",
".",
"get",
"(",
"\"collect_service_metrics\"",
",",
"True",
")"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/ambari/datadog_checks/ambari/ambari.py#L43-L44 | |||
geyang/ml_logger | aa02d230b43a379846f854ad91842e524f5cdbce | ml_logger/full_duplex.py | python | Duplex.__init__ | (self, thunk, keep_alive_interval=10) | runs the thunk per interval. Saves the output of the
thunk in the signal buffer.
:param interval: int
:param interval: Check interval, in seconds | runs the thunk per interval. Saves the output of the
thunk in the signal buffer. | [
"runs",
"the",
"thunk",
"per",
"interval",
".",
"Saves",
"the",
"output",
"of",
"the",
"thunk",
"in",
"the",
"signal",
"buffer",
"."
] | def __init__(self, thunk, keep_alive_interval=10):
"""
runs the thunk per interval. Saves the output of the
thunk in the signal buffer.
:param interval: int
:param interval: Check interval, in seconds
"""
self.keep_alive_interval = keep_alive_interval
sel... | [
"def",
"__init__",
"(",
"self",
",",
"thunk",
",",
"keep_alive_interval",
"=",
"10",
")",
":",
"self",
".",
"keep_alive_interval",
"=",
"keep_alive_interval",
"self",
".",
"thunk",
"=",
"thunk",
"self",
".",
"buffer",
"=",
"[",
"]",
"self",
".",
"send_buff... | https://github.com/geyang/ml_logger/blob/aa02d230b43a379846f854ad91842e524f5cdbce/ml_logger/full_duplex.py#L30-L44 | ||
minerllabs/minerl | 0123527c334c96ebb3f0cf313df1552fa4302691 | minerl/herobraine/hero/handlers/server/quit.py | python | ServerQuitWhenAnyAgentFinishes.xml_template | (self) | return str(
"""<ServerQuitWhenAnyAgentFinishes/>
"""
) | [] | def xml_template(self) -> str:
return str(
"""<ServerQuitWhenAnyAgentFinishes/>
"""
) | [
"def",
"xml_template",
"(",
"self",
")",
"->",
"str",
":",
"return",
"str",
"(",
"\"\"\"<ServerQuitWhenAnyAgentFinishes/>\n \"\"\"",
")"
] | https://github.com/minerllabs/minerl/blob/0123527c334c96ebb3f0cf313df1552fa4302691/minerl/herobraine/hero/handlers/server/quit.py#L56-L60 | |||
pypa/setuptools | 9f37366aab9cd8f6baa23e6a77cfdb8daf97757e | setuptools/_vendor/more_itertools/more.py | python | callback_iter.__exit__ | (self, exc_type, exc_value, traceback) | [] | def __exit__(self, exc_type, exc_value, traceback):
self._aborted = True
self._executor.shutdown() | [
"def",
"__exit__",
"(",
"self",
",",
"exc_type",
",",
"exc_value",
",",
"traceback",
")",
":",
"self",
".",
"_aborted",
"=",
"True",
"self",
".",
"_executor",
".",
"shutdown",
"(",
")"
] | https://github.com/pypa/setuptools/blob/9f37366aab9cd8f6baa23e6a77cfdb8daf97757e/setuptools/_vendor/more_itertools/more.py#L3463-L3465 | ||||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/_candlestick.py | python | Candlestick.decreasing | (self) | return self["decreasing"] | The 'decreasing' property is an instance of Decreasing
that may be specified as:
- An instance of :class:`plotly.graph_objs.candlestick.Decreasing`
- A dict of string/value properties that will be passed
to the Decreasing constructor
Supported dict properties:
... | The 'decreasing' property is an instance of Decreasing
that may be specified as:
- An instance of :class:`plotly.graph_objs.candlestick.Decreasing`
- A dict of string/value properties that will be passed
to the Decreasing constructor
Supported dict properties:
... | [
"The",
"decreasing",
"property",
"is",
"an",
"instance",
"of",
"Decreasing",
"that",
"may",
"be",
"specified",
"as",
":",
"-",
"An",
"instance",
"of",
":",
"class",
":",
"plotly",
".",
"graph_objs",
".",
"candlestick",
".",
"Decreasing",
"-",
"A",
"dict",
... | def decreasing(self):
"""
The 'decreasing' property is an instance of Decreasing
that may be specified as:
- An instance of :class:`plotly.graph_objs.candlestick.Decreasing`
- A dict of string/value properties that will be passed
to the Decreasing constructor
... | [
"def",
"decreasing",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"decreasing\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_candlestick.py#L148-L172 | |
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/sklearn/mixture/bayesian_mixture.py | python | BayesianGaussianMixture._estimate_precisions | (self, nk, xk, sk) | Estimate the precisions parameters of the precision distribution.
Parameters
----------
nk : array-like, shape (n_components,)
xk : array-like, shape (n_components, n_features)
sk : array-like
The shape depends of `covariance_type`:
'full' : (n_componen... | Estimate the precisions parameters of the precision distribution. | [
"Estimate",
"the",
"precisions",
"parameters",
"of",
"the",
"precision",
"distribution",
"."
] | def _estimate_precisions(self, nk, xk, sk):
"""Estimate the precisions parameters of the precision distribution.
Parameters
----------
nk : array-like, shape (n_components,)
xk : array-like, shape (n_components, n_features)
sk : array-like
The shape depends... | [
"def",
"_estimate_precisions",
"(",
"self",
",",
"nk",
",",
"xk",
",",
"sk",
")",
":",
"{",
"\"full\"",
":",
"self",
".",
"_estimate_wishart_full",
",",
"\"tied\"",
":",
"self",
".",
"_estimate_wishart_tied",
",",
"\"diag\"",
":",
"self",
".",
"_estimate_wis... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/sklearn/mixture/bayesian_mixture.py#L498-L521 | ||
globaleaks/GlobaLeaks | 4624ca937728adb8e21c4733a8aecec6a41cb3db | backend/globaleaks/handlers/public.py | python | db_prepare_receivers_serialization | (session, receivers) | return data | Transaction to prepare and optimize receiver serialization
:param session: An ORM session
:param receivers: The list of receivers for which preparing the serialization
:return: The set of retrieved objects necessary for optimizing the serialization | Transaction to prepare and optimize receiver serialization | [
"Transaction",
"to",
"prepare",
"and",
"optimize",
"receiver",
"serialization"
] | def db_prepare_receivers_serialization(session, receivers):
"""
Transaction to prepare and optimize receiver serialization
:param session: An ORM session
:param receivers: The list of receivers for which preparing the serialization
:return: The set of retrieved objects necessary for optimizing the ... | [
"def",
"db_prepare_receivers_serialization",
"(",
"session",
",",
"receivers",
")",
":",
"data",
"=",
"{",
"'imgs'",
":",
"{",
"}",
"}",
"receivers_ids",
"=",
"[",
"r",
".",
"id",
"for",
"r",
"in",
"receivers",
"]",
"if",
"receivers_ids",
":",
"for",
"o"... | https://github.com/globaleaks/GlobaLeaks/blob/4624ca937728adb8e21c4733a8aecec6a41cb3db/backend/globaleaks/handlers/public.py#L169-L185 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.