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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pygments/pygments | cd3ad20dfc8a6cb43e2c0b22b14446dcc0a554d7 | pygments/lexers/webmisc.py | python | XQueryLexer.pushstate_operator_root_validate | (lexer, match, ctx) | [] | def pushstate_operator_root_validate(lexer, match, ctx):
yield match.start(), Keyword, match.group(1)
yield match.start(), Text, match.group(2)
yield match.start(), Punctuation, match.group(3)
ctx.stack = ['root']
lexer.xquery_parse_state.append('operator')
ctx.pos = matc... | [
"def",
"pushstate_operator_root_validate",
"(",
"lexer",
",",
"match",
",",
"ctx",
")",
":",
"yield",
"match",
".",
"start",
"(",
")",
",",
"Keyword",
",",
"match",
".",
"group",
"(",
"1",
")",
"yield",
"match",
".",
"start",
"(",
")",
",",
"Text",
"... | https://github.com/pygments/pygments/blob/cd3ad20dfc8a6cb43e2c0b22b14446dcc0a554d7/pygments/lexers/webmisc.py#L204-L210 | ||||
lovelylain/pyctp | fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d | option/ctp/ApiStruct.py | python | QueryBrokerDeposit.__init__ | (self, BrokerID='', ExchangeID='') | [] | def __init__(self, BrokerID='', ExchangeID=''):
self.BrokerID = '' #经纪公司代码, char[11]
self.ExchangeID = '' | [
"def",
"__init__",
"(",
"self",
",",
"BrokerID",
"=",
"''",
",",
"ExchangeID",
"=",
"''",
")",
":",
"self",
".",
"BrokerID",
"=",
"''",
"#经纪公司代码, char[11]",
"self",
".",
"ExchangeID",
"=",
"''"
] | https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/option/ctp/ApiStruct.py#L5238-L5240 | ||||
Tencent/QT4i | 75f8705c194505b483c6b7464da8522cd53ba679 | qt4i/icontrols.py | python | MetisView.os_type | (self) | return "ios" | 系统类型,例如"android","ios","pc" | 系统类型,例如"android","ios","pc" | [
"系统类型,例如",
"android",
",",
"ios",
",",
"pc"
] | def os_type(self):
'''系统类型,例如"android","ios","pc"
'''
return "ios" | [
"def",
"os_type",
"(",
"self",
")",
":",
"return",
"\"ios\""
] | https://github.com/Tencent/QT4i/blob/75f8705c194505b483c6b7464da8522cd53ba679/qt4i/icontrols.py#L892-L895 | |
llSourcell/AI_Artist | 3038c06c2e389b9c919c881c9a169efe2fd7810e | lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/_base.py | python | Node.insertText | (self, data, insertBefore=None) | Insert data as text in the current node, positioned before the
start of node insertBefore or to the end of the node's text. | Insert data as text in the current node, positioned before the
start of node insertBefore or to the end of the node's text. | [
"Insert",
"data",
"as",
"text",
"in",
"the",
"current",
"node",
"positioned",
"before",
"the",
"start",
"of",
"node",
"insertBefore",
"or",
"to",
"the",
"end",
"of",
"the",
"node",
"s",
"text",
"."
] | def insertText(self, data, insertBefore=None):
"""Insert data as text in the current node, positioned before the
start of node insertBefore or to the end of the node's text.
"""
raise NotImplementedError | [
"def",
"insertText",
"(",
"self",
",",
"data",
",",
"insertBefore",
"=",
"None",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/_base.py#L59-L63 | ||
Xilinx/finn | d1cc9cf94f1c33354cc169c5a6517314d0e94e3b | src/finn/custom_op/fpgadataflow/thresholding_batch.py | python | Thresholding_Batch.get_weightstream_width_padded | (self) | return roundup_to_integer_multiple(weight_width, 8) | Returns weight stream width padded to a multiple of 8. This is required
by the AXI Stream spec. Used in decoupled mode. | Returns weight stream width padded to a multiple of 8. This is required
by the AXI Stream spec. Used in decoupled mode. | [
"Returns",
"weight",
"stream",
"width",
"padded",
"to",
"a",
"multiple",
"of",
"8",
".",
"This",
"is",
"required",
"by",
"the",
"AXI",
"Stream",
"spec",
".",
"Used",
"in",
"decoupled",
"mode",
"."
] | def get_weightstream_width_padded(self):
"""Returns weight stream width padded to a multiple of 8. This is required
by the AXI Stream spec. Used in decoupled mode."""
weight_width = self.get_weightstream_width()
return roundup_to_integer_multiple(weight_width, 8) | [
"def",
"get_weightstream_width_padded",
"(",
"self",
")",
":",
"weight_width",
"=",
"self",
".",
"get_weightstream_width",
"(",
")",
"return",
"roundup_to_integer_multiple",
"(",
"weight_width",
",",
"8",
")"
] | https://github.com/Xilinx/finn/blob/d1cc9cf94f1c33354cc169c5a6517314d0e94e3b/src/finn/custom_op/fpgadataflow/thresholding_batch.py#L243-L247 | |
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/team_log.py | python | EventType.get_shared_link_settings_allow_download_disabled | (self) | return self._value | (sharing) Disabled downloads
Only call this if :meth:`is_shared_link_settings_allow_download_disabled` is true.
:rtype: SharedLinkSettingsAllowDownloadDisabledType | (sharing) Disabled downloads | [
"(",
"sharing",
")",
"Disabled",
"downloads"
] | def get_shared_link_settings_allow_download_disabled(self):
"""
(sharing) Disabled downloads
Only call this if :meth:`is_shared_link_settings_allow_download_disabled` is true.
:rtype: SharedLinkSettingsAllowDownloadDisabledType
"""
if not self.is_shared_link_settings_al... | [
"def",
"get_shared_link_settings_allow_download_disabled",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_shared_link_settings_allow_download_disabled",
"(",
")",
":",
"raise",
"AttributeError",
"(",
"\"tag 'shared_link_settings_allow_download_disabled' not set\"",
")",
"... | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L35823-L35833 | |
ubuntu/ubuntu-make | 939668aad1f4c38ffb74cce55b3678f6fded5c71 | umake/frameworks/android.py | python | AndroidPlatformTools.parse_license | (self, line, license_txt, in_license) | return self.category.parse_license('<div class="dialog-content-stretch sdk-terms">',
line, license_txt, in_license) | Parse Android SDK download page for license | Parse Android SDK download page for license | [
"Parse",
"Android",
"SDK",
"download",
"page",
"for",
"license"
] | def parse_license(self, line, license_txt, in_license):
"""Parse Android SDK download page for license"""
return self.category.parse_license('<div class="dialog-content-stretch sdk-terms">',
line, license_txt, in_license) | [
"def",
"parse_license",
"(",
"self",
",",
"line",
",",
"license_txt",
",",
"in_license",
")",
":",
"return",
"self",
".",
"category",
".",
"parse_license",
"(",
"'<div class=\"dialog-content-stretch sdk-terms\">'",
",",
"line",
",",
"license_txt",
",",
"in_license",... | https://github.com/ubuntu/ubuntu-make/blob/939668aad1f4c38ffb74cce55b3678f6fded5c71/umake/frameworks/android.py#L164-L167 | |
SigmaHQ/sigma | 6f7d28b52a6468b2430e8d7dfefb79dc01e2f1af | tools/sigma/backends/misc.py | python | GrepBackend.cleanValue | (self, val) | return re.sub("\\*", ".*", val) | [] | def cleanValue(self, val):
val = super().cleanValue(val)
val = val.replace("'","'\"'\"'")
return re.sub("\\*", ".*", val) | [
"def",
"cleanValue",
"(",
"self",
",",
"val",
")",
":",
"val",
"=",
"super",
"(",
")",
".",
"cleanValue",
"(",
"val",
")",
"val",
"=",
"val",
".",
"replace",
"(",
"\"'\"",
",",
"\"'\\\"'\\\"'\"",
")",
"return",
"re",
".",
"sub",
"(",
"\"\\\\*\"",
"... | https://github.com/SigmaHQ/sigma/blob/6f7d28b52a6468b2430e8d7dfefb79dc01e2f1af/tools/sigma/backends/misc.py#L32-L35 | |||
twisted/twisted | dee676b040dd38b847ea6fb112a712cb5e119490 | src/twisted/mail/interfaces.py | python | IMailboxIMAP.getUIDNext | () | Return the likely UID for the next message added to this mailbox.
@rtype: L{int} | Return the likely UID for the next message added to this mailbox. | [
"Return",
"the",
"likely",
"UID",
"for",
"the",
"next",
"message",
"added",
"to",
"this",
"mailbox",
"."
] | def getUIDNext():
"""
Return the likely UID for the next message added to this mailbox.
@rtype: L{int}
""" | [
"def",
"getUIDNext",
"(",
")",
":"
] | https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/mail/interfaces.py#L623-L628 | ||
RaRe-Technologies/gensim | 8b8203d8df354673732dff635283494a33d0d422 | gensim/models/doc2vec.py | python | Doc2Vec.__str__ | (self) | return '%s<%s>' % (self.__class__.__name__, ','.join(segments)) | Abbreviated name reflecting major configuration parameters.
Returns
-------
str
Human readable representation of the models internal state. | Abbreviated name reflecting major configuration parameters. | [
"Abbreviated",
"name",
"reflecting",
"major",
"configuration",
"parameters",
"."
] | def __str__(self):
"""Abbreviated name reflecting major configuration parameters.
Returns
-------
str
Human readable representation of the models internal state.
"""
segments = []
if self.comment:
segments.append('"%s"' % self.comment)
... | [
"def",
"__str__",
"(",
"self",
")",
":",
"segments",
"=",
"[",
"]",
"if",
"self",
".",
"comment",
":",
"segments",
".",
"append",
"(",
"'\"%s\"'",
"%",
"self",
".",
"comment",
")",
"if",
"self",
".",
"sg",
":",
"if",
"self",
".",
"dbow_words",
":",... | https://github.com/RaRe-Technologies/gensim/blob/8b8203d8df354673732dff635283494a33d0d422/gensim/models/doc2vec.py#L677-L716 | |
digidotcom/xbee-python | 0757f4be0017530c205175fbee8f9f61be9614d1 | digi/xbee/packets/filesystem.py | python | RemoteFSRequestPacket.needs_id | (self) | return True | Override method.
.. seealso::
| :meth:`.XBeeAPIPacket.needs_id` | Override method. | [
"Override",
"method",
"."
] | def needs_id(self):
"""
Override method.
.. seealso::
| :meth:`.XBeeAPIPacket.needs_id`
"""
return True | [
"def",
"needs_id",
"(",
"self",
")",
":",
"return",
"True"
] | https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/packets/filesystem.py#L440-L447 | |
shiweibsw/Translation-Tools | 2fbbf902364e557fa7017f9a74a8797b7440c077 | venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/html5lib/treewalkers/base.py | python | TreeWalker.startTag | (self, namespace, name, attrs) | return {"type": "StartTag",
"name": name,
"namespace": namespace,
"data": attrs} | [] | def startTag(self, namespace, name, attrs):
return {"type": "StartTag",
"name": name,
"namespace": namespace,
"data": attrs} | [
"def",
"startTag",
"(",
"self",
",",
"namespace",
",",
"name",
",",
"attrs",
")",
":",
"return",
"{",
"\"type\"",
":",
"\"StartTag\"",
",",
"\"name\"",
":",
"name",
",",
"\"namespace\"",
":",
"namespace",
",",
"\"data\"",
":",
"attrs",
"}"
] | https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/html5lib/treewalkers/base.py#L37-L41 | |||
rigetti/pyquil | 36987ecb78d5dc85d299dd62395b7669a1cedd5a | pyquil/latex/_diagram.py | python | DiagramBuilder._build_generic_unitary | (self) | Update the partial diagram with a unitary operation.
Advances the index by one. | Update the partial diagram with a unitary operation. | [
"Update",
"the",
"partial",
"diagram",
"with",
"a",
"unitary",
"operation",
"."
] | def _build_generic_unitary(self) -> None:
"""
Update the partial diagram with a unitary operation.
Advances the index by one.
"""
assert self.working_instructions is not None
instr = self.working_instructions[self.index]
assert isinstance(instr, Gate)
qub... | [
"def",
"_build_generic_unitary",
"(",
"self",
")",
"->",
"None",
":",
"assert",
"self",
".",
"working_instructions",
"is",
"not",
"None",
"instr",
"=",
"self",
".",
"working_instructions",
"[",
"self",
".",
"index",
"]",
"assert",
"isinstance",
"(",
"instr",
... | https://github.com/rigetti/pyquil/blob/36987ecb78d5dc85d299dd62395b7669a1cedd5a/pyquil/latex/_diagram.py#L484-L517 | ||
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/analyses/decompiler/peephole_optimizations/basepointeroffset_add_n.py | python | BasePointerOffsetAddN.optimize | (self, expr: BinaryOp) | return None | [] | def optimize(self, expr: BinaryOp):
if (expr.op in ("Add", "Sub")
and isinstance(expr.operands[0], BasePointerOffset)
and isinstance(expr.operands[1], Const)
):
offset = expr.operands[0].offset
if expr.op == "Add":
offset += expr.o... | [
"def",
"optimize",
"(",
"self",
",",
"expr",
":",
"BinaryOp",
")",
":",
"if",
"(",
"expr",
".",
"op",
"in",
"(",
"\"Add\"",
",",
"\"Sub\"",
")",
"and",
"isinstance",
"(",
"expr",
".",
"operands",
"[",
"0",
"]",
",",
"BasePointerOffset",
")",
"and",
... | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/analyses/decompiler/peephole_optimizations/basepointeroffset_add_n.py#L12-L33 | |||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/schemes/toric/library.py | python | ToricVarietyFactory._make_ToricVariety | (self, name, coordinate_names, base_ring) | return self.__dict__[dict_key] | r"""
Construct a toric variety and cache the result.
INPUT:
- ``name`` -- string. One of the pre-defined names in the
``toric_varieties_rays_cones`` data structure.
- ``coordinate_names`` -- A string describing the names of the
homogeneous coordinates of the toric ... | r"""
Construct a toric variety and cache the result. | [
"r",
"Construct",
"a",
"toric",
"variety",
"and",
"cache",
"the",
"result",
"."
] | def _make_ToricVariety(self, name, coordinate_names, base_ring):
r"""
Construct a toric variety and cache the result.
INPUT:
- ``name`` -- string. One of the pre-defined names in the
``toric_varieties_rays_cones`` data structure.
- ``coordinate_names`` -- A string de... | [
"def",
"_make_ToricVariety",
"(",
"self",
",",
"name",
",",
"coordinate_names",
",",
"base_ring",
")",
":",
"rays",
",",
"cones",
"=",
"toric_varieties_rays_cones",
"[",
"name",
"]",
"if",
"coordinate_names",
"is",
"None",
":",
"dict_key",
"=",
"(",
"name",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/schemes/toric/library.py#L192-L230 | |
DataDog/dd-trace-py | 13f9c6c1a8b4820365b299ab204f2bb5189d2a49 | ddtrace/vendor/psutil/_pswindows.py | python | WindowsService.username | (self) | return self._query_config()['username'] | The name of the user that owns this service. | The name of the user that owns this service. | [
"The",
"name",
"of",
"the",
"user",
"that",
"owns",
"this",
"service",
"."
] | def username(self):
"""The name of the user that owns this service."""
return self._query_config()['username'] | [
"def",
"username",
"(",
"self",
")",
":",
"return",
"self",
".",
"_query_config",
"(",
")",
"[",
"'username'",
"]"
] | https://github.com/DataDog/dd-trace-py/blob/13f9c6c1a8b4820365b299ab204f2bb5189d2a49/ddtrace/vendor/psutil/_pswindows.py#L592-L594 | |
Antergos/Cnchi | 13ac2209da9432d453e0097cf48a107640b563a9 | src/misc/nm.py | python | NetworkManagerWidget.__init__ | (self) | Init widget | Init widget | [
"Init",
"widget"
] | def __init__(self):
""" Init widget """
Gtk.Box.__init__(self)
self.set_orientation(Gtk.Orientation.VERTICAL)
self.set_spacing(12)
self.password_entry = Gtk.Entry()
self.view = NetworkManagerTreeView(self.password_entry,
self.sta... | [
"def",
"__init__",
"(",
"self",
")",
":",
"Gtk",
".",
"Box",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"set_orientation",
"(",
"Gtk",
".",
"Orientation",
".",
"VERTICAL",
")",
"self",
".",
"set_spacing",
"(",
"12",
")",
"self",
".",
"password_ent... | https://github.com/Antergos/Cnchi/blob/13ac2209da9432d453e0097cf48a107640b563a9/src/misc/nm.py#L493-L523 | ||
hasegaw/IkaLog | bd476da541fcc296f792d4db76a6b9174c4777ad | ikalog/utils/image_filters/filters.py | python | ImageFilter.__call__ | (self, img_bgr=None, img_gray=None) | return self._run_filter(img_bgr=img_bgr, img_gray=img_gray) | [] | def __call__(self, img_bgr=None, img_gray=None):
return self._run_filter(img_bgr=img_bgr, img_gray=img_gray) | [
"def",
"__call__",
"(",
"self",
",",
"img_bgr",
"=",
"None",
",",
"img_gray",
"=",
"None",
")",
":",
"return",
"self",
".",
"_run_filter",
"(",
"img_bgr",
"=",
"img_bgr",
",",
"img_gray",
"=",
"img_gray",
")"
] | https://github.com/hasegaw/IkaLog/blob/bd476da541fcc296f792d4db76a6b9174c4777ad/ikalog/utils/image_filters/filters.py#L46-L47 | |||
pycrypto/pycrypto | 7acba5f3a6ff10f1424c309d0d34d2b713233019 | lib/Crypto/Cipher/ARC2.py | python | new | (key, *args, **kwargs) | return RC2Cipher(key, *args, **kwargs) | Create a new RC2 cipher
:Parameters:
key : byte string
The secret key to use in the symmetric cipher.
Its length can vary from 1 to 128 bytes.
:Keywords:
mode : a *MODE_** constant
The chaining mode to use for encryption or decryption.
Default is `MODE_ECB`.
IV... | Create a new RC2 cipher | [
"Create",
"a",
"new",
"RC2",
"cipher"
] | def new(key, *args, **kwargs):
"""Create a new RC2 cipher
:Parameters:
key : byte string
The secret key to use in the symmetric cipher.
Its length can vary from 1 to 128 bytes.
:Keywords:
mode : a *MODE_** constant
The chaining mode to use for encryption or decryption.
... | [
"def",
"new",
"(",
"key",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"RC2Cipher",
"(",
"key",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/pycrypto/pycrypto/blob/7acba5f3a6ff10f1424c309d0d34d2b713233019/lib/Crypto/Cipher/ARC2.py#L73-L119 | |
facebookresearch/ParlAI | e4d59c30eef44f1f67105961b82a83fd28d7d78b | parlai/core/params.py | python | ParlaiParser.add_model_args | (self) | Add arguments related to models such as model files. | Add arguments related to models such as model files. | [
"Add",
"arguments",
"related",
"to",
"models",
"such",
"as",
"model",
"files",
"."
] | def add_model_args(self):
"""
Add arguments related to models such as model files.
"""
model_args = self.add_argument_group('ParlAI Model Arguments')
model_args.add_argument(
'-m',
'--model',
default=None,
help='the model class name... | [
"def",
"add_model_args",
"(",
"self",
")",
":",
"model_args",
"=",
"self",
".",
"add_argument_group",
"(",
"'ParlAI Model Arguments'",
")",
"model_args",
".",
"add_argument",
"(",
"'-m'",
",",
"'--model'",
",",
"default",
"=",
"None",
",",
"help",
"=",
"'the m... | https://github.com/facebookresearch/ParlAI/blob/e4d59c30eef44f1f67105961b82a83fd28d7d78b/parlai/core/params.py#L787-L816 | ||
Tencent/FaceDetection-DSFD | 09deec4376f397a1124f71bc81210fadfaac296e | model/resnet.py | python | resnet50 | (pretrained=False) | return model | Constructs a ResNet-50 model.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet | Constructs a ResNet-50 model.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet | [
"Constructs",
"a",
"ResNet",
"-",
"50",
"model",
".",
"Args",
":",
"pretrained",
"(",
"bool",
")",
":",
"If",
"True",
"returns",
"a",
"model",
"pre",
"-",
"trained",
"on",
"ImageNet"
] | def resnet50(pretrained=False):
'''Constructs a ResNet-50 model.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet
'''
model = ResNet(Bottleneck, [3, 4, 6, 3])
if pretrained:
model.load_state_dict(model_zoo.load_url(model_urls['resnet50']))
return model | [
"def",
"resnet50",
"(",
"pretrained",
"=",
"False",
")",
":",
"model",
"=",
"ResNet",
"(",
"Bottleneck",
",",
"[",
"3",
",",
"4",
",",
"6",
",",
"3",
"]",
")",
"if",
"pretrained",
":",
"model",
".",
"load_state_dict",
"(",
"model_zoo",
".",
"load_url... | https://github.com/Tencent/FaceDetection-DSFD/blob/09deec4376f397a1124f71bc81210fadfaac296e/model/resnet.py#L185-L193 | |
taomujian/linbing | fe772a58f41e3b046b51a866bdb7e4655abaf51a | python/main.py | python | pause_scan | (request : VueRequest) | 暂停扫描的接口
:param:
:return str response: 需要返回的数据 | 暂停扫描的接口 | [
"暂停扫描的接口"
] | async def pause_scan(request : VueRequest):
"""
暂停扫描的接口
:param:
:return str response: 需要返回的数据
"""
try:
response = {'code': '', 'message': '', 'data': ''}
request = rsa_crypto.decrypt(request.data)
request = json.loads(request)
target = request['target']
... | [
"async",
"def",
"pause_scan",
"(",
"request",
":",
"VueRequest",
")",
":",
"try",
":",
"response",
"=",
"{",
"'code'",
":",
"''",
",",
"'message'",
":",
"''",
",",
"'data'",
":",
"''",
"}",
"request",
"=",
"rsa_crypto",
".",
"decrypt",
"(",
"request",
... | https://github.com/taomujian/linbing/blob/fe772a58f41e3b046b51a866bdb7e4655abaf51a/python/main.py#L746-L793 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/collections/__init__.py | python | ChainMap.clear | (self) | Clear maps[0], leaving maps[1:] intact. | Clear maps[0], leaving maps[1:] intact. | [
"Clear",
"maps",
"[",
"0",
"]",
"leaving",
"maps",
"[",
"1",
":",
"]",
"intact",
"."
] | def clear(self):
'Clear maps[0], leaving maps[1:] intact.'
self.maps[0].clear() | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"maps",
"[",
"0",
"]",
".",
"clear",
"(",
")"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/collections/__init__.py#L986-L988 | ||
microsoft/botbuilder-python | 3d410365461dc434df59bdfeaa2f16d28d9df868 | libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_turn_result.py | python | DialogTurnResult.status | (self) | return self._status | Gets or sets the current status of the stack.
:return self._status: The status of the stack.
:rtype self._status: :class:`DialogTurnStatus` | Gets or sets the current status of the stack. | [
"Gets",
"or",
"sets",
"the",
"current",
"status",
"of",
"the",
"stack",
"."
] | def status(self):
"""
Gets or sets the current status of the stack.
:return self._status: The status of the stack.
:rtype self._status: :class:`DialogTurnStatus`
"""
return self._status | [
"def",
"status",
"(",
"self",
")",
":",
"return",
"self",
".",
"_status"
] | https://github.com/microsoft/botbuilder-python/blob/3d410365461dc434df59bdfeaa2f16d28d9df868/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_turn_result.py#L23-L30 | |
kaaedit/kaa | e6a8819a5ecba04b7db8303bd5736b5a7c9b822d | kaa/cui/color.py | python | LightPalette.__init__ | (self) | [] | def __init__(self):
super().__init__()
self.COLOR256_TO_16[self.BASE02] = curses.COLOR_BLUE
self.COLOR256_TO_16[self.BASE3] = curses.COLOR_CYAN
self.COLOR256_TO_16[self.YELLOW] = curses.COLOR_YELLOW
self.COLOR256_TO_16[self.WHITE] = curses.COLOR_WHITE
if self.num_colors... | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"COLOR256_TO_16",
"[",
"self",
".",
"BASE02",
"]",
"=",
"curses",
".",
"COLOR_BLUE",
"self",
".",
"COLOR256_TO_16",
"[",
"self",
".",
"BASE3",
"]",
"... | https://github.com/kaaedit/kaa/blob/e6a8819a5ecba04b7db8303bd5736b5a7c9b822d/kaa/cui/color.py#L378-L399 | ||||
pysmt/pysmt | ade4dc2a825727615033a96d31c71e9f53ce4764 | pysmt/solvers/bdd.py | python | BddConverter.walk_forall | (self, formula, args, **kwargs) | return res | [] | def walk_forall(self, formula, args, **kwargs):
f = args[0]
cube = self.cube_from_var_list(formula.quantifier_vars())
res = self.ddmanager.UnivAbstract(f, cube)
return res | [
"def",
"walk_forall",
"(",
"self",
",",
"formula",
",",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"f",
"=",
"args",
"[",
"0",
"]",
"cube",
"=",
"self",
".",
"cube_from_var_list",
"(",
"formula",
".",
"quantifier_vars",
"(",
")",
")",
"res",
"=",
"... | https://github.com/pysmt/pysmt/blob/ade4dc2a825727615033a96d31c71e9f53ce4764/pysmt/solvers/bdd.py#L329-L333 | |||
Podshot/MCEdit-Unified | 90abfb170c65b877ac67193e717fa3a3ded635dd | release.py | python | get_version | () | return VERSION | Returns the name of the current version | Returns the name of the current version | [
"Returns",
"the",
"name",
"of",
"the",
"current",
"version"
] | def get_version():
'''
Returns the name of the current version
'''
return VERSION | [
"def",
"get_version",
"(",
")",
":",
"return",
"VERSION"
] | https://github.com/Podshot/MCEdit-Unified/blob/90abfb170c65b877ac67193e717fa3a3ded635dd/release.py#L33-L37 | |
salesforce/awd-lstm-lm | 32fcb42562aeb5c7e6c9dec3f2a3baaaf68a5cb5 | data.py | python | Corpus.tokenize | (self, path) | return ids | Tokenizes a text file. | Tokenizes a text file. | [
"Tokenizes",
"a",
"text",
"file",
"."
] | def tokenize(self, path):
"""Tokenizes a text file."""
assert os.path.exists(path)
# Add words to the dictionary
with open(path, 'r') as f:
tokens = 0
for line in f:
words = line.split() + ['<eos>']
tokens += len(words)
... | [
"def",
"tokenize",
"(",
"self",
",",
"path",
")",
":",
"assert",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
"# Add words to the dictionary",
"with",
"open",
"(",
"path",
",",
"'r'",
")",
"as",
"f",
":",
"tokens",
"=",
"0",
"for",
"line",
"in... | https://github.com/salesforce/awd-lstm-lm/blob/32fcb42562aeb5c7e6c9dec3f2a3baaaf68a5cb5/data.py#L34-L56 | |
Cadene/tensorflow-model-zoo.torch | 990b10ffc22d4c8eacb2a502f20415b4f70c74c2 | models/research/adv_imagenet_models/inception_resnet_v2.py | python | inception_resnet_v2_base | (inputs,
final_endpoint='Conv2d_7b_1x1',
output_stride=16,
align_feature_maps=False,
scope=None) | Inception model from http://arxiv.org/abs/1602.07261.
Constructs an Inception Resnet v2 network from inputs to the given final
endpoint. This method can construct the network up to the final inception
block Conv2d_7b_1x1.
Args:
inputs: a tensor of size [batch_size, height, width, channels].
final_end... | Inception model from http://arxiv.org/abs/1602.07261. | [
"Inception",
"model",
"from",
"http",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1602",
".",
"07261",
"."
] | def inception_resnet_v2_base(inputs,
final_endpoint='Conv2d_7b_1x1',
output_stride=16,
align_feature_maps=False,
scope=None):
"""Inception model from http://arxiv.org/abs/1602.07261.
Constructs an I... | [
"def",
"inception_resnet_v2_base",
"(",
"inputs",
",",
"final_endpoint",
"=",
"'Conv2d_7b_1x1'",
",",
"output_stride",
"=",
"16",
",",
"align_feature_maps",
"=",
"False",
",",
"scope",
"=",
"None",
")",
":",
"if",
"output_stride",
"!=",
"8",
"and",
"output_strid... | https://github.com/Cadene/tensorflow-model-zoo.torch/blob/990b10ffc22d4c8eacb2a502f20415b4f70c74c2/models/research/adv_imagenet_models/inception_resnet_v2.py#L95-L268 | ||
GraylinKim/sc2reader | d69feb4e0be597581040588193579d29e8241431 | sc2reader/objects.py | python | User.url | (self) | return self.URL_TEMPLATE.format(**self.__dict__) | The player's formatted Battle.net profile url | The player's formatted Battle.net profile url | [
"The",
"player",
"s",
"formatted",
"Battle",
".",
"net",
"profile",
"url"
] | def url(self):
"""The player's formatted Battle.net profile url"""
return self.URL_TEMPLATE.format(**self.__dict__) | [
"def",
"url",
"(",
"self",
")",
":",
"return",
"self",
".",
"URL_TEMPLATE",
".",
"format",
"(",
"*",
"*",
"self",
".",
"__dict__",
")"
] | https://github.com/GraylinKim/sc2reader/blob/d69feb4e0be597581040588193579d29e8241431/sc2reader/objects.py#L242-L244 | |
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/bdb.py | python | Bdb.clear_all_breaks | (self) | return None | Delete all existing breakpoints.
If none were set, return an error message. | Delete all existing breakpoints. | [
"Delete",
"all",
"existing",
"breakpoints",
"."
] | def clear_all_breaks(self):
"""Delete all existing breakpoints.
If none were set, return an error message.
"""
if not self.breaks:
return 'There are no breakpoints'
for bp in Breakpoint.bpbynumber:
if bp:
bp.deleteMe()
self.breaks ... | [
"def",
"clear_all_breaks",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"breaks",
":",
"return",
"'There are no breakpoints'",
"for",
"bp",
"in",
"Breakpoint",
".",
"bpbynumber",
":",
"if",
"bp",
":",
"bp",
".",
"deleteMe",
"(",
")",
"self",
".",
"br... | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/bdb.py#L442-L453 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/multiprocessing/pool.py | python | Pool._help_stuff_finish | (inqueue, task_handler, size) | [] | def _help_stuff_finish(inqueue, task_handler, size):
# task_handler may be blocked trying to put items on inqueue
debug('removing tasks from inqueue until task handler finished')
inqueue._rlock.acquire()
while task_handler.is_alive() and inqueue._reader.poll():
inqueue._reade... | [
"def",
"_help_stuff_finish",
"(",
"inqueue",
",",
"task_handler",
",",
"size",
")",
":",
"# task_handler may be blocked trying to put items on inqueue",
"debug",
"(",
"'removing tasks from inqueue until task handler finished'",
")",
"inqueue",
".",
"_rlock",
".",
"acquire",
"... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/multiprocessing/pool.py#L468-L474 | ||||
opsmop/opsmop | 376ca587f8c5f9ca8ed1829909d075c339066034 | opsmop/callbacks/callback.py | python | BaseCallbacks.setup_logger | (self) | return logger | [] | def setup_logger(self):
path = UserDefaults.log_path()
dirname = os.path.dirname(path)
if not os.path.exists(dirname):
os.makedirs(dirname, 0o770)
logger = logging.getLogger('opsmop')
logger.setLevel(logging.DEBUG)
handler = logging.handlers.RotatingFileHandle... | [
"def",
"setup_logger",
"(",
"self",
")",
":",
"path",
"=",
"UserDefaults",
".",
"log_path",
"(",
")",
"dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dirname",
")",
":",
"os"... | https://github.com/opsmop/opsmop/blob/376ca587f8c5f9ca8ed1829909d075c339066034/opsmop/callbacks/callback.py#L34-L45 | |||
ifwe/digsby | f5fe00244744aa131e07f09348d10563f3d8fa99 | digsby/src/yahoo/yahooutil.py | python | filename_from_url | (url) | return unquote_plus(_filematch.search(url).group(1)) | Returns a normally formatted filename from a file transfer URL.
>> filename_from_url("http://fs.yahoo.com/name/.tmp/filename.txt?adfadfa'")
filename.txt | Returns a normally formatted filename from a file transfer URL. | [
"Returns",
"a",
"normally",
"formatted",
"filename",
"from",
"a",
"file",
"transfer",
"URL",
"."
] | def filename_from_url(url):
'''
Returns a normally formatted filename from a file transfer URL.
>> filename_from_url("http://fs.yahoo.com/name/.tmp/filename.txt?adfadfa'")
filename.txt
'''
return unquote_plus(_filematch.search(url).group(1)) | [
"def",
"filename_from_url",
"(",
"url",
")",
":",
"return",
"unquote_plus",
"(",
"_filematch",
".",
"search",
"(",
"url",
")",
".",
"group",
"(",
"1",
")",
")"
] | https://github.com/ifwe/digsby/blob/f5fe00244744aa131e07f09348d10563f3d8fa99/digsby/src/yahoo/yahooutil.py#L29-L37 | |
QUANTAXIS/QUANTAXIS | d6eccb97c8385854aa596d6ba8d70ec0655519ff | QUANTAXIS/QAUtil/QADate.py | python | QA_util_ms_stamp | (ms) | return ms | explanation:
直接返回不做处理
params:
* ms->
含义: 时间戳
类型: float
参数支持: []
return:
float | explanation:
直接返回不做处理 | [
"explanation",
":",
"直接返回不做处理"
] | def QA_util_ms_stamp(ms):
"""
explanation:
直接返回不做处理
params:
* ms->
含义: 时间戳
类型: float
参数支持: []
return:
float
"""
return ms | [
"def",
"QA_util_ms_stamp",
"(",
"ms",
")",
":",
"return",
"ms"
] | https://github.com/QUANTAXIS/QUANTAXIS/blob/d6eccb97c8385854aa596d6ba8d70ec0655519ff/QUANTAXIS/QAUtil/QADate.py#L327-L341 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/tabs/tabclasses.py | python | ProjectReportsTab.view | (self) | return MySavedReportsView.urlname | [] | def view(self):
from corehq.apps.reports.views import MySavedReportsView
return MySavedReportsView.urlname | [
"def",
"view",
"(",
"self",
")",
":",
"from",
"corehq",
".",
"apps",
".",
"reports",
".",
"views",
"import",
"MySavedReportsView",
"return",
"MySavedReportsView",
".",
"urlname"
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/tabs/tabclasses.py#L127-L129 | |||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/requests-2.25.1/requests/models.py | python | Response.raise_for_status | (self) | Raises :class:`HTTPError`, if one occurred. | Raises :class:`HTTPError`, if one occurred. | [
"Raises",
":",
"class",
":",
"HTTPError",
"if",
"one",
"occurred",
"."
] | def raise_for_status(self):
"""Raises :class:`HTTPError`, if one occurred."""
http_error_msg = ''
if isinstance(self.reason, bytes):
# We attempt to decode utf-8 first because some servers
# choose to localize their reason strings. If the string
# isn't utf-8... | [
"def",
"raise_for_status",
"(",
"self",
")",
":",
"http_error_msg",
"=",
"''",
"if",
"isinstance",
"(",
"self",
".",
"reason",
",",
"bytes",
")",
":",
"# We attempt to decode utf-8 first because some servers",
"# choose to localize their reason strings. If the string",
"# i... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/requests-2.25.1/requests/models.py#L933-L956 | ||
GoogleCloudPlatform/ml-on-gcp | ffd88931674e08ef6b0b20de27700ed1da61772c | example_zoo/tensorflow/models/ncf_main/official/recommendation/data_preprocessing.py | python | instantiate_pipeline | (dataset, data_dir, params, constructor_type=None,
deterministic=False) | return num_users, num_items, producer | Load and digest data CSV into a usable form.
Args:
dataset: The name of the dataset to be used.
data_dir: The root directory of the dataset.
params: dict of parameters for the run.
constructor_type: The name of the constructor subclass that should be used
for the input pipeline.
determinist... | Load and digest data CSV into a usable form. | [
"Load",
"and",
"digest",
"data",
"CSV",
"into",
"a",
"usable",
"form",
"."
] | def instantiate_pipeline(dataset, data_dir, params, constructor_type=None,
deterministic=False):
# type: (str, str, dict, typing.Optional[str], bool) -> (NCFDataset, typing.Callable)
"""Load and digest data CSV into a usable form.
Args:
dataset: The name of the dataset to be used.
... | [
"def",
"instantiate_pipeline",
"(",
"dataset",
",",
"data_dir",
",",
"params",
",",
"constructor_type",
"=",
"None",
",",
"deterministic",
"=",
"False",
")",
":",
"# type: (str, str, dict, typing.Optional[str], bool) -> (NCFDataset, typing.Callable)",
"tf",
".",
"logging",
... | https://github.com/GoogleCloudPlatform/ml-on-gcp/blob/ffd88931674e08ef6b0b20de27700ed1da61772c/example_zoo/tensorflow/models/ncf_main/official/recommendation/data_preprocessing.py#L178-L232 | |
dawsonjon/Chips-2.0 | 57a986b8df36248bb4736bd84e3e68046b8665af | chips/compiler/verilog_area.py | python | generate_CHIP | (input_file,
name,
instructions,
output_file,
allocator,
initialize_memory,
memory_size=1024,
no_tb_mode=False,
options={}) | return inputs, outputs | A big ugly function to crunch through all the instructions and generate the CHIP equivilent | A big ugly function to crunch through all the instructions and generate the CHIP equivilent | [
"A",
"big",
"ugly",
"function",
"to",
"crunch",
"through",
"all",
"the",
"instructions",
"and",
"generate",
"the",
"CHIP",
"equivilent"
] | def generate_CHIP(input_file,
name,
instructions,
output_file,
allocator,
initialize_memory,
memory_size=1024,
no_tb_mode=False,
options={}):
"""A big ugly function to crun... | [
"def",
"generate_CHIP",
"(",
"input_file",
",",
"name",
",",
"instructions",
",",
"output_file",
",",
"allocator",
",",
"initialize_memory",
",",
"memory_size",
"=",
"1024",
",",
"no_tb_mode",
"=",
"False",
",",
"options",
"=",
"{",
"}",
")",
":",
"instructi... | https://github.com/dawsonjon/Chips-2.0/blob/57a986b8df36248bb4736bd84e3e68046b8665af/chips/compiler/verilog_area.py#L244-L1609 | |
lfz/Guided-Denoise | 8881ab768d16eaf87342da4ff7dc8271e183e205 | Attackset/Iter8_ensv3_resv2_inresv2_random/nets/vgg.py | python | vgg_19 | (inputs,
num_classes=1000,
is_training=True,
dropout_keep_prob=0.5,
spatial_squeeze=True,
scope='vgg_19',
fc_conv_padding='VALID') | Oxford Net VGG 19-Layers version E Example.
Note: All the fully_connected layers have been transformed to conv2d layers.
To use in classification mode, resize input to 224x224.
Args:
inputs: a tensor of size [batch_size, height, width, channels].
num_classes: number of predicted classes.
is_tr... | Oxford Net VGG 19-Layers version E Example. | [
"Oxford",
"Net",
"VGG",
"19",
"-",
"Layers",
"version",
"E",
"Example",
"."
] | def vgg_19(inputs,
num_classes=1000,
is_training=True,
dropout_keep_prob=0.5,
spatial_squeeze=True,
scope='vgg_19',
fc_conv_padding='VALID'):
"""Oxford Net VGG 19-Layers version E Example.
Note: All the fully_connected layers have been transformed t... | [
"def",
"vgg_19",
"(",
"inputs",
",",
"num_classes",
"=",
"1000",
",",
"is_training",
"=",
"True",
",",
"dropout_keep_prob",
"=",
"0.5",
",",
"spatial_squeeze",
"=",
"True",
",",
"scope",
"=",
"'vgg_19'",
",",
"fc_conv_padding",
"=",
"'VALID'",
")",
":",
"w... | https://github.com/lfz/Guided-Denoise/blob/8881ab768d16eaf87342da4ff7dc8271e183e205/Attackset/Iter8_ensv3_resv2_inresv2_random/nets/vgg.py#L198-L261 | ||
SanPen/GridCal | d3f4566d2d72c11c7e910c9d162538ef0e60df31 | src/research/three_phase/Engine/Simulation/power_flow.py | python | PowerFlow.__init__ | (self, circuit: Circuit) | Power Flow constructor
:param circuit: | Power Flow constructor
:param circuit: | [
"Power",
"Flow",
"constructor",
":",
"param",
"circuit",
":"
] | def __init__(self, circuit: Circuit):
"""
Power Flow constructor
:param circuit:
"""
self.circuit = circuit | [
"def",
"__init__",
"(",
"self",
",",
"circuit",
":",
"Circuit",
")",
":",
"self",
".",
"circuit",
"=",
"circuit"
] | https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/research/three_phase/Engine/Simulation/power_flow.py#L8-L13 | ||
selfteaching/selfteaching-python-camp | 9982ee964b984595e7d664b07c389cddaf158f1e | 19100205/Ceasar1978/pip-19.0.3/src/pip/_vendor/pyparsing.py | python | pyparsing_common.stripHTMLTags | (s, l, tokens) | return pyparsing_common._html_stripper.transformString(tokens[0]) | Parse action to remove HTML tags from web page HTML source
Example::
# strip HTML links from normal text
text = '<td>More info at the <a href="https://github.com/pyparsing/pyparsing/wiki">pyparsing</a> wiki page</td>'
td,td_end = makeHTMLTags("TD")
table_text = ... | Parse action to remove HTML tags from web page HTML source | [
"Parse",
"action",
"to",
"remove",
"HTML",
"tags",
"from",
"web",
"page",
"HTML",
"source"
] | def stripHTMLTags(s, l, tokens):
"""Parse action to remove HTML tags from web page HTML source
Example::
# strip HTML links from normal text
text = '<td>More info at the <a href="https://github.com/pyparsing/pyparsing/wiki">pyparsing</a> wiki page</td>'
td,td_end = ... | [
"def",
"stripHTMLTags",
"(",
"s",
",",
"l",
",",
"tokens",
")",
":",
"return",
"pyparsing_common",
".",
"_html_stripper",
".",
"transformString",
"(",
"tokens",
"[",
"0",
"]",
")"
] | https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/19100205/Ceasar1978/pip-19.0.3/src/pip/_vendor/pyparsing.py#L6196-L6211 | |
CalebBell/thermo | 572a47d1b03d49fe609b8d5f826fa6a7cde00828 | thermo/phases/gibbs_excess.py | python | GibbsExcessLiquid.dVms_dP | (self) | return [0.0]*self.N | [] | def dVms_dP(self):
return [0.0]*self.N | [
"def",
"dVms_dP",
"(",
"self",
")",
":",
"return",
"[",
"0.0",
"]",
"*",
"self",
".",
"N"
] | https://github.com/CalebBell/thermo/blob/572a47d1b03d49fe609b8d5f826fa6a7cde00828/thermo/phases/gibbs_excess.py#L1114-L1115 | |||
fluentpython/example-code-2e | 80f7f84274a47579e59c29a4657691525152c9d5 | 17-it-generator/isis2json/iso2709.py | python | IsoRecord.dump | (self) | [] | def dump(self):
for field in self.directory:
print('%3s %r' % (field.tag, field.value)) | [
"def",
"dump",
"(",
"self",
")",
":",
"for",
"field",
"in",
"self",
".",
"directory",
":",
"print",
"(",
"'%3s %r'",
"%",
"(",
"field",
".",
"tag",
",",
"field",
".",
"value",
")",
")"
] | https://github.com/fluentpython/example-code-2e/blob/80f7f84274a47579e59c29a4657691525152c9d5/17-it-generator/isis2json/iso2709.py#L141-L143 | ||||
pytorch/contrib | c545fedf4f73c8e95f91fd81f2d5bf7fa9c62a61 | torchcontrib/nn/modules/linear.py | python | FiLM.forward | (self, input, gamma, beta) | return F.film(input, gamma, beta) | [] | def forward(self, input, gamma, beta):
return F.film(input, gamma, beta) | [
"def",
"forward",
"(",
"self",
",",
"input",
",",
"gamma",
",",
"beta",
")",
":",
"return",
"F",
".",
"film",
"(",
"input",
",",
"gamma",
",",
"beta",
")"
] | https://github.com/pytorch/contrib/blob/c545fedf4f73c8e95f91fd81f2d5bf7fa9c62a61/torchcontrib/nn/modules/linear.py#L35-L36 | |||
pretix/pretix | 96f694cf61345f54132cd26cdeb07d5d11b34232 | src/pretix/base/models/orders.py | python | Order.can_modify_answers | (self) | return False | ``True`` if the user can change the question answers / attendee names that are
related to the order. This checks order status and modification deadlines. It also
returns ``False`` if there are no questions that can be answered. | ``True`` if the user can change the question answers / attendee names that are
related to the order. This checks order status and modification deadlines. It also
returns ``False`` if there are no questions that can be answered. | [
"True",
"if",
"the",
"user",
"can",
"change",
"the",
"question",
"answers",
"/",
"attendee",
"names",
"that",
"are",
"related",
"to",
"the",
"order",
".",
"This",
"checks",
"order",
"status",
"and",
"modification",
"deadlines",
".",
"It",
"also",
"returns",
... | def can_modify_answers(self) -> bool:
"""
``True`` if the user can change the question answers / attendee names that are
related to the order. This checks order status and modification deadlines. It also
returns ``False`` if there are no questions that can be answered.
"""
... | [
"def",
"can_modify_answers",
"(",
"self",
")",
"->",
"bool",
":",
"from",
".",
"checkin",
"import",
"Checkin",
"if",
"self",
".",
"status",
"not",
"in",
"(",
"Order",
".",
"STATUS_PENDING",
",",
"Order",
".",
"STATUS_PAID",
",",
"Order",
".",
"STATUS_EXPIR... | https://github.com/pretix/pretix/blob/96f694cf61345f54132cd26cdeb07d5d11b34232/src/pretix/base/models/orders.py#L749-L790 | |
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | pypy/module/cpyext/setobject.py | python | PySet_Pop | (space, w_set) | return space.call_method(space.w_set, "pop", w_set) | Return a new reference to an arbitrary object in the set, and removes the
object from the set. Return NULL on failure. Raise KeyError if the
set is empty. Raise a SystemError if set is an not an instance of
set or its subtype. | Return a new reference to an arbitrary object in the set, and removes the
object from the set. Return NULL on failure. Raise KeyError if the
set is empty. Raise a SystemError if set is an not an instance of
set or its subtype. | [
"Return",
"a",
"new",
"reference",
"to",
"an",
"arbitrary",
"object",
"in",
"the",
"set",
"and",
"removes",
"the",
"object",
"from",
"the",
"set",
".",
"Return",
"NULL",
"on",
"failure",
".",
"Raise",
"KeyError",
"if",
"the",
"set",
"is",
"empty",
".",
... | def PySet_Pop(space, w_set):
"""Return a new reference to an arbitrary object in the set, and removes the
object from the set. Return NULL on failure. Raise KeyError if the
set is empty. Raise a SystemError if set is an not an instance of
set or its subtype."""
return space.call_method(space.w_set... | [
"def",
"PySet_Pop",
"(",
"space",
",",
"w_set",
")",
":",
"return",
"space",
".",
"call_method",
"(",
"space",
".",
"w_set",
",",
"\"pop\"",
",",
"w_set",
")"
] | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/pypy/module/cpyext/setobject.py#L77-L82 | |
e2nIEE/pandapower | 12bd83d7c4e1bf3fa338dab2db649c3cd3db0cfb | pandapower/shortcircuit/calc_sc.py | python | calc_sc | (net, bus=None,
fault="3ph", case='max', lv_tol_percent=10, topology="auto", ip=False,
ith=False, tk_s=1., kappa_method="C", r_fault_ohm=0., x_fault_ohm=0.,
branch_results=False, check_connectivity=True, return_all_currents=False,
inverse_y=True) | Calculates minimal or maximal symmetrical short-circuit currents.
The calculation is based on the method of the equivalent voltage source
according to DIN/IEC EN 60909.
The initial short-circuit alternating current *ikss* is the basis of the short-circuit
calculation and is therefore always calculated.
... | Calculates minimal or maximal symmetrical short-circuit currents.
The calculation is based on the method of the equivalent voltage source
according to DIN/IEC EN 60909.
The initial short-circuit alternating current *ikss* is the basis of the short-circuit
calculation and is therefore always calculated.
... | [
"Calculates",
"minimal",
"or",
"maximal",
"symmetrical",
"short",
"-",
"circuit",
"currents",
".",
"The",
"calculation",
"is",
"based",
"on",
"the",
"method",
"of",
"the",
"equivalent",
"voltage",
"source",
"according",
"to",
"DIN",
"/",
"IEC",
"EN",
"60909",
... | def calc_sc(net, bus=None,
fault="3ph", case='max', lv_tol_percent=10, topology="auto", ip=False,
ith=False, tk_s=1., kappa_method="C", r_fault_ohm=0., x_fault_ohm=0.,
branch_results=False, check_connectivity=True, return_all_currents=False,
inverse_y=True):
"""
... | [
"def",
"calc_sc",
"(",
"net",
",",
"bus",
"=",
"None",
",",
"fault",
"=",
"\"3ph\"",
",",
"case",
"=",
"'max'",
",",
"lv_tol_percent",
"=",
"10",
",",
"topology",
"=",
"\"auto\"",
",",
"ip",
"=",
"False",
",",
"ith",
"=",
"False",
",",
"tk_s",
"=",... | https://github.com/e2nIEE/pandapower/blob/12bd83d7c4e1bf3fa338dab2db649c3cd3db0cfb/pandapower/shortcircuit/calc_sc.py#L31-L151 | ||
inventree/InvenTree | 4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b | InvenTree/report/models.py | python | BillOfMaterialsReport.getSubdir | (cls) | return 'bom' | [] | def getSubdir(cls):
return 'bom' | [
"def",
"getSubdir",
"(",
"cls",
")",
":",
"return",
"'bom'"
] | https://github.com/inventree/InvenTree/blob/4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b/InvenTree/report/models.py#L419-L420 | |||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-windows/x86/PIL/ImageMode.py | python | ModeDescriptor.__str__ | (self) | return self.mode | [] | def __str__(self):
return self.mode | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"self",
".",
"mode"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/PIL/ImageMode.py#L29-L30 | |||
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/data/oweditdomain.py | python | make_dict_mapper | (
mapping: Mapping, dtype: Optional[DType] = None
) | return mapper | Wrap a `mapping` into a callable ufunc-like function with
`out`, `dtype`, `where`, ... parameters. If `dtype` is passed to
`make_dict_mapper` it is used as a the default return dtype,
otherwise the default dtype is `object`. | Wrap a `mapping` into a callable ufunc-like function with
`out`, `dtype`, `where`, ... parameters. If `dtype` is passed to
`make_dict_mapper` it is used as a the default return dtype,
otherwise the default dtype is `object`. | [
"Wrap",
"a",
"mapping",
"into",
"a",
"callable",
"ufunc",
"-",
"like",
"function",
"with",
"out",
"dtype",
"where",
"...",
"parameters",
".",
"If",
"dtype",
"is",
"passed",
"to",
"make_dict_mapper",
"it",
"is",
"used",
"as",
"a",
"the",
"default",
"return"... | def make_dict_mapper(
mapping: Mapping, dtype: Optional[DType] = None
) -> Callable:
"""
Wrap a `mapping` into a callable ufunc-like function with
`out`, `dtype`, `where`, ... parameters. If `dtype` is passed to
`make_dict_mapper` it is used as a the default return dtype,
otherwise the defau... | [
"def",
"make_dict_mapper",
"(",
"mapping",
":",
"Mapping",
",",
"dtype",
":",
"Optional",
"[",
"DType",
"]",
"=",
"None",
")",
"->",
"Callable",
":",
"_vmapper",
"=",
"np",
".",
"frompyfunc",
"(",
"mapping",
".",
"__getitem__",
",",
"1",
",",
"1",
")",... | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/data/oweditdomain.py#L2633-L2649 | |
hankcs/HanLP | 6c02812969c4827d74b404c3ad4207f71ca9165a | hanlp/utils/span_util.py | python | allowed_transitions | (constraint_type: str, labels: Dict[int, str]) | return allowed | Given labels and a constraint type, returns the allowed transitions. It will
additionally include transitions for the start and end states, which are used
by the conditional random field.
# Parameters
constraint_type : `str`, required
Indicates which constraint to apply. Current choices are
... | Given labels and a constraint type, returns the allowed transitions. It will
additionally include transitions for the start and end states, which are used
by the conditional random field. | [
"Given",
"labels",
"and",
"a",
"constraint",
"type",
"returns",
"the",
"allowed",
"transitions",
".",
"It",
"will",
"additionally",
"include",
"transitions",
"for",
"the",
"start",
"and",
"end",
"states",
"which",
"are",
"used",
"by",
"the",
"conditional",
"ra... | def allowed_transitions(constraint_type: str, labels: Dict[int, str]) -> List[Tuple[int, int]]:
"""
Given labels and a constraint type, returns the allowed transitions. It will
additionally include transitions for the start and end states, which are used
by the conditional random field.
# Parameter... | [
"def",
"allowed_transitions",
"(",
"constraint_type",
":",
"str",
",",
"labels",
":",
"Dict",
"[",
"int",
",",
"str",
"]",
")",
"->",
"List",
"[",
"Tuple",
"[",
"int",
",",
"int",
"]",
"]",
":",
"num_labels",
"=",
"len",
"(",
"labels",
")",
"start_ta... | https://github.com/hankcs/HanLP/blob/6c02812969c4827d74b404c3ad4207f71ca9165a/hanlp/utils/span_util.py#L102-L144 | |
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/pandas/core/categorical.py | python | Categorical._get_labels | (self) | return self.codes | Get the category labels (deprecated).
Deprecated, use .codes! | Get the category labels (deprecated). | [
"Get",
"the",
"category",
"labels",
"(",
"deprecated",
")",
"."
] | def _get_labels(self):
"""
Get the category labels (deprecated).
Deprecated, use .codes!
"""
warn("'labels' is deprecated. Use 'codes' instead", FutureWarning,
stacklevel=2)
return self.codes | [
"def",
"_get_labels",
"(",
"self",
")",
":",
"warn",
"(",
"\"'labels' is deprecated. Use 'codes' instead\"",
",",
"FutureWarning",
",",
"stacklevel",
"=",
"2",
")",
"return",
"self",
".",
"codes"
] | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pandas/core/categorical.py#L489-L497 | |
Azure/azure-cli | 6c1b085a0910c6c2139006fcbd8ade44006eb6dd | src/azure-cli/azure/cli/command_modules/acr/_docker_utils.py | python | get_login_credentials | (cmd,
registry_name,
tenant_suffix=None,
username=None,
password=None) | return _get_credentials(cmd,
registry_name,
tenant_suffix,
username,
password,
only_refresh_token=True,
is_login_context=True) | Try to get AAD authorization tokens or admin user credentials to log into a registry.
:param str registry_name: The name of container registry
:param str username: The username used to log into the container registry
:param str password: The password used to log into the container registry | Try to get AAD authorization tokens or admin user credentials to log into a registry.
:param str registry_name: The name of container registry
:param str username: The username used to log into the container registry
:param str password: The password used to log into the container registry | [
"Try",
"to",
"get",
"AAD",
"authorization",
"tokens",
"or",
"admin",
"user",
"credentials",
"to",
"log",
"into",
"a",
"registry",
".",
":",
"param",
"str",
"registry_name",
":",
"The",
"name",
"of",
"container",
"registry",
":",
"param",
"str",
"username",
... | def get_login_credentials(cmd,
registry_name,
tenant_suffix=None,
username=None,
password=None):
"""Try to get AAD authorization tokens or admin user credentials to log into a registry.
:param str registry_na... | [
"def",
"get_login_credentials",
"(",
"cmd",
",",
"registry_name",
",",
"tenant_suffix",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"return",
"_get_credentials",
"(",
"cmd",
",",
"registry_name",
",",
"tenant_suffix",
","... | https://github.com/Azure/azure-cli/blob/6c1b085a0910c6c2139006fcbd8ade44006eb6dd/src/azure-cli/azure/cli/command_modules/acr/_docker_utils.py#L401-L417 | |
heroku/heroku.py | cadc0a074896cf29c65a457c5c5bdb2069470af0 | heroku/models.py | python | App.collaborators | (self) | return self._h._get_resources(
resource=('apps', self.name, 'collaborators'),
obj=Collaborator, app=self
) | The collaborators for this app. | The collaborators for this app. | [
"The",
"collaborators",
"for",
"this",
"app",
"."
] | def collaborators(self):
"""The collaborators for this app."""
return self._h._get_resources(
resource=('apps', self.name, 'collaborators'),
obj=Collaborator, app=self
) | [
"def",
"collaborators",
"(",
"self",
")",
":",
"return",
"self",
".",
"_h",
".",
"_get_resources",
"(",
"resource",
"=",
"(",
"'apps'",
",",
"self",
".",
"name",
",",
"'collaborators'",
")",
",",
"obj",
"=",
"Collaborator",
",",
"app",
"=",
"self",
")"... | https://github.com/heroku/heroku.py/blob/cadc0a074896cf29c65a457c5c5bdb2069470af0/heroku/models.py#L214-L219 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/cloud/clouds/azurearm.py | python | get_location | (call=None, kwargs=None) | return config.get_cloud_config_value(
"location", vm_dict, __opts__, search_global=False
) | Return the location that is configured for this provider | Return the location that is configured for this provider | [
"Return",
"the",
"location",
"that",
"is",
"configured",
"for",
"this",
"provider"
] | def get_location(call=None, kwargs=None): # pylint: disable=unused-argument
"""
Return the location that is configured for this provider
"""
if not kwargs:
kwargs = {}
vm_dict = get_configured_provider()
vm_dict.update(kwargs)
return config.get_cloud_config_value(
"location"... | [
"def",
"get_location",
"(",
"call",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"# pylint: disable=unused-argument",
"if",
"not",
"kwargs",
":",
"kwargs",
"=",
"{",
"}",
"vm_dict",
"=",
"get_configured_provider",
"(",
")",
"vm_dict",
".",
"update",
"(... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/cloud/clouds/azurearm.py#L290-L300 | |
ricequant/rqalpha-mod-ctp | bfd40801f9a182226a911cac74660f62993eb6db | rqalpha_mod_ctp/ctp/pyctp/linux64_27/__init__.py | python | TraderApi.OnRspExecOrderAction | (self, pInputExecOrderAction, pRspInfo, nRequestID, bIsLast) | 执行宣告操作请求响应 | 执行宣告操作请求响应 | [
"执行宣告操作请求响应"
] | def OnRspExecOrderAction(self, pInputExecOrderAction, pRspInfo, nRequestID, bIsLast):
"""执行宣告操作请求响应""" | [
"def",
"OnRspExecOrderAction",
"(",
"self",
",",
"pInputExecOrderAction",
",",
"pRspInfo",
",",
"nRequestID",
",",
"bIsLast",
")",
":"
] | https://github.com/ricequant/rqalpha-mod-ctp/blob/bfd40801f9a182226a911cac74660f62993eb6db/rqalpha_mod_ctp/ctp/pyctp/linux64_27/__init__.py#L549-L550 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/pip/_vendor/pyparsing.py | python | ParserElement.parseString | ( self, instring, parseAll=False ) | Execute the parse expression with the given string.
This is the main interface to the client code, once the complete
expression has been built.
If you want the grammar to require that the entire input string be
successfully parsed, then set ``parseAll`` to True (equivalent to ending
... | Execute the parse expression with the given string.
This is the main interface to the client code, once the complete
expression has been built. | [
"Execute",
"the",
"parse",
"expression",
"with",
"the",
"given",
"string",
".",
"This",
"is",
"the",
"main",
"interface",
"to",
"the",
"client",
"code",
"once",
"the",
"complete",
"expression",
"has",
"been",
"built",
"."
] | def parseString( self, instring, parseAll=False ):
"""
Execute the parse expression with the given string.
This is the main interface to the client code, once the complete
expression has been built.
If you want the grammar to require that the entire input string be
succe... | [
"def",
"parseString",
"(",
"self",
",",
"instring",
",",
"parseAll",
"=",
"False",
")",
":",
"ParserElement",
".",
"resetCache",
"(",
")",
"if",
"not",
"self",
".",
"streamlined",
":",
"self",
".",
"streamline",
"(",
")",
"#~ self.saveAsList = True",
"for",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pip/_vendor/pyparsing.py#L1780-L1830 | ||
Cog-Creators/Red-DiscordBot | b05933274a11fb097873ab0d1b246d37b06aa306 | redbot/core/utils/chat_formatting.py | python | spoiler | (text: str, escape_formatting: bool = True) | return f"||{escape(text, formatting=escape_formatting)}||" | Get the given text as a spoiler.
Note: By default, this function will escape ``text`` prior to making the text a spoiler.
Parameters
----------
text : str
The text to be marked up.
escape_formatting : `bool`, optional
Set to :code:`False` to not escape markdown formatting in the te... | Get the given text as a spoiler. | [
"Get",
"the",
"given",
"text",
"as",
"a",
"spoiler",
"."
] | def spoiler(text: str, escape_formatting: bool = True) -> str:
"""Get the given text as a spoiler.
Note: By default, this function will escape ``text`` prior to making the text a spoiler.
Parameters
----------
text : str
The text to be marked up.
escape_formatting : `bool`, optional
... | [
"def",
"spoiler",
"(",
"text",
":",
"str",
",",
"escape_formatting",
":",
"bool",
"=",
"True",
")",
"->",
"str",
":",
"return",
"f\"||{escape(text, formatting=escape_formatting)}||\""
] | https://github.com/Cog-Creators/Red-DiscordBot/blob/b05933274a11fb097873ab0d1b246d37b06aa306/redbot/core/utils/chat_formatting.py#L182-L200 | |
Abjad/abjad | d0646dfbe83db3dc5ab268f76a0950712b87b7fd | abjad/tag.py | python | Line.__repr__ | (self) | return _format.get_repr(self) | Gets interpreter representation. | Gets interpreter representation. | [
"Gets",
"interpreter",
"representation",
"."
] | def __repr__(self) -> str:
"""
Gets interpreter representation.
"""
return _format.get_repr(self) | [
"def",
"__repr__",
"(",
"self",
")",
"->",
"str",
":",
"return",
"_format",
".",
"get_repr",
"(",
"self",
")"
] | https://github.com/Abjad/abjad/blob/d0646dfbe83db3dc5ab268f76a0950712b87b7fd/abjad/tag.py#L417-L421 | |
pfnet/pytorch-pfn-extras | b7ced31c1e78a0527c36d745ca091ec270da49e3 | example/mnist_ddp.py | python | test | (args, model, device, data, target) | The extension loops over the iterator in order to
drive the evaluator progress bar and reporting
averages | The extension loops over the iterator in order to
drive the evaluator progress bar and reporting
averages | [
"The",
"extension",
"loops",
"over",
"the",
"iterator",
"in",
"order",
"to",
"drive",
"the",
"evaluator",
"progress",
"bar",
"and",
"reporting",
"averages"
] | def test(args, model, device, data, target):
""" The extension loops over the iterator in order to
drive the evaluator progress bar and reporting
averages
"""
model.eval()
test_loss = 0.0
correct = 0
data, target = data.to(device), target.to(device)
output = model(data)
#... | [
"def",
"test",
"(",
"args",
",",
"model",
",",
"device",
",",
"data",
",",
"target",
")",
":",
"model",
".",
"eval",
"(",
")",
"test_loss",
"=",
"0.0",
"correct",
"=",
"0",
"data",
",",
"target",
"=",
"data",
".",
"to",
"(",
"device",
")",
",",
... | https://github.com/pfnet/pytorch-pfn-extras/blob/b7ced31c1e78a0527c36d745ca091ec270da49e3/example/mnist_ddp.py#L45-L60 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_gcloud/library/gcloud_dm_resource_builder.py | python | ForwardingRule.__init__ | (self,
rname,
project,
zone,
desc,
ip_address,
protocol,
region,
port_range,
target,
) | constructor for gcp resource | constructor for gcp resource | [
"constructor",
"for",
"gcp",
"resource"
] | def __init__(self,
rname,
project,
zone,
desc,
ip_address,
protocol,
region,
port_range,
target,
):
'''constructor for gcp resource'''
... | [
"def",
"__init__",
"(",
"self",
",",
"rname",
",",
"project",
",",
"zone",
",",
"desc",
",",
"ip_address",
",",
"protocol",
",",
"region",
",",
"port_range",
",",
"target",
",",
")",
":",
"super",
"(",
"ForwardingRule",
",",
"self",
")",
".",
"__init__... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_gcloud/library/gcloud_dm_resource_builder.py#L845-L863 | ||
numenta/nupic | b9ebedaf54f49a33de22d8d44dff7c765cdb5548 | external/linux32/lib/python2.6/site-packages/matplotlib/text.py | python | Text.get_fontname | (self) | return self.get_name() | alias for get_name | alias for get_name | [
"alias",
"for",
"get_name"
] | def get_fontname(self):
'alias for get_name'
return self.get_name() | [
"def",
"get_fontname",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_name",
"(",
")"
] | https://github.com/numenta/nupic/blob/b9ebedaf54f49a33de22d8d44dff7c765cdb5548/external/linux32/lib/python2.6/site-packages/matplotlib/text.py#L548-L550 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/serial/sensor.py | python | SerialSensor.native_value | (self) | return self._state | Return the state of the sensor. | Return the state of the sensor. | [
"Return",
"the",
"state",
"of",
"the",
"sensor",
"."
] | def native_value(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/serial/sensor.py#L256-L258 | |
ibis-project/ibis | e1ef8b6870ac53de9d1fe5c52851fa41872109c4 | ibis/expr/api.py | python | prevent_rewrite | (expr, client=None) | return ops.SQLQueryResult(query, expr.schema(), client).to_expr() | Prevent optimization from happening below `expr`.
Parameters
----------
expr : ir.TableExpr
Any table expression whose optimization you want to prevent
client : ibis.backends.base.Client, optional, default None
A client to use to create the SQLQueryResult operation. This is useful
... | Prevent optimization from happening below `expr`. | [
"Prevent",
"optimization",
"from",
"happening",
"below",
"expr",
"."
] | def prevent_rewrite(expr, client=None):
"""Prevent optimization from happening below `expr`.
Parameters
----------
expr : ir.TableExpr
Any table expression whose optimization you want to prevent
client : ibis.backends.base.Client, optional, default None
A client to use to create the... | [
"def",
"prevent_rewrite",
"(",
"expr",
",",
"client",
"=",
"None",
")",
":",
"if",
"client",
"is",
"None",
":",
"client",
"=",
"expr",
".",
"_find_backend",
"(",
")",
"query",
"=",
"client",
".",
"compile",
"(",
"expr",
")",
"return",
"ops",
".",
"SQ... | https://github.com/ibis-project/ibis/blob/e1ef8b6870ac53de9d1fe5c52851fa41872109c4/ibis/expr/api.py#L4673-L4692 | |
pandas-dev/pandas | 5ba7d714014ae8feaccc0dd4a98890828cf2832d | pandas/_config/config.py | python | config_prefix | (prefix) | contextmanager for multiple invocations of API with a common prefix
supported API functions: (register / get / set )__option
Warning: This is not thread - safe, and won't work properly if you import
the API functions into your module using the "from x import y" construct.
Example
-------
impo... | contextmanager for multiple invocations of API with a common prefix | [
"contextmanager",
"for",
"multiple",
"invocations",
"of",
"API",
"with",
"a",
"common",
"prefix"
] | def config_prefix(prefix):
"""
contextmanager for multiple invocations of API with a common prefix
supported API functions: (register / get / set )__option
Warning: This is not thread - safe, and won't work properly if you import
the API functions into your module using the "from x import y" const... | [
"def",
"config_prefix",
"(",
"prefix",
")",
":",
"# Note: reset_option relies on set_option, and on key directly",
"# it does not fit in to this monkey-patching scheme",
"global",
"register_option",
",",
"get_option",
",",
"set_option",
",",
"reset_option",
"def",
"wrap",
"(",
... | https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/_config/config.py#L723-L770 | ||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-windows/x86/cryptography/x509/base.py | python | RevokedCertificateBuilder.add_extension | (self, extension, critical) | return RevokedCertificateBuilder(
self._serial_number, self._revocation_date,
self._extensions + [extension]
) | [] | def add_extension(self, extension, critical):
if not isinstance(extension, ExtensionType):
raise TypeError("extension must be an ExtensionType")
extension = Extension(extension.oid, critical, extension)
_reject_duplicate_extension(extension, self._extensions)
return RevokedC... | [
"def",
"add_extension",
"(",
"self",
",",
"extension",
",",
"critical",
")",
":",
"if",
"not",
"isinstance",
"(",
"extension",
",",
"ExtensionType",
")",
":",
"raise",
"TypeError",
"(",
"\"extension must be an ExtensionType\"",
")",
"extension",
"=",
"Extension",
... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/cryptography/x509/base.py#L735-L744 | |||
magenta/magenta | be6558f1a06984faff6d6949234f5fe9ad0ffdb5 | magenta/models/latent_transfer/common.py | python | make_grid | (boundary=2.0, number_grid=50, dim_latent=2) | return ObjectBlob(z_grid=z_grid, dim_grid=dim_grid) | Helper function making 1D or 2D grid for evaluation purpose. | Helper function making 1D or 2D grid for evaluation purpose. | [
"Helper",
"function",
"making",
"1D",
"or",
"2D",
"grid",
"for",
"evaluation",
"purpose",
"."
] | def make_grid(boundary=2.0, number_grid=50, dim_latent=2):
"""Helper function making 1D or 2D grid for evaluation purpose."""
zs = np.linspace(-boundary, boundary, number_grid)
z_grid = []
if dim_latent == 1:
for x in range(number_grid):
z_grid.append([zs[x]])
dim_grid = 1
else:
for x in ran... | [
"def",
"make_grid",
"(",
"boundary",
"=",
"2.0",
",",
"number_grid",
"=",
"50",
",",
"dim_latent",
"=",
"2",
")",
":",
"zs",
"=",
"np",
".",
"linspace",
"(",
"-",
"boundary",
",",
"boundary",
",",
"number_grid",
")",
"z_grid",
"=",
"[",
"]",
"if",
... | https://github.com/magenta/magenta/blob/be6558f1a06984faff6d6949234f5fe9ad0ffdb5/magenta/models/latent_transfer/common.py#L216-L230 | |
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/optimization_tf.py | python | AdamWeightDecay.__init__ | (
self,
learning_rate: Union[float, tf.keras.optimizers.schedules.LearningRateSchedule] = 0.001,
beta_1: float = 0.9,
beta_2: float = 0.999,
epsilon: float = 1e-7,
amsgrad: bool = False,
weight_decay_rate: float = 0.0,
include_in_weight_decay: Optional[Lis... | [] | def __init__(
self,
learning_rate: Union[float, tf.keras.optimizers.schedules.LearningRateSchedule] = 0.001,
beta_1: float = 0.9,
beta_2: float = 0.999,
epsilon: float = 1e-7,
amsgrad: bool = False,
weight_decay_rate: float = 0.0,
include_in_weight_decay: ... | [
"def",
"__init__",
"(",
"self",
",",
"learning_rate",
":",
"Union",
"[",
"float",
",",
"tf",
".",
"keras",
".",
"optimizers",
".",
"schedules",
".",
"LearningRateSchedule",
"]",
"=",
"0.001",
",",
"beta_1",
":",
"float",
"=",
"0.9",
",",
"beta_2",
":",
... | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/optimization_tf.py#L191-L207 | ||||
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/api/apiextensions_v1beta1_api.py | python | ApiextensionsV1beta1Api.read_custom_resource_definition_status | (self, name, **kwargs) | return self.read_custom_resource_definition_status_with_http_info(name, **kwargs) | read_custom_resource_definition_status # noqa: E501
read status of the specified CustomResourceDefinition # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.read_custom_resource_defini... | read_custom_resource_definition_status # noqa: E501 | [
"read_custom_resource_definition_status",
"#",
"noqa",
":",
"E501"
] | def read_custom_resource_definition_status(self, name, **kwargs): # noqa: E501
"""read_custom_resource_definition_status # noqa: E501
read status of the specified CustomResourceDefinition # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HT... | [
"def",
"read_custom_resource_definition_status",
"(",
"self",
",",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"return",
"self",
".",
"read_custom_resource_definition_status_with_http_info",
"("... | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/api/apiextensions_v1beta1_api.py#L1165-L1189 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/contourcarpet/_colorbar.py | python | ColorBar.nticks | (self) | return self["nticks"] | Specifies the maximum number of ticks for the particular axis.
The actual number of ticks will be chosen automatically to be
less than or equal to `nticks`. Has an effect only if
`tickmode` is set to "auto".
The 'nticks' property is a integer and may be specified as:
- An ... | Specifies the maximum number of ticks for the particular axis.
The actual number of ticks will be chosen automatically to be
less than or equal to `nticks`. Has an effect only if
`tickmode` is set to "auto".
The 'nticks' property is a integer and may be specified as:
- An ... | [
"Specifies",
"the",
"maximum",
"number",
"of",
"ticks",
"for",
"the",
"particular",
"axis",
".",
"The",
"actual",
"number",
"of",
"ticks",
"will",
"be",
"chosen",
"automatically",
"to",
"be",
"less",
"than",
"or",
"equal",
"to",
"nticks",
".",
"Has",
"an",... | def nticks(self):
"""
Specifies the maximum number of ticks for the particular axis.
The actual number of ticks will be chosen automatically to be
less than or equal to `nticks`. Has an effect only if
`tickmode` is set to "auto".
The 'nticks' property is a integer an... | [
"def",
"nticks",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"nticks\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/contourcarpet/_colorbar.py#L331-L346 | |
hatRiot/zarp | 2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad | src/lib/scapy/layers/inet6.py | python | _ICMPv6Error.guess_payload_class | (self,p) | return IPerror6 | [] | def guess_payload_class(self,p):
return IPerror6 | [
"def",
"guess_payload_class",
"(",
"self",
",",
"p",
")",
":",
"return",
"IPerror6"
] | https://github.com/hatRiot/zarp/blob/2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad/src/lib/scapy/layers/inet6.py#L1169-L1170 | |||
Ultimaker/Uranium | 66da853cd9a04edd3a8a03526fac81e83c03f5aa | UM/Mesh/MeshData.py | python | MeshData.getFacePlane | (self, face_id: int) | return in_point, face_normal | Gets the plane the supplied face lies in. The resultant plane is specified by a point and a normal.
:param face_id: :type{int} The index of the face (not the flattened indices).
:return: :type{Tuple[numpy.ndarray, numpy.ndarray]} A plane, the 1st vector is the center, the 2nd the normal. | Gets the plane the supplied face lies in. The resultant plane is specified by a point and a normal. | [
"Gets",
"the",
"plane",
"the",
"supplied",
"face",
"lies",
"in",
".",
"The",
"resultant",
"plane",
"is",
"specified",
"by",
"a",
"point",
"and",
"a",
"normal",
"."
] | def getFacePlane(self, face_id: int) -> Tuple[numpy.ndarray, numpy.ndarray]:
"""Gets the plane the supplied face lies in. The resultant plane is specified by a point and a normal.
:param face_id: :type{int} The index of the face (not the flattened indices).
:return: :type{Tuple[numpy.ndarray, n... | [
"def",
"getFacePlane",
"(",
"self",
",",
"face_id",
":",
"int",
")",
"->",
"Tuple",
"[",
"numpy",
".",
"ndarray",
",",
"numpy",
".",
"ndarray",
"]",
":",
"v_a",
",",
"v_b",
",",
"v_c",
"=",
"self",
".",
"getFaceNodes",
"(",
"face_id",
")",
"in_point"... | https://github.com/Ultimaker/Uranium/blob/66da853cd9a04edd3a8a03526fac81e83c03f5aa/UM/Mesh/MeshData.py#L314-L324 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/phoenixdb-1.1.0/phoenixdb/avatica/client.py | python | AvaticaClient.fetch | (self, connection_id, statement_id, offset=0, frame_max_size=None) | return response.frame | Returns a frame of rows.
The frame describes whether there may be another frame. If there is not
another frame, the current iteration is done when we have finished the
rows in the this frame.
:param connection_id:
ID of the current connection.
:param statement_id:
... | Returns a frame of rows. | [
"Returns",
"a",
"frame",
"of",
"rows",
"."
] | def fetch(self, connection_id, statement_id, offset=0, frame_max_size=None):
"""Returns a frame of rows.
The frame describes whether there may be another frame. If there is not
another frame, the current iteration is done when we have finished the
rows in the this frame.
:param... | [
"def",
"fetch",
"(",
"self",
",",
"connection_id",
",",
"statement_id",
",",
"offset",
"=",
"0",
",",
"frame_max_size",
"=",
"None",
")",
":",
"request",
"=",
"requests_pb2",
".",
"FetchRequest",
"(",
")",
"request",
".",
"connection_id",
"=",
"connection_id... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/phoenixdb-1.1.0/phoenixdb/avatica/client.py#L566-L598 | |
pandas-dev/pandas | 5ba7d714014ae8feaccc0dd4a98890828cf2832d | pandas/core/arrays/datetimes.py | python | DatetimeArray.month_name | (self, locale=None) | return result | Return the month names of the DateTimeIndex with specified locale.
Parameters
----------
locale : str, optional
Locale determining the language in which to return the month name.
Default is English locale.
Returns
-------
Index
Index ... | Return the month names of the DateTimeIndex with specified locale. | [
"Return",
"the",
"month",
"names",
"of",
"the",
"DateTimeIndex",
"with",
"specified",
"locale",
"."
] | def month_name(self, locale=None):
"""
Return the month names of the DateTimeIndex with specified locale.
Parameters
----------
locale : str, optional
Locale determining the language in which to return the month name.
Default is English locale.
R... | [
"def",
"month_name",
"(",
"self",
",",
"locale",
"=",
"None",
")",
":",
"values",
"=",
"self",
".",
"_local_timestamps",
"(",
")",
"result",
"=",
"fields",
".",
"get_date_name_field",
"(",
"values",
",",
"\"month_name\"",
",",
"locale",
"=",
"locale",
")",... | https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/arrays/datetimes.py#L1218-L1246 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/plotting/pygletplot/plot_mode_base.py | python | PlotModeBase.push_wireframe | (self, function) | Push a function which performs gl commands
used to build a display list. (The list is
built outside of the function) | Push a function which performs gl commands
used to build a display list. (The list is
built outside of the function) | [
"Push",
"a",
"function",
"which",
"performs",
"gl",
"commands",
"used",
"to",
"build",
"a",
"display",
"list",
".",
"(",
"The",
"list",
"is",
"built",
"outside",
"of",
"the",
"function",
")"
] | def push_wireframe(self, function):
"""
Push a function which performs gl commands
used to build a display list. (The list is
built outside of the function)
"""
assert callable(function)
self._draw_wireframe.append(function)
if len(self._draw_wireframe) > ... | [
"def",
"push_wireframe",
"(",
"self",
",",
"function",
")",
":",
"assert",
"callable",
"(",
"function",
")",
"self",
".",
"_draw_wireframe",
".",
"append",
"(",
"function",
")",
"if",
"len",
"(",
"self",
".",
"_draw_wireframe",
")",
">",
"self",
".",
"_m... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/plotting/pygletplot/plot_mode_base.py#L181-L190 | ||
exaile/exaile | a7b58996c5c15b3aa7b9975ac13ee8f784ef4689 | xl/player/gst/engine.py | python | AudioStream.on_message | (self, bus, message) | This is called on the main thread | This is called on the main thread | [
"This",
"is",
"called",
"on",
"the",
"main",
"thread"
] | def on_message(self, bus, message):
"""
This is called on the main thread
"""
if message.type == Gst.MessageType.BUFFERING:
percent = message.parse_buffering()
if not percent < 100:
self.logger.info('Buffering complete')
if percent % 5... | [
"def",
"on_message",
"(",
"self",
",",
"bus",
",",
"message",
")",
":",
"if",
"message",
".",
"type",
"==",
"Gst",
".",
"MessageType",
".",
"BUFFERING",
":",
"percent",
"=",
"message",
".",
"parse_buffering",
"(",
")",
"if",
"not",
"percent",
"<",
"100... | https://github.com/exaile/exaile/blob/a7b58996c5c15b3aa7b9975ac13ee8f784ef4689/xl/player/gst/engine.py#L609-L691 | ||
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/CPython/27/Lib/decimal.py | python | Decimal.__rfloordiv__ | (self, other, context=None) | return other.__floordiv__(self, context=context) | Swaps self/other and returns __floordiv__. | Swaps self/other and returns __floordiv__. | [
"Swaps",
"self",
"/",
"other",
"and",
"returns",
"__floordiv__",
"."
] | def __rfloordiv__(self, other, context=None):
"""Swaps self/other and returns __floordiv__."""
other = _convert_other(other)
if other is NotImplemented:
return other
return other.__floordiv__(self, context=context) | [
"def",
"__rfloordiv__",
"(",
"self",
",",
"other",
",",
"context",
"=",
"None",
")",
":",
"other",
"=",
"_convert_other",
"(",
"other",
")",
"if",
"other",
"is",
"NotImplemented",
":",
"return",
"other",
"return",
"other",
".",
"__floordiv__",
"(",
"self",... | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/decimal.py#L1575-L1580 | |
lululxvi/deepxde | 730c97282636e86c845ce2ba3253482f2178469e | deepxde/nn/tensorflow/deeponet.py | python | DeepONetCartesianProd.call | (self, inputs, training=False) | return x | [] | def call(self, inputs, training=False):
x_func = inputs[0]
x_loc = inputs[1]
# Branch net to encode the input function
x_func = self.branch(x_func)
# Trunk net to encode the domain of the output function
if self._input_transform is not None:
x_loc = self._inp... | [
"def",
"call",
"(",
"self",
",",
"inputs",
",",
"training",
"=",
"False",
")",
":",
"x_func",
"=",
"inputs",
"[",
"0",
"]",
"x_loc",
"=",
"inputs",
"[",
"1",
"]",
"# Branch net to encode the input function",
"x_func",
"=",
"self",
".",
"branch",
"(",
"x_... | https://github.com/lululxvi/deepxde/blob/730c97282636e86c845ce2ba3253482f2178469e/deepxde/nn/tensorflow/deeponet.py#L46-L68 | |||
pulp/pulp | a0a28d804f997b6f81c391378aff2e4c90183df9 | bindings/pulp/bindings/content.py | python | OrphanContentAPI.orphans_by_type | (self, type_id) | return self.server.GET(path) | Remove all orphaned units of a specific type
:param type_id: identifier for a content type
:type type_id: str | Remove all orphaned units of a specific type
:param type_id: identifier for a content type
:type type_id: str | [
"Remove",
"all",
"orphaned",
"units",
"of",
"a",
"specific",
"type",
":",
"param",
"type_id",
":",
"identifier",
"for",
"a",
"content",
"type",
":",
"type",
"type_id",
":",
"str"
] | def orphans_by_type(self, type_id):
"""
Remove all orphaned units of a specific type
:param type_id: identifier for a content type
:type type_id: str
"""
path = self.PATH + "%s/" % type_id
return self.server.GET(path) | [
"def",
"orphans_by_type",
"(",
"self",
",",
"type_id",
")",
":",
"path",
"=",
"self",
".",
"PATH",
"+",
"\"%s/\"",
"%",
"type_id",
"return",
"self",
".",
"server",
".",
"GET",
"(",
"path",
")"
] | https://github.com/pulp/pulp/blob/a0a28d804f997b6f81c391378aff2e4c90183df9/bindings/pulp/bindings/content.py#L29-L36 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/twisted/twisted/internet/interfaces.py | python | IReactorFDSet.addWriter | (writer) | I add writer to the set of file descriptors to get write events for.
@param writer: An L{IWriteDescriptor} provider that will be checked for
write events until it is removed from the reactor with
L{removeWriter}.
@return: C{None}. | I add writer to the set of file descriptors to get write events for. | [
"I",
"add",
"writer",
"to",
"the",
"set",
"of",
"file",
"descriptors",
"to",
"get",
"write",
"events",
"for",
"."
] | def addWriter(writer):
"""
I add writer to the set of file descriptors to get write events for.
@param writer: An L{IWriteDescriptor} provider that will be checked for
write events until it is removed from the reactor with
L{removeWriter}.
... | [
"def",
"addWriter",
"(",
"writer",
")",
":"
] | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/internet/interfaces.py#L892-L901 | ||
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/lib-tk/Tkinter.py | python | Menu.insert_radiobutton | (self, index, cnf={}, **kw) | Addd radio menu item at INDEX. | Addd radio menu item at INDEX. | [
"Addd",
"radio",
"menu",
"item",
"at",
"INDEX",
"."
] | def insert_radiobutton(self, index, cnf={}, **kw):
"""Addd radio menu item at INDEX."""
self.insert(index, 'radiobutton', cnf or kw) | [
"def",
"insert_radiobutton",
"(",
"self",
",",
"index",
",",
"cnf",
"=",
"{",
"}",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"insert",
"(",
"index",
",",
"'radiobutton'",
",",
"cnf",
"or",
"kw",
")"
] | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/lib-tk/Tkinter.py#L2641-L2643 | ||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/CrowdStrikeFalconX/Integrations/CrowdStrikeFalconX/CrowdStrikeFalconX.py | python | send_uploaded_file_to_sandbox_analysis_command | (
client: Client,
sha256: str,
environment_id: str,
action_script: str = "",
command_line: str = "",
document_password: str = "",
enable_tor: str = "false",
submit_name: str = "",
system_date: str = "",
system_time: str = ""
) | return tableToMarkdown("CrowdStrike Falcon X response:", filtered_outputs), entry_context, [response] | Submit a sample SHA256 for sandbox analysis.
:param client: the client object with an access token
:param sha256: SHA256 ID of the sample, which is a SHA256 hash value
:param environment_id: specifies the sandbox environment used for analysis
:param action_script: runtime script for sandbox analysis
... | Submit a sample SHA256 for sandbox analysis.
:param client: the client object with an access token
:param sha256: SHA256 ID of the sample, which is a SHA256 hash value
:param environment_id: specifies the sandbox environment used for analysis
:param action_script: runtime script for sandbox analysis
... | [
"Submit",
"a",
"sample",
"SHA256",
"for",
"sandbox",
"analysis",
".",
":",
"param",
"client",
":",
"the",
"client",
"object",
"with",
"an",
"access",
"token",
":",
"param",
"sha256",
":",
"SHA256",
"ID",
"of",
"the",
"sample",
"which",
"is",
"a",
"SHA256... | def send_uploaded_file_to_sandbox_analysis_command(
client: Client,
sha256: str,
environment_id: str,
action_script: str = "",
command_line: str = "",
document_password: str = "",
enable_tor: str = "false",
submit_name: str = "",
system_date: str =... | [
"def",
"send_uploaded_file_to_sandbox_analysis_command",
"(",
"client",
":",
"Client",
",",
"sha256",
":",
"str",
",",
"environment_id",
":",
"str",
",",
"action_script",
":",
"str",
"=",
"\"\"",
",",
"command_line",
":",
"str",
"=",
"\"\"",
",",
"document_passw... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/CrowdStrikeFalconX/Integrations/CrowdStrikeFalconX/CrowdStrikeFalconX.py#L565-L601 | |
foremast/foremast | e8eb9bd24e975772532d90efa8a9ba1850e968cc | src/foremast/runner.py | python | ForemastRunner.check_env_defined | (self) | Checks if the current environment is defined in the pipeline files.
Raises a ForemastError if it is missing. | Checks if the current environment is defined in the pipeline files.
Raises a ForemastError if it is missing. | [
"Checks",
"if",
"the",
"current",
"environment",
"is",
"defined",
"in",
"the",
"pipeline",
"files",
".",
"Raises",
"a",
"ForemastError",
"if",
"it",
"is",
"missing",
"."
] | def check_env_defined(self):
"""Checks if the current environment is defined in the pipeline files.
Raises a ForemastError if it is missing."""
if not self.env:
raise ForemastError("Environment not set")
if self.env not in self.configs:
raise ForemastError("Enviro... | [
"def",
"check_env_defined",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"env",
":",
"raise",
"ForemastError",
"(",
"\"Environment not set\"",
")",
"if",
"self",
".",
"env",
"not",
"in",
"self",
".",
"configs",
":",
"raise",
"ForemastError",
"(",
"\"En... | https://github.com/foremast/foremast/blob/e8eb9bd24e975772532d90efa8a9ba1850e968cc/src/foremast/runner.py#L320-L327 | ||
tribe29/checkmk | 6260f2512e159e311f426e16b84b19d0b8e9ad0c | cmk/base/plugins/agent_based/brocade_optical.py | python | parse_brocade_optical | (string_table: List[type_defs.StringTable]) | return parsed | >>> from pprint import pprint
>>> pprint(parse_brocade_optical([
... [['1409', '10GigabitEthernet23/1', '6', '1'],
... ['1410', '10GigabitEthernet23/2', '6', '2'],
... ['1411', '10GigabitEthernet23/3', '6', '2'],
... ['2049', 'EthernetManagement1', '6', '1'], ['33554433', 'lb1', '24', '1'],
.... | >>> from pprint import pprint
>>> pprint(parse_brocade_optical([
... [['1409', '10GigabitEthernet23/1', '6', '1'],
... ['1410', '10GigabitEthernet23/2', '6', '2'],
... ['1411', '10GigabitEthernet23/3', '6', '2'],
... ['2049', 'EthernetManagement1', '6', '1'], ['33554433', 'lb1', '24', '1'],
.... | [
">>>",
"from",
"pprint",
"import",
"pprint",
">>>",
"pprint",
"(",
"parse_brocade_optical",
"(",
"[",
"...",
"[[",
"1409",
"10GigabitEthernet23",
"/",
"1",
"6",
"1",
"]",
"...",
"[",
"1410",
"10GigabitEthernet23",
"/",
"2",
"6",
"2",
"]",
"...",
"[",
"14... | def parse_brocade_optical(string_table: List[type_defs.StringTable]) -> Section:
"""
>>> from pprint import pprint
>>> pprint(parse_brocade_optical([
... [['1409', '10GigabitEthernet23/1', '6', '1'],
... ['1410', '10GigabitEthernet23/2', '6', '2'],
... ['1411', '10GigabitEthernet23/3', '6', '2... | [
"def",
"parse_brocade_optical",
"(",
"string_table",
":",
"List",
"[",
"type_defs",
".",
"StringTable",
"]",
")",
"->",
"Section",
":",
"if_info",
",",
"if_data",
",",
"if_ids",
",",
"lanes",
"=",
"string_table",
"parsed",
":",
"Section",
"=",
"{",
"}",
"f... | https://github.com/tribe29/checkmk/blob/6260f2512e159e311f426e16b84b19d0b8e9ad0c/cmk/base/plugins/agent_based/brocade_optical.py#L130-L221 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/rings/padics/padic_valuation.py | python | pAdicValuation_base.is_unramified | (self, G, include_steps=False, assume_squarefree=False) | r"""
Return whether ``G`` defines a single unramified extension of the
completion of the domain of this valuation.
INPUT:
- ``G`` -- a monic squarefree polynomial over the domain of this valuation
- ``include_steps`` -- a boolean (default: ``False``); whether to
incl... | r"""
Return whether ``G`` defines a single unramified extension of the
completion of the domain of this valuation. | [
"r",
"Return",
"whether",
"G",
"defines",
"a",
"single",
"unramified",
"extension",
"of",
"the",
"completion",
"of",
"the",
"domain",
"of",
"this",
"valuation",
"."
] | def is_unramified(self, G, include_steps=False, assume_squarefree=False):
r"""
Return whether ``G`` defines a single unramified extension of the
completion of the domain of this valuation.
INPUT:
- ``G`` -- a monic squarefree polynomial over the domain of this valuation
... | [
"def",
"is_unramified",
"(",
"self",
",",
"G",
",",
"include_steps",
"=",
"False",
",",
"assume_squarefree",
"=",
"False",
")",
":",
"R",
"=",
"G",
".",
"parent",
"(",
")",
"from",
"sage",
".",
"rings",
".",
"polynomial",
".",
"polynomial_ring",
"import"... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/padics/padic_valuation.py#L528-L603 | ||
psychopy/psychopy | 01b674094f38d0e0bd51c45a6f66f671d7041696 | psychopy/iohub/client/__init__.py | python | ioHubConnection.eventListToDict | (evt_data) | return EventConstants.getClass(etype).createEventAsDict(evt_data) | Convert an ioHub event currently in list value format into
the event as a dictionary of attribute name, attribute values. | Convert an ioHub event currently in list value format into
the event as a dictionary of attribute name, attribute values. | [
"Convert",
"an",
"ioHub",
"event",
"currently",
"in",
"list",
"value",
"format",
"into",
"the",
"event",
"as",
"a",
"dictionary",
"of",
"attribute",
"name",
"attribute",
"values",
"."
] | def eventListToDict(evt_data):
"""Convert an ioHub event currently in list value format into
the event as a dictionary of attribute name, attribute values."""
if isinstance(evt_data, dict):
return evt_data
etype = evt_data[DeviceEvent.EVENT_TYPE_ID_INDEX]
return Event... | [
"def",
"eventListToDict",
"(",
"evt_data",
")",
":",
"if",
"isinstance",
"(",
"evt_data",
",",
"dict",
")",
":",
"return",
"evt_data",
"etype",
"=",
"evt_data",
"[",
"DeviceEvent",
".",
"EVENT_TYPE_ID_INDEX",
"]",
"return",
"EventConstants",
".",
"getClass",
"... | https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/iohub/client/__init__.py#L1218-L1224 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/min/queue.py | python | LifoQueue._init | (self, maxsize) | [] | def _init(self, maxsize):
self.queue = [] | [
"def",
"_init",
"(",
"self",
",",
"maxsize",
")",
":",
"self",
".",
"queue",
"=",
"[",
"]"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/queue.py#L245-L246 | ||||
emesene/emesene | 4548a4098310e21b16437bb36223a7f632a4f7bc | emesene/e3/papylib/papyon/papyon/service/description/SchematizedStore/DeleteRelationships.py | python | soap_body | (cid, source_rid, target_rid) | return """<DeleteRelationships xmlns="http://www.msn.com/webservices/storage/w10">
<sourceHandle>
%s
</sourceHandle>
<targetHandles>
<ObjectHandle>
<ResourceID>
%s
</ResourceID... | Returns the SOAP xml body | Returns the SOAP xml body | [
"Returns",
"the",
"SOAP",
"xml",
"body"
] | def soap_body(cid, source_rid, target_rid):
"""Returns the SOAP xml body
"""
if cid is not None:
source_handle = """<RelationshipName>
/UserTiles
</RelationshipName>
<Alias>
<Name>
... | [
"def",
"soap_body",
"(",
"cid",
",",
"source_rid",
",",
"target_rid",
")",
":",
"if",
"cid",
"is",
"not",
"None",
":",
"source_handle",
"=",
"\"\"\"<RelationshipName>\n /UserTiles\n </RelationshipName>\n ... | https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/e3/papylib/papyon/papyon/service/description/SchematizedStore/DeleteRelationships.py#L34-L63 | |
MarioVilas/winappdbg | 975a088ac54253d0bdef39fe831e82f24b4c11f6 | winappdbg/process.py | python | Process.get_running_time | (self) | return RunningTime / 10000 | Determines how long has this process been running.
@rtype: long
@return: Process running time in milliseconds. | Determines how long has this process been running. | [
"Determines",
"how",
"long",
"has",
"this",
"process",
"been",
"running",
"."
] | def get_running_time(self):
"""
Determines how long has this process been running.
@rtype: long
@return: Process running time in milliseconds.
"""
if win32.PROCESS_ALL_ACCESS == win32.PROCESS_ALL_ACCESS_VISTA:
dwAccess = win32.PROCESS_QUERY_LIMITED_INFORMATI... | [
"def",
"get_running_time",
"(",
"self",
")",
":",
"if",
"win32",
".",
"PROCESS_ALL_ACCESS",
"==",
"win32",
".",
"PROCESS_ALL_ACCESS_VISTA",
":",
"dwAccess",
"=",
"win32",
".",
"PROCESS_QUERY_LIMITED_INFORMATION",
"else",
":",
"dwAccess",
"=",
"win32",
".",
"PROCES... | https://github.com/MarioVilas/winappdbg/blob/975a088ac54253d0bdef39fe831e82f24b4c11f6/winappdbg/process.py#L832-L850 | |
Yenthe666/Odoo_Samples | a70d5f67a363dbf92865405c4e190898ec80908a | sale/sale.py | python | sale_order_line._amount_line | (self, cr, uid, ids, field_name, arg, context=None) | return res | [] | def _amount_line(self, cr, uid, ids, field_name, arg, context=None):
tax_obj = self.pool.get('account.tax')
cur_obj = self.pool.get('res.currency')
res = {}
if context is None:
context = {}
for line in self.browse(cr, uid, ids, context=context):
price = li... | [
"def",
"_amount_line",
"(",
"self",
",",
"cr",
",",
"uid",
",",
"ids",
",",
"field_name",
",",
"arg",
",",
"context",
"=",
"None",
")",
":",
"tax_obj",
"=",
"self",
".",
"pool",
".",
"get",
"(",
"'account.tax'",
")",
"cur_obj",
"=",
"self",
".",
"p... | https://github.com/Yenthe666/Odoo_Samples/blob/a70d5f67a363dbf92865405c4e190898ec80908a/sale/sale.py#L820-L831 | |||
openstack/swift | b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100 | swift/common/middleware/s3api/controllers/multi_upload.py | python | UploadsController.POST | (self, req) | return HTTPOk(body=body, content_type='application/xml') | Handles Initiate Multipart Upload. | Handles Initiate Multipart Upload. | [
"Handles",
"Initiate",
"Multipart",
"Upload",
"."
] | def POST(self, req):
"""
Handles Initiate Multipart Upload.
"""
if len(req.object_name) > constraints.MAX_OBJECT_NAME_LENGTH:
# Note that we can still run into trouble where the MPU is just
# within the limit, which means the segment names will go over
... | [
"def",
"POST",
"(",
"self",
",",
"req",
")",
":",
"if",
"len",
"(",
"req",
".",
"object_name",
")",
">",
"constraints",
".",
"MAX_OBJECT_NAME_LENGTH",
":",
"# Note that we can still run into trouble where the MPU is just",
"# within the limit, which means the segment names ... | https://github.com/openstack/swift/blob/b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100/swift/common/middleware/s3api/controllers/multi_upload.py#L403-L460 | |
roclark/sportsipy | c19f545d3376d62ded6304b137dc69238ac620a9 | sportsipy/nba/roster.py | python | Player.points_per_poss | (self) | return self._points_per_poss | Returns a ``float`` of the total number of points the player scored
per 100 posessions. | Returns a ``float`` of the total number of points the player scored
per 100 posessions. | [
"Returns",
"a",
"float",
"of",
"the",
"total",
"number",
"of",
"points",
"the",
"player",
"scored",
"per",
"100",
"posessions",
"."
] | def points_per_poss(self):
"""
Returns a ``float`` of the total number of points the player scored
per 100 posessions.
"""
return self._points_per_poss | [
"def",
"points_per_poss",
"(",
"self",
")",
":",
"return",
"self",
".",
"_points_per_poss"
] | https://github.com/roclark/sportsipy/blob/c19f545d3376d62ded6304b137dc69238ac620a9/sportsipy/nba/roster.py#L959-L964 | |
ydkhatri/mac_apt | 729630c8bbe7a73cce3ca330305d3301a919cb07 | plugins/helpers/macinfo.py | python | MountedIosInfo._GetAppDetails | (self) | return False | Get app name, path, version, uuid, container path and other info | Get app name, path, version, uuid, container path and other info | [
"Get",
"app",
"name",
"path",
"version",
"uuid",
"container",
"path",
"and",
"other",
"info"
] | def _GetAppDetails(self):
'''Get app name, path, version, uuid, container path and other info'''
app_state_db = '/private/var/mobile/Library/FrontBoard/applicationState.db'
if self.IsValidFilePath(app_state_db):
self.ExportFile(app_state_db, 'APPS')
try:
s... | [
"def",
"_GetAppDetails",
"(",
"self",
")",
":",
"app_state_db",
"=",
"'/private/var/mobile/Library/FrontBoard/applicationState.db'",
"if",
"self",
".",
"IsValidFilePath",
"(",
"app_state_db",
")",
":",
"self",
".",
"ExportFile",
"(",
"app_state_db",
",",
"'APPS'",
")"... | https://github.com/ydkhatri/mac_apt/blob/729630c8bbe7a73cce3ca330305d3301a919cb07/plugins/helpers/macinfo.py#L2039-L2133 | |
maurosoria/dirsearch | b83e68c8fdf360ab06be670d7b92b263262ee5b1 | thirdparty/jinja2/compiler.py | python | CodeGenerator.visit_Include | (self, node: nodes.Include, frame: Frame) | Handles includes. | Handles includes. | [
"Handles",
"includes",
"."
] | def visit_Include(self, node: nodes.Include, frame: Frame) -> None:
"""Handles includes."""
if node.ignore_missing:
self.writeline("try:")
self.indent()
func_name = "get_or_select_template"
if isinstance(node.template, nodes.Const):
if isinstance(node... | [
"def",
"visit_Include",
"(",
"self",
",",
"node",
":",
"nodes",
".",
"Include",
",",
"frame",
":",
"Frame",
")",
"->",
"None",
":",
"if",
"node",
".",
"ignore_missing",
":",
"self",
".",
"writeline",
"(",
"\"try:\"",
")",
"self",
".",
"indent",
"(",
... | https://github.com/maurosoria/dirsearch/blob/b83e68c8fdf360ab06be670d7b92b263262ee5b1/thirdparty/jinja2/compiler.py#L1030-L1079 | ||
tensorflow/fold | 0e7ca14832a14a5f2009d4e0424783a80e7d7a2c | tensorflow_fold/blocks/block_compiler.py | python | Compiler.root | (self) | return self._root | Returns the root block, or None if `compile()` has not been called. | Returns the root block, or None if `compile()` has not been called. | [
"Returns",
"the",
"root",
"block",
"or",
"None",
"if",
"compile",
"()",
"has",
"not",
"been",
"called",
"."
] | def root(self):
"""Returns the root block, or None if `compile()` has not been called."""
return self._root | [
"def",
"root",
"(",
"self",
")",
":",
"return",
"self",
".",
"_root"
] | https://github.com/tensorflow/fold/blob/0e7ca14832a14a5f2009d4e0424783a80e7d7a2c/tensorflow_fold/blocks/block_compiler.py#L270-L272 | |
ucbdrive/3d-vehicle-tracking | 8ee189f6792897651bb56bb2950ce07c9629a89d | 3d-tracking/model/tracker_model.py | python | KalmanBoxTracker.update | (self, bbox) | Updates the state vector with observed bbox. | Updates the state vector with observed bbox. | [
"Updates",
"the",
"state",
"vector",
"with",
"observed",
"bbox",
"."
] | def update(self, bbox):
"""
Updates the state vector with observed bbox.
"""
self.time_since_update = 0
self.history = []
self.hits += 1
self.hit_streak += 1
self.kf.update(convert_bbox_to_z(bbox))
self.lost = False | [
"def",
"update",
"(",
"self",
",",
"bbox",
")",
":",
"self",
".",
"time_since_update",
"=",
"0",
"self",
".",
"history",
"=",
"[",
"]",
"self",
".",
"hits",
"+=",
"1",
"self",
".",
"hit_streak",
"+=",
"1",
"self",
".",
"kf",
".",
"update",
"(",
"... | https://github.com/ucbdrive/3d-vehicle-tracking/blob/8ee189f6792897651bb56bb2950ce07c9629a89d/3d-tracking/model/tracker_model.py#L55-L64 | ||
avocado-framework/avocado | 1f9b3192e8ba47d029c33fe21266bd113d17811f | avocado/utils/iso9660.py | python | Iso9660Mount.read | (self, path) | Read data from path
:param path: path to read data
:type path: str
:return: data content
:rtype: str | Read data from path | [
"Read",
"data",
"from",
"path"
] | def read(self, path):
"""
Read data from path
:param path: path to read data
:type path: str
:return: data content
:rtype: str
"""
full_path = os.path.join(self.mnt_dir, path)
with open(full_path, 'rb') as file_to_read:
return bytes(fi... | [
"def",
"read",
"(",
"self",
",",
"path",
")",
":",
"full_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"mnt_dir",
",",
"path",
")",
"with",
"open",
"(",
"full_path",
",",
"'rb'",
")",
"as",
"file_to_read",
":",
"return",
"bytes",
"(... | https://github.com/avocado-framework/avocado/blob/1f9b3192e8ba47d029c33fe21266bd113d17811f/avocado/utils/iso9660.py#L324-L335 | ||
guoruoqian/DetNet_pytorch | 735e2c51eea0ee4e91d2ec3f28e441ac4e076551 | lib/pycocotools/coco.py | python | COCO.loadImgs | (self, ids=[]) | Load anns with the specified ids.
:param ids (int array) : integer ids specifying img
:return: imgs (object array) : loaded img objects | Load anns with the specified ids.
:param ids (int array) : integer ids specifying img
:return: imgs (object array) : loaded img objects | [
"Load",
"anns",
"with",
"the",
"specified",
"ids",
".",
":",
"param",
"ids",
"(",
"int",
"array",
")",
":",
"integer",
"ids",
"specifying",
"img",
":",
"return",
":",
"imgs",
"(",
"object",
"array",
")",
":",
"loaded",
"img",
"objects"
] | def loadImgs(self, ids=[]):
"""
Load anns with the specified ids.
:param ids (int array) : integer ids specifying img
:return: imgs (object array) : loaded img objects
"""
if _isArrayLike(ids):
return [self.imgs[id] for id in ids]
elif type(ids) ... | [
"def",
"loadImgs",
"(",
"self",
",",
"ids",
"=",
"[",
"]",
")",
":",
"if",
"_isArrayLike",
"(",
"ids",
")",
":",
"return",
"[",
"self",
".",
"imgs",
"[",
"id",
"]",
"for",
"id",
"in",
"ids",
"]",
"elif",
"type",
"(",
"ids",
")",
"==",
"int",
... | https://github.com/guoruoqian/DetNet_pytorch/blob/735e2c51eea0ee4e91d2ec3f28e441ac4e076551/lib/pycocotools/coco.py#L222-L231 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/colors.py | python | same_color | (c1, c2) | return (to_rgba_array(c1) == to_rgba_array(c2)).all() | Compare two colors to see if they are the same.
Parameters
----------
c1, c2 : Matplotlib colors
Returns
-------
bool
``True`` if *c1* and *c2* are the same color, otherwise ``False``. | Compare two colors to see if they are the same. | [
"Compare",
"two",
"colors",
"to",
"see",
"if",
"they",
"are",
"the",
"same",
"."
] | def same_color(c1, c2):
"""
Compare two colors to see if they are the same.
Parameters
----------
c1, c2 : Matplotlib colors
Returns
-------
bool
``True`` if *c1* and *c2* are the same color, otherwise ``False``.
"""
return (to_rgba_array(c1) == to_rgba_array(c2)).all() | [
"def",
"same_color",
"(",
"c1",
",",
"c2",
")",
":",
"return",
"(",
"to_rgba_array",
"(",
"c1",
")",
"==",
"to_rgba_array",
"(",
"c2",
")",
")",
".",
"all",
"(",
")"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/colors.py#L134-L147 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.