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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.2/django/contrib/gis/gdal/prototypes/generation.py | python | srs_output | (func, argtypes) | return func | Generates a ctypes prototype for the given function with
the given C arguments that returns a pointer to an OGR
Spatial Reference System. | Generates a ctypes prototype for the given function with
the given C arguments that returns a pointer to an OGR
Spatial Reference System. | [
"Generates",
"a",
"ctypes",
"prototype",
"for",
"the",
"given",
"function",
"with",
"the",
"given",
"C",
"arguments",
"that",
"returns",
"a",
"pointer",
"to",
"an",
"OGR",
"Spatial",
"Reference",
"System",
"."
] | def srs_output(func, argtypes):
"""
Generates a ctypes prototype for the given function with
the given C arguments that returns a pointer to an OGR
Spatial Reference System.
"""
func.argtypes = argtypes
func.restype = c_void_p
func.errcheck = check_srs
return func | [
"def",
"srs_output",
"(",
"func",
",",
"argtypes",
")",
":",
"func",
".",
"argtypes",
"=",
"argtypes",
"func",
".",
"restype",
"=",
"c_void_p",
"func",
".",
"errcheck",
"=",
"check_srs",
"return",
"func"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/contrib/gis/gdal/prototypes/generation.py#L49-L58 | |
plone/Products.CMFPlone | 83137764e3e7e4fe60d03c36dfc6ba9c7c543324 | Products/CMFPlone/UnicodeSplitter/splitter.py | python | bigram | (u, limit=1) | return [u[i:i + 2] for i in range(len(u) - limit)] | Split into bi-gram.
limit arg describes ending process.
If limit = 0 then
日本人-> [日本,本人, 人]
金 -> [金]
If limit = 1 then
日本人-> [日本,本人]
金 -> [] | Split into bi-gram.
limit arg describes ending process.
If limit = 0 then
日本人-> [日本,本人, 人]
金 -> [金]
If limit = 1 then
日本人-> [日本,本人]
金 -> [] | [
"Split",
"into",
"bi",
"-",
"gram",
".",
"limit",
"arg",
"describes",
"ending",
"process",
".",
"If",
"limit",
"=",
"0",
"then",
"日本人",
"-",
">",
"[",
"日本",
"本人",
"人",
"]",
"金",
"-",
">",
"[",
"金",
"]",
"If",
"limit",
"=",
"1",
"then",
"日本人",
... | def bigram(u, limit=1):
""" Split into bi-gram.
limit arg describes ending process.
If limit = 0 then
日本人-> [日本,本人, 人]
金 -> [金]
If limit = 1 then
日本人-> [日本,本人]
金 -> []
"""
return [u[i:i + 2] for i in range(len(u) - limit)] | [
"def",
"bigram",
"(",
"u",
",",
"limit",
"=",
"1",
")",
":",
"return",
"[",
"u",
"[",
"i",
":",
"i",
"+",
"2",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"u",
")",
"-",
"limit",
")",
"]"
] | https://github.com/plone/Products.CMFPlone/blob/83137764e3e7e4fe60d03c36dfc6ba9c7c543324/Products/CMFPlone/UnicodeSplitter/splitter.py#L22-L32 | |
mchristopher/PokemonGo-DesktopMap | ec37575f2776ee7d64456e2a1f6b6b78830b4fe0 | app/pylibs/win32/Cryptodome/Util/asn1.py | python | DerObject.__init__ | (self, asn1Id=None, payload=b(''), implicit=None,
constructed=False, explicit=None) | Initialize the DER object according to a specific ASN.1 type.
:Parameters:
asn1Id : integer
The universal DER tag number for this object
(e.g. 0x10 for a SEQUENCE).
If None, the tag is not known yet.
payloa... | Initialize the DER object according to a specific ASN.1 type. | [
"Initialize",
"the",
"DER",
"object",
"according",
"to",
"a",
"specific",
"ASN",
".",
"1",
"type",
"."
] | def __init__(self, asn1Id=None, payload=b(''), implicit=None,
constructed=False, explicit=None):
"""Initialize the DER object according to a specific ASN.1 type.
:Parameters:
asn1Id : integer
The universal DER tag number for thi... | [
"def",
"__init__",
"(",
"self",
",",
"asn1Id",
"=",
"None",
",",
"payload",
"=",
"b",
"(",
"''",
")",
",",
"implicit",
"=",
"None",
",",
"constructed",
"=",
"False",
",",
"explicit",
"=",
"None",
")",
":",
"if",
"asn1Id",
"is",
"None",
":",
"# The ... | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pylibs/win32/Cryptodome/Util/asn1.py#L86-L146 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/mimetypes.py | python | MimeTypes.__init__ | (self, filenames=(), strict=True) | [] | def __init__(self, filenames=(), strict=True):
if not inited:
init()
self.encodings_map = _encodings_map_default.copy()
self.suffix_map = _suffix_map_default.copy()
self.types_map = ({}, {}) # dict for (non-strict, strict)
self.types_map_inv = ({}, {})
for (ex... | [
"def",
"__init__",
"(",
"self",
",",
"filenames",
"=",
"(",
")",
",",
"strict",
"=",
"True",
")",
":",
"if",
"not",
"inited",
":",
"init",
"(",
")",
"self",
".",
"encodings_map",
"=",
"_encodings_map_default",
".",
"copy",
"(",
")",
"self",
".",
"suf... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/mimetypes.py#L66-L78 | ||||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Tools/pybench/pybench.py | python | Test.test | (self) | return | Run the test.
The test needs to run self.rounds executing
self.operations number of operations each. | Run the test. | [
"Run",
"the",
"test",
"."
] | def test(self):
""" Run the test.
The test needs to run self.rounds executing
self.operations number of operations each.
"""
return | [
"def",
"test",
"(",
"self",
")",
":",
"return"
] | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Tools/pybench/pybench.py#L358-L366 | |
roclark/sportsipy | c19f545d3376d62ded6304b137dc69238ac620a9 | sportsipy/nba/roster.py | python | Player.steals_per_poss | (self) | return self._steals_per_poss | Returns a ``float`` of the total number of steals the player tallied
per 100 posessions. | Returns a ``float`` of the total number of steals the player tallied
per 100 posessions. | [
"Returns",
"a",
"float",
"of",
"the",
"total",
"number",
"of",
"steals",
"the",
"player",
"tallied",
"per",
"100",
"posessions",
"."
] | def steals_per_poss(self):
"""
Returns a ``float`` of the total number of steals the player tallied
per 100 posessions.
"""
return self._steals_per_poss | [
"def",
"steals_per_poss",
"(",
"self",
")",
":",
"return",
"self",
".",
"_steals_per_poss"
] | https://github.com/roclark/sportsipy/blob/c19f545d3376d62ded6304b137dc69238ac620a9/sportsipy/nba/roster.py#L927-L932 | |
realpython/book2-exercises | cde325eac8e6d8cff2316601c2e5b36bb46af7d0 | web2py-rest/gluon/rewrite.py | python | MapUrlIn.arg0 | (self) | return self.args(0) | Returns first arg | Returns first arg | [
"Returns",
"first",
"arg"
] | def arg0(self):
"""Returns first arg"""
return self.args(0) | [
"def",
"arg0",
"(",
"self",
")",
":",
"return",
"self",
".",
"args",
"(",
"0",
")"
] | https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py-rest/gluon/rewrite.py#L1109-L1111 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/celery/worker/control.py | python | registered | (state, taskinfoitems=None, builtins=False, **kwargs) | return [_extract_info(reg[task]) for task in sorted(tasks)] | List of registered tasks.
Arguments:
taskinfoitems (Sequence[str]): List of task attributes to include.
Defaults to ``exchange,routing_key,rate_limit``.
builtins (bool): Also include built-in tasks. | List of registered tasks. | [
"List",
"of",
"registered",
"tasks",
"."
] | def registered(state, taskinfoitems=None, builtins=False, **kwargs):
"""List of registered tasks.
Arguments:
taskinfoitems (Sequence[str]): List of task attributes to include.
Defaults to ``exchange,routing_key,rate_limit``.
builtins (bool): Also include built-in tasks.
"""
... | [
"def",
"registered",
"(",
"state",
",",
"taskinfoitems",
"=",
"None",
",",
"builtins",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"reg",
"=",
"state",
".",
"app",
".",
"tasks",
"taskinfoitems",
"=",
"taskinfoitems",
"or",
"DEFAULT_TASK_INFO_ITEMS",
"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/celery/worker/control.py#L387-L411 | |
MushroomRL/mushroom-rl | a0eaa2cf8001e433419234a9fc48b64170e3f61c | mushroom_rl/environments/mujoco_envs/humanoid_gait/reward_goals/reward.py | python | GoalRewardInterface.get_observation_space | (self) | return -np.inf * np.ones(len(obs)), np.inf * np.ones(len(obs)) | Getter.
Returns:
The low and high arrays of the observation space | Getter. | [
"Getter",
"."
] | def get_observation_space(self):
"""
Getter.
Returns:
The low and high arrays of the observation space
"""
obs = self.get_observation()
return -np.inf * np.ones(len(obs)), np.inf * np.ones(len(obs)) | [
"def",
"get_observation_space",
"(",
"self",
")",
":",
"obs",
"=",
"self",
".",
"get_observation",
"(",
")",
"return",
"-",
"np",
".",
"inf",
"*",
"np",
".",
"ones",
"(",
"len",
"(",
"obs",
")",
")",
",",
"np",
".",
"inf",
"*",
"np",
".",
"ones",... | https://github.com/MushroomRL/mushroom-rl/blob/a0eaa2cf8001e433419234a9fc48b64170e3f61c/mushroom_rl/environments/mujoco_envs/humanoid_gait/reward_goals/reward.py#L30-L39 | |
h2oai/h2o4gpu | aaf7795d3c3be430129eacfd99d598da0cc838e7 | src/interface_py/h2o4gpu/solvers/truncated_svd.py | python | TruncatedSVDH2O.explained_variance_ratio_ | (self) | return self.explained_variance_ratio | Percentage of variance explained by each of the selected components. | Percentage of variance explained by each of the selected components. | [
"Percentage",
"of",
"variance",
"explained",
"by",
"each",
"of",
"the",
"selected",
"components",
"."
] | def explained_variance_ratio_(self):
"""
Percentage of variance explained by each of the selected components.
"""
return self.explained_variance_ratio | [
"def",
"explained_variance_ratio_",
"(",
"self",
")",
":",
"return",
"self",
".",
"explained_variance_ratio"
] | https://github.com/h2oai/h2o4gpu/blob/aaf7795d3c3be430129eacfd99d598da0cc838e7/src/interface_py/h2o4gpu/solvers/truncated_svd.py#L322-L326 | |
czhu95/ternarynet | 1a67251f7f5a1cdf854f87f90f841655c7c9f11c | tensorpack/callbacks/base.py | python | Callback.trigger_step | (self) | Callback to be triggered after every step (every backpropagation)
Could be useful to apply some tricks on parameters (clipping, low-rank, etc) | Callback to be triggered after every step (every backpropagation) | [
"Callback",
"to",
"be",
"triggered",
"after",
"every",
"step",
"(",
"every",
"backpropagation",
")"
] | def trigger_step(self):
"""
Callback to be triggered after every step (every backpropagation)
Could be useful to apply some tricks on parameters (clipping, low-rank, etc)
""" | [
"def",
"trigger_step",
"(",
"self",
")",
":"
] | https://github.com/czhu95/ternarynet/blob/1a67251f7f5a1cdf854f87f90f841655c7c9f11c/tensorpack/callbacks/base.py#L54-L59 | ||
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/cli/plug/__init__.py | python | run_report | (db, name, **options_str_dict) | return clr | Given a database, run a given report.
db is a Db database
name is the name of a report
options_str_dict is the same kind of options
given at the command line. For example:
>>> run_report(db, "ancestor_report", off="txt",
of="ancestor-007.txt", pid="I37")
returns CommandLi... | Given a database, run a given report. | [
"Given",
"a",
"database",
"run",
"a",
"given",
"report",
"."
] | def run_report(db, name, **options_str_dict):
"""
Given a database, run a given report.
db is a Db database
name is the name of a report
options_str_dict is the same kind of options
given at the command line. For example:
>>> run_report(db, "ancestor_report", off="txt",
... | [
"def",
"run_report",
"(",
"db",
",",
"name",
",",
"*",
"*",
"options_str_dict",
")",
":",
"dbstate",
"=",
"DbState",
"(",
")",
"climanager",
"=",
"CLIManager",
"(",
"dbstate",
",",
"False",
",",
"User",
"(",
")",
")",
"# don't load db",
"climanager",
"."... | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/cli/plug/__init__.py#L723-L767 | |
IronLanguages/ironpython2 | 51fdedeeda15727717fb8268a805f71b06c0b9f1 | Src/StdLib/Lib/ConfigParser.py | python | RawConfigParser.write | (self, fp) | Write an .ini-format representation of the configuration state. | Write an .ini-format representation of the configuration state. | [
"Write",
"an",
".",
"ini",
"-",
"format",
"representation",
"of",
"the",
"configuration",
"state",
"."
] | def write(self, fp):
"""Write an .ini-format representation of the configuration state."""
if self._defaults:
fp.write("[%s]\n" % DEFAULTSECT)
for (key, value) in self._defaults.items():
fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t')))
f... | [
"def",
"write",
"(",
"self",
",",
"fp",
")",
":",
"if",
"self",
".",
"_defaults",
":",
"fp",
".",
"write",
"(",
"\"[%s]\\n\"",
"%",
"DEFAULTSECT",
")",
"for",
"(",
"key",
",",
"value",
")",
"in",
"self",
".",
"_defaults",
".",
"items",
"(",
")",
... | https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/ConfigParser.py#L399-L414 | ||
StackStorm/st2 | 85ae05b73af422efd3097c9c05351f7f1cc8369e | st2common/st2common/rbac/types.py | python | PermissionType.get_valid_permissions_for_resource_type | (cls, resource_type) | return valid_permissions | Return valid permissions for the provided resource type.
:rtype: ``list`` | Return valid permissions for the provided resource type. | [
"Return",
"valid",
"permissions",
"for",
"the",
"provided",
"resource",
"type",
"."
] | def get_valid_permissions_for_resource_type(cls, resource_type):
"""
Return valid permissions for the provided resource type.
:rtype: ``list``
"""
valid_permissions = RESOURCE_TYPE_TO_PERMISSION_TYPES_MAP[resource_type]
return valid_permissions | [
"def",
"get_valid_permissions_for_resource_type",
"(",
"cls",
",",
"resource_type",
")",
":",
"valid_permissions",
"=",
"RESOURCE_TYPE_TO_PERMISSION_TYPES_MAP",
"[",
"resource_type",
"]",
"return",
"valid_permissions"
] | https://github.com/StackStorm/st2/blob/85ae05b73af422efd3097c9c05351f7f1cc8369e/st2common/st2common/rbac/types.py#L161-L168 | |
wikimedia/pywikibot | 81a01ffaec7271bf5b4b170f85a80388420a4e78 | pywikibot/pagegenerators.py | python | GeneratorFactory._handle_file | (self, value: str) | return TextIOPageGenerator(value, site=self.site) | Handle `-file` argument. | Handle `-file` argument. | [
"Handle",
"-",
"file",
"argument",
"."
] | def _handle_file(self, value: str) -> HANDLER_RETURN_TYPE:
"""Handle `-file` argument."""
if not value:
value = pywikibot.input('Please enter the local file name:')
return TextIOPageGenerator(value, site=self.site) | [
"def",
"_handle_file",
"(",
"self",
",",
"value",
":",
"str",
")",
"->",
"HANDLER_RETURN_TYPE",
":",
"if",
"not",
"value",
":",
"value",
"=",
"pywikibot",
".",
"input",
"(",
"'Please enter the local file name:'",
")",
"return",
"TextIOPageGenerator",
"(",
"value... | https://github.com/wikimedia/pywikibot/blob/81a01ffaec7271bf5b4b170f85a80388420a4e78/pywikibot/pagegenerators.py#L975-L979 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/cmdmod.py | python | exec_code_all | (lang, code, cwd=None, args=None, **kwargs) | return ret | Pass in two strings, the first naming the executable language, aka -
python2, python3, ruby, perl, lua, etc. the second string containing
the code you wish to execute. All cmd artifacts (stdout, stderr, retcode, pid)
will be returned.
All parameters from :mod:`cmd.run_all <salt.modules.cmdmod.run_all>`... | Pass in two strings, the first naming the executable language, aka -
python2, python3, ruby, perl, lua, etc. the second string containing
the code you wish to execute. All cmd artifacts (stdout, stderr, retcode, pid)
will be returned. | [
"Pass",
"in",
"two",
"strings",
"the",
"first",
"naming",
"the",
"executable",
"language",
"aka",
"-",
"python2",
"python3",
"ruby",
"perl",
"lua",
"etc",
".",
"the",
"second",
"string",
"containing",
"the",
"code",
"you",
"wish",
"to",
"execute",
".",
"Al... | def exec_code_all(lang, code, cwd=None, args=None, **kwargs):
"""
Pass in two strings, the first naming the executable language, aka -
python2, python3, ruby, perl, lua, etc. the second string containing
the code you wish to execute. All cmd artifacts (stdout, stderr, retcode, pid)
will be returned.... | [
"def",
"exec_code_all",
"(",
"lang",
",",
"code",
",",
"cwd",
"=",
"None",
",",
"args",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"powershell",
"=",
"lang",
".",
"lower",
"(",
")",
".",
"startswith",
"(",
"\"powershell\"",
")",
"if",
"powershel... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/cmdmod.py#L3163-L3217 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/smtplib.py | python | SMTP.ehlo | (self, name='') | return (code, msg) | SMTP 'ehlo' command.
Hostname to send for this command defaults to the FQDN of the local
host. | SMTP 'ehlo' command.
Hostname to send for this command defaults to the FQDN of the local
host. | [
"SMTP",
"ehlo",
"command",
".",
"Hostname",
"to",
"send",
"for",
"this",
"command",
"defaults",
"to",
"the",
"FQDN",
"of",
"the",
"local",
"host",
"."
] | def ehlo(self, name=''):
""" SMTP 'ehlo' command.
Hostname to send for this command defaults to the FQDN of the local
host.
"""
self.esmtp_features = {}
self.putcmd(self.ehlo_msg, name or self.local_hostname)
(code, msg) = self.getreply()
# According to RF... | [
"def",
"ehlo",
"(",
"self",
",",
"name",
"=",
"''",
")",
":",
"self",
".",
"esmtp_features",
"=",
"{",
"}",
"self",
".",
"putcmd",
"(",
"self",
".",
"ehlo_msg",
",",
"name",
"or",
"self",
".",
"local_hostname",
")",
"(",
"code",
",",
"msg",
")",
... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/smtplib.py#L389-L437 | |
Pymol-Scripts/Pymol-script-repo | bcd7bb7812dc6db1595953dfa4471fa15fb68c77 | anglebetweenhelices.py | python | helix_orientation | (selection, visualize=1, sigma_cutoff=1.5, quiet=0) | return _common_orientation(selection, vec, visualize, quiet) | DESCRIPTION
Get the center and direction of a helix as vectors. Will only work
for helices and gives slightly different results than loop_orientation.
Averages direction of C(i)->O(i) bonds.
USAGE
helix_orientation selection [, visualize [, sigma_cutoff]]
ARGUMENTS
selection = string: atom sele... | DESCRIPTION | [
"DESCRIPTION"
] | def helix_orientation(selection, visualize=1, sigma_cutoff=1.5, quiet=0):
'''
DESCRIPTION
Get the center and direction of a helix as vectors. Will only work
for helices and gives slightly different results than loop_orientation.
Averages direction of C(i)->O(i) bonds.
USAGE
helix_orientation sele... | [
"def",
"helix_orientation",
"(",
"selection",
",",
"visualize",
"=",
"1",
",",
"sigma_cutoff",
"=",
"1.5",
",",
"quiet",
"=",
"0",
")",
":",
"visualize",
",",
"quiet",
",",
"sigma_cutoff",
"=",
"int",
"(",
"visualize",
")",
",",
"int",
"(",
"quiet",
")... | https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/anglebetweenhelices.py#L170-L218 | |
shuup/shuup | 25f78cfe370109b9885b903e503faac295c7b7f2 | shuup/utils/dates.py | python | try_parse_date | (value) | Tries to make a time out of the value. If impossible, returns None.
:param value: A value of some kind.
:return: Date.
:rtype: datetime.date | Tries to make a time out of the value. If impossible, returns None. | [
"Tries",
"to",
"make",
"a",
"time",
"out",
"of",
"the",
"value",
".",
"If",
"impossible",
"returns",
"None",
"."
] | def try_parse_date(value):
"""
Tries to make a time out of the value. If impossible, returns None.
:param value: A value of some kind.
:return: Date.
:rtype: datetime.date
"""
if value is None:
return None
try:
return parse_date(value)
except ValueError:
retu... | [
"def",
"try_parse_date",
"(",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"try",
":",
"return",
"parse_date",
"(",
"value",
")",
"except",
"ValueError",
":",
"return",
"None"
] | https://github.com/shuup/shuup/blob/25f78cfe370109b9885b903e503faac295c7b7f2/shuup/utils/dates.py#L197-L210 | ||
xiepaup/dbatools | 8549f2571aaee6a39f5c6f32179ac9c5d301a9aa | mysqlTools/mysql_utilities/mysql/utilities/common/user.py | python | User.__init__ | (self, server1, user, verbosity=0) | Constructor
server1[in] Server class
user[in] MySQL user credentials string (user@host:passwd)
verbose[in] print extra data during operations (optional)
default value = False | Constructor
server1[in] Server class
user[in] MySQL user credentials string (user | [
"Constructor",
"server1",
"[",
"in",
"]",
"Server",
"class",
"user",
"[",
"in",
"]",
"MySQL",
"user",
"credentials",
"string",
"(",
"user"
] | def __init__(self, server1, user, verbosity=0):
"""Constructor
server1[in] Server class
user[in] MySQL user credentials string (user@host:passwd)
verbose[in] print extra data during operations (optional)
default value = False
... | [
"def",
"__init__",
"(",
"self",
",",
"server1",
",",
"user",
",",
"verbosity",
"=",
"0",
")",
":",
"self",
".",
"server1",
"=",
"server1",
"self",
".",
"user",
",",
"self",
".",
"passwd",
",",
"self",
".",
"host",
"=",
"parse_user_host",
"(",
"user",... | https://github.com/xiepaup/dbatools/blob/8549f2571aaee6a39f5c6f32179ac9c5d301a9aa/mysqlTools/mysql_utilities/mysql/utilities/common/user.py#L57-L72 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/numbers.py | python | Integral.__long__ | (self) | long(self) | long(self) | [
"long",
"(",
"self",
")"
] | def __long__(self):
"""long(self)"""
raise NotImplementedError | [
"def",
"__long__",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/numbers.py#L301-L303 | ||
tenpy/tenpy | bbdd3dbbdb511948eb0e6ba7ff619ac6ca657fff | tenpy/algorithms/mps_common.py | python | ZeroSiteH.adjoint | (self) | return adj | Return the hermitian conjugate of `self`. | Return the hermitian conjugate of `self`. | [
"Return",
"the",
"hermitian",
"conjugate",
"of",
"self",
"."
] | def adjoint(self):
"""Return the hermitian conjugate of `self`."""
adj = copy.copy(self)
adj.LP = self.LP.conj().ireplace_label('wR*', 'wR').itranspose(self.LP.get_leg_labels())
adj.RP = self.RP.conj().ireplace_label('wL*', 'wL').itranspose(self.RP.get_leg_labels())
return adj | [
"def",
"adjoint",
"(",
"self",
")",
":",
"adj",
"=",
"copy",
".",
"copy",
"(",
"self",
")",
"adj",
".",
"LP",
"=",
"self",
".",
"LP",
".",
"conj",
"(",
")",
".",
"ireplace_label",
"(",
"'wR*'",
",",
"'wR'",
")",
".",
"itranspose",
"(",
"self",
... | https://github.com/tenpy/tenpy/blob/bbdd3dbbdb511948eb0e6ba7ff619ac6ca657fff/tenpy/algorithms/mps_common.py#L1178-L1183 | |
implus/PytorchInsight | 2864528f8b83f52c3df76f7c3804aa468b91e5cf | classification/imagenet_mobile.py | python | SoftCrossEntropyLoss.forward | (self, input, target) | return self.criterion(input, one_hot) | [] | def forward(self, input, target):
one_hot = torch.zeros_like(input)
one_hot.fill_(self.other)
one_hot.scatter_(1, target.unsqueeze(1).long(), self.confidence)
input = F.log_softmax(input, 1)
return self.criterion(input, one_hot) | [
"def",
"forward",
"(",
"self",
",",
"input",
",",
"target",
")",
":",
"one_hot",
"=",
"torch",
".",
"zeros_like",
"(",
"input",
")",
"one_hot",
".",
"fill_",
"(",
"self",
".",
"other",
")",
"one_hot",
".",
"scatter_",
"(",
"1",
",",
"target",
".",
... | https://github.com/implus/PytorchInsight/blob/2864528f8b83f52c3df76f7c3804aa468b91e5cf/classification/imagenet_mobile.py#L760-L765 | |||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/min/gettext.py | python | textdomain | (domain=None) | return _current_domain | [] | def textdomain(domain=None):
global _current_domain
if domain is not None:
_current_domain = domain
return _current_domain | [
"def",
"textdomain",
"(",
"domain",
"=",
"None",
")",
":",
"global",
"_current_domain",
"if",
"domain",
"is",
"not",
"None",
":",
"_current_domain",
"=",
"domain",
"return",
"_current_domain"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/gettext.py#L640-L644 | |||
enthought/mayavi | 2103a273568b8f0bd62328801aafbd6252543ae8 | tvtk/wrapper_gen.py | python | WrapperGenerator._find_return_type | (self, sig) | return self._find_type(rets) | Given a method signature `sig`, this finds the return
types. | Given a method signature `sig`, this finds the return
types. | [
"Given",
"a",
"method",
"signature",
"sig",
"this",
"finds",
"the",
"return",
"types",
"."
] | def _find_return_type(self, sig):
"""Given a method signature `sig`, this finds the return
types.
"""
rets = [s[0] for s in sig]
return self._find_type(rets) | [
"def",
"_find_return_type",
"(",
"self",
",",
"sig",
")",
":",
"rets",
"=",
"[",
"s",
"[",
"0",
"]",
"for",
"s",
"in",
"sig",
"]",
"return",
"self",
".",
"_find_type",
"(",
"rets",
")"
] | https://github.com/enthought/mayavi/blob/2103a273568b8f0bd62328801aafbd6252543ae8/tvtk/wrapper_gen.py#L993-L998 | |
etetoolkit/ete | 2b207357dc2a40ccad7bfd8f54964472c72e4726 | ete3/tools/ete_build_lib/scheduler.py | python | launch_detached | (cmd) | [] | def launch_detached(cmd):
pid1 = os.fork()
if pid1 == 0:
pid2 = os.fork()
if pid2 == 0:
os.setsid()
pid3 = os.fork()
if pid3 == 0:
os.chdir("/")
os.umask(0)
P = subprocess.Popen(cmd, shell=True)
... | [
"def",
"launch_detached",
"(",
"cmd",
")",
":",
"pid1",
"=",
"os",
".",
"fork",
"(",
")",
"if",
"pid1",
"==",
"0",
":",
"pid2",
"=",
"os",
".",
"fork",
"(",
")",
"if",
"pid2",
"==",
"0",
":",
"os",
".",
"setsid",
"(",
")",
"pid3",
"=",
"os",
... | https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/tools/ete_build_lib/scheduler.py#L657-L684 | ||||
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/utils/dummy_pt_objects.py | python | LayoutLMForSequenceClassification.from_pretrained | (cls, *args, **kwargs) | [] | def from_pretrained(cls, *args, **kwargs):
requires_backends(cls, ["torch"]) | [
"def",
"from_pretrained",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"requires_backends",
"(",
"cls",
",",
"[",
"\"torch\"",
"]",
")"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/utils/dummy_pt_objects.py#L2780-L2781 | ||||
mdiazcl/fuzzbunch-debian | 2b76c2249ade83a389ae3badb12a1bd09901fd2c | windows/Resources/Python/Core/Lib/distutils/ccompiler.py | python | customize_compiler | (compiler) | Do any platform-specific customization of a CCompiler instance.
Mainly needed on Unix, so we can plug in the information that
varies across Unices and is stored in Python's Makefile. | Do any platform-specific customization of a CCompiler instance.
Mainly needed on Unix, so we can plug in the information that
varies across Unices and is stored in Python's Makefile. | [
"Do",
"any",
"platform",
"-",
"specific",
"customization",
"of",
"a",
"CCompiler",
"instance",
".",
"Mainly",
"needed",
"on",
"Unix",
"so",
"we",
"can",
"plug",
"in",
"the",
"information",
"that",
"varies",
"across",
"Unices",
"and",
"is",
"stored",
"in",
... | def customize_compiler(compiler):
"""Do any platform-specific customization of a CCompiler instance.
Mainly needed on Unix, so we can plug in the information that
varies across Unices and is stored in Python's Makefile.
"""
if compiler.compiler_type == 'unix':
cc, cxx, opt, cflags, ccsh... | [
"def",
"customize_compiler",
"(",
"compiler",
")",
":",
"if",
"compiler",
".",
"compiler_type",
"==",
"'unix'",
":",
"cc",
",",
"cxx",
",",
"opt",
",",
"cflags",
",",
"ccshared",
",",
"ldshared",
",",
"so_ext",
",",
"ar",
",",
"ar_flags",
"=",
"_sysconfi... | https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/distutils/ccompiler.py#L23-L58 | ||
cloudant/bigcouch | 8e9c1ec0ed1676ff152f10658f5c83a1a91fa8fe | couchjs/scons/scons-local-2.0.1/SCons/SConf.py | python | SConfBase.TryLink | ( self, text, extension ) | return self.TryBuild(self.env.Program, text, extension ) | Compiles the program given in text to an executable env.Program,
using extension as file extension (e.g. '.c'). Returns 1, if
compilation was successful, 0 otherwise. The target is saved in
self.lastTarget (for further processing). | Compiles the program given in text to an executable env.Program,
using extension as file extension (e.g. '.c'). Returns 1, if
compilation was successful, 0 otherwise. The target is saved in
self.lastTarget (for further processing). | [
"Compiles",
"the",
"program",
"given",
"in",
"text",
"to",
"an",
"executable",
"env",
".",
"Program",
"using",
"extension",
"as",
"file",
"extension",
"(",
"e",
".",
"g",
".",
".",
"c",
")",
".",
"Returns",
"1",
"if",
"compilation",
"was",
"successful",
... | def TryLink( self, text, extension ):
"""Compiles the program given in text to an executable env.Program,
using extension as file extension (e.g. '.c'). Returns 1, if
compilation was successful, 0 otherwise. The target is saved in
self.lastTarget (for further processing).
"""
... | [
"def",
"TryLink",
"(",
"self",
",",
"text",
",",
"extension",
")",
":",
"return",
"self",
".",
"TryBuild",
"(",
"self",
".",
"env",
".",
"Program",
",",
"text",
",",
"extension",
")"
] | https://github.com/cloudant/bigcouch/blob/8e9c1ec0ed1676ff152f10658f5c83a1a91fa8fe/couchjs/scons/scons-local-2.0.1/SCons/SConf.py#L605-L611 | |
seppius-xbmc-repo/ru | d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2 | script.module.html5lib/lib/html5lib/trie/py.py | python | Trie.__getitem__ | (self, key) | return self._data[key] | [] | def __getitem__(self, key):
return self._data[key] | [
"def",
"__getitem__",
"(",
"self",
",",
"key",
")",
":",
"return",
"self",
".",
"_data",
"[",
"key",
"]"
] | https://github.com/seppius-xbmc-repo/ru/blob/d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2/script.module.html5lib/lib/html5lib/trie/py.py#L28-L29 | |||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/eb/v20210416/models.py | python | GetEventBusResponse.__init__ | (self) | r"""
:param ModTime: 更新时间
:type ModTime: str
:param Description: 事件集描述
:type Description: str
:param ClsTopicId: 日志主题ID
:type ClsTopicId: str
:param AddTime: 创建时间
:type AddTime: str
:param ClsLogsetId: 日志集ID
:type ClsLogsetId: str
:... | r"""
:param ModTime: 更新时间
:type ModTime: str
:param Description: 事件集描述
:type Description: str
:param ClsTopicId: 日志主题ID
:type ClsTopicId: str
:param AddTime: 创建时间
:type AddTime: str
:param ClsLogsetId: 日志集ID
:type ClsLogsetId: str
:... | [
"r",
":",
"param",
"ModTime",
":",
"更新时间",
":",
"type",
"ModTime",
":",
"str",
":",
"param",
"Description",
":",
"事件集描述",
":",
"type",
"Description",
":",
"str",
":",
"param",
"ClsTopicId",
":",
"日志主题ID",
":",
"type",
"ClsTopicId",
":",
"str",
":",
"pa... | def __init__(self):
r"""
:param ModTime: 更新时间
:type ModTime: str
:param Description: 事件集描述
:type Description: str
:param ClsTopicId: 日志主题ID
:type ClsTopicId: str
:param AddTime: 创建时间
:type AddTime: str
:param ClsLogsetId: 日志集ID
:typ... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"ModTime",
"=",
"None",
"self",
".",
"Description",
"=",
"None",
"self",
".",
"ClsTopicId",
"=",
"None",
"self",
".",
"AddTime",
"=",
"None",
"self",
".",
"ClsLogsetId",
"=",
"None",
"self",
".",
... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/eb/v20210416/models.py#L1064-L1093 | ||
aaronportnoy/toolbag | 2d39457a7617b2f334d203d8c8cf88a5a25ef1fa | toolbag/agent/dbg/vtrace/platforms/gdbstub.py | python | GdbStubMixin.platformGetRegCtx | (self, tid) | return ctx | Get an envi register context from the target stub. | Get an envi register context from the target stub. | [
"Get",
"an",
"envi",
"register",
"context",
"from",
"the",
"target",
"stub",
"."
] | def platformGetRegCtx(self, tid):
'''
Get an envi register context from the target stub.
'''
# FIXME tid!
regbytes = self._cmdTransact('g').decode('hex')
rvals = struct.unpack(self._arch_regfmt, regbytes[:self._arch_regsize])
ctx = self.arch.archGetRegCtx()
... | [
"def",
"platformGetRegCtx",
"(",
"self",
",",
"tid",
")",
":",
"# FIXME tid!",
"regbytes",
"=",
"self",
".",
"_cmdTransact",
"(",
"'g'",
")",
".",
"decode",
"(",
"'hex'",
")",
"rvals",
"=",
"struct",
".",
"unpack",
"(",
"self",
".",
"_arch_regfmt",
",",
... | https://github.com/aaronportnoy/toolbag/blob/2d39457a7617b2f334d203d8c8cf88a5a25ef1fa/toolbag/agent/dbg/vtrace/platforms/gdbstub.py#L575-L585 | |
apache/libcloud | 90971e17bfd7b6bb97b2489986472c531cc8e140 | libcloud/compute/drivers/gce.py | python | GCENodeDriver.ex_destroy_urlmap | (self, urlmap) | return True | Destroy a URL map.
:param urlmap: UrlMap object to destroy
:type urlmap: :class:`GCEUrlMap`
:return: True if successful
:rtype: ``bool`` | Destroy a URL map. | [
"Destroy",
"a",
"URL",
"map",
"."
] | def ex_destroy_urlmap(self, urlmap):
"""
Destroy a URL map.
:param urlmap: UrlMap object to destroy
:type urlmap: :class:`GCEUrlMap`
:return: True if successful
:rtype: ``bool``
"""
request = "/global/urlMaps/%s" % urlmap.name
self.connect... | [
"def",
"ex_destroy_urlmap",
"(",
"self",
",",
"urlmap",
")",
":",
"request",
"=",
"\"/global/urlMaps/%s\"",
"%",
"urlmap",
".",
"name",
"self",
".",
"connection",
".",
"async_request",
"(",
"request",
",",
"method",
"=",
"\"DELETE\"",
")",
"return",
"True"
] | https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/compute/drivers/gce.py#L7557-L7570 | |
bhoov/exbert | d27b6236aa51b185f7d3fed904f25cabe3baeb1a | server/transformers/src/transformers/modeling_xlnet.py | python | XLNetPreTrainedModel._init_weights | (self, module) | Initialize the weights. | Initialize the weights. | [
"Initialize",
"the",
"weights",
"."
] | def _init_weights(self, module):
""" Initialize the weights.
"""
if isinstance(module, (nn.Linear, nn.Embedding)):
# Slightly different from the TF version which uses truncated_normal for initialization
# cf https://github.com/pytorch/pytorch/pull/5617
module.... | [
"def",
"_init_weights",
"(",
"self",
",",
"module",
")",
":",
"if",
"isinstance",
"(",
"module",
",",
"(",
"nn",
".",
"Linear",
",",
"nn",
".",
"Embedding",
")",
")",
":",
"# Slightly different from the TF version which uses truncated_normal for initialization",
"# ... | https://github.com/bhoov/exbert/blob/d27b6236aa51b185f7d3fed904f25cabe3baeb1a/server/transformers/src/transformers/modeling_xlnet.py#L466-L492 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/core/expr.py | python | Expr.__lt__ | (self, other) | return C.StrictLessThan(self, other) | [] | def __lt__(self, other):
dif = self - other
if dif.is_number and dif.is_real is False:
raise TypeError("Invalid comparison of complex %s" % dif)
if dif.is_negative is not None and \
dif.is_negative is not dif.is_nonnegative:
return sympify(dif.is_negative)... | [
"def",
"__lt__",
"(",
"self",
",",
"other",
")",
":",
"dif",
"=",
"self",
"-",
"other",
"if",
"dif",
".",
"is_number",
"and",
"dif",
".",
"is_real",
"is",
"False",
":",
"raise",
"TypeError",
"(",
"\"Invalid comparison of complex %s\"",
"%",
"dif",
")",
"... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/core/expr.py#L247-L254 | |||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/categories/category_types.py | python | Elements._latex_ | (self) | return "\\mathbf{Elt}_{%s}"%latex(self.__object) | r"""
EXAMPLES::
sage: V = VectorSpace(QQ,3)
sage: x = V.0
sage: latex(x.category()) # indirect doctest
\mathbf{Elt}_{\Bold{Q}^{3}} | r"""
EXAMPLES:: | [
"r",
"EXAMPLES",
"::"
] | def _latex_(self):
r"""
EXAMPLES::
sage: V = VectorSpace(QQ,3)
sage: x = V.0
sage: latex(x.category()) # indirect doctest
\mathbf{Elt}_{\Bold{Q}^{3}}
"""
return "\\mathbf{Elt}_{%s}"%latex(self.__object) | [
"def",
"_latex_",
"(",
"self",
")",
":",
"return",
"\"\\\\mathbf{Elt}_{%s}\"",
"%",
"latex",
"(",
"self",
".",
"__object",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/categories/category_types.py#L128-L137 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/twitter/notify.py | python | get_service | (hass, config, discovery_info=None) | return TwitterNotificationService(
hass,
config[CONF_CONSUMER_KEY],
config[CONF_CONSUMER_SECRET],
config[CONF_ACCESS_TOKEN],
config[CONF_ACCESS_TOKEN_SECRET],
config.get(CONF_USERNAME),
) | Get the Twitter notification service. | Get the Twitter notification service. | [
"Get",
"the",
"Twitter",
"notification",
"service",
"."
] | def get_service(hass, config, discovery_info=None):
"""Get the Twitter notification service."""
return TwitterNotificationService(
hass,
config[CONF_CONSUMER_KEY],
config[CONF_CONSUMER_SECRET],
config[CONF_ACCESS_TOKEN],
config[CONF_ACCESS_TOKEN_SECRET],
config.ge... | [
"def",
"get_service",
"(",
"hass",
",",
"config",
",",
"discovery_info",
"=",
"None",
")",
":",
"return",
"TwitterNotificationService",
"(",
"hass",
",",
"config",
"[",
"CONF_CONSUMER_KEY",
"]",
",",
"config",
"[",
"CONF_CONSUMER_SECRET",
"]",
",",
"config",
"... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/twitter/notify.py#L41-L50 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/lib-tk/turtle.py | python | RawTurtle.setundobuffer | (self, size) | Set or disable undobuffer.
Argument:
size -- an integer or None
If size is an integer an empty undobuffer of given size is installed.
Size gives the maximum number of turtle-actions that can be undone
by the undo() function.
If size is None, no undobuffer is present.
... | Set or disable undobuffer. | [
"Set",
"or",
"disable",
"undobuffer",
"."
] | def setundobuffer(self, size):
"""Set or disable undobuffer.
Argument:
size -- an integer or None
If size is an integer an empty undobuffer of given size is installed.
Size gives the maximum number of turtle-actions that can be undone
by the undo() function.
If ... | [
"def",
"setundobuffer",
"(",
"self",
",",
"size",
")",
":",
"if",
"size",
"is",
"None",
":",
"self",
".",
"undobuffer",
"=",
"None",
"else",
":",
"self",
".",
"undobuffer",
"=",
"Tbuffer",
"(",
"size",
")"
] | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/lib-tk/turtle.py#L2488-L2505 | ||
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/pdb.py | python | Pdb.do_EOF | (self, arg) | return 1 | EOF
Handles the receipt of EOF as a command. | EOF
Handles the receipt of EOF as a command. | [
"EOF",
"Handles",
"the",
"receipt",
"of",
"EOF",
"as",
"a",
"command",
"."
] | def do_EOF(self, arg):
"""EOF
Handles the receipt of EOF as a command.
"""
self.message('')
self._user_requested_quit = True
self.set_quit()
return 1 | [
"def",
"do_EOF",
"(",
"self",
",",
"arg",
")",
":",
"self",
".",
"message",
"(",
"''",
")",
"self",
".",
"_user_requested_quit",
"=",
"True",
"self",
".",
"set_quit",
"(",
")",
"return",
"1"
] | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/pdb.py#L1124-L1131 | |
yqyao/FCOS_PLUS | 0d20ba34ccc316650d8c30febb2eb40cb6eaae37 | maskrcnn_benchmark/structures/boxlist_ops.py | python | remove_small_boxes | (boxlist, min_size) | return boxlist[keep] | Only keep boxes with both sides >= min_size
Arguments:
boxlist (Boxlist)
min_size (int) | Only keep boxes with both sides >= min_size | [
"Only",
"keep",
"boxes",
"with",
"both",
"sides",
">",
"=",
"min_size"
] | def remove_small_boxes(boxlist, min_size):
"""
Only keep boxes with both sides >= min_size
Arguments:
boxlist (Boxlist)
min_size (int)
"""
# TODO maybe add an API for querying the ws / hs
xywh_boxes = boxlist.convert("xywh").bbox
_, _, ws, hs = xywh_boxes.unbind(dim=1)
k... | [
"def",
"remove_small_boxes",
"(",
"boxlist",
",",
"min_size",
")",
":",
"# TODO maybe add an API for querying the ws / hs",
"xywh_boxes",
"=",
"boxlist",
".",
"convert",
"(",
"\"xywh\"",
")",
".",
"bbox",
"_",
",",
"_",
",",
"ws",
",",
"hs",
"=",
"xywh_boxes",
... | https://github.com/yqyao/FCOS_PLUS/blob/0d20ba34ccc316650d8c30febb2eb40cb6eaae37/maskrcnn_benchmark/structures/boxlist_ops.py#L34-L48 | |
pm4py/pm4py-core | 7807b09a088b02199cd0149d724d0e28793971bf | pm4py/evaluation/soundness/woflan/algorithm.py | python | compute_non_live_sequences | (woflan_object) | return red_paths | We want to compute the sequences of transitions which lead to deadlocks.
To do this, we first compute a reachbility graph (possible, since we know that the Petri Net is bounded) and then we
convert it to a spanning tree. Afterwards, we compute the paths which lead to nodes from which the final marking cannot
... | We want to compute the sequences of transitions which lead to deadlocks.
To do this, we first compute a reachbility graph (possible, since we know that the Petri Net is bounded) and then we
convert it to a spanning tree. Afterwards, we compute the paths which lead to nodes from which the final marking cannot
... | [
"We",
"want",
"to",
"compute",
"the",
"sequences",
"of",
"transitions",
"which",
"lead",
"to",
"deadlocks",
".",
"To",
"do",
"this",
"we",
"first",
"compute",
"a",
"reachbility",
"graph",
"(",
"possible",
"since",
"we",
"know",
"that",
"the",
"Petri",
"Net... | def compute_non_live_sequences(woflan_object):
"""
We want to compute the sequences of transitions which lead to deadlocks.
To do this, we first compute a reachbility graph (possible, since we know that the Petri Net is bounded) and then we
convert it to a spanning tree. Afterwards, we compute the paths... | [
"def",
"compute_non_live_sequences",
"(",
"woflan_object",
")",
":",
"woflan_object",
".",
"set_r_g",
"(",
"reachability_graph",
"(",
"woflan_object",
".",
"get_net",
"(",
")",
",",
"woflan_object",
".",
"get_initial_marking",
"(",
")",
")",
")",
"f_m",
"=",
"co... | https://github.com/pm4py/pm4py-core/blob/7807b09a088b02199cd0149d724d0e28793971bf/pm4py/evaluation/soundness/woflan/algorithm.py#L548-L591 | |
youfou/wxpy | ab63e12da822dc85615fa203e5be9fa28ae0b59f | wxpy/api/chats/member.py | python | Member.name | (self) | | 该群成员的友好名称
| 具体为: 从 群聊显示名称、昵称(或群名称),或微信号中,按序选取第一个可用的 | | 该群成员的友好名称
| 具体为: 从 群聊显示名称、昵称(或群名称),或微信号中,按序选取第一个可用的 | [
"|",
"该群成员的友好名称",
"|",
"具体为",
":",
"从",
"群聊显示名称、昵称",
"(",
"或群名称",
")",
",或微信号中,按序选取第一个可用的"
] | def name(self):
"""
| 该群成员的友好名称
| 具体为: 从 群聊显示名称、昵称(或群名称),或微信号中,按序选取第一个可用的
"""
for attr in 'display_name', 'nick_name', 'wxid':
_name = getattr(self, attr, None)
if _name:
return _name | [
"def",
"name",
"(",
"self",
")",
":",
"for",
"attr",
"in",
"'display_name'",
",",
"'nick_name'",
",",
"'wxid'",
":",
"_name",
"=",
"getattr",
"(",
"self",
",",
"attr",
",",
"None",
")",
"if",
"_name",
":",
"return",
"_name"
] | https://github.com/youfou/wxpy/blob/ab63e12da822dc85615fa203e5be9fa28ae0b59f/wxpy/api/chats/member.py#L40-L48 | ||
menpo/lsfm | 0a256c6c59deebc97b47398b22f419c15bcb9c39 | lsfm/io.py | python | export_settings | (r, settings, overwrite=False) | [] | def export_settings(r, settings, overwrite=False):
_save_settings_to_path(settings, path_settings(r), overwrite=overwrite) | [
"def",
"export_settings",
"(",
"r",
",",
"settings",
",",
"overwrite",
"=",
"False",
")",
":",
"_save_settings_to_path",
"(",
"settings",
",",
"path_settings",
"(",
"r",
")",
",",
"overwrite",
"=",
"overwrite",
")"
] | https://github.com/menpo/lsfm/blob/0a256c6c59deebc97b47398b22f419c15bcb9c39/lsfm/io.py#L72-L73 | ||||
jwyang/graph-rcnn.pytorch | 0f294ecb86d5f130e82ee85246b6afd5180240e5 | lib/scene_parser/rcnn/modeling/rpn/anchor_generator.py | python | _mkanchors | (ws, hs, x_ctr, y_ctr) | return anchors | Given a vector of widths (ws) and heights (hs) around a center
(x_ctr, y_ctr), output a set of anchors (windows). | Given a vector of widths (ws) and heights (hs) around a center
(x_ctr, y_ctr), output a set of anchors (windows). | [
"Given",
"a",
"vector",
"of",
"widths",
"(",
"ws",
")",
"and",
"heights",
"(",
"hs",
")",
"around",
"a",
"center",
"(",
"x_ctr",
"y_ctr",
")",
"output",
"a",
"set",
"of",
"anchors",
"(",
"windows",
")",
"."
] | def _mkanchors(ws, hs, x_ctr, y_ctr):
"""Given a vector of widths (ws) and heights (hs) around a center
(x_ctr, y_ctr), output a set of anchors (windows).
"""
ws = ws[:, np.newaxis]
hs = hs[:, np.newaxis]
anchors = np.hstack(
(
x_ctr - 0.5 * (ws - 1),
y_ctr - 0.5 ... | [
"def",
"_mkanchors",
"(",
"ws",
",",
"hs",
",",
"x_ctr",
",",
"y_ctr",
")",
":",
"ws",
"=",
"ws",
"[",
":",
",",
"np",
".",
"newaxis",
"]",
"hs",
"=",
"hs",
"[",
":",
",",
"np",
".",
"newaxis",
"]",
"anchors",
"=",
"np",
".",
"hstack",
"(",
... | https://github.com/jwyang/graph-rcnn.pytorch/blob/0f294ecb86d5f130e82ee85246b6afd5180240e5/lib/scene_parser/rcnn/modeling/rpn/anchor_generator.py#L255-L269 | |
google/macops | 8442745359c0c941cd4e4e7d243e43bd16b40dec | crankd/ApplicationUsage.py | python | ApplicationUsage.LogApplicationUsage | (self, event, bundle_id, app_version, app_path) | Log application usage.
Args:
event: str, like "launch" or "quit"
bundle_id: str
app_version: str
app_path: str | Log application usage. | [
"Log",
"application",
"usage",
"."
] | def LogApplicationUsage(self, event, bundle_id, app_version, app_path):
"""Log application usage.
Args:
event: str, like "launch" or "quit"
bundle_id: str
app_version: str
app_path: str
"""
if bundle_id is None and app_version is None and app_path is None:
return
try:... | [
"def",
"LogApplicationUsage",
"(",
"self",
",",
"event",
",",
"bundle_id",
",",
"app_version",
",",
"app_path",
")",
":",
"if",
"bundle_id",
"is",
"None",
"and",
"app_version",
"is",
"None",
"and",
"app_path",
"is",
"None",
":",
"return",
"try",
":",
"now"... | https://github.com/google/macops/blob/8442745359c0c941cd4e4e7d243e43bd16b40dec/crankd/ApplicationUsage.py#L267-L296 | ||
openstack/tempest | fe0ac89a5a1c43fa908a76759cd99eea3b1f9853 | tempest/lib/services/compute/servers_client.py | python | ServersClient.update_tag | (self, server_id, tag) | return rest_client.ResponseBody(resp, body) | Adds a single tag to the server if server has no specified tag.
For a full list of available parameters, please refer to the official
API reference:
https://docs.openstack.org/api-ref/compute/#add-a-single-tag
:param tag: Tag to be added to the specified server. | Adds a single tag to the server if server has no specified tag. | [
"Adds",
"a",
"single",
"tag",
"to",
"the",
"server",
"if",
"server",
"has",
"no",
"specified",
"tag",
"."
] | def update_tag(self, server_id, tag):
"""Adds a single tag to the server if server has no specified tag.
For a full list of available parameters, please refer to the official
API reference:
https://docs.openstack.org/api-ref/compute/#add-a-single-tag
:param tag: Tag to be added... | [
"def",
"update_tag",
"(",
"self",
",",
"server_id",
",",
"tag",
")",
":",
"url",
"=",
"'servers/%s/tags/%s'",
"%",
"(",
"server_id",
",",
"tag",
")",
"resp",
",",
"body",
"=",
"self",
".",
"put",
"(",
"url",
",",
"None",
")",
"schema",
"=",
"self",
... | https://github.com/openstack/tempest/blob/fe0ac89a5a1c43fa908a76759cd99eea3b1f9853/tempest/lib/services/compute/servers_client.py#L864-L877 | |
LuxCoreRender/BlendLuxCore | bf31ca58501d54c02acd97001b6db7de81da7cbf | nodes/textures/constfloat1.py | python | LuxCoreNodeTexConstfloat1.sub_export | (self, exporter, depsgraph, props, luxcore_name=None, output_socket=None) | return self.create_props(props, definitions, luxcore_name) | [] | def sub_export(self, exporter, depsgraph, props, luxcore_name=None, output_socket=None):
definitions = {
"type": "constfloat1",
"value": self.value,
}
return self.create_props(props, definitions, luxcore_name) | [
"def",
"sub_export",
"(",
"self",
",",
"exporter",
",",
"depsgraph",
",",
"props",
",",
"luxcore_name",
"=",
"None",
",",
"output_socket",
"=",
"None",
")",
":",
"definitions",
"=",
"{",
"\"type\"",
":",
"\"constfloat1\"",
",",
"\"value\"",
":",
"self",
".... | https://github.com/LuxCoreRender/BlendLuxCore/blob/bf31ca58501d54c02acd97001b6db7de81da7cbf/nodes/textures/constfloat1.py#L19-L25 | |||
microsoft/debugpy | be8dd607f6837244e0b565345e497aff7a0c08bf | src/debugpy/_version.py | python | get_keywords | () | return keywords | Get the keywords needed to look up the version information. | Get the keywords needed to look up the version information. | [
"Get",
"the",
"keywords",
"needed",
"to",
"look",
"up",
"the",
"version",
"information",
"."
] | def get_keywords():
"""Get the keywords needed to look up the version information."""
# these strings will be replaced by git during git-archive.
# setup.py/versioneer.py will grep for the variable names, so they must
# each be defined on a line of their own. _version.py will just call
# get_keyword... | [
"def",
"get_keywords",
"(",
")",
":",
"# these strings will be replaced by git during git-archive.",
"# setup.py/versioneer.py will grep for the variable names, so they must",
"# each be defined on a line of their own. _version.py will just call",
"# get_keywords().",
"git_refnames",
"=",
"\"$... | https://github.com/microsoft/debugpy/blob/be8dd607f6837244e0b565345e497aff7a0c08bf/src/debugpy/_version.py#L24-L34 | |
dagster-io/dagster | b27d569d5fcf1072543533a0c763815d96f90b8f | python_modules/libraries/dagster-aws/dagster_aws/emr/emr.py | python | EmrJobRunner._check_for_missing_default_iam_roles | (self, log, cluster) | If cluster couldn't start due to missing IAM roles, tell user what to do. | If cluster couldn't start due to missing IAM roles, tell user what to do. | [
"If",
"cluster",
"couldn",
"t",
"start",
"due",
"to",
"missing",
"IAM",
"roles",
"tell",
"user",
"what",
"to",
"do",
"."
] | def _check_for_missing_default_iam_roles(self, log, cluster):
"""If cluster couldn't start due to missing IAM roles, tell user what to do."""
check.dict_param(cluster, "cluster")
reason = _get_reason(cluster)
if any(
reason.endswith("/%s is invalid" % role)
for ... | [
"def",
"_check_for_missing_default_iam_roles",
"(",
"self",
",",
"log",
",",
"cluster",
")",
":",
"check",
".",
"dict_param",
"(",
"cluster",
",",
"\"cluster\"",
")",
"reason",
"=",
"_get_reason",
"(",
"cluster",
")",
"if",
"any",
"(",
"reason",
".",
"endswi... | https://github.com/dagster-io/dagster/blob/b27d569d5fcf1072543533a0c763815d96f90b8f/python_modules/libraries/dagster-aws/dagster_aws/emr/emr.py#L315-L328 | ||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/merchant_center_link_service/client.py | python | MerchantCenterLinkServiceClient.merchant_center_link_path | (
customer_id: str, merchant_center_id: str,
) | return "customers/{customer_id}/merchantCenterLinks/{merchant_center_id}".format(
customer_id=customer_id, merchant_center_id=merchant_center_id,
) | Return a fully-qualified merchant_center_link string. | Return a fully-qualified merchant_center_link string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"merchant_center_link",
"string",
"."
] | def merchant_center_link_path(
customer_id: str, merchant_center_id: str,
) -> str:
"""Return a fully-qualified merchant_center_link string."""
return "customers/{customer_id}/merchantCenterLinks/{merchant_center_id}".format(
customer_id=customer_id, merchant_center_id=merchant_c... | [
"def",
"merchant_center_link_path",
"(",
"customer_id",
":",
"str",
",",
"merchant_center_id",
":",
"str",
",",
")",
"->",
"str",
":",
"return",
"\"customers/{customer_id}/merchantCenterLinks/{merchant_center_id}\"",
".",
"format",
"(",
"customer_id",
"=",
"customer_id",
... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/merchant_center_link_service/client.py#L182-L188 | |
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/site-packages/django/contrib/comments/__init__.py | python | get_flag_url | (comment) | Get the URL for the "flag this comment" view. | Get the URL for the "flag this comment" view. | [
"Get",
"the",
"URL",
"for",
"the",
"flag",
"this",
"comment",
"view",
"."
] | def get_flag_url(comment):
"""
Get the URL for the "flag this comment" view.
"""
if get_comment_app_name() != DEFAULT_COMMENTS_APP and hasattr(get_comment_app(), "get_flag_url"):
return get_comment_app().get_flag_url(comment)
else:
return urlresolvers.reverse("django.contrib.comments... | [
"def",
"get_flag_url",
"(",
"comment",
")",
":",
"if",
"get_comment_app_name",
"(",
")",
"!=",
"DEFAULT_COMMENTS_APP",
"and",
"hasattr",
"(",
"get_comment_app",
"(",
")",
",",
"\"get_flag_url\"",
")",
":",
"return",
"get_comment_app",
"(",
")",
".",
"get_flag_ur... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/contrib/comments/__init__.py#L63-L71 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/plat-irix5/panelparser.py | python | tokenize_file | (fp) | return tokens | [] | def tokenize_file(fp):
tokens = []
while 1:
line = fp.readline()
if not line: break
tokens = tokens + tokenize_string(line)
return tokens | [
"def",
"tokenize_file",
"(",
"fp",
")",
":",
"tokens",
"=",
"[",
"]",
"while",
"1",
":",
"line",
"=",
"fp",
".",
"readline",
"(",
")",
"if",
"not",
"line",
":",
"break",
"tokens",
"=",
"tokens",
"+",
"tokenize_string",
"(",
"line",
")",
"return",
"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/plat-irix5/panelparser.py#L55-L61 | |||
hatRiot/zarp | 2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad | src/core/module.py | python | ZarpModule.log | (self, opt, log_loc=None) | Logging function for enabling or disabling
the logging of messages to a file | Logging function for enabling or disabling
the logging of messages to a file | [
"Logging",
"function",
"for",
"enabling",
"or",
"disabling",
"the",
"logging",
"of",
"messages",
"to",
"a",
"file"
] | def log(self, opt, log_loc=None):
""" Logging function for enabling or disabling
the logging of messages to a file
"""
if opt and not self.log_data:
try:
util.debug('Starting %s logger...')
self.log_file = open(log_loc, 'w+')
... | [
"def",
"log",
"(",
"self",
",",
"opt",
",",
"log_loc",
"=",
"None",
")",
":",
"if",
"opt",
"and",
"not",
"self",
".",
"log_data",
":",
"try",
":",
"util",
".",
"debug",
"(",
"'Starting %s logger...'",
")",
"self",
".",
"log_file",
"=",
"open",
"(",
... | https://github.com/hatRiot/zarp/blob/2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad/src/core/module.py#L58-L84 | ||
archesproject/arches | bdb6b3fec9eaa1289957471d5e86b4a5e7c8fa97 | arches/app/utils/data_management/resources/formats/shpfile.py | python | ShpWriter.sort_by_geometry_type | (self, instances, geometry_field) | return features_by_geom_type | Sorts flattend resource instances by their geometry type (multipoint=4, multipolyline==5, multipolygon==6).
If an instance has more than one geometry type, it is assigned to the respective geometry type once
for each of its geometries. | Sorts flattend resource instances by their geometry type (multipoint=4, multipolyline==5, multipolygon==6).
If an instance has more than one geometry type, it is assigned to the respective geometry type once
for each of its geometries. | [
"Sorts",
"flattend",
"resource",
"instances",
"by",
"their",
"geometry",
"type",
"(",
"multipoint",
"=",
"4",
"multipolyline",
"==",
"5",
"multipolygon",
"==",
"6",
")",
".",
"If",
"an",
"instance",
"has",
"more",
"than",
"one",
"geometry",
"type",
"it",
"... | def sort_by_geometry_type(self, instances, geometry_field):
"""
Sorts flattend resource instances by their geometry type (multipoint=4, multipolyline==5, multipolygon==6).
If an instance has more than one geometry type, it is assigned to the respective geometry type once
for each of its ... | [
"def",
"sort_by_geometry_type",
"(",
"self",
",",
"instances",
",",
"geometry_field",
")",
":",
"features_by_geom_type",
"=",
"{",
"\"point\"",
":",
"[",
"]",
",",
"\"line\"",
":",
"[",
"]",
",",
"\"poly\"",
":",
"[",
"]",
"}",
"for",
"instance",
"in",
"... | https://github.com/archesproject/arches/blob/bdb6b3fec9eaa1289957471d5e86b4a5e7c8fa97/arches/app/utils/data_management/resources/formats/shpfile.py#L80-L101 | |
stanford-futuredata/noscope | 6c6aa72e09280530dfdcf87871c1ac43df3b6cc3 | example/noscope_accuracy.py | python | strip_comment_lines | (lines) | return lines | [] | def strip_comment_lines(lines):
lines = map(lambda x: x.split('#')[0], lines)
lines = filter(lambda x: x != '', lines)
return lines | [
"def",
"strip_comment_lines",
"(",
"lines",
")",
":",
"lines",
"=",
"map",
"(",
"lambda",
"x",
":",
"x",
".",
"split",
"(",
"'#'",
")",
"[",
"0",
"]",
",",
"lines",
")",
"lines",
"=",
"filter",
"(",
"lambda",
"x",
":",
"x",
"!=",
"''",
",",
"li... | https://github.com/stanford-futuredata/noscope/blob/6c6aa72e09280530dfdcf87871c1ac43df3b6cc3/example/noscope_accuracy.py#L21-L24 | |||
NoxArt/SublimeText2-FTPSync | 5893073bf081a0c7d51dff26fac77f2163d8d71f | lib3/ftplib.py | python | FTP.voidcmd | (self, cmd) | return self.voidresp() | Send a command and expect a response beginning with '2'. | Send a command and expect a response beginning with '2'. | [
"Send",
"a",
"command",
"and",
"expect",
"a",
"response",
"beginning",
"with",
"2",
"."
] | def voidcmd(self, cmd):
"""Send a command and expect a response beginning with '2'."""
self.putcmd(cmd)
return self.voidresp() | [
"def",
"voidcmd",
"(",
"self",
",",
"cmd",
")",
":",
"self",
".",
"putcmd",
"(",
"cmd",
")",
"return",
"self",
".",
"voidresp",
"(",
")"
] | https://github.com/NoxArt/SublimeText2-FTPSync/blob/5893073bf081a0c7d51dff26fac77f2163d8d71f/lib3/ftplib.py#L271-L274 | |
santhoshkolloju/Abstractive-Summarization-With-Transfer-Learning | 97ff2ae3ba9f2d478e174444c4e0f5349f28c319 | texar_repo/texar/module_base.py | python | ModuleBase.variable_scope | (self) | return self._template.variable_scope | The variable scope of the module. | The variable scope of the module. | [
"The",
"variable",
"scope",
"of",
"the",
"module",
"."
] | def variable_scope(self):
"""The variable scope of the module.
"""
return self._template.variable_scope | [
"def",
"variable_scope",
"(",
"self",
")",
":",
"return",
"self",
".",
"_template",
".",
"variable_scope"
] | https://github.com/santhoshkolloju/Abstractive-Summarization-With-Transfer-Learning/blob/97ff2ae3ba9f2d478e174444c4e0f5349f28c319/texar_repo/texar/module_base.py#L150-L153 | |
mesonbuild/meson | a22d0f9a0a787df70ce79b05d0c45de90a970048 | mesonbuild/backend/ninjabackend.py | python | NinjaBackend.add_build_comment | (self, comment) | [] | def add_build_comment(self, comment):
self.build_elements.append(comment) | [
"def",
"add_build_comment",
"(",
"self",
",",
"comment",
")",
":",
"self",
".",
"build_elements",
".",
"append",
"(",
"comment",
")"
] | https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/backend/ninjabackend.py#L1192-L1193 | ||||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/core_v1_endpoint_port.py | python | CoreV1EndpointPort.port | (self, port) | Sets the port of this CoreV1EndpointPort.
The port number of the endpoint. # noqa: E501
:param port: The port of this CoreV1EndpointPort. # noqa: E501
:type: int | Sets the port of this CoreV1EndpointPort. | [
"Sets",
"the",
"port",
"of",
"this",
"CoreV1EndpointPort",
"."
] | def port(self, port):
"""Sets the port of this CoreV1EndpointPort.
The port number of the endpoint. # noqa: E501
:param port: The port of this CoreV1EndpointPort. # noqa: E501
:type: int
"""
if self.local_vars_configuration.client_side_validation and port is None: # ... | [
"def",
"port",
"(",
"self",
",",
"port",
")",
":",
"if",
"self",
".",
"local_vars_configuration",
".",
"client_side_validation",
"and",
"port",
"is",
"None",
":",
"# noqa: E501",
"raise",
"ValueError",
"(",
"\"Invalid value for `port`, must not be `None`\"",
")",
"#... | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/core_v1_endpoint_port.py#L127-L138 | ||
ctxis/canape | 5f0e03424577296bcc60c2008a60a98ec5307e4b | CANAPE.Scripting/Lib/mailbox.py | python | Mailbox.flush | (self) | Write any pending changes to the disk. | Write any pending changes to the disk. | [
"Write",
"any",
"pending",
"changes",
"to",
"the",
"disk",
"."
] | def flush(self):
"""Write any pending changes to the disk."""
raise NotImplementedError('Method must be implemented by subclass') | [
"def",
"flush",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"'Method must be implemented by subclass'",
")"
] | https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/mailbox.py#L184-L186 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/encodings/cp737.py | python | IncrementalEncoder.encode | (self, input, final=False) | return codecs.charmap_encode(input,self.errors,encoding_map)[0] | [] | def encode(self, input, final=False):
return codecs.charmap_encode(input,self.errors,encoding_map)[0] | [
"def",
"encode",
"(",
"self",
",",
"input",
",",
"final",
"=",
"False",
")",
":",
"return",
"codecs",
".",
"charmap_encode",
"(",
"input",
",",
"self",
".",
"errors",
",",
"encoding_map",
")",
"[",
"0",
"]"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/encodings/cp737.py#L18-L19 | |||
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/dev/bdf_vectorized/bdf.py | python | BDF._process_card | (self, card_lines) | return card | Converts card_lines into a card.
Considers dynamic syntax and removes empty fields
Parameters
----------
card_lines : List[str]
list of strings that represent the card's lines
Returns
-------
fields : list[str]
the parsed card's fields
... | Converts card_lines into a card.
Considers dynamic syntax and removes empty fields | [
"Converts",
"card_lines",
"into",
"a",
"card",
".",
"Considers",
"dynamic",
"syntax",
"and",
"removes",
"empty",
"fields"
] | def _process_card(self, card_lines):
"""
Converts card_lines into a card.
Considers dynamic syntax and removes empty fields
Parameters
----------
card_lines : List[str]
list of strings that represent the card's lines
Returns
-------
f... | [
"def",
"_process_card",
"(",
"self",
",",
"card_lines",
")",
":",
"card_name",
"=",
"self",
".",
"_get_card_name",
"(",
"card_lines",
")",
"fields",
"=",
"to_fields",
"(",
"card_lines",
",",
"card_name",
")",
"if",
"self",
".",
"_is_dynamic_syntax",
":",
"fi... | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/dev/bdf_vectorized/bdf.py#L1392-L1427 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/multiprocessing/shared_memory.py | python | ShareableList.__init__ | (self, sequence=None, *, name=None) | [] | def __init__(self, sequence=None, *, name=None):
if name is None or sequence is not None:
sequence = sequence or ()
_formats = [
self._types_mapping[type(item)]
if not isinstance(item, (str, bytes))
else self._types_mapping[type(ite... | [
"def",
"__init__",
"(",
"self",
",",
"sequence",
"=",
"None",
",",
"*",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
"or",
"sequence",
"is",
"not",
"None",
":",
"sequence",
"=",
"sequence",
"or",
"(",
")",
"_formats",
"=",
"[",
... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/multiprocessing/shared_memory.py#L296-L367 | ||||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/bdb.py | python | Bdb.set_next | (self, frame) | Stop on the next line in or below the given frame. | Stop on the next line in or below the given frame. | [
"Stop",
"on",
"the",
"next",
"line",
"in",
"or",
"below",
"the",
"given",
"frame",
"."
] | def set_next(self, frame):
"""Stop on the next line in or below the given frame."""
self._set_stopinfo(frame, None) | [
"def",
"set_next",
"(",
"self",
",",
"frame",
")",
":",
"self",
".",
"_set_stopinfo",
"(",
"frame",
",",
"None",
")"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/bdb.py#L205-L207 | ||
lepture/authlib | 2284f751a47474da7d127303e0d8f34d9046c310 | authlib/oauth1/rfc5849/parameters.py | python | prepare_form_encoded_body | (oauth_params, body) | return url_encode(_append_params(oauth_params, body)) | Prepare the Form-Encoded Body.
Per `section 3.5.2`_ of the spec.
.. _`section 3.5.2`: https://tools.ietf.org/html/rfc5849#section-3.5.2 | Prepare the Form-Encoded Body. | [
"Prepare",
"the",
"Form",
"-",
"Encoded",
"Body",
"."
] | def prepare_form_encoded_body(oauth_params, body):
"""Prepare the Form-Encoded Body.
Per `section 3.5.2`_ of the spec.
.. _`section 3.5.2`: https://tools.ietf.org/html/rfc5849#section-3.5.2
"""
# append OAuth params to the existing body
return url_encode(_append_params(oauth_params, body)) | [
"def",
"prepare_form_encoded_body",
"(",
"oauth_params",
",",
"body",
")",
":",
"# append OAuth params to the existing body",
"return",
"url_encode",
"(",
"_append_params",
"(",
"oauth_params",
",",
"body",
")",
")"
] | https://github.com/lepture/authlib/blob/2284f751a47474da7d127303e0d8f34d9046c310/authlib/oauth1/rfc5849/parameters.py#L79-L88 | |
scipy/scipy | e0a749f01e79046642ccfdc419edbf9e7ca141ad | scipy/interpolate/_rbfinterp_pythran.py | python | _build_system | (y, d, smoothing, kernel, epsilon, powers) | return lhs, rhs, shift, scale | Build the system used to solve for the RBF interpolant coefficients.
Parameters
----------
y : (P, N) float ndarray
Data point coordinates.
d : (P, S) float ndarray
Data values at `y`.
smoothing : (P,) float ndarray
Smoothing parameter for each data point.
kernel : str
... | Build the system used to solve for the RBF interpolant coefficients. | [
"Build",
"the",
"system",
"used",
"to",
"solve",
"for",
"the",
"RBF",
"interpolant",
"coefficients",
"."
] | def _build_system(y, d, smoothing, kernel, epsilon, powers):
"""Build the system used to solve for the RBF interpolant coefficients.
Parameters
----------
y : (P, N) float ndarray
Data point coordinates.
d : (P, S) float ndarray
Data values at `y`.
smoothing : (P,) float ndarray... | [
"def",
"_build_system",
"(",
"y",
",",
"d",
",",
"smoothing",
",",
"kernel",
",",
"epsilon",
",",
"powers",
")",
":",
"p",
"=",
"d",
".",
"shape",
"[",
"0",
"]",
"s",
"=",
"d",
".",
"shape",
"[",
"1",
"]",
"r",
"=",
"powers",
".",
"shape",
"[... | https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/interpolate/_rbfinterp_pythran.py#L101-L164 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/garages_amsterdam/sensor.py | python | GaragesamsterdamSensor.__init__ | (
self, coordinator: DataUpdateCoordinator, garage_name: str, info_type: str
) | Initialize garages amsterdam sensor. | Initialize garages amsterdam sensor. | [
"Initialize",
"garages",
"amsterdam",
"sensor",
"."
] | def __init__(
self, coordinator: DataUpdateCoordinator, garage_name: str, info_type: str
) -> None:
"""Initialize garages amsterdam sensor."""
super().__init__(coordinator)
self._attr_unique_id = f"{garage_name}-{info_type}"
self._garage_name = garage_name
self._info_... | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
":",
"DataUpdateCoordinator",
",",
"garage_name",
":",
"str",
",",
"info_type",
":",
"str",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"_attr_unique_... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/garages_amsterdam/sensor.py#L51-L60 | ||
ashleysommer/sanic-cors | a8d4fb1f0c616c37318d1849816ecce3b315aed2 | examples/blueprints_based_example.py | python | create_user | (request) | return json({"success": True}) | Since the path matches the regular expression r'/api/*', this resource
automatically has CORS headers set.
Browsers will first make a preflight request to verify that the resource
allows cross-origin POSTs with a JSON Content-Type, which can be simulated
as:
$ curl --include -X ... | Since the path matches the regular expression r'/api/*', this resource
automatically has CORS headers set. | [
"Since",
"the",
"path",
"matches",
"the",
"regular",
"expression",
"r",
"/",
"api",
"/",
"*",
"this",
"resource",
"automatically",
"has",
"CORS",
"headers",
"set",
"."
] | def create_user(request):
'''
Since the path matches the regular expression r'/api/*', this resource
automatically has CORS headers set.
Browsers will first make a preflight request to verify that the resource
allows cross-origin POSTs with a JSON Content-Type, which can be simulate... | [
"def",
"create_user",
"(",
"request",
")",
":",
"return",
"json",
"(",
"{",
"\"success\"",
":",
"True",
"}",
")"
] | https://github.com/ashleysommer/sanic-cors/blob/a8d4fb1f0c616c37318d1849816ecce3b315aed2/examples/blueprints_based_example.py#L53-L93 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/fixtures/models.py | python | FixtureDataItem.by_field_value | (cls, domain, data_type, field_name, field_value) | return cls.view('fixtures/data_items_by_field_value', key=[domain, data_type_id, field_name, field_value],
reduce=False, include_docs=True) | [] | def by_field_value(cls, domain, data_type, field_name, field_value):
data_type_id = _id_from_doc(data_type)
return cls.view('fixtures/data_items_by_field_value', key=[domain, data_type_id, field_name, field_value],
reduce=False, include_docs=True) | [
"def",
"by_field_value",
"(",
"cls",
",",
"domain",
",",
"data_type",
",",
"field_name",
",",
"field_value",
")",
":",
"data_type_id",
"=",
"_id_from_doc",
"(",
"data_type",
")",
"return",
"cls",
".",
"view",
"(",
"'fixtures/data_items_by_field_value'",
",",
"ke... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/fixtures/models.py#L423-L426 | |||
fossasia/x-mario-center | fe67afe28d995dcf4e2498e305825a4859566172 | build/lib.linux-i686-2.7/softwarecenter/backend/reviews/rnr.py | python | ReviewLoaderSpawningRNRClient._server_has_histogram | (self, piston_review_stats) | return True | check response from server to see if histogram is supported | check response from server to see if histogram is supported | [
"check",
"response",
"from",
"server",
"to",
"see",
"if",
"histogram",
"is",
"supported"
] | def _server_has_histogram(self, piston_review_stats):
'''check response from server to see if histogram is supported'''
supported = getattr(piston_review_stats[0], "histogram", False)
if not supported:
return False
return True | [
"def",
"_server_has_histogram",
"(",
"self",
",",
"piston_review_stats",
")",
":",
"supported",
"=",
"getattr",
"(",
"piston_review_stats",
"[",
"0",
"]",
",",
"\"histogram\"",
",",
"False",
")",
"if",
"not",
"supported",
":",
"return",
"False",
"return",
"Tru... | https://github.com/fossasia/x-mario-center/blob/fe67afe28d995dcf4e2498e305825a4859566172/build/lib.linux-i686-2.7/softwarecenter/backend/reviews/rnr.py#L185-L190 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/sympy/geometry/point.py | python | Point2D.x | (self) | return self.args[0] | Returns the X coordinate of the Point.
Examples
========
>>> from sympy import Point2D
>>> p = Point2D(0, 1)
>>> p.x
0 | Returns the X coordinate of the Point. | [
"Returns",
"the",
"X",
"coordinate",
"of",
"the",
"Point",
"."
] | def x(self):
"""
Returns the X coordinate of the Point.
Examples
========
>>> from sympy import Point2D
>>> p = Point2D(0, 1)
>>> p.x
0
"""
return self.args[0] | [
"def",
"x",
"(",
"self",
")",
":",
"return",
"self",
".",
"args",
"[",
"0",
"]"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/geometry/point.py#L1033-L1045 | |
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/supertooltip.py | python | SuperToolTip.SetMiddleGradientColour | (self, colour) | Sets the middle gradient colour for :class:`SuperToolTip`.
:param `colour`: the colour to use as middle colour, a valid :class:`wx.Colour` object. | Sets the middle gradient colour for :class:`SuperToolTip`. | [
"Sets",
"the",
"middle",
"gradient",
"colour",
"for",
":",
"class",
":",
"SuperToolTip",
"."
] | def SetMiddleGradientColour(self, colour):
"""
Sets the middle gradient colour for :class:`SuperToolTip`.
:param `colour`: the colour to use as middle colour, a valid :class:`wx.Colour` object.
"""
self._middleColour = colour
if self._superToolTip:
self._sup... | [
"def",
"SetMiddleGradientColour",
"(",
"self",
",",
"colour",
")",
":",
"self",
".",
"_middleColour",
"=",
"colour",
"if",
"self",
".",
"_superToolTip",
":",
"self",
".",
"_superToolTip",
".",
"Refresh",
"(",
")"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/supertooltip.py#L1192-L1201 | ||
Jenyay/outwiker | 50530cf7b3f71480bb075b2829bc0669773b835b | plugins/webpage/webpage/libs/soupsieve/css_parser.py | python | SpecialPseudoPattern.match | (self, selector, index) | return pseudo | Match the selector. | Match the selector. | [
"Match",
"the",
"selector",
"."
] | def match(self, selector, index):
"""Match the selector."""
pseudo = None
m = self.re_pseudo_name.match(selector, index)
if m:
name = util.lower(css_unescape(m.group('name')))
pattern = self.patterns.get(name)
if pattern:
pseudo = patt... | [
"def",
"match",
"(",
"self",
",",
"selector",
",",
"index",
")",
":",
"pseudo",
"=",
"None",
"m",
"=",
"self",
".",
"re_pseudo_name",
".",
"match",
"(",
"selector",
",",
"index",
")",
"if",
"m",
":",
"name",
"=",
"util",
".",
"lower",
"(",
"css_une... | https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/plugins/webpage/webpage/libs/soupsieve/css_parser.py#L340-L353 | |
deluge-torrent/deluge | 2316088f5c0dd6cb044d9d4832fa7d56dcc79cdc | deluge/ui/gtk3/sidebar.py | python | SideBar.remove_tab | (self, tab_name) | Removes a tab by name. | Removes a tab by name. | [
"Removes",
"a",
"tab",
"by",
"name",
"."
] | def remove_tab(self, tab_name):
"""Removes a tab by name."""
self.notebook.remove_page(self.notebook.page_num(self.tabs[tab_name]))
del self.tabs[tab_name]
self.after_update() | [
"def",
"remove_tab",
"(",
"self",
",",
"tab_name",
")",
":",
"self",
".",
"notebook",
".",
"remove_page",
"(",
"self",
".",
"notebook",
".",
"page_num",
"(",
"self",
".",
"tabs",
"[",
"tab_name",
"]",
")",
")",
"del",
"self",
".",
"tabs",
"[",
"tab_n... | https://github.com/deluge-torrent/deluge/blob/2316088f5c0dd6cb044d9d4832fa7d56dcc79cdc/deluge/ui/gtk3/sidebar.py#L54-L59 | ||
pyqt/examples | 843bb982917cecb2350b5f6d7f42c9b7fb142ec1 | src/pyqt-official/widgets/groupbox.py | python | Window.createSecondExclusiveGroup | (self) | return groupBox | [] | def createSecondExclusiveGroup(self):
groupBox = QGroupBox("E&xclusive Radio Buttons")
groupBox.setCheckable(True)
groupBox.setChecked(False)
radio1 = QRadioButton("Rad&io button 1")
radio2 = QRadioButton("Radi&o button 2")
radio3 = QRadioButton("Radio &button 3")
... | [
"def",
"createSecondExclusiveGroup",
"(",
"self",
")",
":",
"groupBox",
"=",
"QGroupBox",
"(",
"\"E&xclusive Radio Buttons\"",
")",
"groupBox",
".",
"setCheckable",
"(",
"True",
")",
"groupBox",
".",
"setChecked",
"(",
"False",
")",
"radio1",
"=",
"QRadioButton",
... | https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/widgets/groupbox.py#L82-L102 | |||
paulc/dnslib | 729a655b069303de089a9ca3904378b15dd17ff1 | dnslib/ranges.py | python | I | (attr) | return range_property(attr,0,4294967295) | Unsigned Long | Unsigned Long | [
"Unsigned",
"Long"
] | def I(attr):
"""
Unsigned Long
"""
return range_property(attr,0,4294967295) | [
"def",
"I",
"(",
"attr",
")",
":",
"return",
"range_property",
"(",
"attr",
",",
"0",
",",
"4294967295",
")"
] | https://github.com/paulc/dnslib/blob/729a655b069303de089a9ca3904378b15dd17ff1/dnslib/ranges.py#L111-L115 | |
mlflow/mlflow | 364aca7daf0fcee3ec407ae0b1b16d9cb3085081 | mlflow/utils/autologging_utils/__init__.py | python | disable_autologging | () | Context manager that temporarily disables autologging globally for all integrations upon
entry and restores the previous autologging configuration upon exit. | Context manager that temporarily disables autologging globally for all integrations upon
entry and restores the previous autologging configuration upon exit. | [
"Context",
"manager",
"that",
"temporarily",
"disables",
"autologging",
"globally",
"for",
"all",
"integrations",
"upon",
"entry",
"and",
"restores",
"the",
"previous",
"autologging",
"configuration",
"upon",
"exit",
"."
] | def disable_autologging():
"""
Context manager that temporarily disables autologging globally for all integrations upon
entry and restores the previous autologging configuration upon exit.
"""
global _AUTOLOGGING_GLOBALLY_DISABLED
_AUTOLOGGING_GLOBALLY_DISABLED = True
yield None
_AUTOLOG... | [
"def",
"disable_autologging",
"(",
")",
":",
"global",
"_AUTOLOGGING_GLOBALLY_DISABLED",
"_AUTOLOGGING_GLOBALLY_DISABLED",
"=",
"True",
"yield",
"None",
"_AUTOLOGGING_GLOBALLY_DISABLED",
"=",
"False"
] | https://github.com/mlflow/mlflow/blob/364aca7daf0fcee3ec407ae0b1b16d9cb3085081/mlflow/utils/autologging_utils/__init__.py#L464-L472 | ||
igraph/python-igraph | e9f83e8af08f24ea025596e745917197d8b44d94 | src/igraph/__init__.py | python | Graph.write | (self, f, format=None, *args, **kwds) | return writer(f, *args, **kwds) | Unified writing function for graphs.
This method tries to identify the format of the graph given in
the first parameter (based on extension) and calls the corresponding
writer method.
The remaining arguments are passed to the writer method without
any changes.
@param f... | Unified writing function for graphs. | [
"Unified",
"writing",
"function",
"for",
"graphs",
"."
] | def write(self, f, format=None, *args, **kwds):
"""Unified writing function for graphs.
This method tries to identify the format of the graph given in
the first parameter (based on extension) and calls the corresponding
writer method.
The remaining arguments are passed to the w... | [
"def",
"write",
"(",
"self",
",",
"f",
",",
"format",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"if",
"isinstance",
"(",
"f",
",",
"os",
".",
"PathLike",
")",
":",
"f",
"=",
"str",
"(",
"f",
")",
"if",
"format",
"is",
... | https://github.com/igraph/python-igraph/blob/e9f83e8af08f24ea025596e745917197d8b44d94/src/igraph/__init__.py#L2933-L2988 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/idlelib/rpc.py | python | RemoteProxy.__init__ | (self, oid) | [] | def __init__(self, oid):
self.oid = oid | [
"def",
"__init__",
"(",
"self",
",",
"oid",
")",
":",
"self",
".",
"oid",
"=",
"oid"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/idlelib/rpc.py#L502-L503 | ||||
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | python | DistInfoDistribution._parsed_pkg_info | (self) | Parse and cache metadata | Parse and cache metadata | [
"Parse",
"and",
"cache",
"metadata"
] | def _parsed_pkg_info(self):
"""Parse and cache metadata"""
try:
return self._pkg_info
except AttributeError:
metadata = self.get_metadata(self.PKG_INFO)
self._pkg_info = email.parser.Parser().parsestr(metadata)
return self._pkg_info | [
"def",
"_parsed_pkg_info",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_pkg_info",
"except",
"AttributeError",
":",
"metadata",
"=",
"self",
".",
"get_metadata",
"(",
"self",
".",
"PKG_INFO",
")",
"self",
".",
"_pkg_info",
"=",
"email",
".",... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L3009-L3016 | ||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/keyword_plan_idea_service/client.py | python | KeywordPlanIdeaServiceClient.from_service_account_file | (cls, filename: str, *args, **kwargs) | return cls(*args, **kwargs) | Creates an instance of this client using the provided credentials
file.
Args:
filename (str): The path to the service account private key json
file.
args: Additional arguments to pass to the constructor.
kwargs: Additional arguments to pass to the con... | Creates an instance of this client using the provided credentials
file. | [
"Creates",
"an",
"instance",
"of",
"this",
"client",
"using",
"the",
"provided",
"credentials",
"file",
"."
] | def from_service_account_file(cls, filename: str, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
file.
Args:
filename (str): The path to the service account private key json
file.
args: Additional arguments to pass ... | [
"def",
"from_service_account_file",
"(",
"cls",
",",
"filename",
":",
"str",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"credentials",
"=",
"service_account",
".",
"Credentials",
".",
"from_service_account_file",
"(",
"filename",
")",
"kwargs",
"[",
... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/keyword_plan_idea_service/client.py#L136-L153 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/ma/extras.py | python | vander | (x, n=None) | return _vander | Masked values in the input array result in rows of zeros. | Masked values in the input array result in rows of zeros. | [
"Masked",
"values",
"in",
"the",
"input",
"array",
"result",
"in",
"rows",
"of",
"zeros",
"."
] | def vander(x, n=None):
"""
Masked values in the input array result in rows of zeros.
"""
_vander = np.vander(x, n)
m = getmask(x)
if m is not nomask:
_vander[m] = 0
return _vander | [
"def",
"vander",
"(",
"x",
",",
"n",
"=",
"None",
")",
":",
"_vander",
"=",
"np",
".",
"vander",
"(",
"x",
",",
"n",
")",
"m",
"=",
"getmask",
"(",
"x",
")",
"if",
"m",
"is",
"not",
"nomask",
":",
"_vander",
"[",
"m",
"]",
"=",
"0",
"return... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/ma/extras.py#L1841-L1849 | |
runawayhorse001/LearningApacheSpark | 67f3879dce17553195f094f5728b94a01badcf24 | pyspark/mllib/random.py | python | RandomRDDs.gammaVectorRDD | (sc, shape, scale, numRows, numCols, numPartitions=None, seed=None) | return callMLlibFunc("gammaVectorRDD", sc._jsc, float(shape), float(scale),
numRows, numCols, numPartitions, seed) | Generates an RDD comprised of vectors containing i.i.d. samples drawn
from the Gamma distribution.
:param sc: SparkContext used to create the RDD.
:param shape: Shape (> 0) of the Gamma distribution
:param scale: Scale (> 0) of the Gamma distribution
:param numRows: Number of Ve... | Generates an RDD comprised of vectors containing i.i.d. samples drawn
from the Gamma distribution. | [
"Generates",
"an",
"RDD",
"comprised",
"of",
"vectors",
"containing",
"i",
".",
"i",
".",
"d",
".",
"samples",
"drawn",
"from",
"the",
"Gamma",
"distribution",
"."
] | def gammaVectorRDD(sc, shape, scale, numRows, numCols, numPartitions=None, seed=None):
"""
Generates an RDD comprised of vectors containing i.i.d. samples drawn
from the Gamma distribution.
:param sc: SparkContext used to create the RDD.
:param shape: Shape (> 0) of the Gamma di... | [
"def",
"gammaVectorRDD",
"(",
"sc",
",",
"shape",
",",
"scale",
",",
"numRows",
",",
"numCols",
",",
"numPartitions",
"=",
"None",
",",
"seed",
"=",
"None",
")",
":",
"return",
"callMLlibFunc",
"(",
"\"gammaVectorRDD\"",
",",
"sc",
".",
"_jsc",
",",
"flo... | https://github.com/runawayhorse001/LearningApacheSpark/blob/67f3879dce17553195f094f5728b94a01badcf24/pyspark/mllib/random.py#L379-L408 | |
Cadene/tensorflow-model-zoo.torch | 990b10ffc22d4c8eacb2a502f20415b4f70c74c2 | models/research/adversarial_text/layers.py | python | predictions | (logits) | Class prediction from logits. | Class prediction from logits. | [
"Class",
"prediction",
"from",
"logits",
"."
] | def predictions(logits):
"""Class prediction from logits."""
inner_dim = logits.get_shape().as_list()[-1]
with tf.name_scope('predictions'):
# For binary classification
if inner_dim == 1:
pred = tf.cast(tf.greater(tf.squeeze(logits), 0.5), tf.int64)
# For multi-class classification
else:
... | [
"def",
"predictions",
"(",
"logits",
")",
":",
"inner_dim",
"=",
"logits",
".",
"get_shape",
"(",
")",
".",
"as_list",
"(",
")",
"[",
"-",
"1",
"]",
"with",
"tf",
".",
"name_scope",
"(",
"'predictions'",
")",
":",
"# For binary classification",
"if",
"in... | https://github.com/Cadene/tensorflow-model-zoo.torch/blob/990b10ffc22d4c8eacb2a502f20415b4f70c74c2/models/research/adversarial_text/layers.py#L250-L260 | ||
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/scipy/signal/ltisys.py | python | lti.to_discrete | (self, dt, method='zoh', alpha=None) | Return a discretized version of the current system.
Parameters: See `cont2discrete` for details.
Returns
-------
sys: instance of `dlti` | Return a discretized version of the current system. | [
"Return",
"a",
"discretized",
"version",
"of",
"the",
"current",
"system",
"."
] | def to_discrete(self, dt, method='zoh', alpha=None):
"""Return a discretized version of the current system.
Parameters: See `cont2discrete` for details.
Returns
-------
sys: instance of `dlti`
"""
raise NotImplementedError('to_discrete is not implemented for thi... | [
"def",
"to_discrete",
"(",
"self",
",",
"dt",
",",
"method",
"=",
"'zoh'",
",",
"alpha",
"=",
"None",
")",
":",
"raise",
"NotImplementedError",
"(",
"'to_discrete is not implemented for this '",
"'system class.'",
")"
] | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/scipy/signal/ltisys.py#L455-L465 | ||
renatahodovan/fuzzinator | 017264c683b4ecf23f56f30a1b9c0f891b4251a1 | fuzzinator/ui/tui/table.py | python | TableRowsListWalker.next_position | (self, position) | return index | [] | def next_position(self, position):
index = position + 1
if position >= len(self.rows):
raise IndexError
return index | [
"def",
"next_position",
"(",
"self",
",",
"position",
")",
":",
"index",
"=",
"position",
"+",
"1",
"if",
"position",
">=",
"len",
"(",
"self",
".",
"rows",
")",
":",
"raise",
"IndexError",
"return",
"index"
] | https://github.com/renatahodovan/fuzzinator/blob/017264c683b4ecf23f56f30a1b9c0f891b4251a1/fuzzinator/ui/tui/table.py#L53-L57 | |||
ambujraj/hacktoberfest2018 | 53df2cac8b3404261131a873352ec4f2ffa3544d | MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/chardet/chardistribution.py | python | CharDistributionAnalysis.feed | (self, char, char_len) | feed a character with known length | feed a character with known length | [
"feed",
"a",
"character",
"with",
"known",
"length"
] | def feed(self, char, char_len):
"""feed a character with known length"""
if char_len == 2:
# we only care about 2-bytes character in our distribution analysis
order = self.get_order(char)
else:
order = -1
if order >= 0:
self._total_chars +=... | [
"def",
"feed",
"(",
"self",
",",
"char",
",",
"char_len",
")",
":",
"if",
"char_len",
"==",
"2",
":",
"# we only care about 2-bytes character in our distribution analysis",
"order",
"=",
"self",
".",
"get_order",
"(",
"char",
")",
"else",
":",
"order",
"=",
"-... | https://github.com/ambujraj/hacktoberfest2018/blob/53df2cac8b3404261131a873352ec4f2ffa3544d/MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/chardet/chardistribution.py#L70-L82 | ||
benedekrozemberczki/karateclub | 8588463906dc792785f951d287c66c2f070bda46 | karateclub/node_embedding/attributed/musae.py | python | MUSAE.fit | (self, graph: nx.classes.graph.Graph, X: Union[np.array, coo_matrix]) | Fitting a MUSAE model.
Arg types:
* **graph** *(NetworkX graph)* - The graph to be embedded.
* **X** *(Scipy COO array)* - The binary matrix of node features. | Fitting a MUSAE model. | [
"Fitting",
"a",
"MUSAE",
"model",
"."
] | def fit(self, graph: nx.classes.graph.Graph, X: Union[np.array, coo_matrix]):
"""
Fitting a MUSAE model.
Arg types:
* **graph** *(NetworkX graph)* - The graph to be embedded.
* **X** *(Scipy COO array)* - The binary matrix of node features.
"""
self._set_... | [
"def",
"fit",
"(",
"self",
",",
"graph",
":",
"nx",
".",
"classes",
".",
"graph",
".",
"Graph",
",",
"X",
":",
"Union",
"[",
"np",
".",
"array",
",",
"coo_matrix",
"]",
")",
":",
"self",
".",
"_set_seed",
"(",
")",
"graph",
"=",
"self",
".",
"_... | https://github.com/benedekrozemberczki/karateclub/blob/8588463906dc792785f951d287c66c2f070bda46/karateclub/node_embedding/attributed/musae.py#L122-L138 | ||
KhronosGroup/NNEF-Tools | c913758ca687dab8cb7b49e8f1556819a2d0ca25 | nnef_tools/io/tf/lite/flatbuffers/Model.py | python | ModelAddBuffers | (builder, buffers) | [] | def ModelAddBuffers(builder, buffers): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(buffers), 0) | [
"def",
"ModelAddBuffers",
"(",
"builder",
",",
"buffers",
")",
":",
"builder",
".",
"PrependUOffsetTRelativeSlot",
"(",
"4",
",",
"flatbuffers",
".",
"number_types",
".",
"UOffsetTFlags",
".",
"py_type",
"(",
"buffers",
")",
",",
"0",
")"
] | https://github.com/KhronosGroup/NNEF-Tools/blob/c913758ca687dab8cb7b49e8f1556819a2d0ca25/nnef_tools/io/tf/lite/flatbuffers/Model.py#L175-L175 | ||||
trezor/trezor-firmware | 5c4703c9bbfb962fbbe409c2e40030f30161e4f0 | core/src/apps/monero/xmr/serialize/int_serialize.py | python | dump_uint_b_into | (n, width, buffer, offset=0) | return buffer | Serializes fixed size integer to the buffer | Serializes fixed size integer to the buffer | [
"Serializes",
"fixed",
"size",
"integer",
"to",
"the",
"buffer"
] | def dump_uint_b_into(n, width, buffer, offset=0):
"""
Serializes fixed size integer to the buffer
"""
for idx in range(width):
buffer[idx + offset] = n & 0xFF
n >>= 8
return buffer | [
"def",
"dump_uint_b_into",
"(",
"n",
",",
"width",
",",
"buffer",
",",
"offset",
"=",
"0",
")",
":",
"for",
"idx",
"in",
"range",
"(",
"width",
")",
":",
"buffer",
"[",
"idx",
"+",
"offset",
"]",
"=",
"n",
"&",
"0xFF",
"n",
">>=",
"8",
"return",
... | https://github.com/trezor/trezor-firmware/blob/5c4703c9bbfb962fbbe409c2e40030f30161e4f0/core/src/apps/monero/xmr/serialize/int_serialize.py#L77-L84 | |
CJWorkbench/cjworkbench | e0b878d8ff819817fa049a4126efcbfcec0b50e6 | cjwstate/importmodule.py | python | _hexsha1 | (path: Path) | return sha1.hexdigest() | Generate a hex sha1 digest from the file at `path`. | Generate a hex sha1 digest from the file at `path`. | [
"Generate",
"a",
"hex",
"sha1",
"digest",
"from",
"the",
"file",
"at",
"path",
"."
] | def _hexsha1(path: Path) -> str:
"""Generate a hex sha1 digest from the file at `path`."""
BLOCK_SIZE = 128 * 1024 # 128kb, chosen at random
sha1 = hashlib.sha1()
with path.open("rb") as f:
while True:
block = f.read(BLOCK_SIZE)
if not block:
break
... | [
"def",
"_hexsha1",
"(",
"path",
":",
"Path",
")",
"->",
"str",
":",
"BLOCK_SIZE",
"=",
"128",
"*",
"1024",
"# 128kb, chosen at random",
"sha1",
"=",
"hashlib",
".",
"sha1",
"(",
")",
"with",
"path",
".",
"open",
"(",
"\"rb\"",
")",
"as",
"f",
":",
"w... | https://github.com/CJWorkbench/cjworkbench/blob/e0b878d8ff819817fa049a4126efcbfcec0b50e6/cjwstate/importmodule.py#L226-L236 | |
matrix-org/synapse | 8e57584a5859a9002759963eb546d523d2498a01 | synapse/storage/databases/main/events_worker.py | python | EventsWorkerStore._enqueue_events | (self, events: Collection[str]) | return row_map | Fetches events from the database using the _event_fetch_list. This
allows batch and bulk fetching of events - it allows us to fetch events
without having to create a new transaction for each request for events.
Args:
events: events to be fetched.
Returns:
A map ... | Fetches events from the database using the _event_fetch_list. This
allows batch and bulk fetching of events - it allows us to fetch events
without having to create a new transaction for each request for events. | [
"Fetches",
"events",
"from",
"the",
"database",
"using",
"the",
"_event_fetch_list",
".",
"This",
"allows",
"batch",
"and",
"bulk",
"fetching",
"of",
"events",
"-",
"it",
"allows",
"us",
"to",
"fetch",
"events",
"without",
"having",
"to",
"create",
"a",
"new... | async def _enqueue_events(self, events: Collection[str]) -> Dict[str, _EventRow]:
"""Fetches events from the database using the _event_fetch_list. This
allows batch and bulk fetching of events - it allows us to fetch events
without having to create a new transaction for each request for events.
... | [
"async",
"def",
"_enqueue_events",
"(",
"self",
",",
"events",
":",
"Collection",
"[",
"str",
"]",
")",
"->",
"Dict",
"[",
"str",
",",
"_EventRow",
"]",
":",
"events_d",
":",
"\"defer.Deferred[Dict[str, _EventRow]]\"",
"=",
"defer",
".",
"Deferred",
"(",
")"... | https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/storage/databases/main/events_worker.py#L1085-L1110 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/whoosh/sorting.py | python | FacetMap.as_dict | (self) | Returns a dictionary object mapping group names to
implementation-specific values. For example, the value might be a list
of document numbers, or a integer representing the number of documents
in the group. | Returns a dictionary object mapping group names to
implementation-specific values. For example, the value might be a list
of document numbers, or a integer representing the number of documents
in the group. | [
"Returns",
"a",
"dictionary",
"object",
"mapping",
"group",
"names",
"to",
"implementation",
"-",
"specific",
"values",
".",
"For",
"example",
"the",
"value",
"might",
"be",
"a",
"list",
"of",
"document",
"numbers",
"or",
"a",
"integer",
"representing",
"the",... | def as_dict(self):
"""Returns a dictionary object mapping group names to
implementation-specific values. For example, the value might be a list
of document numbers, or a integer representing the number of documents
in the group.
"""
raise NotImplementedError | [
"def",
"as_dict",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/sorting.py#L982-L989 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/polys/densebasic.py | python | dup_random | (n, a, b, K) | return f | Return a polynomial of degree ``n`` with coefficients in ``[a, b]``.
Examples
========
>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_random
>>> dup_random(3, -10, 10, ZZ) #doctest: +SKIP
[-2, -8, 9, -4] | Return a polynomial of degree ``n`` with coefficients in ``[a, b]``. | [
"Return",
"a",
"polynomial",
"of",
"degree",
"n",
"with",
"coefficients",
"in",
"[",
"a",
"b",
"]",
"."
] | def dup_random(n, a, b, K):
"""
Return a polynomial of degree ``n`` with coefficients in ``[a, b]``.
Examples
========
>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_random
>>> dup_random(3, -10, 10, ZZ) #doctest: +SKIP
[-2, -8, 9, -4]
"""
f... | [
"def",
"dup_random",
"(",
"n",
",",
"a",
",",
"b",
",",
"K",
")",
":",
"f",
"=",
"[",
"K",
".",
"convert",
"(",
"random",
".",
"randint",
"(",
"a",
",",
"b",
")",
")",
"for",
"_",
"in",
"xrange",
"(",
"0",
",",
"n",
"+",
"1",
")",
"]",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/polys/densebasic.py#L1865-L1884 | |
ClusterHQ/flocker | eaa586248986d7cd681c99c948546c2b507e44de | flocker/control/_model.py | python | ip_to_uuid | (ip) | return UUID(bytes=md5(ip.encode("utf-8")).digest()) | Deterministically convert IP to UUID.
This is intended for interim use and backwards compatibility for
existing tests. It should not be hit in production code paths.
:param unicode ip: An IP.
:return UUID: Matching UUID. | Deterministically convert IP to UUID. | [
"Deterministically",
"convert",
"IP",
"to",
"UUID",
"."
] | def ip_to_uuid(ip):
"""
Deterministically convert IP to UUID.
This is intended for interim use and backwards compatibility for
existing tests. It should not be hit in production code paths.
:param unicode ip: An IP.
:return UUID: Matching UUID.
"""
return UUID(bytes=md5(ip.encode("utf... | [
"def",
"ip_to_uuid",
"(",
"ip",
")",
":",
"return",
"UUID",
"(",
"bytes",
"=",
"md5",
"(",
"ip",
".",
"encode",
"(",
"\"utf-8\"",
")",
")",
".",
"digest",
"(",
")",
")"
] | https://github.com/ClusterHQ/flocker/blob/eaa586248986d7cd681c99c948546c2b507e44de/flocker/control/_model.py#L970-L981 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/antlr3/antlr3/recognizers.py | python | BaseRecognizer.recoverFromMismatchedToken | (self, input, ttype, follow) | Attempt to recover from a single missing or extra token.
EXTRA TOKEN
LA(1) is not what we are looking for. If LA(2) has the right token,
however, then assume LA(1) is some extra spurious token. Delete it
and LA(2) as if we were doing a normal match(), which advances the
input... | Attempt to recover from a single missing or extra token. | [
"Attempt",
"to",
"recover",
"from",
"a",
"single",
"missing",
"or",
"extra",
"token",
"."
] | def recoverFromMismatchedToken(self, input, ttype, follow):
"""Attempt to recover from a single missing or extra token.
EXTRA TOKEN
LA(1) is not what we are looking for. If LA(2) has the right token,
however, then assume LA(1) is some extra spurious token. Delete it
and LA(2)... | [
"def",
"recoverFromMismatchedToken",
"(",
"self",
",",
"input",
",",
"ttype",
",",
"follow",
")",
":",
"e",
"=",
"None",
"# if next token is what we are looking for then \"delete\" this token",
"if",
"self",
".",
"mismatchIsUnwantedToken",
"(",
"input",
",",
"ttype",
... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/antlr3/antlr3/recognizers.py#L710-L772 | ||
weechat/scripts | 99ec0e7eceefabb9efb0f11ec26d45d6e8e84335 | python/screen_away.py | python | get_servers | () | return buffers | Get the servers that are not away, or were set away by this script. | Get the servers that are not away, or were set away by this script. | [
"Get",
"the",
"servers",
"that",
"are",
"not",
"away",
"or",
"were",
"set",
"away",
"by",
"this",
"script",
"."
] | def get_servers():
'''Get the servers that are not away, or were set away by this script.'''
ignores = w.config_get_plugin('ignore').split(',')
infolist = w.infolist_get('irc_server', '', '')
buffers = []
while w.infolist_next(infolist):
if (not w.infolist_integer(infolist, 'is_connected') =... | [
"def",
"get_servers",
"(",
")",
":",
"ignores",
"=",
"w",
".",
"config_get_plugin",
"(",
"'ignore'",
")",
".",
"split",
"(",
"','",
")",
"infolist",
"=",
"w",
".",
"infolist_get",
"(",
"'irc_server'",
",",
"''",
",",
"''",
")",
"buffers",
"=",
"[",
"... | https://github.com/weechat/scripts/blob/99ec0e7eceefabb9efb0f11ec26d45d6e8e84335/python/screen_away.py#L133-L149 | |
harvardnlp/neural-template-gen | dff72ca246e80fd0eef2ca0b8b1fbf21fe927df4 | data/utils.py | python | get_e2e_poswrds | (tokes) | return fields | assumes a key only appears once per line...
returns (key, num) -> word | assumes a key only appears once per line...
returns (key, num) -> word | [
"assumes",
"a",
"key",
"only",
"appears",
"once",
"per",
"line",
"...",
"returns",
"(",
"key",
"num",
")",
"-",
">",
"word"
] | def get_e2e_poswrds(tokes):
"""
assumes a key only appears once per line...
returns (key, num) -> word
"""
fields = {}
state, num = None, 1 # 1-idx the numbering
for toke in tokes:
if "__start" in toke:
assert state is None
state = toke[7:-2]
elif "__e... | [
"def",
"get_e2e_poswrds",
"(",
"tokes",
")",
":",
"fields",
"=",
"{",
"}",
"state",
",",
"num",
"=",
"None",
",",
"1",
"# 1-idx the numbering",
"for",
"toke",
"in",
"tokes",
":",
"if",
"\"__start\"",
"in",
"toke",
":",
"assert",
"state",
"is",
"None",
... | https://github.com/harvardnlp/neural-template-gen/blob/dff72ca246e80fd0eef2ca0b8b1fbf21fe927df4/data/utils.py#L32-L48 | |
fortharris/Pcode | 147962d160a834c219e12cb456abc130826468e4 | rope/refactor/occurrences.py | python | CallsFilter.__call__ | (self, occurrence) | [] | def __call__(self, occurrence):
if not occurrence.is_called():
return False | [
"def",
"__call__",
"(",
"self",
",",
"occurrence",
")",
":",
"if",
"not",
"occurrence",
".",
"is_called",
"(",
")",
":",
"return",
"False"
] | https://github.com/fortharris/Pcode/blob/147962d160a834c219e12cb456abc130826468e4/rope/refactor/occurrences.py#L224-L226 | ||||
lightforever/mlcomp | c78fdb77ec9c4ec8ff11beea50b90cab20903ad9 | mlcomp/contrib/segmentation/deeplabv3/backbone/drn.py | python | Bottleneck.forward | (self, x) | return out | [] | def forward(self, x):
residual = x
out = self.conv1(x)
out = self.bn1(out)
out = self.relu(out)
out = self.conv2(out)
out = self.bn2(out)
out = self.relu(out)
out = self.conv3(out)
out = self.bn3(out)
if self.downsample is not None:
... | [
"def",
"forward",
"(",
"self",
",",
"x",
")",
":",
"residual",
"=",
"x",
"out",
"=",
"self",
".",
"conv1",
"(",
"x",
")",
"out",
"=",
"self",
".",
"bn1",
"(",
"out",
")",
"out",
"=",
"self",
".",
"relu",
"(",
"out",
")",
"out",
"=",
"self",
... | https://github.com/lightforever/mlcomp/blob/c78fdb77ec9c4ec8ff11beea50b90cab20903ad9/mlcomp/contrib/segmentation/deeplabv3/backbone/drn.py#L78-L98 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.