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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | thirdparty_libs/dns/message.py | python | make_query | (qname, rdtype, rdclass = dns.rdataclass.IN, use_edns=None,
want_dnssec=False, ednsflags=0, payload=1280,
request_payload=None, options=None) | return m | Make a query message.
The query name, type, and class may all be specified either
as objects of the appropriate type, or as strings.
The query will have a randomly choosen query id, and its DNS flags
will be set to dns.flags.RD.
@param qname: The query name.
@type qname: dns.name.Name object ... | Make a query message. | [
"Make",
"a",
"query",
"message",
"."
] | def make_query(qname, rdtype, rdclass = dns.rdataclass.IN, use_edns=None,
want_dnssec=False, ednsflags=0, payload=1280,
request_payload=None, options=None):
"""Make a query message.
The query name, type, and class may all be specified either
as objects of the appropriate type,... | [
"def",
"make_query",
"(",
"qname",
",",
"rdtype",
",",
"rdclass",
"=",
"dns",
".",
"rdataclass",
".",
"IN",
",",
"use_edns",
"=",
"None",
",",
"want_dnssec",
"=",
"False",
",",
"ednsflags",
"=",
"0",
",",
"payload",
"=",
"1280",
",",
"request_payload",
... | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/dns/message.py#L1024-L1072 | |
aiidateam/aiida-core | c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2 | aiida/orm/implementation/django/groups.py | python | DjangoGroup.__init__ | (self, backend, label, user, description='', type_string='') | Construct a new Django group | Construct a new Django group | [
"Construct",
"a",
"new",
"Django",
"group"
] | def __init__(self, backend, label, user, description='', type_string=''):
"""Construct a new Django group"""
type_check(user, users.DjangoUser)
super().__init__(backend)
self._dbmodel = utils.ModelWrapper(
models.DbGroup(label=label, description=description, user=user.dbmode... | [
"def",
"__init__",
"(",
"self",
",",
"backend",
",",
"label",
",",
"user",
",",
"description",
"=",
"''",
",",
"type_string",
"=",
"''",
")",
":",
"type_check",
"(",
"user",
",",
"users",
".",
"DjangoUser",
")",
"super",
"(",
")",
".",
"__init__",
"(... | https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/orm/implementation/django/groups.py#L30-L37 | ||
1012598167/flask_mongodb_game | 60c7e0351586656ec38f851592886338e50b4110 | python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/manifest.py | python | Manifest._glob_to_re | (self, pattern) | return pattern_re | Translate a shell-like glob pattern to a regular expression.
Return a string containing the regex. Differs from
'fnmatch.translate()' in that '*' does not match "special characters"
(which are platform-specific). | Translate a shell-like glob pattern to a regular expression. | [
"Translate",
"a",
"shell",
"-",
"like",
"glob",
"pattern",
"to",
"a",
"regular",
"expression",
"."
] | def _glob_to_re(self, pattern):
"""Translate a shell-like glob pattern to a regular expression.
Return a string containing the regex. Differs from
'fnmatch.translate()' in that '*' does not match "special characters"
(which are platform-specific).
"""
pattern_re = fnmat... | [
"def",
"_glob_to_re",
"(",
"self",
",",
"pattern",
")",
":",
"pattern_re",
"=",
"fnmatch",
".",
"translate",
"(",
"pattern",
")",
"# '?' and '*' in the glob pattern become '.' and '.*' in the RE, which",
"# IMHO is wrong -- '?' and '*' aren't supposed to match slash in Unix,",
"#... | https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/manifest.py#L372-L393 | |
picoCTF/picoCTF | ec33d05208b51b56760d8f72f4971ea70712bc3b | picoCTF-shell/hacksport/problem.py | python | Compiled.compiler_setup | (self) | Setup function for compiled challenges | Setup function for compiled challenges | [
"Setup",
"function",
"for",
"compiled",
"challenges"
] | def compiler_setup(self):
"""
Setup function for compiled challenges
"""
if self.program_name is None:
raise Exception("Must specify program_name for compiled challenge.")
if self.makefile is not None:
execute(["make", "-f", self.makefile])
elif ... | [
"def",
"compiler_setup",
"(",
"self",
")",
":",
"if",
"self",
".",
"program_name",
"is",
"None",
":",
"raise",
"Exception",
"(",
"\"Must specify program_name for compiled challenge.\"",
")",
"if",
"self",
".",
"makefile",
"is",
"not",
"None",
":",
"execute",
"("... | https://github.com/picoCTF/picoCTF/blob/ec33d05208b51b56760d8f72f4971ea70712bc3b/picoCTF-shell/hacksport/problem.py#L176-L193 | ||
SheffieldML/GPy | bb1bc5088671f9316bc92a46d356734e34c2d5c0 | GPy/util/warping_functions.py | python | IdentityFunction.fgrad_y | (self, y) | return np.ones(y.shape) | [] | def fgrad_y(self, y):
return np.ones(y.shape) | [
"def",
"fgrad_y",
"(",
"self",
",",
"y",
")",
":",
"return",
"np",
".",
"ones",
"(",
"y",
".",
"shape",
")"
] | https://github.com/SheffieldML/GPy/blob/bb1bc5088671f9316bc92a46d356734e34c2d5c0/GPy/util/warping_functions.py#L219-L220 | |||
ceph/teuthology | 6fc2011361437a9dfe4e45b50de224392eed8abc | teuthology/suite/util.py | python | teuthology_schedule | (args, verbose, dry_run, log_prefix='') | Run teuthology-schedule to schedule individual jobs.
If --dry-run has been passed but --verbose has been passed just once, don't
actually run the command - only print what would be executed.
If --dry-run has been passed and --verbose has been passed multiple times,
do both. | Run teuthology-schedule to schedule individual jobs. | [
"Run",
"teuthology",
"-",
"schedule",
"to",
"schedule",
"individual",
"jobs",
"."
] | def teuthology_schedule(args, verbose, dry_run, log_prefix=''):
"""
Run teuthology-schedule to schedule individual jobs.
If --dry-run has been passed but --verbose has been passed just once, don't
actually run the command - only print what would be executed.
If --dry-run has been passed and --verb... | [
"def",
"teuthology_schedule",
"(",
"args",
",",
"verbose",
",",
"dry_run",
",",
"log_prefix",
"=",
"''",
")",
":",
"exec_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"sys",
".",
"argv",
"[",
"0",
"]",
")"... | https://github.com/ceph/teuthology/blob/6fc2011361437a9dfe4e45b50de224392eed8abc/teuthology/suite/util.py#L431-L459 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/curses/ascii.py | python | isupper | (c) | return 65 <= _ctoi(c) <= 90 | [] | def isupper(c): return 65 <= _ctoi(c) <= 90 | [
"def",
"isupper",
"(",
"c",
")",
":",
"return",
"65",
"<=",
"_ctoi",
"(",
"c",
")",
"<=",
"90"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/curses/ascii.py#L65-L65 | |||
tanghaibao/jcvi | 5e720870c0928996f8b77a38208106ff0447ccb6 | jcvi/utils/range.py | python | range_overlap | (a, b, ratio=False) | return ov | Returns whether two ranges overlap. Set percentage=True returns overlap
ratio over the shorter range of the two.
>>> range_overlap(("1", 30, 45), ("1", 41, 55))
5
>>> range_overlap(("1", 21, 45), ("1", 41, 75), ratio=True)
0.2
>>> range_overlap(("1", 30, 45), ("1", 15, 55))
16
>>> range... | Returns whether two ranges overlap. Set percentage=True returns overlap
ratio over the shorter range of the two. | [
"Returns",
"whether",
"two",
"ranges",
"overlap",
".",
"Set",
"percentage",
"=",
"True",
"returns",
"overlap",
"ratio",
"over",
"the",
"shorter",
"range",
"of",
"the",
"two",
"."
] | def range_overlap(a, b, ratio=False):
"""
Returns whether two ranges overlap. Set percentage=True returns overlap
ratio over the shorter range of the two.
>>> range_overlap(("1", 30, 45), ("1", 41, 55))
5
>>> range_overlap(("1", 21, 45), ("1", 41, 75), ratio=True)
0.2
>>> range_overlap(... | [
"def",
"range_overlap",
"(",
"a",
",",
"b",
",",
"ratio",
"=",
"False",
")",
":",
"a_chr",
",",
"a_min",
",",
"a_max",
"=",
"a",
"b_chr",
",",
"b_min",
",",
"b_max",
"=",
"b",
"a_min",
",",
"a_max",
"=",
"sorted",
"(",
"(",
"a_min",
",",
"a_max",... | https://github.com/tanghaibao/jcvi/blob/5e720870c0928996f8b77a38208106ff0447ccb6/jcvi/utils/range.py#L79-L112 | |
Azure/azure-linux-extensions | a42ef718c746abab2b3c6a21da87b29e76364558 | OmsAgent/omsagent.py | python | install | () | return exit_code, output | Ensure that this VM distro and version are supported.
Install the OMSAgent shell bundle, using retries.
Note: install operation times out from WAAgent at 15 minutes, so do not
wait longer. | Ensure that this VM distro and version are supported.
Install the OMSAgent shell bundle, using retries.
Note: install operation times out from WAAgent at 15 minutes, so do not
wait longer. | [
"Ensure",
"that",
"this",
"VM",
"distro",
"and",
"version",
"are",
"supported",
".",
"Install",
"the",
"OMSAgent",
"shell",
"bundle",
"using",
"retries",
".",
"Note",
":",
"install",
"operation",
"times",
"out",
"from",
"WAAgent",
"at",
"15",
"minutes",
"so"... | def install():
"""
Ensure that this VM distro and version are supported.
Install the OMSAgent shell bundle, using retries.
Note: install operation times out from WAAgent at 15 minutes, so do not
wait longer.
"""
exit_if_vm_not_supported('Install')
public_settings, protected_settings = g... | [
"def",
"install",
"(",
")",
":",
"exit_if_vm_not_supported",
"(",
"'Install'",
")",
"public_settings",
",",
"protected_settings",
"=",
"get_settings",
"(",
")",
"if",
"public_settings",
"is",
"None",
":",
"raise",
"ParameterMissingException",
"(",
"'Public configurati... | https://github.com/Azure/azure-linux-extensions/blob/a42ef718c746abab2b3c6a21da87b29e76364558/OmsAgent/omsagent.py#L445-L483 | |
OpenCobolIDE/OpenCobolIDE | c78d0d335378e5fe0a5e74f53c19b68b55e85388 | open_cobol_ide/view/dialogs/preferences.py | python | DlgPreferences._add_rel_lib_path | (self) | [] | def _add_rel_lib_path(self):
path, status = QtWidgets.QInputDialog.getText(
self, 'Add relative library path', 'Path:')
if status:
self.listWidgetLibPaths.addItem(system.normpath(path)) | [
"def",
"_add_rel_lib_path",
"(",
"self",
")",
":",
"path",
",",
"status",
"=",
"QtWidgets",
".",
"QInputDialog",
".",
"getText",
"(",
"self",
",",
"'Add relative library path'",
",",
"'Path:'",
")",
"if",
"status",
":",
"self",
".",
"listWidgetLibPaths",
".",
... | https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/view/dialogs/preferences.py#L196-L200 | ||||
marcosfede/algorithms | 1ee7c815f9d556c9cef4d4b0d21ee3a409d21629 | graph/tarjan.py | python | DirectedEdge.__eq__ | (self, obj) | return False | [] | def __eq__(self, obj):
if isinstance(obj, DirectedEdge):
return obj.nf == self.nf and obj.nt == self.nt
return False | [
"def",
"__eq__",
"(",
"self",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"DirectedEdge",
")",
":",
"return",
"obj",
".",
"nf",
"==",
"self",
".",
"nf",
"and",
"obj",
".",
"nt",
"==",
"self",
".",
"nt",
"return",
"False"
] | https://github.com/marcosfede/algorithms/blob/1ee7c815f9d556c9cef4d4b0d21ee3a409d21629/graph/tarjan.py#L31-L34 | |||
Dentosal/python-sc2 | e816cce83772d1aee1291b86b300b69405aa96b4 | sc2/bot_ai.py | python | BotAI.can_afford | (self, item_id: Union[UnitTypeId, UpgradeId, AbilityId], check_supply_cost: bool=True) | return CanAffordWrapper(cost.minerals <= self.minerals, cost.vespene <= self.vespene, enough_supply) | Tests if the player has enough resources to build a unit or cast an ability. | Tests if the player has enough resources to build a unit or cast an ability. | [
"Tests",
"if",
"the",
"player",
"has",
"enough",
"resources",
"to",
"build",
"a",
"unit",
"or",
"cast",
"an",
"ability",
"."
] | def can_afford(self, item_id: Union[UnitTypeId, UpgradeId, AbilityId], check_supply_cost: bool=True) -> "CanAffordWrapper":
"""Tests if the player has enough resources to build a unit or cast an ability."""
enough_supply = True
if isinstance(item_id, UnitTypeId):
unit = self._game_da... | [
"def",
"can_afford",
"(",
"self",
",",
"item_id",
":",
"Union",
"[",
"UnitTypeId",
",",
"UpgradeId",
",",
"AbilityId",
"]",
",",
"check_supply_cost",
":",
"bool",
"=",
"True",
")",
"->",
"\"CanAffordWrapper\"",
":",
"enough_supply",
"=",
"True",
"if",
"isins... | https://github.com/Dentosal/python-sc2/blob/e816cce83772d1aee1291b86b300b69405aa96b4/sc2/bot_ai.py#L263-L276 | |
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/plugins/attack/db/sqlmap/lib/core/common.py | python | safeExpandUser | (filepath) | return retVal | Patch for a Python Issue18171 (http://bugs.python.org/issue18171) | Patch for a Python Issue18171 (http://bugs.python.org/issue18171) | [
"Patch",
"for",
"a",
"Python",
"Issue18171",
"(",
"http",
":",
"//",
"bugs",
".",
"python",
".",
"org",
"/",
"issue18171",
")"
] | def safeExpandUser(filepath):
"""
Patch for a Python Issue18171 (http://bugs.python.org/issue18171)
"""
retVal = filepath
try:
retVal = os.path.expanduser(filepath)
except UnicodeError:
_ = locale.getdefaultlocale()
encoding = _[1] if _ and len(_) > 1 else UNICODE_ENCOD... | [
"def",
"safeExpandUser",
"(",
"filepath",
")",
":",
"retVal",
"=",
"filepath",
"try",
":",
"retVal",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"filepath",
")",
"except",
"UnicodeError",
":",
"_",
"=",
"locale",
".",
"getdefaultlocale",
"(",
")",
"e... | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/db/sqlmap/lib/core/common.py#L1742-L1756 | |
iiau-tracker/SPLT | a196e603798e9be969d9d985c087c11cad1cda43 | lib/object_detection/core/preprocessor.py | python | _apply_with_random_selector_tuples | (x, func, num_cases) | return tuple(tuples) | Computes func(x, sel), with sel sampled from [0...num_cases-1].
Args:
x: A tuple of input tensors.
func: Python function to apply.
num_cases: Python int32, number of cases to sample sel from.
Returns:
The result of func(x, sel), where func receives the value of the
selector as a python integer... | Computes func(x, sel), with sel sampled from [0...num_cases-1]. | [
"Computes",
"func",
"(",
"x",
"sel",
")",
"with",
"sel",
"sampled",
"from",
"[",
"0",
"...",
"num_cases",
"-",
"1",
"]",
"."
] | def _apply_with_random_selector_tuples(x, func, num_cases):
"""Computes func(x, sel), with sel sampled from [0...num_cases-1].
Args:
x: A tuple of input tensors.
func: Python function to apply.
num_cases: Python int32, number of cases to sample sel from.
Returns:
The result of func(x, sel), wher... | [
"def",
"_apply_with_random_selector_tuples",
"(",
"x",
",",
"func",
",",
"num_cases",
")",
":",
"num_inputs",
"=",
"len",
"(",
"x",
")",
"rand_sel",
"=",
"tf",
".",
"random_uniform",
"(",
"[",
"]",
",",
"maxval",
"=",
"num_cases",
",",
"dtype",
"=",
"tf"... | https://github.com/iiau-tracker/SPLT/blob/a196e603798e9be969d9d985c087c11cad1cda43/lib/object_detection/core/preprocessor.py#L76-L101 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/sympy/polys/polyclasses.py | python | DMP.integrate | (f, m=1, j=0) | return f.per(dmp_integrate_in(f.rep, m, j, f.lev, f.dom)) | Computes the ``m``-th order indefinite integral of ``f`` in ``x_j``. | Computes the ``m``-th order indefinite integral of ``f`` in ``x_j``. | [
"Computes",
"the",
"m",
"-",
"th",
"order",
"indefinite",
"integral",
"of",
"f",
"in",
"x_j",
"."
] | def integrate(f, m=1, j=0):
"""Computes the ``m``-th order indefinite integral of ``f`` in ``x_j``. """
if not isinstance(m, int):
raise TypeError("``int`` expected, got %s" % type(m))
if not isinstance(j, int):
raise TypeError("``int`` expected, got %s" % type(j))
... | [
"def",
"integrate",
"(",
"f",
",",
"m",
"=",
"1",
",",
"j",
"=",
"0",
")",
":",
"if",
"not",
"isinstance",
"(",
"m",
",",
"int",
")",
":",
"raise",
"TypeError",
"(",
"\"``int`` expected, got %s\"",
"%",
"type",
"(",
"m",
")",
")",
"if",
"not",
"i... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/polys/polyclasses.py#L592-L600 | |
elbayadm/attn2d | 982653439dedc7306e484e00b3dfb90e2cd7c9e1 | fairseq/data/concat_dataset.py | python | ConcatDataset.size | (self, idx: int) | return self.datasets[dataset_idx].size(sample_idx) | Return an example's size as a float or tuple. | Return an example's size as a float or tuple. | [
"Return",
"an",
"example",
"s",
"size",
"as",
"a",
"float",
"or",
"tuple",
"."
] | def size(self, idx: int):
"""
Return an example's size as a float or tuple.
"""
dataset_idx, sample_idx = self._get_dataset_and_sample_index(idx)
return self.datasets[dataset_idx].size(sample_idx) | [
"def",
"size",
"(",
"self",
",",
"idx",
":",
"int",
")",
":",
"dataset_idx",
",",
"sample_idx",
"=",
"self",
".",
"_get_dataset_and_sample_index",
"(",
"idx",
")",
"return",
"self",
".",
"datasets",
"[",
"dataset_idx",
"]",
".",
"size",
"(",
"sample_idx",
... | https://github.com/elbayadm/attn2d/blob/982653439dedc7306e484e00b3dfb90e2cd7c9e1/fairseq/data/concat_dataset.py#L57-L62 | |
dictation-toolbox/dragonfly | a2b8f8e8ed1182465b831205b9804323beea112a | dragonfly/engines/backend_kaldi/audio.py | python | AudioStore.finalize | (self, text, grammar_name, rule_name, likelihood=None, tag='', has_dictation=None) | Finalizes current utterance, creating its AudioStoreEntry and saving it (if enabled). | Finalizes current utterance, creating its AudioStoreEntry and saving it (if enabled). | [
"Finalizes",
"current",
"utterance",
"creating",
"its",
"AudioStoreEntry",
"and",
"saving",
"it",
"(",
"if",
"enabled",
")",
"."
] | def finalize(self, text, grammar_name, rule_name, likelihood=None, tag='', has_dictation=None):
""" Finalizes current utterance, creating its AudioStoreEntry and saving it (if enabled). """
entry = AudioStoreEntry(self.current_audio_data, grammar_name, rule_name, text, likelihood, tag, has_dictation)
... | [
"def",
"finalize",
"(",
"self",
",",
"text",
",",
"grammar_name",
",",
"rule_name",
",",
"likelihood",
"=",
"None",
",",
"tag",
"=",
"''",
",",
"has_dictation",
"=",
"None",
")",
":",
"entry",
"=",
"AudioStoreEntry",
"(",
"self",
".",
"current_audio_data",... | https://github.com/dictation-toolbox/dragonfly/blob/a2b8f8e8ed1182465b831205b9804323beea112a/dragonfly/engines/backend_kaldi/audio.py#L362-L369 | ||
exaile/exaile | a7b58996c5c15b3aa7b9975ac13ee8f784ef4689 | xlgui/cover.py | python | CoverWindow.available_image_height | (self) | return self.cover_window.get_size()[1] - tb_natural_height - sb_natural_height | Returns the available vertical space for the image | Returns the available vertical space for the image | [
"Returns",
"the",
"available",
"vertical",
"space",
"for",
"the",
"image"
] | def available_image_height(self):
"""Returns the available vertical space for the image"""
tb_min_height, tb_natural_height = self.toolbar.get_preferred_height()
sb_min_height, sb_natural_height = self.statusbar.get_preferred_height()
return self.cover_window.get_size()[1] - tb_natural_... | [
"def",
"available_image_height",
"(",
"self",
")",
":",
"tb_min_height",
",",
"tb_natural_height",
"=",
"self",
".",
"toolbar",
".",
"get_preferred_height",
"(",
")",
"sb_min_height",
",",
"sb_natural_height",
"=",
"self",
".",
"statusbar",
".",
"get_preferred_heigh... | https://github.com/exaile/exaile/blob/a7b58996c5c15b3aa7b9975ac13ee8f784ef4689/xlgui/cover.py#L844-L849 | |
geopython/pywps | 7f228ff17594912664073a629b2c2ed9d4f5f615 | pywps/validator/complexvalidator.py | python | validateshapefile | (data_input, mode) | return passed | ESRI Shapefile validation example | ESRI Shapefile validation example | [
"ESRI",
"Shapefile",
"validation",
"example"
] | def validateshapefile(data_input, mode):
"""ESRI Shapefile validation example
"""
LOGGER.info('validating Shapefile; Mode: {}'.format(mode))
passed = False
if mode >= MODE.NONE:
passed = True
if mode >= MODE.SIMPLE:
name = data_input.file
(mtype, encoding) = mimetype... | [
"def",
"validateshapefile",
"(",
"data_input",
",",
"mode",
")",
":",
"LOGGER",
".",
"info",
"(",
"'validating Shapefile; Mode: {}'",
".",
"format",
"(",
"mode",
")",
")",
"passed",
"=",
"False",
"if",
"mode",
">=",
"MODE",
".",
"NONE",
":",
"passed",
"=",... | https://github.com/geopython/pywps/blob/7f228ff17594912664073a629b2c2ed9d4f5f615/pywps/validator/complexvalidator.py#L301-L327 | |
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/core/grr_response_core/lib/config_lib.py | python | GrrConfigManager.PrintHelp | (self) | [] | def PrintHelp(self):
print(self.FormatHelp()) | [
"def",
"PrintHelp",
"(",
"self",
")",
":",
"print",
"(",
"self",
".",
"FormatHelp",
"(",
")",
")"
] | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/core/grr_response_core/lib/config_lib.py#L797-L798 | ||||
googledatalab/pydatalab | 1c86e26a0d24e3bc8097895ddeab4d0607be4c40 | solutionbox/image_classification/mltoolbox/image/classification/_predictor.py | python | _tf_predict | (model_dir, images) | return zip(predictions, labels, scores) | [] | def _tf_predict(model_dir, images):
session, inputs, outputs = _load_tf_model(model_dir)
with session:
feed_dict = collections.defaultdict(list)
for ii, image in enumerate(images):
feed_dict[inputs['image_bytes']].append(image)
feed_dict[inputs['key']].append(str(ii))
predictions, labels, s... | [
"def",
"_tf_predict",
"(",
"model_dir",
",",
"images",
")",
":",
"session",
",",
"inputs",
",",
"outputs",
"=",
"_load_tf_model",
"(",
"model_dir",
")",
"with",
"session",
":",
"feed_dict",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"... | https://github.com/googledatalab/pydatalab/blob/1c86e26a0d24e3bc8097895ddeab4d0607be4c40/solutionbox/image_classification/mltoolbox/image/classification/_predictor.py#L44-L55 | |||
selfteaching/selfteaching-python-camp | 9982ee964b984595e7d664b07c389cddaf158f1e | 19100205/Ceasar1978/pip-19.0.3/src/pip/_vendor/requests/cookies.py | python | create_cookie | (name, value, **kwargs) | return cookielib.Cookie(**result) | Make a cookie from underspecified parameters.
By default, the pair of `name` and `value` will be set for the domain ''
and sent on every request (this is sometimes called a "supercookie"). | Make a cookie from underspecified parameters. | [
"Make",
"a",
"cookie",
"from",
"underspecified",
"parameters",
"."
] | def create_cookie(name, value, **kwargs):
"""Make a cookie from underspecified parameters.
By default, the pair of `name` and `value` will be set for the domain ''
and sent on every request (this is sometimes called a "supercookie").
"""
result = {
'version': 0,
'name': name,
... | [
"def",
"create_cookie",
"(",
"name",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"{",
"'version'",
":",
"0",
",",
"'name'",
":",
"name",
",",
"'value'",
":",
"value",
",",
"'port'",
":",
"None",
",",
"'domain'",
":",
"''",
",",
... | https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/19100205/Ceasar1978/pip-19.0.3/src/pip/_vendor/requests/cookies.py#L441-L474 | |
bendmorris/static-python | 2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473 | Lib/nntplib.py | python | _NNTPBase.over | (self, message_spec, *, file=None) | return resp, _parse_overview(lines, fmt) | Process an OVER command. If the command isn't supported, fall
back to XOVER. Arguments:
- message_spec:
- either a message id, indicating the article to fetch
information about
- or a (start, end) tuple, indicating a range of article numbers;
if end i... | Process an OVER command. If the command isn't supported, fall
back to XOVER. Arguments:
- message_spec:
- either a message id, indicating the article to fetch
information about
- or a (start, end) tuple, indicating a range of article numbers;
if end i... | [
"Process",
"an",
"OVER",
"command",
".",
"If",
"the",
"command",
"isn",
"t",
"supported",
"fall",
"back",
"to",
"XOVER",
".",
"Arguments",
":",
"-",
"message_spec",
":",
"-",
"either",
"a",
"message",
"id",
"indicating",
"the",
"article",
"to",
"fetch",
... | def over(self, message_spec, *, file=None):
"""Process an OVER command. If the command isn't supported, fall
back to XOVER. Arguments:
- message_spec:
- either a message id, indicating the article to fetch
information about
- or a (start, end) tuple, indica... | [
"def",
"over",
"(",
"self",
",",
"message_spec",
",",
"*",
",",
"file",
"=",
"None",
")",
":",
"cmd",
"=",
"'OVER'",
"if",
"'OVER'",
"in",
"self",
".",
"_caps",
"else",
"'XOVER'",
"if",
"isinstance",
"(",
"message_spec",
",",
"(",
"tuple",
",",
"list... | https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/nntplib.py#L801-L826 | |
lovelylain/pyctp | fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d | example/ctp/futures/ApiStruct.py | python | QryBroker.__init__ | (self, BrokerID='') | [] | def __init__(self, BrokerID=''):
self.BrokerID = '' | [
"def",
"__init__",
"(",
"self",
",",
"BrokerID",
"=",
"''",
")",
":",
"self",
".",
"BrokerID",
"=",
"''"
] | https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/example/ctp/futures/ApiStruct.py#L3080-L3081 | ||||
spectacles/CodeComplice | 8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62 | libs/codeintel2/lang_javascript.py | python | JavaScriptCiler.addClassFunction | (self, namelist, args=None, doc=None) | [] | def addClassFunction(self, namelist, args=None, doc=None):
log.debug("AddClassFunction: %s(%s)", namelist, args)
toScope = self.currentClass
if not toScope:
# See if it's a function, we'll convert it into a class then
if isinstance(self.currentScope, JSFunction):
... | [
"def",
"addClassFunction",
"(",
"self",
",",
"namelist",
",",
"args",
"=",
"None",
",",
"doc",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"\"AddClassFunction: %s(%s)\"",
",",
"namelist",
",",
"args",
")",
"toScope",
"=",
"self",
".",
"currentClass",
... | https://github.com/spectacles/CodeComplice/blob/8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62/libs/codeintel2/lang_javascript.py#L2260-L2275 | ||||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/sloane_functions.py | python | A000290.__init__ | (self) | r"""
The squares: `a(n) = n^2`.
INPUT:
- ``n`` -- non negative integer
OUTPUT:
- ``integer`` -- function value
EXAMPLES::
sage: a = sloane.A000290;a
The squares: a(n) = n^2.
sage: a(0)
0
sage: a(-1)
... | r"""
The squares: `a(n) = n^2`. | [
"r",
"The",
"squares",
":",
"a",
"(",
"n",
")",
"=",
"n^2",
"."
] | def __init__(self):
r"""
The squares: `a(n) = n^2`.
INPUT:
- ``n`` -- non negative integer
OUTPUT:
- ``integer`` -- function value
EXAMPLES::
sage: a = sloane.A000290;a
The squares: a(n) = n^2.
sage: a(0)
0
... | [
"def",
"__init__",
"(",
"self",
")",
":",
"SloaneSequence",
".",
"__init__",
"(",
"self",
",",
"offset",
"=",
"0",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/sloane_functions.py#L2163-L2194 | ||
huggingface/naacl_transfer_learning_tutorial | dc976775bb11edee24a77e2ce161450089c5e169 | utils.py | python | pad_dataset | (dataset, padding=0, to_left=True) | return dataset | Pad a dataset (list of list) to the left or the right. | Pad a dataset (list of list) to the left or the right. | [
"Pad",
"a",
"dataset",
"(",
"list",
"of",
"list",
")",
"to",
"the",
"left",
"or",
"the",
"right",
"."
] | def pad_dataset(dataset, padding=0, to_left=True):
""" Pad a dataset (list of list) to the left or the right. """
max_l = max(len(x) for x in dataset)
dataset = [(x if to_left else []) + [padding] * (max_l - len(x)) + ([] if to_left else x) for x in dataset]
return dataset | [
"def",
"pad_dataset",
"(",
"dataset",
",",
"padding",
"=",
"0",
",",
"to_left",
"=",
"True",
")",
":",
"max_l",
"=",
"max",
"(",
"len",
"(",
"x",
")",
"for",
"x",
"in",
"dataset",
")",
"dataset",
"=",
"[",
"(",
"x",
"if",
"to_left",
"else",
"[",
... | https://github.com/huggingface/naacl_transfer_learning_tutorial/blob/dc976775bb11edee24a77e2ce161450089c5e169/utils.py#L62-L66 | |
biopython/biopython | 2dd97e71762af7b046d7f7f8a4f1e38db6b06c86 | Bio/Phylo/Applications/_Fasttree.py | python | _is_int | (x) | return isinstance(x, int) or str(x).isdigit() | Test whether the argument can be serialized as an integer (PRIVATE). | Test whether the argument can be serialized as an integer (PRIVATE). | [
"Test",
"whether",
"the",
"argument",
"can",
"be",
"serialized",
"as",
"an",
"integer",
"(",
"PRIVATE",
")",
"."
] | def _is_int(x):
"""Test whether the argument can be serialized as an integer (PRIVATE)."""
return isinstance(x, int) or str(x).isdigit() | [
"def",
"_is_int",
"(",
"x",
")",
":",
"return",
"isinstance",
"(",
"x",
",",
"int",
")",
"or",
"str",
"(",
"x",
")",
".",
"isdigit",
"(",
")"
] | https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/Phylo/Applications/_Fasttree.py#L15-L17 | |
out0fmemory/GoAgent-Always-Available | c4254984fea633ce3d1893fe5901debd9f22c2a9 | server/lib/google/appengine/api/appinfo.py | python | EnvironmentVariables.Merge | (cls, env_variables_one, env_variables_two) | return (EnvironmentVariables(**result_env_variables)
if result_env_variables else None) | Merges to EnvironmentVariables instances.
Args:
env_variables_one: The first EnvironmentVariables instance or None.
env_variables_two: The second EnvironmentVariables instance or None.
Returns:
The merged EnvironmentVariables instance, or None if both input instances
are None or empty.... | Merges to EnvironmentVariables instances. | [
"Merges",
"to",
"EnvironmentVariables",
"instances",
"."
] | def Merge(cls, env_variables_one, env_variables_two):
"""Merges to EnvironmentVariables instances.
Args:
env_variables_one: The first EnvironmentVariables instance or None.
env_variables_two: The second EnvironmentVariables instance or None.
Returns:
The merged EnvironmentVariables insta... | [
"def",
"Merge",
"(",
"cls",
",",
"env_variables_one",
",",
"env_variables_two",
")",
":",
"result_env_variables",
"=",
"(",
"env_variables_one",
"or",
"{",
"}",
")",
".",
"copy",
"(",
")",
"result_env_variables",
".",
"update",
"(",
"env_variables_two",
"or",
... | https://github.com/out0fmemory/GoAgent-Always-Available/blob/c4254984fea633ce3d1893fe5901debd9f22c2a9/server/lib/google/appengine/api/appinfo.py#L1510-L1528 | |
ContextLab/hypertools | 948050a22b345c7dcccf729672c76f49609b1ac8 | hypertools/plot/draw.py | python | _draw | (x, legend=None, title=None, labels=False,
show=True, kwargs_list=None, fmt=None, animate=False,
tail_duration=2, rotations=2, zoom=1, chemtrails=False, precog=False,
bullettime=False, frame_rate=50, elev=10, azim=-60, duration=30,
explore=False, size=None, ax=None) | return fig, ax, data, line_ani | Draws the plot | Draws the plot | [
"Draws",
"the",
"plot"
] | def _draw(x, legend=None, title=None, labels=False,
show=True, kwargs_list=None, fmt=None, animate=False,
tail_duration=2, rotations=2, zoom=1, chemtrails=False, precog=False,
bullettime=False, frame_rate=50, elev=10, azim=-60, duration=30,
explore=False, size=None, ax=None):
"""... | [
"def",
"_draw",
"(",
"x",
",",
"legend",
"=",
"None",
",",
"title",
"=",
"None",
",",
"labels",
"=",
"False",
",",
"show",
"=",
"True",
",",
"kwargs_list",
"=",
"None",
",",
"fmt",
"=",
"None",
",",
"animate",
"=",
"False",
",",
"tail_duration",
"=... | https://github.com/ContextLab/hypertools/blob/948050a22b345c7dcccf729672c76f49609b1ac8/hypertools/plot/draw.py#L16-L448 | |
nathanlopez/Stitch | 8e22e91c94237959c02d521aab58dc7e3d994cea | Application/stitch_lnxshell.py | python | st_lnxshell.help_location | (self) | [] | def help_location(self): st_help_location() | [
"def",
"help_location",
"(",
"self",
")",
":",
"st_help_location",
"(",
")"
] | https://github.com/nathanlopez/Stitch/blob/8e22e91c94237959c02d521aab58dc7e3d994cea/Application/stitch_lnxshell.py#L226-L226 | ||||
lalor/python_for_linux_system_administration | 2a002fcab3e74e82287400556dee7909e1996d10 | chapter11/section6/class_person1.py | python | Person.__init__ | (self, name, age) | [] | def __init__(self, name, age):
self.name = name
self.age = age | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"age",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"age",
"=",
"age"
] | https://github.com/lalor/python_for_linux_system_administration/blob/2a002fcab3e74e82287400556dee7909e1996d10/chapter11/section6/class_person1.py#L2-L4 | ||||
deanishe/alfred-repos | 7f7b3999331808cb58fc33e8793f6be692ed9fe5 | src/workflow/update.py | python | Version.__str__ | (self) | return vstr | Return semantic version string. | Return semantic version string. | [
"Return",
"semantic",
"version",
"string",
"."
] | def __str__(self):
"""Return semantic version string."""
vstr = '{0}.{1}.{2}'.format(self.major, self.minor, self.patch)
if self.suffix:
vstr = '{0}-{1}'.format(vstr, self.suffix)
if self.build:
vstr = '{0}+{1}'.format(vstr, self.build)
return vstr | [
"def",
"__str__",
"(",
"self",
")",
":",
"vstr",
"=",
"'{0}.{1}.{2}'",
".",
"format",
"(",
"self",
".",
"major",
",",
"self",
".",
"minor",
",",
"self",
".",
"patch",
")",
"if",
"self",
".",
"suffix",
":",
"vstr",
"=",
"'{0}-{1}'",
".",
"format",
"... | https://github.com/deanishe/alfred-repos/blob/7f7b3999331808cb58fc33e8793f6be692ed9fe5/src/workflow/update.py#L333-L340 | |
buffer/thug | 96ccd5bb1a45375ad665dfb8fb975978bf4659cb | thug/DOM/Window.py | python | Window.btoa | (self, s) | return base64.b64encode(s) | The btoa method encodes a string in base-64 | The btoa method encodes a string in base-64 | [
"The",
"btoa",
"method",
"encodes",
"a",
"string",
"in",
"base",
"-",
"64"
] | def btoa(self, s):
"""
The btoa method encodes a string in base-64
"""
if isinstance(s, str):
s = s.encode()
return base64.b64encode(s) | [
"def",
"btoa",
"(",
"self",
",",
"s",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"str",
")",
":",
"s",
"=",
"s",
".",
"encode",
"(",
")",
"return",
"base64",
".",
"b64encode",
"(",
"s",
")"
] | https://github.com/buffer/thug/blob/96ccd5bb1a45375ad665dfb8fb975978bf4659cb/thug/DOM/Window.py#L1034-L1041 | |
bbfamily/abu | 2de85ae57923a720dac99a545b4f856f6b87304b | abupy/UtilBu/ABuKLUtil.py | python | qcut_change_vc | (df, q=10) | return _df_dispatch_concat(df, _qcut_change_vc) | eg:
tsla = ABuSymbolPd.make_kl_df('usTSLA')
ABuKLUtil.qcut_change_vc(tsla)
out:
change
0 [-10.45, -3.002]
1 (-3.002, -1.666]
2 (-1.666, -0.93]
3 (-0.93, -0.396]
4 (-0.396, 0.065]
5 (0.065, 0.48]
6 (0.48, 1.102]
7 (1.102... | eg:
tsla = ABuSymbolPd.make_kl_df('usTSLA')
ABuKLUtil.qcut_change_vc(tsla) | [
"eg",
":",
"tsla",
"=",
"ABuSymbolPd",
".",
"make_kl_df",
"(",
"usTSLA",
")",
"ABuKLUtil",
".",
"qcut_change_vc",
"(",
"tsla",
")"
] | def qcut_change_vc(df, q=10):
"""
eg:
tsla = ABuSymbolPd.make_kl_df('usTSLA')
ABuKLUtil.qcut_change_vc(tsla)
out:
change
0 [-10.45, -3.002]
1 (-3.002, -1.666]
2 (-1.666, -0.93]
3 (-0.93, -0.396]
4 (-0.396, 0.065]
5 (0.065, 0.48... | [
"def",
"qcut_change_vc",
"(",
"df",
",",
"q",
"=",
"10",
")",
":",
"def",
"_qcut_change_vc",
"(",
"p_df",
",",
"df_name",
"=",
"''",
")",
":",
"dww",
"=",
"pd",
".",
"qcut",
"(",
"p_df",
".",
"p_change",
",",
"q",
")",
".",
"value_counts",
"(",
"... | https://github.com/bbfamily/abu/blob/2de85ae57923a720dac99a545b4f856f6b87304b/abupy/UtilBu/ABuKLUtil.py#L196-L232 | |
ricequant/rqalpha | d8b345ca3fde299e061c6a89c1f2c362c3584c96 | rqalpha/_version.py | python | run_command | (commands, args, cwd=None, verbose=False, hide_stderr=False,
env=None) | return stdout, p.returncode | Call the given command(s). | Call the given command(s). | [
"Call",
"the",
"given",
"command",
"(",
"s",
")",
"."
] | def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
env=None):
"""Call the given command(s)."""
assert isinstance(commands, list)
p = None
for c in commands:
try:
dispcmd = str([c] + args)
# remember shell=False, so use git.cmd on w... | [
"def",
"run_command",
"(",
"commands",
",",
"args",
",",
"cwd",
"=",
"None",
",",
"verbose",
"=",
"False",
",",
"hide_stderr",
"=",
"False",
",",
"env",
"=",
"None",
")",
":",
"assert",
"isinstance",
"(",
"commands",
",",
"list",
")",
"p",
"=",
"None... | https://github.com/ricequant/rqalpha/blob/d8b345ca3fde299e061c6a89c1f2c362c3584c96/rqalpha/_version.py#L70-L104 | |
waveform80/picamera | 7e4f1d379d698c44501fb84b886fadf3fc164b70 | picamera/camera.py | python | PiCamera.stop_recording | (self, splitter_port=1) | Stop recording video from the camera.
After calling this method the video encoder will be shut down and
output will stop being written to the file-like object specified with
:meth:`start_recording`. If an error occurred during recording and
:meth:`wait_recording` has not been called sin... | Stop recording video from the camera. | [
"Stop",
"recording",
"video",
"from",
"the",
"camera",
"."
] | def stop_recording(self, splitter_port=1):
"""
Stop recording video from the camera.
After calling this method the video encoder will be shut down and
output will stop being written to the file-like object specified with
:meth:`start_recording`. If an error occurred during recor... | [
"def",
"stop_recording",
"(",
"self",
",",
"splitter_port",
"=",
"1",
")",
":",
"try",
":",
"with",
"self",
".",
"_encoders_lock",
":",
"encoder",
"=",
"self",
".",
"_encoders",
"[",
"splitter_port",
"]",
"except",
"KeyError",
":",
"raise",
"PiCameraNotRecor... | https://github.com/waveform80/picamera/blob/7e4f1d379d698c44501fb84b886fadf3fc164b70/picamera/camera.py#L1357-L1388 | ||
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/mailbox.py | python | mbox._generate_toc | (self) | Generate key-to-(start, stop) table of contents. | Generate key-to-(start, stop) table of contents. | [
"Generate",
"key",
"-",
"to",
"-",
"(",
"start",
"stop",
")",
"table",
"of",
"contents",
"."
] | def _generate_toc(self):
"""Generate key-to-(start, stop) table of contents."""
starts, stops = [], []
self._file.seek(0)
while True:
line_pos = self._file.tell()
line = self._file.readline()
if line.startswith('From '):
if len(stops) <... | [
"def",
"_generate_toc",
"(",
"self",
")",
":",
"starts",
",",
"stops",
"=",
"[",
"]",
",",
"[",
"]",
"self",
".",
"_file",
".",
"seek",
"(",
"0",
")",
"while",
"True",
":",
"line_pos",
"=",
"self",
".",
"_file",
".",
"tell",
"(",
")",
"line",
"... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/mailbox.py#L793-L809 | ||
microsoft/dowhy | 8b2cf6a722572a7e0d6a1f7fef22e743dbd3b13a | dowhy/causal_estimator.py | python | CausalEstimate.get_standard_error | (self, method=None, **kwargs) | return std_error | Get standard error of the obtained estimate.
By default, this is done with the help of bootstrapped standard errors
but can be overridden if the specific estimator implements other methods of estimating standard error.
If the method provided is not bootstrap, this function calls the implementa... | Get standard error of the obtained estimate. | [
"Get",
"standard",
"error",
"of",
"the",
"obtained",
"estimate",
"."
] | def get_standard_error(self, method=None, **kwargs):
""" Get standard error of the obtained estimate.
By default, this is done with the help of bootstrapped standard errors
but can be overridden if the specific estimator implements other methods of estimating standard error.
If the met... | [
"def",
"get_standard_error",
"(",
"self",
",",
"method",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"std_error",
"=",
"self",
".",
"estimator",
".",
"estimate_std_error",
"(",
"method",
"=",
"method",
",",
"*",
"*",
"kwargs",
")",
"return",
"std_err... | https://github.com/microsoft/dowhy/blob/8b2cf6a722572a7e0d6a1f7fef22e743dbd3b13a/dowhy/causal_estimator.py#L708-L722 | |
jesseweisberg/moveo_ros | b9282bdadbf2505a26d3b94b91e60a98d86efa34 | object_detector_app/object_detection/models/ssd_inception_v2_feature_extractor.py | python | SSDInceptionV2FeatureExtractor.extract_features | (self, preprocessed_inputs) | return feature_maps.values() | Extract features from preprocessed inputs.
Args:
preprocessed_inputs: a [batch, height, width, channels] float tensor
representing a batch of images.
Returns:
feature_maps: a list of tensors where the ith tensor has shape
[batch, height_i, width_i, depth_i] | Extract features from preprocessed inputs. | [
"Extract",
"features",
"from",
"preprocessed",
"inputs",
"."
] | def extract_features(self, preprocessed_inputs):
"""Extract features from preprocessed inputs.
Args:
preprocessed_inputs: a [batch, height, width, channels] float tensor
representing a batch of images.
Returns:
feature_maps: a list of tensors where the ith tensor has shape
[bat... | [
"def",
"extract_features",
"(",
"self",
",",
"preprocessed_inputs",
")",
":",
"preprocessed_inputs",
".",
"get_shape",
"(",
")",
".",
"assert_has_rank",
"(",
"4",
")",
"shape_assert",
"=",
"tf",
".",
"Assert",
"(",
"tf",
".",
"logical_and",
"(",
"tf",
".",
... | https://github.com/jesseweisberg/moveo_ros/blob/b9282bdadbf2505a26d3b94b91e60a98d86efa34/object_detector_app/object_detection/models/ssd_inception_v2_feature_extractor.py#L60-L99 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/demo/stt.py | python | DemoProvider.supported_bit_rates | (self) | return [AudioBitRates.BITRATE_16] | Return a list of supported bit rates. | Return a list of supported bit rates. | [
"Return",
"a",
"list",
"of",
"supported",
"bit",
"rates",
"."
] | def supported_bit_rates(self) -> list[AudioBitRates]:
"""Return a list of supported bit rates."""
return [AudioBitRates.BITRATE_16] | [
"def",
"supported_bit_rates",
"(",
"self",
")",
"->",
"list",
"[",
"AudioBitRates",
"]",
":",
"return",
"[",
"AudioBitRates",
".",
"BITRATE_16",
"]"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/demo/stt.py#L43-L45 | |
uber/fiber | ad6faf02b8e94dee498990e9fd9c588234666725 | fiber/util.py | python | find_listen_address | () | return ip, ifce | Find an IP address for Fiber to use. | Find an IP address for Fiber to use. | [
"Find",
"an",
"IP",
"address",
"for",
"Fiber",
"to",
"use",
"."
] | def find_listen_address():
"""Find an IP address for Fiber to use."""
ip = None
ifce = None
ifces = psutil.net_if_addrs()
for ifce, addrs in ifces.items():
if re.match(r"^eth", ifce) or re.match(r"^en", ifce):
for snicaddr in addrs:
# IPv4 only
if ... | [
"def",
"find_listen_address",
"(",
")",
":",
"ip",
"=",
"None",
"ifce",
"=",
"None",
"ifces",
"=",
"psutil",
".",
"net_if_addrs",
"(",
")",
"for",
"ifce",
",",
"addrs",
"in",
"ifces",
".",
"items",
"(",
")",
":",
"if",
"re",
".",
"match",
"(",
"r\"... | https://github.com/uber/fiber/blob/ad6faf02b8e94dee498990e9fd9c588234666725/fiber/util.py#L111-L124 | |
JoneXiong/YouPBX | e24a8b74814761bc90fd86f4217c92ec7238874b | pbx/conf.py | python | ivr_menus | (fs_conf_path) | u'''
ivr_menus | u'''
ivr_menus | [
"u",
"ivr_menus"
] | def ivr_menus(fs_conf_path):
u'''
ivr_menus
'''
try:
from apps.extend.models import IVR
except:
return
menus = IVR.objects.all()
m_data = jinja2_template('ivr_menus.xml', menus=menus)
m_file = os.path.join(fs_conf_path,'ivr_menus', 'oe_ivr.xml')
f = open(m_file,'w+')
... | [
"def",
"ivr_menus",
"(",
"fs_conf_path",
")",
":",
"try",
":",
"from",
"apps",
".",
"extend",
".",
"models",
"import",
"IVR",
"except",
":",
"return",
"menus",
"=",
"IVR",
".",
"objects",
".",
"all",
"(",
")",
"m_data",
"=",
"jinja2_template",
"(",
"'i... | https://github.com/JoneXiong/YouPBX/blob/e24a8b74814761bc90fd86f4217c92ec7238874b/pbx/conf.py#L65-L78 | ||
py2neo-org/py2neo | 2e46bbf4d622f53282e796ffc521fc4bc6d0b60d | py2neo/vendor/bottle.py | python | BaseRequest.body | (self) | return self._body | The HTTP request body as a seek-able file-like object. Depending on
:attr:`MEMFILE_MAX`, this is either a temporary file or a
:class:`io.BytesIO` instance. Accessing this property for the first
time reads and replaces the ``wsgi.input`` environ variable.
Subsequent access... | The HTTP request body as a seek-able file-like object. Depending on
:attr:`MEMFILE_MAX`, this is either a temporary file or a
:class:`io.BytesIO` instance. Accessing this property for the first
time reads and replaces the ``wsgi.input`` environ variable.
Subsequent access... | [
"The",
"HTTP",
"request",
"body",
"as",
"a",
"seek",
"-",
"able",
"file",
"-",
"like",
"object",
".",
"Depending",
"on",
":",
"attr",
":",
"MEMFILE_MAX",
"this",
"is",
"either",
"a",
"temporary",
"file",
"or",
"a",
":",
"class",
":",
"io",
".",
"Byte... | def body(self):
""" The HTTP request body as a seek-able file-like object. Depending on
:attr:`MEMFILE_MAX`, this is either a temporary file or a
:class:`io.BytesIO` instance. Accessing this property for the first
time reads and replaces the ``wsgi.input`` environ variable.
... | [
"def",
"body",
"(",
"self",
")",
":",
"self",
".",
"_body",
".",
"seek",
"(",
"0",
")",
"return",
"self",
".",
"_body"
] | https://github.com/py2neo-org/py2neo/blob/2e46bbf4d622f53282e796ffc521fc4bc6d0b60d/py2neo/vendor/bottle.py#L1197-L1204 | |
astropy/photutils | 3caa48e4e4d139976ed7457dc41583fb2c56ba20 | photutils/aperture/ellipse.py | python | EllipticalAnnulus._to_patch | (self, origin=(0, 0), **kwargs) | Return a `~matplotlib.patches.patch` for the aperture.
Parameters
----------
origin : array_like, optional
The ``(x, y)`` position of the origin of the displayed
image.
**kwargs : `dict`
Any keyword arguments accepted by
`matplotlib.patch... | Return a `~matplotlib.patches.patch` for the aperture. | [
"Return",
"a",
"~matplotlib",
".",
"patches",
".",
"patch",
"for",
"the",
"aperture",
"."
] | def _to_patch(self, origin=(0, 0), **kwargs):
"""
Return a `~matplotlib.patches.patch` for the aperture.
Parameters
----------
origin : array_like, optional
The ``(x, y)`` position of the origin of the displayed
image.
**kwargs : `dict`
... | [
"def",
"_to_patch",
"(",
"self",
",",
"origin",
"=",
"(",
"0",
",",
"0",
")",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"matplotlib",
".",
"patches",
"as",
"mpatches",
"xy_positions",
",",
"patch_kwargs",
"=",
"self",
".",
"_define_patch_params",
"(",... | https://github.com/astropy/photutils/blob/3caa48e4e4d139976ed7457dc41583fb2c56ba20/photutils/aperture/ellipse.py#L357-L396 | ||
Yelp/venv-update | 5fb5491bd421fdd8ef3cff3faa5d4846b5985ec8 | pip_faster.py | python | fresh_working_set | () | return WorkingSetPlusEditableInstalls() | return a pkg_resources "working set", representing the *currently* installed packages | return a pkg_resources "working set", representing the *currently* installed packages | [
"return",
"a",
"pkg_resources",
"working",
"set",
"representing",
"the",
"*",
"currently",
"*",
"installed",
"packages"
] | def fresh_working_set():
"""return a pkg_resources "working set", representing the *currently* installed packages"""
class WorkingSetPlusEditableInstalls(pkg_resources.WorkingSet):
def __init__(self, *args, **kwargs):
self._normalized_name_mapping = {}
super(WorkingSetPlusEditab... | [
"def",
"fresh_working_set",
"(",
")",
":",
"class",
"WorkingSetPlusEditableInstalls",
"(",
"pkg_resources",
".",
"WorkingSet",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_normalized_name_mapping... | https://github.com/Yelp/venv-update/blob/5fb5491bd421fdd8ef3cff3faa5d4846b5985ec8/pip_faster.py#L250-L280 | |
QCoDeS/Qcodes | 3cda2cef44812e2aa4672781f2423bf5f816f9f9 | qcodes/instrument_drivers/tektronix/AWGFileParser.py | python | _unpacker | (
binaryarray: np.ndarray,
dacbitdepth: int = 14
) | return wf, m1, m2 | Unpacks an awg-file integer wave into a waveform and two markers
in the same way as the AWG does. This can be useful for checking
how the signals are going to be interpreted by the instrument.
Args:
binaryarray: A numpy array containing the
packed waveform and markers.
dacbitdep... | Unpacks an awg-file integer wave into a waveform and two markers
in the same way as the AWG does. This can be useful for checking
how the signals are going to be interpreted by the instrument. | [
"Unpacks",
"an",
"awg",
"-",
"file",
"integer",
"wave",
"into",
"a",
"waveform",
"and",
"two",
"markers",
"in",
"the",
"same",
"way",
"as",
"the",
"AWG",
"does",
".",
"This",
"can",
"be",
"useful",
"for",
"checking",
"how",
"the",
"signals",
"are",
"go... | def _unpacker(
binaryarray: np.ndarray,
dacbitdepth: int = 14
) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
"""
Unpacks an awg-file integer wave into a waveform and two markers
in the same way as the AWG does. This can be useful for checking
how the signals are going to be interpreted ... | [
"def",
"_unpacker",
"(",
"binaryarray",
":",
"np",
".",
"ndarray",
",",
"dacbitdepth",
":",
"int",
"=",
"14",
")",
"->",
"Tuple",
"[",
"np",
".",
"ndarray",
",",
"np",
".",
"ndarray",
",",
"np",
".",
"ndarray",
"]",
":",
"wflength",
"=",
"len",
"("... | https://github.com/QCoDeS/Qcodes/blob/3cda2cef44812e2aa4672781f2423bf5f816f9f9/qcodes/instrument_drivers/tektronix/AWGFileParser.py#L309-L340 | |
selfteaching/selfteaching-python-camp | 9982ee964b984595e7d664b07c389cddaf158f1e | 19100205/Ceasar1978/pip-19.0.3/src/pip/_vendor/ipaddress.py | python | _BaseV6._compress_hextets | (cls, hextets) | return hextets | Compresses a list of hextets.
Compresses a list of strings, replacing the longest continuous
sequence of "0" in the list with "" and adding empty strings at
the beginning or at the end of the string such that subsequently
calling ":".join(hextets) will produce the compressed version of
... | Compresses a list of hextets. | [
"Compresses",
"a",
"list",
"of",
"hextets",
"."
] | def _compress_hextets(cls, hextets):
"""Compresses a list of hextets.
Compresses a list of strings, replacing the longest continuous
sequence of "0" in the list with "" and adding empty strings at
the beginning or at the end of the string such that subsequently
calling ":".join(... | [
"def",
"_compress_hextets",
"(",
"cls",
",",
"hextets",
")",
":",
"best_doublecolon_start",
"=",
"-",
"1",
"best_doublecolon_len",
"=",
"0",
"doublecolon_start",
"=",
"-",
"1",
"doublecolon_len",
"=",
"0",
"for",
"index",
",",
"hextet",
"in",
"enumerate",
"(",... | https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/19100205/Ceasar1978/pip-19.0.3/src/pip/_vendor/ipaddress.py#L1881-L1926 | |
eventable/vobject | 498555a553155ea9b26aace93332ae79365ecb31 | vobject/icalendar.py | python | TimezoneComponent.__str__ | (self) | return "<VTIMEZONE | {0}>".format(getattr(self, 'tzid', 'No TZID')) | [] | def __str__(self):
return "<VTIMEZONE | {0}>".format(getattr(self, 'tzid', 'No TZID')) | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"\"<VTIMEZONE | {0}>\"",
".",
"format",
"(",
"getattr",
"(",
"self",
",",
"'tzid'",
",",
"'No TZID'",
")",
")"
] | https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/icalendar.py#L358-L359 | |||
reviewboard/reviewboard | 7395902e4c181bcd1d633f61105012ffb1d18e1b | reviewboard/scmtools/svn/__init__.py | python | SVNTool.parse_diff_revision | (self, filename, revision, *args, **kwargs) | return filename, revision | Parse and return a filename and revision from a diff.
Args:
filename (bytes):
The filename as represented in the diff.
revision (bytes):
The revision as represented in the diff.
*args (tuple, unused):
Unused positional argume... | Parse and return a filename and revision from a diff. | [
"Parse",
"and",
"return",
"a",
"filename",
"and",
"revision",
"from",
"a",
"diff",
"."
] | def parse_diff_revision(self, filename, revision, *args, **kwargs):
"""Parse and return a filename and revision from a diff.
Args:
filename (bytes):
The filename as represented in the diff.
revision (bytes):
The revision as represented in the dif... | [
"def",
"parse_diff_revision",
"(",
"self",
",",
"filename",
",",
"revision",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"isinstance",
"(",
"filename",
",",
"bytes",
")",
",",
"(",
"'filename must be a byte string, not %s'",
"%",
"type",
"... | https://github.com/reviewboard/reviewboard/blob/7395902e4c181bcd1d633f61105012ffb1d18e1b/reviewboard/scmtools/svn/__init__.py#L277-L348 | |
geopandas/geopandas | 8e7133aef9e6c0d2465e07e92d954e95dedd3881 | geopandas/sindex.py | python | BaseSpatialIndex.valid_query_predicates | (self) | Returns valid predicates for this spatial index.
Returns
-------
set
Set of valid predicates for this spatial index.
Examples
--------
>>> from shapely.geometry import Point
>>> s = geopandas.GeoSeries([Point(0, 0), Point(1, 1)])
>>> s.sindex... | Returns valid predicates for this spatial index. | [
"Returns",
"valid",
"predicates",
"for",
"this",
"spatial",
"index",
"."
] | def valid_query_predicates(self):
"""Returns valid predicates for this spatial index.
Returns
-------
set
Set of valid predicates for this spatial index.
Examples
--------
>>> from shapely.geometry import Point
>>> s = geopandas.GeoSeries([Po... | [
"def",
"valid_query_predicates",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/geopandas/geopandas/blob/8e7133aef9e6c0d2465e07e92d954e95dedd3881/geopandas/sindex.py#L29-L45 | ||
IBM/watson-online-store | 4c8b60883b319f07c3187d9cb433ef9c3ae29aea | python-flask-server/server.py | python | WebSocketSender.send_message | (self, message) | Function to send a message to the web-ui via Flask SocketIO. | Function to send a message to the web-ui via Flask SocketIO. | [
"Function",
"to",
"send",
"a",
"message",
"to",
"the",
"web",
"-",
"ui",
"via",
"Flask",
"SocketIO",
"."
] | def send_message(self, message):
"""Function to send a message to the web-ui via Flask SocketIO."""
lines = message.split('\n')
for line in lines:
image = None
if 'output_format[png]' in line:
line, http_tail = line.split('http', 1)
image =... | [
"def",
"send_message",
"(",
"self",
",",
"message",
")",
":",
"lines",
"=",
"message",
".",
"split",
"(",
"'\\n'",
")",
"for",
"line",
"in",
"lines",
":",
"image",
"=",
"None",
"if",
"'output_format[png]'",
"in",
"line",
":",
"line",
",",
"http_tail",
... | https://github.com/IBM/watson-online-store/blob/4c8b60883b319f07c3187d9cb433ef9c3ae29aea/python-flask-server/server.py#L57-L66 | ||
raiden-network/raiden | 76c68b426a6f81f173b9a2c09bd88a610502c38b | raiden/raiden_service.py | python | RaidenService._trigger_state_change_effects | (
self,
new_state: ChainState,
state_changes: List[StateChange],
events: List[Event],
) | Trigger effects that are based on processed state changes.
Examples are MS/PFS updates, transport communication channel updates
and presence checks. | Trigger effects that are based on processed state changes. | [
"Trigger",
"effects",
"that",
"are",
"based",
"on",
"processed",
"state",
"changes",
"."
] | def _trigger_state_change_effects(
self,
new_state: ChainState,
state_changes: List[StateChange],
events: List[Event],
) -> List[Greenlet]:
"""Trigger effects that are based on processed state changes.
Examples are MS/PFS updates, transport communication channel upda... | [
"def",
"_trigger_state_change_effects",
"(",
"self",
",",
"new_state",
":",
"ChainState",
",",
"state_changes",
":",
"List",
"[",
"StateChange",
"]",
",",
"events",
":",
"List",
"[",
"Event",
"]",
",",
")",
"->",
"List",
"[",
"Greenlet",
"]",
":",
"# For s... | https://github.com/raiden-network/raiden/blob/76c68b426a6f81f173b9a2c09bd88a610502c38b/raiden/raiden_service.py#L912-L995 | ||
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/config_models/defaults.py | python | instance_kerberos_auth | (field, value) | return 'disabled' | [] | def instance_kerberos_auth(field, value):
return 'disabled' | [
"def",
"instance_kerberos_auth",
"(",
"field",
",",
"value",
")",
":",
"return",
"'disabled'"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/config_models/defaults.py#L105-L106 | |||
bigaidream-projects/drmad | a4bb6010595d956f29c5a42a095bab76a60b29eb | cpu_ver/experiments/exp1/exact/exact.py | python | run | () | return all_L2_regs, all_tests_rates, all_avg_regs | [] | def run():
RS = RandomState((seed, "top_rs"))
all_data = mnist.load_data_as_dict()
train_data, tests_data = random_partition(all_data, RS, [N_train, N_tests])
w_parser, pred_fun, loss_fun, frac_err = make_nn_funs(layer_sizes)
N_weights = w_parser.vect.size
def transform_weights(z_vect, transfor... | [
"def",
"run",
"(",
")",
":",
"RS",
"=",
"RandomState",
"(",
"(",
"seed",
",",
"\"top_rs\"",
")",
")",
"all_data",
"=",
"mnist",
".",
"load_data_as_dict",
"(",
")",
"train_data",
",",
"tests_data",
"=",
"random_partition",
"(",
"all_data",
",",
"RS",
",",... | https://github.com/bigaidream-projects/drmad/blob/a4bb6010595d956f29c5a42a095bab76a60b29eb/cpu_ver/experiments/exp1/exact/exact.py#L35-L132 | |||
hzlzh/AlfredWorkflow.com | 7055f14f6922c80ea5943839eb0caff11ae57255 | Sources/Workflows/Rotten-Tomatoes/PyAl/Request/requests/packages/oauthlib/oauth2/draft25/__init__.py | python | Client.prepare_request_body | (self, *args, **kwargs) | Abstract method used to create request bodies. | Abstract method used to create request bodies. | [
"Abstract",
"method",
"used",
"to",
"create",
"request",
"bodies",
"."
] | def prepare_request_body(self, *args, **kwargs):
"""Abstract method used to create request bodies."""
raise NotImplementedError("Must be implemented by inheriting classes.") | [
"def",
"prepare_request_body",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"Must be implemented by inheriting classes.\"",
")"
] | https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/Rotten-Tomatoes/PyAl/Request/requests/packages/oauthlib/oauth2/draft25/__init__.py#L140-L142 | ||
dit/dit | 2853cb13110c5a5b2fa7ad792e238e2177013da2 | dit/rate_distortion/curves.py | python | IBCurve.plot | (self, downsample=5) | return plotter.plot(downsample) | Construct an IBPlotter and utilize it to plot the information
bottleneck curve.
Parameters
----------
downsample : int
The how frequent to display points along the IB curve.
Returns
-------
fig : plt.figure
The resulting figure. | Construct an IBPlotter and utilize it to plot the information
bottleneck curve. | [
"Construct",
"an",
"IBPlotter",
"and",
"utilize",
"it",
"to",
"plot",
"the",
"information",
"bottleneck",
"curve",
"."
] | def plot(self, downsample=5): # pragma: no cover
"""
Construct an IBPlotter and utilize it to plot the information
bottleneck curve.
Parameters
----------
downsample : int
The how frequent to display points along the IB curve.
Returns
------... | [
"def",
"plot",
"(",
"self",
",",
"downsample",
"=",
"5",
")",
":",
"# pragma: no cover",
"from",
".",
"plotting",
"import",
"IBPlotter",
"plotter",
"=",
"IBPlotter",
"(",
"self",
")",
"return",
"plotter",
".",
"plot",
"(",
"downsample",
")"
] | https://github.com/dit/dit/blob/2853cb13110c5a5b2fa7ad792e238e2177013da2/dit/rate_distortion/curves.py#L513-L530 | |
tztztztztz/eql.detectron2 | 29224acf4ea549c53264e6229da69868bd5470f3 | detectron2/structures/instances.py | python | Instances.get_fields | (self) | return self._fields | Returns:
dict: a dict which maps names (str) to data of the fields
Modifying the returned dict will modify this instance. | Returns:
dict: a dict which maps names (str) to data of the fields | [
"Returns",
":",
"dict",
":",
"a",
"dict",
"which",
"maps",
"names",
"(",
"str",
")",
"to",
"data",
"of",
"the",
"fields"
] | def get_fields(self) -> Dict[str, Any]:
"""
Returns:
dict: a dict which maps names (str) to data of the fields
Modifying the returned dict will modify this instance.
"""
return self._fields | [
"def",
"get_fields",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"self",
".",
"_fields"
] | https://github.com/tztztztztz/eql.detectron2/blob/29224acf4ea549c53264e6229da69868bd5470f3/detectron2/structures/instances.py#L97-L104 | |
StevenLiuWen/ano_pred_cvpr2018 | 06ad21027f96f06d8cfe7ce47133b82e89631d4c | Codes/flownet2/src/net.py | python | Net.loss | (self, **kwargs) | return | Accepts prediction Tensors from the output of `model`.
Returns a single Tensor representing the total loss of the model. | Accepts prediction Tensors from the output of `model`.
Returns a single Tensor representing the total loss of the model. | [
"Accepts",
"prediction",
"Tensors",
"from",
"the",
"output",
"of",
"model",
".",
"Returns",
"a",
"single",
"Tensor",
"representing",
"the",
"total",
"loss",
"of",
"the",
"model",
"."
] | def loss(self, **kwargs):
"""
Accepts prediction Tensors from the output of `model`.
Returns a single Tensor representing the total loss of the model.
"""
return | [
"def",
"loss",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return"
] | https://github.com/StevenLiuWen/ano_pred_cvpr2018/blob/06ad21027f96f06d8cfe7ce47133b82e89631d4c/Codes/flownet2/src/net.py#L38-L43 | |
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/Python3/nntplib.py | python | _NNTPBase.head | (self, message_spec=None, *, file=None) | return self._artcmd(cmd, file) | Process a HEAD command. Argument:
- message_spec: article number or message id
- file: filename string or file object to store the headers in
Returns:
- resp: server response if successful
- ArticleInfo: (article number, message id, list of header lines) | Process a HEAD command. Argument:
- message_spec: article number or message id
- file: filename string or file object to store the headers in
Returns:
- resp: server response if successful
- ArticleInfo: (article number, message id, list of header lines) | [
"Process",
"a",
"HEAD",
"command",
".",
"Argument",
":",
"-",
"message_spec",
":",
"article",
"number",
"or",
"message",
"id",
"-",
"file",
":",
"filename",
"string",
"or",
"file",
"object",
"to",
"store",
"the",
"headers",
"in",
"Returns",
":",
"-",
"re... | def head(self, message_spec=None, *, file=None):
"""Process a HEAD command. Argument:
- message_spec: article number or message id
- file: filename string or file object to store the headers in
Returns:
- resp: server response if successful
- ArticleInfo: (article number... | [
"def",
"head",
"(",
"self",
",",
"message_spec",
"=",
"None",
",",
"*",
",",
"file",
"=",
"None",
")",
":",
"if",
"message_spec",
"is",
"not",
"None",
":",
"cmd",
"=",
"'HEAD {0}'",
".",
"format",
"(",
"message_spec",
")",
"else",
":",
"cmd",
"=",
... | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/nntplib.py#L730-L742 | |
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/site-packages/pip/_vendor/requests/models.py | python | Response.json | (self, **kwargs) | return complexjson.loads(self.text, **kwargs) | r"""Returns the json-encoded content of a response, if any.
:param \*\*kwargs: Optional arguments that ``json.loads`` takes.
:raises ValueError: If the response body does not contain valid json. | r"""Returns the json-encoded content of a response, if any. | [
"r",
"Returns",
"the",
"json",
"-",
"encoded",
"content",
"of",
"a",
"response",
"if",
"any",
"."
] | def json(self, **kwargs):
r"""Returns the json-encoded content of a response, if any.
:param \*\*kwargs: Optional arguments that ``json.loads`` takes.
:raises ValueError: If the response body does not contain valid json.
"""
if not self.encoding and self.content and len(self.co... | [
"def",
"json",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"encoding",
"and",
"self",
".",
"content",
"and",
"len",
"(",
"self",
".",
"content",
")",
">",
"3",
":",
"# No encoding set. JSON RFC 4627 section 3 states we should ex... | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/site-packages/pip/_vendor/requests/models.py#L873-L897 | |
fxsjy/jiebademo | ba3e5a34cd84b612e13f4dfb9f3ec037928c4339 | jiebademo/bottle.py | python | html_escape | (string) | return string.replace('&','&').replace('<','<').replace('>','>')\
.replace('"','"').replace("'",''') | Escape HTML special characters ``&<>`` and quotes ``'"``. | Escape HTML special characters ``&<>`` and quotes ``'"``. | [
"Escape",
"HTML",
"special",
"characters",
"&<",
">",
"and",
"quotes",
"."
] | def html_escape(string):
''' Escape HTML special characters ``&<>`` and quotes ``'"``. '''
return string.replace('&','&').replace('<','<').replace('>','>')\
.replace('"','"').replace("'",''') | [
"def",
"html_escape",
"(",
"string",
")",
":",
"return",
"string",
".",
"replace",
"(",
"'&'",
",",
"'&'",
")",
".",
"replace",
"(",
"'<'",
",",
"'<'",
")",
".",
"replace",
"(",
"'>'",
",",
"'>'",
")",
".",
"replace",
"(",
"'\"'",
",",
"'... | https://github.com/fxsjy/jiebademo/blob/ba3e5a34cd84b612e13f4dfb9f3ec037928c4339/jiebademo/bottle.py#L1961-L1964 | |
rigetti/grove | dc6bf6ec63e8c435fe52b1e00f707d5ce4cdb9b3 | grove/tomography/operator_utils.py | python | OperatorBasis.__eq__ | (self, other) | return (self.labels == other.labels and all(
[(my_op - o_op).norm(FROBENIUS) < EPS for (my_op, o_op) in zip(self.ops, other.ops)])) | [] | def __eq__(self, other):
return (self.labels == other.labels and all(
[(my_op - o_op).norm(FROBENIUS) < EPS for (my_op, o_op) in zip(self.ops, other.ops)])) | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"return",
"(",
"self",
".",
"labels",
"==",
"other",
".",
"labels",
"and",
"all",
"(",
"[",
"(",
"my_op",
"-",
"o_op",
")",
".",
"norm",
"(",
"FROBENIUS",
")",
"<",
"EPS",
"for",
"(",
"my_op",... | https://github.com/rigetti/grove/blob/dc6bf6ec63e8c435fe52b1e00f707d5ce4cdb9b3/grove/tomography/operator_utils.py#L351-L353 | |||
microsoft/unilm | 65f15af2a307ebb64cfb25adf54375b002e6fe8d | xtune/src/transformers/modeling_tf_gpt2.py | python | gelu | (x) | return x * cdf | Gaussian Error Linear Unit.
This is a smoother version of the RELU.
Original paper: https://arxiv.org/abs/1606.08415
Args:
x: float Tensor to perform activation.
Returns:
`x` with the GELU activation applied. | Gaussian Error Linear Unit.
This is a smoother version of the RELU.
Original paper: https://arxiv.org/abs/1606.08415
Args:
x: float Tensor to perform activation.
Returns:
`x` with the GELU activation applied. | [
"Gaussian",
"Error",
"Linear",
"Unit",
".",
"This",
"is",
"a",
"smoother",
"version",
"of",
"the",
"RELU",
".",
"Original",
"paper",
":",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1606",
".",
"08415",
"Args",
":",
"x",
":",
"float",
... | def gelu(x):
"""Gaussian Error Linear Unit.
This is a smoother version of the RELU.
Original paper: https://arxiv.org/abs/1606.08415
Args:
x: float Tensor to perform activation.
Returns:
`x` with the GELU activation applied.
"""
cdf = 0.5 * (1.0 + tf.tanh((np.sqrt(2 / np.pi) ... | [
"def",
"gelu",
"(",
"x",
")",
":",
"cdf",
"=",
"0.5",
"*",
"(",
"1.0",
"+",
"tf",
".",
"tanh",
"(",
"(",
"np",
".",
"sqrt",
"(",
"2",
"/",
"np",
".",
"pi",
")",
"*",
"(",
"x",
"+",
"0.044715",
"*",
"tf",
".",
"pow",
"(",
"x",
",",
"3",
... | https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/xtune/src/transformers/modeling_tf_gpt2.py#L46-L56 | |
haiwen/seahub | e92fcd44e3e46260597d8faa9347cb8222b8b10d | seahub/tags/models.py | python | FileUUIDMapManager.get_fileuuidmaps_by_parent_path | (self, repo_id, parent_path) | return uuids | [] | def get_fileuuidmaps_by_parent_path(self, repo_id, parent_path):
repo_id, parent_path = self.model.get_origin_repo_id_and_parent_path(repo_id, parent_path)
parent_path = FileUUIDMap.normalize_path(parent_path)
uuids = super(FileUUIDMapManager, self).filter(
repo_id=repo_id, parent_pa... | [
"def",
"get_fileuuidmaps_by_parent_path",
"(",
"self",
",",
"repo_id",
",",
"parent_path",
")",
":",
"repo_id",
",",
"parent_path",
"=",
"self",
".",
"model",
".",
"get_origin_repo_id_and_parent_path",
"(",
"repo_id",
",",
"parent_path",
")",
"parent_path",
"=",
"... | https://github.com/haiwen/seahub/blob/e92fcd44e3e46260597d8faa9347cb8222b8b10d/seahub/tags/models.py#L64-L70 | |||
prody/ProDy | b24bbf58aa8fffe463c8548ae50e3955910e5b7f | prody/atomic/dihedral.py | python | Dihedral.setACSIndex | (self, index) | Set the coordinate set at *index* active. | Set the coordinate set at *index* active. | [
"Set",
"the",
"coordinate",
"set",
"at",
"*",
"index",
"*",
"active",
"."
] | def setACSIndex(self, index):
"""Set the coordinate set at *index* active."""
if self._ag._coords is None:
raise AttributeError('coordinates are not set')
if not isinstance(index, Integral):
raise TypeError('index must be an integer')
n_csets = self._ag._n_cset... | [
"def",
"setACSIndex",
"(",
"self",
",",
"index",
")",
":",
"if",
"self",
".",
"_ag",
".",
"_coords",
"is",
"None",
":",
"raise",
"AttributeError",
"(",
"'coordinates are not set'",
")",
"if",
"not",
"isinstance",
"(",
"index",
",",
"Integral",
")",
":",
... | https://github.com/prody/ProDy/blob/b24bbf58aa8fffe463c8548ae50e3955910e5b7f/prody/atomic/dihedral.py#L120-L136 | ||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/heapq.py | python | heapreplace | (heap, item) | return returnitem | Pop and return the current smallest value, and add the new item.
This is more efficient than heappop() followed by heappush(), and can be
more appropriate when using a fixed-size heap. Note that the value
returned may be larger than item! That constrains reasonable uses of
this routine unless written... | Pop and return the current smallest value, and add the new item. | [
"Pop",
"and",
"return",
"the",
"current",
"smallest",
"value",
"and",
"add",
"the",
"new",
"item",
"."
] | def heapreplace(heap, item):
"""Pop and return the current smallest value, and add the new item.
This is more efficient than heappop() followed by heappush(), and can be
more appropriate when using a fixed-size heap. Note that the value
returned may be larger than item! That constrains reasonable use... | [
"def",
"heapreplace",
"(",
"heap",
",",
"item",
")",
":",
"returnitem",
"=",
"heap",
"[",
"0",
"]",
"# raises appropriate IndexError if heap is empty",
"heap",
"[",
"0",
"]",
"=",
"item",
"_siftup",
"(",
"heap",
",",
"0",
")",
"return",
"returnitem"
] | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/heapq.py#L145-L159 | |
yiranran/Audio-driven-TalkingFace-HeadPose | d062a00a46a5d0ebb4bf66751e7a9af92ee418e8 | Audio/code/convolutional_rnn/module.py | python | ConvNdRNNBase.__init__ | (self,
mode,
in_channels,
out_channels,
kernel_size,
num_layers=1,
bias=True,
batch_first=False,
dropout=0.,
bidirectional=False,
convndim=2,
... | [] | def __init__(self,
mode,
in_channels,
out_channels,
kernel_size,
num_layers=1,
bias=True,
batch_first=False,
dropout=0.,
bidirectional=False,
convndim... | [
"def",
"__init__",
"(",
"self",
",",
"mode",
",",
"in_channels",
",",
"out_channels",
",",
"kernel_size",
",",
"num_layers",
"=",
"1",
",",
"bias",
"=",
"True",
",",
"batch_first",
"=",
"False",
",",
"dropout",
"=",
"0.",
",",
"bidirectional",
"=",
"Fals... | https://github.com/yiranran/Audio-driven-TalkingFace-HeadPose/blob/d062a00a46a5d0ebb4bf66751e7a9af92ee418e8/Audio/code/convolutional_rnn/module.py#L13-L92 | ||||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/venv/lib/python3.7/site-packages/pip/_vendor/distro.py | python | name | (pretty=False) | return _distro.name(pretty) | Return the name of the current OS distribution, as a human-readable
string.
If *pretty* is false, the name is returned without version or codename.
(e.g. "CentOS Linux")
If *pretty* is true, the version and codename are appended.
(e.g. "CentOS Linux 7.1.1503 (Core)")
**Lookup hierarchy:**
... | Return the name of the current OS distribution, as a human-readable
string. | [
"Return",
"the",
"name",
"of",
"the",
"current",
"OS",
"distribution",
"as",
"a",
"human",
"-",
"readable",
"string",
"."
] | def name(pretty=False):
"""
Return the name of the current OS distribution, as a human-readable
string.
If *pretty* is false, the name is returned without version or codename.
(e.g. "CentOS Linux")
If *pretty* is true, the version and codename are appended.
(e.g. "CentOS Linux 7.1.1503 (Co... | [
"def",
"name",
"(",
"pretty",
"=",
"False",
")",
":",
"return",
"_distro",
".",
"name",
"(",
"pretty",
")"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/venv/lib/python3.7/site-packages/pip/_vendor/distro.py#L203-L239 | |
dropbox/PyHive | b21c507a24ed2f2b0cf15b0b6abb1c43f31d3ee0 | TCLIService/ttypes.py | python | TGetPrimaryKeysReq.__ne__ | (self, other) | return not (self == other) | [] | def __ne__(self, other):
return not (self == other) | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"return",
"not",
"(",
"self",
"==",
"other",
")"
] | https://github.com/dropbox/PyHive/blob/b21c507a24ed2f2b0cf15b0b6abb1c43f31d3ee0/TCLIService/ttypes.py#L5354-L5355 | |||
cheran-senthil/PyRival | ce94312d429f368b724cdd8d3192935e34b7ba66 | pyrival/algebra/factors.py | python | prime_factors | (n) | return Counter([n]) if f == n else prime_factors(f) + prime_factors(n // f) | returns a Counter of the prime factorization of n | returns a Counter of the prime factorization of n | [
"returns",
"a",
"Counter",
"of",
"the",
"prime",
"factorization",
"of",
"n"
] | def prime_factors(n):
"""returns a Counter of the prime factorization of n"""
if n <= 1:
return Counter()
f = pollard_rho(n)
return Counter([n]) if f == n else prime_factors(f) + prime_factors(n // f) | [
"def",
"prime_factors",
"(",
"n",
")",
":",
"if",
"n",
"<=",
"1",
":",
"return",
"Counter",
"(",
")",
"f",
"=",
"pollard_rho",
"(",
"n",
")",
"return",
"Counter",
"(",
"[",
"n",
"]",
")",
"if",
"f",
"==",
"n",
"else",
"prime_factors",
"(",
"f",
... | https://github.com/cheran-senthil/PyRival/blob/ce94312d429f368b724cdd8d3192935e34b7ba66/pyrival/algebra/factors.py#L55-L60 | |
evennia/evennia | fa79110ba6b219932f22297838e8ac72ebc0be0e | evennia/utils/evtable.py | python | EvCell._split_lines | (self, text) | return text.split("\n") | Simply split by linebreaks
Args:
text (str): text to split.
Returns:
split (list): split text. | Simply split by linebreaks | [
"Simply",
"split",
"by",
"linebreaks"
] | def _split_lines(self, text):
"""
Simply split by linebreaks
Args:
text (str): text to split.
Returns:
split (list): split text.
"""
return text.split("\n") | [
"def",
"_split_lines",
"(",
"self",
",",
"text",
")",
":",
"return",
"text",
".",
"split",
"(",
"\"\\n\"",
")"
] | https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/utils/evtable.py#L487-L497 | |
1040003585/WebScrapingWithPython | a770fa5b03894076c8c9539b1ffff34424ffc016 | portia_examle/lib/python2.7/site-packages/pip/_vendor/requests/utils.py | python | should_bypass_proxies | (url) | return False | Returns whether we should bypass proxies or not.
:rtype: bool | Returns whether we should bypass proxies or not. | [
"Returns",
"whether",
"we",
"should",
"bypass",
"proxies",
"or",
"not",
"."
] | def should_bypass_proxies(url):
"""
Returns whether we should bypass proxies or not.
:rtype: bool
"""
get_proxy = lambda k: os.environ.get(k) or os.environ.get(k.upper())
# First check whether no_proxy is defined. If it is, check that the URL
# we're getting isn't in the no_proxy list.
... | [
"def",
"should_bypass_proxies",
"(",
"url",
")",
":",
"get_proxy",
"=",
"lambda",
"k",
":",
"os",
".",
"environ",
".",
"get",
"(",
"k",
")",
"or",
"os",
".",
"environ",
".",
"get",
"(",
"k",
".",
"upper",
"(",
")",
")",
"# First check whether no_proxy ... | https://github.com/1040003585/WebScrapingWithPython/blob/a770fa5b03894076c8c9539b1ffff34424ffc016/portia_examle/lib/python2.7/site-packages/pip/_vendor/requests/utils.py#L545-L596 | |
nipy/nipy | d16d268938dcd5c15748ca051532c21f57cf8a22 | nipy/algorithms/statistics/models/model.py | python | LikelihoodModel.score | (self, theta, Y, nuisance=None) | Gradient of logL with respect to theta.
This is the score function of the model | Gradient of logL with respect to theta. | [
"Gradient",
"of",
"logL",
"with",
"respect",
"to",
"theta",
"."
] | def score(self, theta, Y, nuisance=None):
""" Gradient of logL with respect to theta.
This is the score function of the model
"""
raise NotImplementedError | [
"def",
"score",
"(",
"self",
",",
"theta",
",",
"Y",
",",
"nuisance",
"=",
"None",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/nipy/nipy/blob/d16d268938dcd5c15748ca051532c21f57cf8a22/nipy/algorithms/statistics/models/model.py#L56-L61 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/lib2to3/fixer_util.py | python | is_list | (node) | return (isinstance(node, Node)
and len(node.children) > 1
and isinstance(node.children[0], Leaf)
and isinstance(node.children[-1], Leaf)
and node.children[0].value == u"["
and node.children[-1].value == u"]") | Does the node represent a list literal? | Does the node represent a list literal? | [
"Does",
"the",
"node",
"represent",
"a",
"list",
"literal?"
] | def is_list(node):
"""Does the node represent a list literal?"""
return (isinstance(node, Node)
and len(node.children) > 1
and isinstance(node.children[0], Leaf)
and isinstance(node.children[-1], Leaf)
and node.children[0].value == u"["
and node.childr... | [
"def",
"is_list",
"(",
"node",
")",
":",
"return",
"(",
"isinstance",
"(",
"node",
",",
"Node",
")",
"and",
"len",
"(",
"node",
".",
"children",
")",
">",
"1",
"and",
"isinstance",
"(",
"node",
".",
"children",
"[",
"0",
"]",
",",
"Leaf",
")",
"a... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/lib2to3/fixer_util.py#L149-L156 | |
fluentpython/notebooks | 0f6e1e8d1686743dacd9281df7c5b5921812010a | 20-descriptor/bulkfood/bulkfood_v4.py | python | LineItem.__init__ | (self, description, weight, price) | [] | def __init__(self, description, weight, price):
self.description = description
self.weight = weight
self.price = price | [
"def",
"__init__",
"(",
"self",
",",
"description",
",",
"weight",
",",
"price",
")",
":",
"self",
".",
"description",
"=",
"description",
"self",
".",
"weight",
"=",
"weight",
"self",
".",
"price",
"=",
"price"
] | https://github.com/fluentpython/notebooks/blob/0f6e1e8d1686743dacd9281df7c5b5921812010a/20-descriptor/bulkfood/bulkfood_v4.py#L67-L70 | ||||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/euclidtools.py | python | dmp_content | (f, u, K) | Returns GCD of multivariate coefficients.
Examples
========
>>> from sympy.polys import ring, ZZ
>>> R, x,y, = ring("x,y", ZZ)
>>> R.dmp_content(2*x*y + 6*x + 4*y + 12)
2*y + 6 | Returns GCD of multivariate coefficients. | [
"Returns",
"GCD",
"of",
"multivariate",
"coefficients",
"."
] | def dmp_content(f, u, K):
"""
Returns GCD of multivariate coefficients.
Examples
========
>>> from sympy.polys import ring, ZZ
>>> R, x,y, = ring("x,y", ZZ)
>>> R.dmp_content(2*x*y + 6*x + 4*y + 12)
2*y + 6
"""
cont, v = dmp_LC(f, K), u - 1
if dmp_zero_p(f, u):
r... | [
"def",
"dmp_content",
"(",
"f",
",",
"u",
",",
"K",
")",
":",
"cont",
",",
"v",
"=",
"dmp_LC",
"(",
"f",
",",
"K",
")",
",",
"u",
"-",
"1",
"if",
"dmp_zero_p",
"(",
"f",
",",
"u",
")",
":",
"return",
"cont",
"for",
"c",
"in",
"f",
"[",
"1... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/euclidtools.py#L1819-L1847 | ||
matrix-org/synapse | 8e57584a5859a9002759963eb546d523d2498a01 | synapse/federation/transport/client.py | python | TransportLayerClient.get_group_profile | (
self, destination: str, group_id: str, requester_user_id: str
) | return await self.client.get_json(
destination=destination,
path=path,
args={"requester_user_id": requester_user_id},
ignore_backoff=True,
) | Get a group profile | Get a group profile | [
"Get",
"a",
"group",
"profile"
] | async def get_group_profile(
self, destination: str, group_id: str, requester_user_id: str
) -> JsonDict:
"""Get a group profile"""
path = _create_v1_path("/groups/%s/profile", group_id)
return await self.client.get_json(
destination=destination,
path=path,
... | [
"async",
"def",
"get_group_profile",
"(",
"self",
",",
"destination",
":",
"str",
",",
"group_id",
":",
"str",
",",
"requester_user_id",
":",
"str",
")",
"->",
"JsonDict",
":",
"path",
"=",
"_create_v1_path",
"(",
"\"/groups/%s/profile\"",
",",
"group_id",
")"... | https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/federation/transport/client.py#L684-L695 | |
aws/aws-parallelcluster | f1fe5679a01c524e7ea904c329bd6d17318c6cd9 | cli/src/pcluster/api/pcluster_api.py | python | PclusterApi.describe_cluster_instances | (
cluster_name: str, region: str, node_type: NodeType = None
) | List instances for a cluster. | List instances for a cluster. | [
"List",
"instances",
"for",
"a",
"cluster",
"."
] | def describe_cluster_instances(
cluster_name: str, region: str, node_type: NodeType = None
) -> Union[List[ClusterInstanceInfo], ApiFailure]:
"""List instances for a cluster."""
try:
if region:
os.environ["AWS_DEFAULT_REGION"] = region
cluster = Clust... | [
"def",
"describe_cluster_instances",
"(",
"cluster_name",
":",
"str",
",",
"region",
":",
"str",
",",
"node_type",
":",
"NodeType",
"=",
"None",
")",
"->",
"Union",
"[",
"List",
"[",
"ClusterInstanceInfo",
"]",
",",
"ApiFailure",
"]",
":",
"try",
":",
"if"... | https://github.com/aws/aws-parallelcluster/blob/f1fe5679a01c524e7ea904c329bd6d17318c6cd9/cli/src/pcluster/api/pcluster_api.py#L269-L286 | ||
megvii-model/SinglePathOneShot | 36eed6cf083497ffa9cfe7b8da25bb0b6ba5a452 | src/Supernet/network.py | python | ShuffleNetV2_OneShot.forward | (self, x, architecture) | return x | [] | def forward(self, x, architecture):
assert self.archLen == len(architecture)
x = self.first_conv(x)
for archs, arch_id in zip(self.features, architecture):
x = archs[arch_id](x)
x = self.conv_last(x)
x = self.globalpool(x)
x = self.dropout(x)
x = ... | [
"def",
"forward",
"(",
"self",
",",
"x",
",",
"architecture",
")",
":",
"assert",
"self",
".",
"archLen",
"==",
"len",
"(",
"architecture",
")",
"x",
"=",
"self",
".",
"first_conv",
"(",
"x",
")",
"for",
"archs",
",",
"arch_id",
"in",
"zip",
"(",
"... | https://github.com/megvii-model/SinglePathOneShot/blob/36eed6cf083497ffa9cfe7b8da25bb0b6ba5a452/src/Supernet/network.py#L77-L92 | |||
psychopy/psychopy | 01b674094f38d0e0bd51c45a6f66f671d7041696 | psychopy/visual/movie2.py | python | MovieStim2._createAudioStream | (self) | Create the audio stream player for the video using pyvlc. | Create the audio stream player for the video using pyvlc. | [
"Create",
"the",
"audio",
"stream",
"player",
"for",
"the",
"video",
"using",
"pyvlc",
"."
] | def _createAudioStream(self):
"""
Create the audio stream player for the video using pyvlc.
"""
if not os.access(self.filename, os.R_OK):
raise RuntimeError('Error: %s file not readable' % self.filename)
self._vlc_instance = vlc.Instance('--novideo')
try:
... | [
"def",
"_createAudioStream",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"access",
"(",
"self",
".",
"filename",
",",
"os",
".",
"R_OK",
")",
":",
"raise",
"RuntimeError",
"(",
"'Error: %s file not readable'",
"%",
"self",
".",
"filename",
")",
"self",
... | https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/visual/movie2.py#L376-L397 | ||
alinlab/Confident_classifier | 462db01967f8a96374f2ab6a534b7c81fd872d2f | src/calculate_log.py | python | auprOut | (dir_name) | return auprBase | [] | def auprOut(dir_name):
#calculate the AUPR
cifar = np.loadtxt('%s/confidence_Base_In.txt'%dir_name, delimiter=',')
other = np.loadtxt('%s/confidence_Base_Out.txt'%dir_name, delimiter=',')
Y1 = other
X1 = cifar
end = np.max([np.max(X1), np.max(Y1)])
start = np.min([np.min(X1),np.min(Y1)])
... | [
"def",
"auprOut",
"(",
"dir_name",
")",
":",
"#calculate the AUPR",
"cifar",
"=",
"np",
".",
"loadtxt",
"(",
"'%s/confidence_Base_In.txt'",
"%",
"dir_name",
",",
"delimiter",
"=",
"','",
")",
"other",
"=",
"np",
".",
"loadtxt",
"(",
"'%s/confidence_Base_Out.txt'... | https://github.com/alinlab/Confident_classifier/blob/462db01967f8a96374f2ab6a534b7c81fd872d2f/src/calculate_log.py#L97-L119 | |||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/somfy/api.py | python | ConfigEntrySomfyApi.refresh_tokens | (
self,
) | return self.session.token | Refresh and return new Somfy tokens using Home Assistant OAuth2 session. | Refresh and return new Somfy tokens using Home Assistant OAuth2 session. | [
"Refresh",
"and",
"return",
"new",
"Somfy",
"tokens",
"using",
"Home",
"Assistant",
"OAuth2",
"session",
"."
] | def refresh_tokens(
self,
) -> dict[str, str | int]:
"""Refresh and return new Somfy tokens using Home Assistant OAuth2 session."""
run_coroutine_threadsafe(
self.session.async_ensure_token_valid(), self.hass.loop
).result()
return self.session.token | [
"def",
"refresh_tokens",
"(",
"self",
",",
")",
"->",
"dict",
"[",
"str",
",",
"str",
"|",
"int",
"]",
":",
"run_coroutine_threadsafe",
"(",
"self",
".",
"session",
".",
"async_ensure_token_valid",
"(",
")",
",",
"self",
".",
"hass",
".",
"loop",
")",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/somfy/api.py#L29-L37 | |
awslabs/autogluon | 7309118f2ab1c9519f25acf61a283a95af95842b | common/src/autogluon/common/features/feature_metadata.py | python | FeatureMetadata.print_feature_metadata_full | (self, log_prefix='', print_only_one_special=False, log_level=20, max_list_len=5, return_str=False) | [] | def print_feature_metadata_full(self, log_prefix='', print_only_one_special=False, log_level=20, max_list_len=5, return_str=False):
feature_metadata_dict = self.to_dict(inverse=True)
if not feature_metadata_dict:
if return_str:
return ''
else:
retu... | [
"def",
"print_feature_metadata_full",
"(",
"self",
",",
"log_prefix",
"=",
"''",
",",
"print_only_one_special",
"=",
"False",
",",
"log_level",
"=",
"20",
",",
"max_list_len",
"=",
"5",
",",
"return_str",
"=",
"False",
")",
":",
"feature_metadata_dict",
"=",
"... | https://github.com/awslabs/autogluon/blob/7309118f2ab1c9519f25acf61a283a95af95842b/common/src/autogluon/common/features/feature_metadata.py#L350-L392 | ||||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/tempfile.py | python | NamedTemporaryFile | (mode='w+b', bufsize=-1, suffix="",
prefix=template, dir=None, delete=True) | return _TemporaryFileWrapper(file, name, delete) | Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the mode argument to os.fdopen (default "w+b").
'bufsize' -- the buffer size argument to os.fdopen (default -1).
'delete' -- whether the file is deleted on close (default True).
The file is crea... | Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the mode argument to os.fdopen (default "w+b").
'bufsize' -- the buffer size argument to os.fdopen (default -1).
'delete' -- whether the file is deleted on close (default True).
The file is crea... | [
"Create",
"and",
"return",
"a",
"temporary",
"file",
".",
"Arguments",
":",
"prefix",
"suffix",
"dir",
"--",
"as",
"for",
"mkstemp",
".",
"mode",
"--",
"the",
"mode",
"argument",
"to",
"os",
".",
"fdopen",
"(",
"default",
"w",
"+",
"b",
")",
".",
"bu... | def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="",
prefix=template, dir=None, delete=True):
"""Create and return a temporary file.
Arguments:
'prefix', 'suffix', 'dir' -- as for mkstemp.
'mode' -- the mode argument to os.fdopen (default "w+b").
'bufsize' -- the buffer s... | [
"def",
"NamedTemporaryFile",
"(",
"mode",
"=",
"'w+b'",
",",
"bufsize",
"=",
"-",
"1",
",",
"suffix",
"=",
"\"\"",
",",
"prefix",
"=",
"template",
",",
"dir",
"=",
"None",
",",
"delete",
"=",
"True",
")",
":",
"if",
"dir",
"is",
"None",
":",
"dir",... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/tempfile.py#L419-L449 | |
gem/oq-engine | 1bdb88f3914e390abcbd285600bfd39477aae47c | openquake/hmtk/seismicity/gcmt_catalogue.py | python | GCMTCatalogue.get_number_tensors | (self) | return len(self.gcmts) | Returns number of CMTs | Returns number of CMTs | [
"Returns",
"number",
"of",
"CMTs"
] | def get_number_tensors(self):
"""
Returns number of CMTs
"""
return len(self.gcmts) | [
"def",
"get_number_tensors",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"gcmts",
")"
] | https://github.com/gem/oq-engine/blob/1bdb88f3914e390abcbd285600bfd39477aae47c/openquake/hmtk/seismicity/gcmt_catalogue.py#L421-L425 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/core/numbers.py | python | NegativeInfinity._eval_power | (self, expt) | ``expt`` is symbolic object but not equal to 0 or 1.
================ ======= ==============================
Expression Result Notes
================ ======= ==============================
``(-oo) ** nan`` ``nan``
``(-oo) ** oo`` ``nan``
``(-oo) ** -oo`` ``nan``
... | ``expt`` is symbolic object but not equal to 0 or 1. | [
"expt",
"is",
"symbolic",
"object",
"but",
"not",
"equal",
"to",
"0",
"or",
"1",
"."
] | def _eval_power(self, expt):
"""
``expt`` is symbolic object but not equal to 0 or 1.
================ ======= ==============================
Expression Result Notes
================ ======= ==============================
``(-oo) ** nan`` ``nan``
``(-oo) *... | [
"def",
"_eval_power",
"(",
"self",
",",
"expt",
")",
":",
"if",
"isinstance",
"(",
"expt",
",",
"Number",
")",
":",
"if",
"expt",
"is",
"S",
".",
"NaN",
"or",
"expt",
"is",
"S",
".",
"Infinity",
"or",
"expt",
"is",
"S",
".",
"NegativeInfinity",
":"... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/core/numbers.py#L2384-L2418 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/tke/v20180525/models.py | python | DescribeClusterEndpointStatusRequest.__init__ | (self) | r"""
:param ClusterId: 集群ID
:type ClusterId: str
:param IsExtranet: 是否为外网访问(TRUE 外网访问 FALSE 内网访问,默认值: FALSE)
:type IsExtranet: bool | r"""
:param ClusterId: 集群ID
:type ClusterId: str
:param IsExtranet: 是否为外网访问(TRUE 外网访问 FALSE 内网访问,默认值: FALSE)
:type IsExtranet: bool | [
"r",
":",
"param",
"ClusterId",
":",
"集群ID",
":",
"type",
"ClusterId",
":",
"str",
":",
"param",
"IsExtranet",
":",
"是否为外网访问(TRUE",
"外网访问",
"FALSE",
"内网访问,默认值:",
"FALSE)",
":",
"type",
"IsExtranet",
":",
"bool"
] | def __init__(self):
r"""
:param ClusterId: 集群ID
:type ClusterId: str
:param IsExtranet: 是否为外网访问(TRUE 外网访问 FALSE 内网访问,默认值: FALSE)
:type IsExtranet: bool
"""
self.ClusterId = None
self.IsExtranet = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"ClusterId",
"=",
"None",
"self",
".",
"IsExtranet",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tke/v20180525/models.py#L3544-L3552 | ||
openstack/manila | 142990edc027e14839d5deaf4954dd6fc88de15e | manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py | python | NetAppCmodeFileStorageLibrary.create_replica | (self, context, replica_list, new_replica,
access_rules, share_snapshots, share_server=None) | return model_update | Creates the new replica on this backend and sets up SnapMirror. | Creates the new replica on this backend and sets up SnapMirror. | [
"Creates",
"the",
"new",
"replica",
"on",
"this",
"backend",
"and",
"sets",
"up",
"SnapMirror",
"."
] | def create_replica(self, context, replica_list, new_replica,
access_rules, share_snapshots, share_server=None):
"""Creates the new replica on this backend and sets up SnapMirror."""
active_replica = self.find_active_replica(replica_list)
dm_session = data_motion.DataMotion... | [
"def",
"create_replica",
"(",
"self",
",",
"context",
",",
"replica_list",
",",
"new_replica",
",",
"access_rules",
",",
"share_snapshots",
",",
"share_server",
"=",
"None",
")",
":",
"active_replica",
"=",
"self",
".",
"find_active_replica",
"(",
"replica_list",
... | https://github.com/openstack/manila/blob/142990edc027e14839d5deaf4954dd6fc88de15e/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py#L2455-L2541 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/core/indexes/api.py | python | _sanitize_and_check | (indexes) | Verify the type of indexes and convert lists to Index.
Cases:
- [list, list, ...]: Return ([list, list, ...], 'list')
- [list, Index, ...]: Return _sanitize_and_check([Index, Index, ...])
Lists are sorted and converted to Index.
- [Index, Index, ...]: Return ([Index, Index, ...], TYPE)
... | Verify the type of indexes and convert lists to Index. | [
"Verify",
"the",
"type",
"of",
"indexes",
"and",
"convert",
"lists",
"to",
"Index",
"."
] | def _sanitize_and_check(indexes):
"""
Verify the type of indexes and convert lists to Index.
Cases:
- [list, list, ...]: Return ([list, list, ...], 'list')
- [list, Index, ...]: Return _sanitize_and_check([Index, Index, ...])
Lists are sorted and converted to Index.
- [Index, Index, ..... | [
"def",
"_sanitize_and_check",
"(",
"indexes",
")",
":",
"kinds",
"=",
"list",
"(",
"{",
"type",
"(",
"index",
")",
"for",
"index",
"in",
"indexes",
"}",
")",
"if",
"list",
"in",
"kinds",
":",
"if",
"len",
"(",
"kinds",
")",
">",
"1",
":",
"indexes"... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/core/indexes/api.py#L205-L240 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/docutils/utils/math/math2html.py | python | StrikeOut.process | (self) | Set the output tag to strike. | Set the output tag to strike. | [
"Set",
"the",
"output",
"tag",
"to",
"strike",
"."
] | def process(self):
"Set the output tag to strike."
self.output.tag = 'strike' | [
"def",
"process",
"(",
"self",
")",
":",
"self",
".",
"output",
".",
"tag",
"=",
"'strike'"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/docutils/utils/math/math2html.py#L3740-L3742 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/pygments/lexers/rebol.py | python | RebolLexer.analyse_text | (text) | Check if code contains REBOL header and so it probably not R code | Check if code contains REBOL header and so it probably not R code | [
"Check",
"if",
"code",
"contains",
"REBOL",
"header",
"and",
"so",
"it",
"probably",
"not",
"R",
"code"
] | def analyse_text(text):
"""
Check if code contains REBOL header and so it probably not R code
"""
if re.match(r'^\s*REBOL\s*\[', text, re.IGNORECASE):
# The code starts with REBOL header
return 1.0
elif re.search(r'\s*REBOL\s*[', text, re.IGNORECASE):
... | [
"def",
"analyse_text",
"(",
"text",
")",
":",
"if",
"re",
".",
"match",
"(",
"r'^\\s*REBOL\\s*\\['",
",",
"text",
",",
"re",
".",
"IGNORECASE",
")",
":",
"# The code starts with REBOL header",
"return",
"1.0",
"elif",
"re",
".",
"search",
"(",
"r'\\s*REBOL\\s*... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pygments/lexers/rebol.py#L235-L244 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_atomic_container.py | python | _uninstall | (module, name) | return rc, out, err, False | uninstall an atomic container by its name. | uninstall an atomic container by its name. | [
"uninstall",
"an",
"atomic",
"container",
"by",
"its",
"name",
"."
] | def _uninstall(module, name):
''' uninstall an atomic container by its name. '''
args = ['atomic', 'uninstall', name]
rc, out, err = module.run_command(args, check_rc=False)
return rc, out, err, False | [
"def",
"_uninstall",
"(",
"module",
",",
"name",
")",
":",
"args",
"=",
"[",
"'atomic'",
",",
"'uninstall'",
",",
"name",
"]",
"rc",
",",
"out",
",",
"err",
"=",
"module",
".",
"run_command",
"(",
"args",
",",
"check_rc",
"=",
"False",
")",
"return",... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_atomic_container.py#L89-L93 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/schemes/elliptic_curves/ell_generic.py | python | EllipticCurve_generic.plot | (self, xmin=None, xmax=None, components='both', **args) | return g | Draw a graph of this elliptic curve.
The plot method is only implemented when there is a natural coercion
from the base ring of ``self`` to ``RR``. In this case, ``self`` is
plotted as if it was defined over ``RR``.
INPUT:
- ``xmin, xmax`` - (optional) points will be computed... | Draw a graph of this elliptic curve. | [
"Draw",
"a",
"graph",
"of",
"this",
"elliptic",
"curve",
"."
] | def plot(self, xmin=None, xmax=None, components='both', **args):
"""
Draw a graph of this elliptic curve.
The plot method is only implemented when there is a natural coercion
from the base ring of ``self`` to ``RR``. In this case, ``self`` is
plotted as if it was defined over ``... | [
"def",
"plot",
"(",
"self",
",",
"xmin",
"=",
"None",
",",
"xmax",
"=",
"None",
",",
"components",
"=",
"'both'",
",",
"*",
"*",
"args",
")",
":",
"RR",
"=",
"rings",
".",
"RealField",
"(",
")",
"K",
"=",
"self",
".",
"base_ring",
"(",
")",
"if... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/schemes/elliptic_curves/ell_generic.py#L2525-L2723 | |
Samsung/cotopaxi | d19178b1235017257fec20d0a41edc918de55574 | cotopaxi/active_scanner.py | python | DTLSScanner.__init__ | (self, test_params, workers=10) | Construct empty DTLSScanner object. | Construct empty DTLSScanner object. | [
"Construct",
"empty",
"DTLSScanner",
"object",
"."
] | def __init__(self, test_params, workers=10):
"""Construct empty DTLSScanner object."""
self.workers = workers
self.capabilities = DTLSInfo(test_params) | [
"def",
"__init__",
"(",
"self",
",",
"test_params",
",",
"workers",
"=",
"10",
")",
":",
"self",
".",
"workers",
"=",
"workers",
"self",
".",
"capabilities",
"=",
"DTLSInfo",
"(",
"test_params",
")"
] | https://github.com/Samsung/cotopaxi/blob/d19178b1235017257fec20d0a41edc918de55574/cotopaxi/active_scanner.py#L573-L576 | ||
cool-RR/python_toolbox | cb9ef64b48f1d03275484d707dc5079b6701ad0c | python_toolbox/wx_tools/widgets/third_party/hypertreelist.py | python | TreeListItem.GetCurrentImage | (self, column=None) | return image | Returns the current item image.
:param `column`: if not ``None``, an integer specifying the column index.
If it is ``None``, the main column index is used. | Returns the current item image. | [
"Returns",
"the",
"current",
"item",
"image",
"."
] | def GetCurrentImage(self, column=None):
"""
Returns the current item image.
:param `column`: if not ``None``, an integer specifying the column index.
If it is ``None``, the main column index is used.
"""
column = (column is not None and [column] or [self._owner.GetMain... | [
"def",
"GetCurrentImage",
"(",
"self",
",",
"column",
"=",
"None",
")",
":",
"column",
"=",
"(",
"column",
"is",
"not",
"None",
"and",
"[",
"column",
"]",
"or",
"[",
"self",
".",
"_owner",
".",
"GetMainColumn",
"(",
")",
"]",
")",
"[",
"0",
"]",
... | https://github.com/cool-RR/python_toolbox/blob/cb9ef64b48f1d03275484d707dc5079b6701ad0c/python_toolbox/wx_tools/widgets/third_party/hypertreelist.py#L1496-L1510 | |
baidu/Dialogue | 2415430e1f3997806d059455a6e5b16a2d565d06 | DGU/dgu/define_paradigm.py | python | Paradigm.create_multi_cls | (self, transformer_inst, params) | return results | create multi classify paradigm network | create multi classify paradigm network | [
"create",
"multi",
"classify",
"paradigm",
"network"
] | def create_multi_cls(self, transformer_inst, params):
"""
create multi classify paradigm network
"""
cls_feats = transformer_inst.get_pooled_output()
cls_feats = fluid.layers.dropout(
x=cls_feats,
dropout_prob=0.1,
dropout_implementation="upsca... | [
"def",
"create_multi_cls",
"(",
"self",
",",
"transformer_inst",
",",
"params",
")",
":",
"cls_feats",
"=",
"transformer_inst",
".",
"get_pooled_output",
"(",
")",
"cls_feats",
"=",
"fluid",
".",
"layers",
".",
"dropout",
"(",
"x",
"=",
"cls_feats",
",",
"dr... | https://github.com/baidu/Dialogue/blob/2415430e1f3997806d059455a6e5b16a2d565d06/DGU/dgu/define_paradigm.py#L72-L105 | |
OpenXenManager/openxenmanager | 1cb5c1cb13358ba584856e99a94f9669d17670ff | src/OXM/window_addserver.py | python | AddServer.update_connect_status | (self, server) | Animates the progress bar during connection. | Animates the progress bar during connection. | [
"Animates",
"the",
"progress",
"bar",
"during",
"connection",
"."
] | def update_connect_status(self, server):
"""
Animates the progress bar during connection.
"""
while server.connectThread.isAlive():
self.builder.get_object("progressconnect").pulse()
server.connectThread.join(1)
# TODO: what does this variable do?
... | [
"def",
"update_connect_status",
"(",
"self",
",",
"server",
")",
":",
"while",
"server",
".",
"connectThread",
".",
"isAlive",
"(",
")",
":",
"self",
".",
"builder",
".",
"get_object",
"(",
"\"progressconnect\"",
")",
".",
"pulse",
"(",
")",
"server",
".",... | https://github.com/OpenXenManager/openxenmanager/blob/1cb5c1cb13358ba584856e99a94f9669d17670ff/src/OXM/window_addserver.py#L175-L184 | ||
awslabs/autogluon | 7309118f2ab1c9519f25acf61a283a95af95842b | tabular/src/autogluon/tabular/models/tab_transformer/tab_transformer_encoder.py | python | EncBase.fit | (self, data: pd.Series, dtype=None) | return data | If dtype == 'float', clean_data will cast the contents of data to floats | If dtype == 'float', clean_data will cast the contents of data to floats | [
"If",
"dtype",
"==",
"float",
"clean_data",
"will",
"cast",
"the",
"contents",
"of",
"data",
"to",
"floats"
] | def fit(self, data: pd.Series, dtype=None):
"""
If dtype == 'float', clean_data will cast the contents of data to floats
"""
if len(pd.unique(data)) == 1:
raise WontEncodeError('Column contains only one value')
data = self.clean_data(data, dtype)
return data | [
"def",
"fit",
"(",
"self",
",",
"data",
":",
"pd",
".",
"Series",
",",
"dtype",
"=",
"None",
")",
":",
"if",
"len",
"(",
"pd",
".",
"unique",
"(",
"data",
")",
")",
"==",
"1",
":",
"raise",
"WontEncodeError",
"(",
"'Column contains only one value'",
... | https://github.com/awslabs/autogluon/blob/7309118f2ab1c9519f25acf61a283a95af95842b/tabular/src/autogluon/tabular/models/tab_transformer/tab_transformer_encoder.py#L46-L53 | |
ryanrhymes/panns | 86b14d28668ed2ac2d7cb16d2270cc63dbbcb952 | panns/index.py | python | PannsIndex.build_sequential | (self, c) | Build the index sequentially, one projection at a time.
Parameters:
c: the number of binary trees to use in building the index. | Build the index sequentially, one projection at a time. | [
"Build",
"the",
"index",
"sequentially",
"one",
"projection",
"at",
"a",
"time",
"."
] | def build_sequential(self, c):
"""
Build the index sequentially, one projection at a time.
Parameters:
c: the number of binary trees to use in building the index.
"""
for i in xrange(c):
logger.info('pass %i ...' % i)
tree = NaiveTree()
... | [
"def",
"build_sequential",
"(",
"self",
",",
"c",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"c",
")",
":",
"logger",
".",
"info",
"(",
"'pass %i ...'",
"%",
"i",
")",
"tree",
"=",
"NaiveTree",
"(",
")",
"self",
".",
"btr",
".",
"append",
"(",
"t... | https://github.com/ryanrhymes/panns/blob/86b14d28668ed2ac2d7cb16d2270cc63dbbcb952/panns/index.py#L140-L153 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.