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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CouchPotato/CouchPotatoServer | 7260c12f72447ddb6f062367c6dfbda03ecd4e9c | libs/suds/mx/appender.py | python | ContentAppender.__init__ | (self, marshaller) | @param marshaller: A marshaller.
@type marshaller: L{suds.mx.core.Core} | [] | def __init__(self, marshaller):
"""
@param marshaller: A marshaller.
@type marshaller: L{suds.mx.core.Core}
"""
self.default = PrimativeAppender(marshaller)
self.appenders = (
(Matcher(None),
NoneAppender(marshaller)),
(Matcher(null... | [
"def",
"__init__",
"(",
"self",
",",
"marshaller",
")",
":",
"self",
".",
"default",
"=",
"PrimativeAppender",
"(",
"marshaller",
")",
"self",
".",
"appenders",
"=",
"(",
"(",
"Matcher",
"(",
"None",
")",
",",
"NoneAppender",
"(",
"marshaller",
")",
")",... | https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/suds/mx/appender.py#L62-L87 | |||
amymcgovern/pyparrot | bf4775ec1199b282e4edde1e4a8e018dcc8725e0 | pyparrot/utils/vlc.py | python | Instance.log_set | (self, cb, data) | return libvlc_log_set(self, cb, data) | Sets the logging callback for a LibVLC instance.
This function is thread-safe: it will wait for any pending callbacks
invocation to complete.
@param data: opaque data pointer for the callback function @note Some log messages (especially debug) are emitted by LibVLC while is being initialized. Th... | Sets the logging callback for a LibVLC instance.
This function is thread-safe: it will wait for any pending callbacks
invocation to complete. | [
"Sets",
"the",
"logging",
"callback",
"for",
"a",
"LibVLC",
"instance",
".",
"This",
"function",
"is",
"thread",
"-",
"safe",
":",
"it",
"will",
"wait",
"for",
"any",
"pending",
"callbacks",
"invocation",
"to",
"complete",
"."
] | def log_set(self, cb, data):
'''Sets the logging callback for a LibVLC instance.
This function is thread-safe: it will wait for any pending callbacks
invocation to complete.
@param data: opaque data pointer for the callback function @note Some log messages (especially debug) are emitted ... | [
"def",
"log_set",
"(",
"self",
",",
"cb",
",",
"data",
")",
":",
"return",
"libvlc_log_set",
"(",
"self",
",",
"cb",
",",
"data",
")"
] | https://github.com/amymcgovern/pyparrot/blob/bf4775ec1199b282e4edde1e4a8e018dcc8725e0/pyparrot/utils/vlc.py#L1882-L1890 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_openshift_3.2/library/oc_version.py | python | Utils.cleanup | (files) | Clean up on exit | Clean up on exit | [
"Clean",
"up",
"on",
"exit"
] | def cleanup(files):
'''Clean up on exit '''
for sfile in files:
if os.path.exists(sfile):
if os.path.isdir(sfile):
shutil.rmtree(sfile)
elif os.path.isfile(sfile):
os.remove(sfile) | [
"def",
"cleanup",
"(",
"files",
")",
":",
"for",
"sfile",
"in",
"files",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"sfile",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"sfile",
")",
":",
"shutil",
".",
"rmtree",
"(",
"sfile",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_openshift_3.2/library/oc_version.py#L311-L318 | ||
materialsproject/pymatgen | 8128f3062a334a2edd240e4062b5b9bdd1ae6f58 | pymatgen/analysis/interfaces/coherent_interfaces.py | python | CoherentInterfaceBuilder.__init__ | (
self,
substrate_structure: Structure,
film_structure: Structure,
film_miller: Tuple[int, int, int],
substrate_miller: Tuple[int, int, int],
zslgen: Optional[ZSLGenerator] = None,
) | Args:
substrate_structure: structure of substrate
film_structure: structure of film
film_miller: miller index of the film layer
substrate_miller: miller index for the substrate layer
zslgen: BiDirectionalZSL if you want custom lattice matching tolerances for c... | Args:
substrate_structure: structure of substrate
film_structure: structure of film
film_miller: miller index of the film layer
substrate_miller: miller index for the substrate layer
zslgen: BiDirectionalZSL if you want custom lattice matching tolerances for c... | [
"Args",
":",
"substrate_structure",
":",
"structure",
"of",
"substrate",
"film_structure",
":",
"structure",
"of",
"film",
"film_miller",
":",
"miller",
"index",
"of",
"the",
"film",
"layer",
"substrate_miller",
":",
"miller",
"index",
"for",
"the",
"substrate",
... | def __init__(
self,
substrate_structure: Structure,
film_structure: Structure,
film_miller: Tuple[int, int, int],
substrate_miller: Tuple[int, int, int],
zslgen: Optional[ZSLGenerator] = None,
):
"""
Args:
substrate_structure: structure of ... | [
"def",
"__init__",
"(",
"self",
",",
"substrate_structure",
":",
"Structure",
",",
"film_structure",
":",
"Structure",
",",
"film_miller",
":",
"Tuple",
"[",
"int",
",",
"int",
",",
"int",
"]",
",",
"substrate_miller",
":",
"Tuple",
"[",
"int",
",",
"int",... | https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/analysis/interfaces/coherent_interfaces.py#L31-L56 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/plat-irix6/jpeg.py | python | setoption | (name, value) | [] | def setoption(name, value):
if type(value) is not type(0):
raise TypeError, 'jpeg.setoption: numeric options only'
if name == 'forcegrey':
name = 'forcegray'
if not options.has_key(name):
raise KeyError, 'jpeg.setoption: unknown option name'
options[name] = int(value) | [
"def",
"setoption",
"(",
"name",
",",
"value",
")",
":",
"if",
"type",
"(",
"value",
")",
"is",
"not",
"type",
"(",
"0",
")",
":",
"raise",
"TypeError",
",",
"'jpeg.setoption: numeric options only'",
"if",
"name",
"==",
"'forcegrey'",
":",
"name",
"=",
"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/plat-irix6/jpeg.py#L64-L71 | ||||
dtmilano/AndroidViewClient | 421b86e3f1a57683557fc0173951cd0332ab43f4 | src/com/dtmilano/android/uiautomator/uiautomatorhelper.py | python | UiAutomatorHelper.pressKeyCode | (self, keyCode, metaState=0) | return self.api_instance.ui_device_press_key_code_get(key_code=keyCode, meta_state=metaState) | :deprecated: | :deprecated: | [
":",
"deprecated",
":"
] | def pressKeyCode(self, keyCode, metaState=0):
"""
:deprecated:
"""
return self.api_instance.ui_device_press_key_code_get(key_code=keyCode, meta_state=metaState) | [
"def",
"pressKeyCode",
"(",
"self",
",",
"keyCode",
",",
"metaState",
"=",
"0",
")",
":",
"return",
"self",
".",
"api_instance",
".",
"ui_device_press_key_code_get",
"(",
"key_code",
"=",
"keyCode",
",",
"meta_state",
"=",
"metaState",
")"
] | https://github.com/dtmilano/AndroidViewClient/blob/421b86e3f1a57683557fc0173951cd0332ab43f4/src/com/dtmilano/android/uiautomator/uiautomatorhelper.py#L574-L578 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/multiprocessing/managers.py | python | ValueProxy.get | (self) | return self._callmethod('get') | [] | def get(self):
return self._callmethod('get') | [
"def",
"get",
"(",
"self",
")",
":",
"return",
"self",
".",
"_callmethod",
"(",
"'get'",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/multiprocessing/managers.py#L1038-L1039 | |||
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/random.py | python | WichmannHill.jumpahead | (self, n) | Act as if n calls to random() were made, but quickly.
n is an int, greater than or equal to 0.
Example use: If you have 2 threads and know that each will
consume no more than a million random numbers, create two Random
objects r1 and r2, then do
r2.setstate(r1.getstate())
... | Act as if n calls to random() were made, but quickly. | [
"Act",
"as",
"if",
"n",
"calls",
"to",
"random",
"()",
"were",
"made",
"but",
"quickly",
"."
] | def jumpahead(self, n):
"""Act as if n calls to random() were made, but quickly.
n is an int, greater than or equal to 0.
Example use: If you have 2 threads and know that each will
consume no more than a million random numbers, create two Random
objects r1 and r2, then do
... | [
"def",
"jumpahead",
"(",
"self",
",",
"n",
")",
":",
"if",
"not",
"n",
">=",
"0",
":",
"raise",
"ValueError",
"(",
"\"n must be >= 0\"",
")",
"x",
",",
"y",
",",
"z",
"=",
"self",
".",
"_seed",
"x",
"=",
"int",
"(",
"x",
"*",
"pow",
"(",
"171",... | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/random.py#L735-L755 | ||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/pip/_vendor/html5lib/_inputstream.py | python | EncodingBytes.jumpTo | (self, bytes) | Look for the next sequence of bytes matching a given sequence. If
a match is found advance the position to the last byte of the match | Look for the next sequence of bytes matching a given sequence. If
a match is found advance the position to the last byte of the match | [
"Look",
"for",
"the",
"next",
"sequence",
"of",
"bytes",
"matching",
"a",
"given",
"sequence",
".",
"If",
"a",
"match",
"is",
"found",
"advance",
"the",
"position",
"to",
"the",
"last",
"byte",
"of",
"the",
"match"
] | def jumpTo(self, bytes):
"""Look for the next sequence of bytes matching a given sequence. If
a match is found advance the position to the last byte of the match"""
newPosition = self[self.position:].find(bytes)
if newPosition > -1:
# XXX: This is ugly, but I can't see a nice... | [
"def",
"jumpTo",
"(",
"self",
",",
"bytes",
")",
":",
"newPosition",
"=",
"self",
"[",
"self",
".",
"position",
":",
"]",
".",
"find",
"(",
"bytes",
")",
"if",
"newPosition",
">",
"-",
"1",
":",
"# XXX: This is ugly, but I can't see a nicer way to fix this.",
... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pip/_vendor/html5lib/_inputstream.py#L674-L685 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/whoosh/codec/base.py | python | PerDocWriterWithColumns.__init__ | (self) | [] | def __init__(self):
PerDocumentWriter.__init__(self)
# Implementations need to set these attributes
self._storage = None
self._segment = None
self._docnum = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"PerDocumentWriter",
".",
"__init__",
"(",
"self",
")",
"# Implementations need to set these attributes",
"self",
".",
"_storage",
"=",
"None",
"self",
".",
"_segment",
"=",
"None",
"self",
".",
"_docnum",
"=",
"None"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/codec/base.py#L799-L804 | ||||
PaulSonOfLars/tgbot | 0ece72778b7772725ab214fe0929daaa2fc7d2d1 | tg_bot/modules/translation.py | python | translate | (bot: Bot, update: Update) | [] | def translate(bot: Bot, update: Update):
if update.effective_message.reply_to_message:
msg = update.effective_message.reply_to_message
params = dict(
lang="US",
clientVersion="2.0",
apiKey=API_KEY,
text=msg.text
)
res = requests.get(U... | [
"def",
"translate",
"(",
"bot",
":",
"Bot",
",",
"update",
":",
"Update",
")",
":",
"if",
"update",
".",
"effective_message",
".",
"reply_to_message",
":",
"msg",
"=",
"update",
".",
"effective_message",
".",
"reply_to_message",
"params",
"=",
"dict",
"(",
... | https://github.com/PaulSonOfLars/tgbot/blob/0ece72778b7772725ab214fe0929daaa2fc7d2d1/tg_bot/modules/translation.py#L15-L47 | ||||
leancloud/satori | 701caccbd4fe45765001ca60435c0cb499477c03 | alarm/src/main.py | python | AlarmDFA.do_tw_recycle | (self, when, action, ev) | [] | def do_tw_recycle(self, when, action, ev):
tw_sec = State.userconf.get('timewait_seconds', 0)
if time.time() - ev['timewait'] < tw_sec:
return 'TIMEWAIT'
else:
return 'OK' | [
"def",
"do_tw_recycle",
"(",
"self",
",",
"when",
",",
"action",
",",
"ev",
")",
":",
"tw_sec",
"=",
"State",
".",
"userconf",
".",
"get",
"(",
"'timewait_seconds'",
",",
"0",
")",
"if",
"time",
".",
"time",
"(",
")",
"-",
"ev",
"[",
"'timewait'",
... | https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/alarm/src/main.py#L211-L216 | ||||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/Django-1.11.29/django/template/context.py | python | Context.update | (self, other_dict) | return ContextDict(self, other_dict) | Pushes other_dict to the stack of dictionaries in the Context | Pushes other_dict to the stack of dictionaries in the Context | [
"Pushes",
"other_dict",
"to",
"the",
"stack",
"of",
"dictionaries",
"in",
"the",
"Context"
] | def update(self, other_dict):
"Pushes other_dict to the stack of dictionaries in the Context"
if not hasattr(other_dict, '__getitem__'):
raise TypeError('other_dict must be a mapping (dictionary-like) object.')
if isinstance(other_dict, BaseContext):
other_dict = other_di... | [
"def",
"update",
"(",
"self",
",",
"other_dict",
")",
":",
"if",
"not",
"hasattr",
"(",
"other_dict",
",",
"'__getitem__'",
")",
":",
"raise",
"TypeError",
"(",
"'other_dict must be a mapping (dictionary-like) object.'",
")",
"if",
"isinstance",
"(",
"other_dict",
... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/Django-1.11.29/django/template/context.py#L178-L184 | |
ljean/modbus-tk | 1159c71794071ae67f73f86fa14dd71c989b4859 | modbus_tk/simulator_rpc_client.py | python | SimulatorRpcClient.__init__ | (self, host="127.0.0.1", port=2711, timeout=0.5) | Constructor | Constructor | [
"Constructor"
] | def __init__(self, host="127.0.0.1", port=2711, timeout=0.5):
"""Constructor"""
self.host = host
self.port = port
self.timeout = timeout | [
"def",
"__init__",
"(",
"self",
",",
"host",
"=",
"\"127.0.0.1\"",
",",
"port",
"=",
"2711",
",",
"timeout",
"=",
"0.5",
")",
":",
"self",
".",
"host",
"=",
"host",
"self",
".",
"port",
"=",
"port",
"self",
".",
"timeout",
"=",
"timeout"
] | https://github.com/ljean/modbus-tk/blob/1159c71794071ae67f73f86fa14dd71c989b4859/modbus_tk/simulator_rpc_client.py#L20-L24 | ||
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/lib-tk/turtle.py | python | _screen_docrevise | (docstr) | return newdocstr | To reduce docstrings from TurtleScreen class for functions | To reduce docstrings from TurtleScreen class for functions | [
"To",
"reduce",
"docstrings",
"from",
"TurtleScreen",
"class",
"for",
"functions"
] | def _screen_docrevise(docstr):
"""To reduce docstrings from TurtleScreen class for functions
"""
import re
if docstr is None:
return None
screenname = _CFG["examplescreen"]
newdocstr = docstr.replace("%s." % screenname,"")
parexp = re.compile(r' \(.+ %s\):' % screenname)
newdocst... | [
"def",
"_screen_docrevise",
"(",
"docstr",
")",
":",
"import",
"re",
"if",
"docstr",
"is",
"None",
":",
"return",
"None",
"screenname",
"=",
"_CFG",
"[",
"\"examplescreen\"",
"]",
"newdocstr",
"=",
"docstr",
".",
"replace",
"(",
"\"%s.\"",
"%",
"screenname",... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/lib-tk/turtle.py#L3834-L3844 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/iai/v20200303/models.py | python | ModifyPersonBaseInfoResponse.__init__ | (self) | r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | [
"r",
":",
"param",
"RequestId",
":",
"唯一请求",
"ID,每次请求都会返回。定位问题时需要提供该次请求的",
"RequestId。",
":",
"type",
"RequestId",
":",
"str"
] | def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"RequestId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/iai/v20200303/models.py#L3295-L3300 | ||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/stretch.py | python | StretchSkein.parseInitialization | (self) | Parse gcode initialization and store the parameters. | Parse gcode initialization and store the parameters. | [
"Parse",
"gcode",
"initialization",
"and",
"store",
"the",
"parameters",
"."
] | def parseInitialization(self):
'Parse gcode initialization and store the parameters.'
for self.lineIndex in xrange(len(self.lines)):
line = self.lines[self.lineIndex]
splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line)
firstWord = gcodec.getFirstWord(splitLine)
self.distanceFeedRate.parseSplitLi... | [
"def",
"parseInitialization",
"(",
"self",
")",
":",
"for",
"self",
".",
"lineIndex",
"in",
"xrange",
"(",
"len",
"(",
"self",
".",
"lines",
")",
")",
":",
"line",
"=",
"self",
".",
"lines",
"[",
"self",
".",
"lineIndex",
"]",
"splitLine",
"=",
"gcod... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/stretch.py#L361-L382 | ||
alonho/pql | e8dfb17ab14a99d5aeb0574b1ac679507778969e | pql/matching.py | python | AlgebricOperator.handle_GtE | (self, node) | return {'$gte': self.field.handle(node)} | >= | >= | [
">",
"="
] | def handle_GtE(self, node):
'''>='''
return {'$gte': self.field.handle(node)} | [
"def",
"handle_GtE",
"(",
"self",
",",
"node",
")",
":",
"return",
"{",
"'$gte'",
":",
"self",
".",
"field",
".",
"handle",
"(",
"node",
")",
"}"
] | https://github.com/alonho/pql/blob/e8dfb17ab14a99d5aeb0574b1ac679507778969e/pql/matching.py#L326-L328 | |
openstack/cinder | 23494a6d6c51451688191e1847a458f1d3cdcaa5 | cinder/interface/backup_chunked_driver.py | python | BackupChunkedDriver.get_container_entries | (self, container, prefix) | Get container entry names.
:param container: The container from which to get entries.
:param prefix: The prefix used to match entries. | Get container entry names. | [
"Get",
"container",
"entry",
"names",
"."
] | def get_container_entries(self, container, prefix):
"""Get container entry names.
:param container: The container from which to get entries.
:param prefix: The prefix used to match entries.
""" | [
"def",
"get_container_entries",
"(",
"self",
",",
"container",
",",
"prefix",
")",
":"
] | https://github.com/openstack/cinder/blob/23494a6d6c51451688191e1847a458f1d3cdcaa5/cinder/interface/backup_chunked_driver.py#L33-L38 | ||
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/scipy/signal/ltisys.py | python | dlti.output | (self, u, t, x0=None) | return dlsim(self, u, t, x0=x0) | Return the response of the discrete-time system to input `u`.
See `dlsim` for details. | Return the response of the discrete-time system to input `u`.
See `dlsim` for details. | [
"Return",
"the",
"response",
"of",
"the",
"discrete",
"-",
"time",
"system",
"to",
"input",
"u",
".",
"See",
"dlsim",
"for",
"details",
"."
] | def output(self, u, t, x0=None):
"""
Return the response of the discrete-time system to input `u`.
See `dlsim` for details.
"""
return dlsim(self, u, t, x0=x0) | [
"def",
"output",
"(",
"self",
",",
"u",
",",
"t",
",",
"x0",
"=",
"None",
")",
":",
"return",
"dlsim",
"(",
"self",
",",
"u",
",",
"t",
",",
"x0",
"=",
"x0",
")"
] | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/scipy/signal/ltisys.py#L603-L608 | |
NTMC-Community/MatchZoo | 8a487ee5a574356fc91e4f48e219253dc11bcff2 | matchzoo/tasks/classification.py | python | Classification.list_available_losses | (cls) | return ['categorical_crossentropy'] | :return: a list of available losses. | :return: a list of available losses. | [
":",
"return",
":",
"a",
"list",
"of",
"available",
"losses",
"."
] | def list_available_losses(cls) -> list:
""":return: a list of available losses."""
return ['categorical_crossentropy'] | [
"def",
"list_available_losses",
"(",
"cls",
")",
"->",
"list",
":",
"return",
"[",
"'categorical_crossentropy'",
"]"
] | https://github.com/NTMC-Community/MatchZoo/blob/8a487ee5a574356fc91e4f48e219253dc11bcff2/matchzoo/tasks/classification.py#L38-L40 | |
spectacles/CodeComplice | 8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62 | CodeComplice.py | python | guess_lang | (view=None, path=None, sublime_scope=None) | return lang | [] | def guess_lang(view=None, path=None, sublime_scope=None):
if not view or not codeintel_enabled(view):
return None
#######################################
##try to guess lang using sublime scope
source_scopes = {
"go": "Go",
"js": "JavaScript",
"json": "JSON",
"p... | [
"def",
"guess_lang",
"(",
"view",
"=",
"None",
",",
"path",
"=",
"None",
",",
"sublime_scope",
"=",
"None",
")",
":",
"if",
"not",
"view",
"or",
"not",
"codeintel_enabled",
"(",
"view",
")",
":",
"return",
"None",
"#######################################",
"... | https://github.com/spectacles/CodeComplice/blob/8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62/CodeComplice.py#L423-L513 | |||
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/optim/optimizer.py | python | _NesterovMomentumSGDOpimizer.__init__ | (self, learning_rate, alpha, penalty, decay, decay_sqrt, mu) | [] | def __init__(self, learning_rate, alpha, penalty, decay, decay_sqrt, mu):
super().__init__(learning_rate, alpha, penalty, decay, decay_sqrt)
self.nesterov_momentum_coeff = 0.9
self.opt_m = None | [
"def",
"__init__",
"(",
"self",
",",
"learning_rate",
",",
"alpha",
",",
"penalty",
",",
"decay",
",",
"decay_sqrt",
",",
"mu",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"learning_rate",
",",
"alpha",
",",
"penalty",
",",
"decay",
",",
"decay_... | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/optim/optimizer.py#L239-L242 | ||||
ask/carrot | 5889a25cd2e274642071c9bba39772f4b3e3d9da | carrot/messaging.py | python | Publisher.send | (self, message_data, routing_key=None, delivery_mode=None,
mandatory=False, immediate=False, priority=0, content_type=None,
content_encoding=None, serializer=None, exchange=None) | Send a message.
:param message_data: The message data to send. Can be a list,
dictionary or a string.
:keyword routing_key: A custom routing key for the message.
If not set, the default routing key set in the :attr:`routing_key`
attribute is used.
:keyword ... | Send a message. | [
"Send",
"a",
"message",
"."
] | def send(self, message_data, routing_key=None, delivery_mode=None,
mandatory=False, immediate=False, priority=0, content_type=None,
content_encoding=None, serializer=None, exchange=None):
"""Send a message.
:param message_data: The message data to send. Can be a list,
... | [
"def",
"send",
"(",
"self",
",",
"message_data",
",",
"routing_key",
"=",
"None",
",",
"delivery_mode",
"=",
"None",
",",
"mandatory",
"=",
"False",
",",
"immediate",
"=",
"False",
",",
"priority",
"=",
"0",
",",
"content_type",
"=",
"None",
",",
"conten... | https://github.com/ask/carrot/blob/5889a25cd2e274642071c9bba39772f4b3e3d9da/carrot/messaging.py#L712-L772 | ||
etetoolkit/ete | 2b207357dc2a40ccad7bfd8f54964472c72e4726 | ete3/nexml/_nexml.py | python | AbstractEdge.__init__ | (self, about=None, meta=None, label=None, id=None, source=None, length=None, target=None, valueOf_=None) | [] | def __init__(self, about=None, meta=None, label=None, id=None, source=None, length=None, target=None, valueOf_=None):
super(AbstractEdge, self).__init__(about, meta, label, id, )
self.source = _cast(None, source)
self.length = _cast(None, length)
self.target = _cast(None, target)
... | [
"def",
"__init__",
"(",
"self",
",",
"about",
"=",
"None",
",",
"meta",
"=",
"None",
",",
"label",
"=",
"None",
",",
"id",
"=",
"None",
",",
"source",
"=",
"None",
",",
"length",
"=",
"None",
",",
"target",
"=",
"None",
",",
"valueOf_",
"=",
"Non... | https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/nexml/_nexml.py#L5148-L5153 | ||||
cagbal/ros_people_object_detection_tensorflow | 982ffd4a54b8059638f5cd4aa167299c7fc9e61f | src/object_detection/metrics/coco_evaluation.py | python | CocoMaskEvaluator.add_single_ground_truth_image_info | (self,
image_id,
groundtruth_dict) | Adds groundtruth for a single image to be used for evaluation.
If the image has already been added, a warning is logged, and groundtruth is
ignored.
Args:
image_id: A unique string/integer identifier for the image.
groundtruth_dict: A dictionary containing -
InputDataFields.groundtruth... | Adds groundtruth for a single image to be used for evaluation. | [
"Adds",
"groundtruth",
"for",
"a",
"single",
"image",
"to",
"be",
"used",
"for",
"evaluation",
"."
] | def add_single_ground_truth_image_info(self,
image_id,
groundtruth_dict):
"""Adds groundtruth for a single image to be used for evaluation.
If the image has already been added, a warning is logged, and groundtruth is
ignored.... | [
"def",
"add_single_ground_truth_image_info",
"(",
"self",
",",
"image_id",
",",
"groundtruth_dict",
")",
":",
"if",
"image_id",
"in",
"self",
".",
"_image_id_to_mask_shape_map",
":",
"tf",
".",
"logging",
".",
"warning",
"(",
"'Ignoring ground truth with image id %s sin... | https://github.com/cagbal/ros_people_object_detection_tensorflow/blob/982ffd4a54b8059638f5cd4aa167299c7fc9e61f/src/object_detection/metrics/coco_evaluation.py#L331-L377 | ||
fr0gger/vthunting | 34d202c0a6bb58c2fb01128cd80ef1256b566f6c | vthunting.py | python | is_notified_on_before | (sha256) | return bool(database_connection.execute(
'SELECT EXISTS ( SELECT sha256 FROM seen_sha256_hashes WHERE sha256 = ?)', [str(sha256)]).fetchone()[0]) | [] | def is_notified_on_before(sha256):
return bool(database_connection.execute(
'SELECT EXISTS ( SELECT sha256 FROM seen_sha256_hashes WHERE sha256 = ?)', [str(sha256)]).fetchone()[0]) | [
"def",
"is_notified_on_before",
"(",
"sha256",
")",
":",
"return",
"bool",
"(",
"database_connection",
".",
"execute",
"(",
"'SELECT EXISTS ( SELECT sha256 FROM seen_sha256_hashes WHERE sha256 = ?)'",
",",
"[",
"str",
"(",
"sha256",
")",
"]",
")",
".",
"fetchone",
"("... | https://github.com/fr0gger/vthunting/blob/34d202c0a6bb58c2fb01128cd80ef1256b566f6c/vthunting.py#L175-L177 | |||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/teleport/webroot/app/base/logger.py | python | Logger.log_print | (self, *args, **kwargs) | [] | def log_print(self, *args, **kwargs):
sep = kwargs['sep'] if 'sep' in kwargs else ' '
end = kwargs['end'] if 'end' in kwargs else '\n'
show_datetime = self._log_datetime
first = True
for x in args:
if not first:
log._do_log(self.LOG_VERBOSE, sep, show... | [
"def",
"log_print",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"sep",
"=",
"kwargs",
"[",
"'sep'",
"]",
"if",
"'sep'",
"in",
"kwargs",
"else",
"' '",
"end",
"=",
"kwargs",
"[",
"'end'",
"]",
"if",
"'end'",
"in",
"kwargs",
"... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/teleport/webroot/app/base/logger.py#L496-L514 | ||||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/idlelib/MultiCall.py | python | _SimpleBinder.__del__ | (self) | [] | def __del__(self):
if self.handlerid:
self.widget.unbind(self.widgetinst, self.sequence, self.handlerid) | [
"def",
"__del__",
"(",
"self",
")",
":",
"if",
"self",
".",
"handlerid",
":",
"self",
".",
"widget",
".",
"unbind",
"(",
"self",
".",
"widgetinst",
",",
"self",
".",
"sequence",
",",
"self",
".",
"handlerid",
")"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/idlelib/MultiCall.py#L99-L101 | ||||
mpenning/ciscoconfparse | a6a176e6ceac7c5f3e974272fa70273476ba84a3 | ciscoconfparse/ciscoconfparse.py | python | ConfigList.__delitem__ | (self, ii) | [] | def __delitem__(self, ii):
del self._list[ii]
self._bootstrap_from_text() | [
"def",
"__delitem__",
"(",
"self",
",",
"ii",
")",
":",
"del",
"self",
".",
"_list",
"[",
"ii",
"]",
"self",
".",
"_bootstrap_from_text",
"(",
")"
] | https://github.com/mpenning/ciscoconfparse/blob/a6a176e6ceac7c5f3e974272fa70273476ba84a3/ciscoconfparse/ciscoconfparse.py#L3483-L3485 | ||||
napari/napari | dbf4158e801fa7a429de8ef1cdee73bf6d64c61e | napari/_qt/widgets/qt_color_swatch.py | python | QColorSwatch.color | (self) | return self._color | Return the current color | Return the current color | [
"Return",
"the",
"current",
"color"
] | def color(self):
"""Return the current color"""
return self._color | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
".",
"_color"
] | https://github.com/napari/napari/blob/dbf4158e801fa7a429de8ef1cdee73bf6d64c61e/napari/_qt/widgets/qt_color_swatch.py#L165-L167 | |
donnemartin/gitsome | d7c57abc7cb66e9c910a844f15d4536866da3310 | xonsh/ast.py | python | CtxAwareTransformer.ctxvisit | (self, node, inp, ctx, mode="exec", filename=None, debug_level=0) | return node | Transforms the node in a context-dependent way.
Parameters
----------
node : ast.AST
A syntax tree to transform.
input : str
The input code in string format.
ctx : dict
The root context to use.
filename : str, optional
File... | Transforms the node in a context-dependent way. | [
"Transforms",
"the",
"node",
"in",
"a",
"context",
"-",
"dependent",
"way",
"."
] | def ctxvisit(self, node, inp, ctx, mode="exec", filename=None, debug_level=0):
"""Transforms the node in a context-dependent way.
Parameters
----------
node : ast.AST
A syntax tree to transform.
input : str
The input code in string format.
ctx : d... | [
"def",
"ctxvisit",
"(",
"self",
",",
"node",
",",
"inp",
",",
"ctx",
",",
"mode",
"=",
"\"exec\"",
",",
"filename",
"=",
"None",
",",
"debug_level",
"=",
"0",
")",
":",
"self",
".",
"filename",
"=",
"self",
".",
"filename",
"if",
"filename",
"is",
... | https://github.com/donnemartin/gitsome/blob/d7c57abc7cb66e9c910a844f15d4536866da3310/xonsh/ast.py#L349-L379 | |
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/wifizoo/WifiZooEntities.py | python | AccessPoint.getFoundWhenString | (self) | return str(self._foundWhen) | [] | def getFoundWhenString(self):
return str(self._foundWhen) | [
"def",
"getFoundWhenString",
"(",
"self",
")",
":",
"return",
"str",
"(",
"self",
".",
"_foundWhen",
")"
] | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/wifizoo/WifiZooEntities.py#L127-L128 | |||
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/mako/_ast_util.py | python | copy_location | (new_node, old_node) | return new_node | Copy the source location hint (`lineno` and `col_offset`) from the
old to the new node if possible and return the new one. | Copy the source location hint (`lineno` and `col_offset`) from the
old to the new node if possible and return the new one. | [
"Copy",
"the",
"source",
"location",
"hint",
"(",
"lineno",
"and",
"col_offset",
")",
"from",
"the",
"old",
"to",
"the",
"new",
"node",
"if",
"possible",
"and",
"return",
"the",
"new",
"one",
"."
] | def copy_location(new_node, old_node):
"""
Copy the source location hint (`lineno` and `col_offset`) from the
old to the new node if possible and return the new one.
"""
for attr in 'lineno', 'col_offset':
if attr in old_node._attributes and attr in new_node._attributes \
and hasa... | [
"def",
"copy_location",
"(",
"new_node",
",",
"old_node",
")",
":",
"for",
"attr",
"in",
"'lineno'",
",",
"'col_offset'",
":",
"if",
"attr",
"in",
"old_node",
".",
"_attributes",
"and",
"attr",
"in",
"new_node",
".",
"_attributes",
"and",
"hasattr",
"(",
"... | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/mako/_ast_util.py#L125-L134 | |
tducret/amazon-scraper-python | 30f812f0d2f2e7dd2f2af7ec1ad23626a0a0cabd | amazonscraper/__init__.py | python | Product.__getattr__ | (self, attr) | return self.product.get(attr, "") | Method to access a dictionnary key as an attribute
(ex : product.title) | Method to access a dictionnary key as an attribute
(ex : product.title) | [
"Method",
"to",
"access",
"a",
"dictionnary",
"key",
"as",
"an",
"attribute",
"(",
"ex",
":",
"product",
".",
"title",
")"
] | def __getattr__(self, attr):
""" Method to access a dictionnary key as an attribute
(ex : product.title) """
return self.product.get(attr, "") | [
"def",
"__getattr__",
"(",
"self",
",",
"attr",
")",
":",
"return",
"self",
".",
"product",
".",
"get",
"(",
"attr",
",",
"\"\"",
")"
] | https://github.com/tducret/amazon-scraper-python/blob/30f812f0d2f2e7dd2f2af7ec1ad23626a0a0cabd/amazonscraper/__init__.py#L82-L85 | |
bitcraze/crazyflie-lib-python | 876f0dc003b91ba5e4de05daae9d0b79cf600f81 | cflib/crtp/radiodriver.py | python | RadioDriver.get_name | (self) | return 'radio' | [] | def get_name(self):
return 'radio' | [
"def",
"get_name",
"(",
"self",
")",
":",
"return",
"'radio'"
] | https://github.com/bitcraze/crazyflie-lib-python/blob/876f0dc003b91ba5e4de05daae9d0b79cf600f81/cflib/crtp/radiodriver.py#L516-L517 | |||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_status.py | python | V1Status.status | (self, status) | Sets the status of this V1Status.
Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status # noqa: E501
:param status: The status of this V1Status. # noqa: E501
:type: str | Sets the status of this V1Status. | [
"Sets",
"the",
"status",
"of",
"this",
"V1Status",
"."
] | def status(self, status):
"""Sets the status of this V1Status.
Status of the operation. One of: \"Success\" or \"Failure\". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status # noqa: E501
:param status: The status of this V1Status. ... | [
"def",
"status",
"(",
"self",
",",
"status",
")",
":",
"self",
".",
"_status",
"=",
"status"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_status.py#L259-L268 | ||
twrecked/hass-aarlo | c00cc750912449dab97b46e060fe52e34e9ca73b | custom_components/aarlo/switch.py | python | AarloSwitch.extra_state_attributes | (self) | return attrs | Return the device state attributes. | Return the device state attributes. | [
"Return",
"the",
"device",
"state",
"attributes",
"."
] | def extra_state_attributes(self):
"""Return the device state attributes."""
attrs = {
ATTR_ATTRIBUTION: COMPONENT_ATTRIBUTION,
"brand": COMPONENT_BRAND,
"friendly_name": self._name,
"icon": self._icon,
}
if self._device is not None:
... | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"attrs",
"=",
"{",
"ATTR_ATTRIBUTION",
":",
"COMPONENT_ATTRIBUTION",
",",
"\"brand\"",
":",
"COMPONENT_BRAND",
",",
"\"friendly_name\"",
":",
"self",
".",
"_name",
",",
"\"icon\"",
":",
"self",
".",
"_icon"... | https://github.com/twrecked/hass-aarlo/blob/c00cc750912449dab97b46e060fe52e34e9ca73b/custom_components/aarlo/switch.py#L149-L162 | |
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Parser/asdl.py | python | ASDLParser.p_definition_1 | (self, (definitions, definition)) | return definitions + definition | definitions ::= definition definitions | definitions ::= definition definitions | [
"definitions",
"::",
"=",
"definition",
"definitions"
] | def p_definition_1(self, (definitions, definition)):
" definitions ::= definition definitions "
return definitions + definition | [
"def",
"p_definition_1",
"(",
"self",
",",
"(",
"definitions",
",",
"definition",
")",
")",
":",
"return",
"definitions",
"+",
"definition"
] | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Parser/asdl.py#L136-L138 | |
fake-name/ReadableWebProxy | ed5c7abe38706acc2684a1e6cd80242a03c5f010 | WebMirror/management/rss_parser_funcs/feed_parse_extractDevilpendingBlogspotCom.py | python | extractDevilpendingBlogspotCom | (item) | return False | Parser for 'devilpending.blogspot.com' | Parser for 'devilpending.blogspot.com' | [
"Parser",
"for",
"devilpending",
".",
"blogspot",
".",
"com"
] | def extractDevilpendingBlogspotCom(item):
'''
Parser for 'devilpending.blogspot.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Lo... | [
"def",
"extractDevilpendingBlogspotCom",
"(",
"item",
")",
":",
"vol",
",",
"chp",
",",
"frag",
",",
"postfix",
"=",
"extractVolChapterFragmentPostfix",
"(",
"item",
"[",
"'title'",
"]",
")",
"if",
"not",
"(",
"chp",
"or",
"vol",
")",
"or",
"\"preview\"",
... | https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractDevilpendingBlogspotCom.py#L1-L29 | |
google/trax | d6cae2067dedd0490b78d831033607357e975015 | trax/rl/task.py | python | Trajectory.done | (self, done) | Sets the `done` flag in the last timestep. | Sets the `done` flag in the last timestep. | [
"Sets",
"the",
"done",
"flag",
"in",
"the",
"last",
"timestep",
"."
] | def done(self, done):
"""Sets the `done` flag in the last timestep."""
if not self._timesteps:
raise ValueError('No interactions yet in the trajectory.')
self._timesteps[-1] = self._timesteps[-1]._replace(done=done) | [
"def",
"done",
"(",
"self",
",",
"done",
")",
":",
"if",
"not",
"self",
".",
"_timesteps",
":",
"raise",
"ValueError",
"(",
"'No interactions yet in the trajectory.'",
")",
"self",
".",
"_timesteps",
"[",
"-",
"1",
"]",
"=",
"self",
".",
"_timesteps",
"[",... | https://github.com/google/trax/blob/d6cae2067dedd0490b78d831033607357e975015/trax/rl/task.py#L133-L137 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/antiddos/v20200309/antiddos_client.py | python | AntiddosClient.ModifyDomainUsrName | (self, request) | 修改智能解析域名名称
:param request: Request instance for ModifyDomainUsrName.
:type request: :class:`tencentcloud.antiddos.v20200309.models.ModifyDomainUsrNameRequest`
:rtype: :class:`tencentcloud.antiddos.v20200309.models.ModifyDomainUsrNameResponse` | 修改智能解析域名名称 | [
"修改智能解析域名名称"
] | def ModifyDomainUsrName(self, request):
"""修改智能解析域名名称
:param request: Request instance for ModifyDomainUsrName.
:type request: :class:`tencentcloud.antiddos.v20200309.models.ModifyDomainUsrNameRequest`
:rtype: :class:`tencentcloud.antiddos.v20200309.models.ModifyDomainUsrNameResponse`
... | [
"def",
"ModifyDomainUsrName",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"ModifyDomainUsrName\"",
",",
"params",
")",
"response",
"=",
"json",
".",
"l... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/antiddos/v20200309/antiddos_client.py#L1345-L1370 | ||
devopshq/tfs | 56644a36dd34457dec6922eb144c21db320f16e7 | tfs/connection.py | python | TFSAPI.result | (self, runId, resultId) | return self._find_resource(Result, ids=(runId, resultId)) | [] | def result(self, runId, resultId):
return self._find_resource(Result, ids=(runId, resultId)) | [
"def",
"result",
"(",
"self",
",",
"runId",
",",
"resultId",
")",
":",
"return",
"self",
".",
"_find_resource",
"(",
"Result",
",",
"ids",
"=",
"(",
"runId",
",",
"resultId",
")",
")"
] | https://github.com/devopshq/tfs/blob/56644a36dd34457dec6922eb144c21db320f16e7/tfs/connection.py#L218-L219 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Tools/scripts/fixcid.py | python | usage | () | [] | def usage():
progname = sys.argv[0]
err('Usage: ' + progname +
' [-c] [-r] [-s file] ... file-or-directory ...\n')
err('\n')
err('-c : substitute inside comments\n')
err('-r : reverse direction for following -s options\n')
err('-s substfile : add a file of subst... | [
"def",
"usage",
"(",
")",
":",
"progname",
"=",
"sys",
".",
"argv",
"[",
"0",
"]",
"err",
"(",
"'Usage: '",
"+",
"progname",
"+",
"' [-c] [-r] [-s file] ... file-or-directory ...\\n'",
")",
"err",
"(",
"'\\n'",
")",
"err",
"(",
"'-c : substitute inside... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Tools/scripts/fixcid.py#L47-L60 | ||||
mirumee/ariadne | 1b8b7ef0ed65cde95a6bd9e25500584a38393b71 | ariadne/enums.py | python | validate_schema_enum_values | (schema: GraphQLSchema) | [] | def validate_schema_enum_values(schema: GraphQLSchema) -> None:
for type_name, field_name, arg, _ in find_enum_values_in_schema(schema):
if is_invalid_enum_value(arg):
raise ValueError(
f"Value for type: <{arg.type}> is invalid. "
f"Check InputField/Arguments for ... | [
"def",
"validate_schema_enum_values",
"(",
"schema",
":",
"GraphQLSchema",
")",
"->",
"None",
":",
"for",
"type_name",
",",
"field_name",
",",
"arg",
",",
"_",
"in",
"find_enum_values_in_schema",
"(",
"schema",
")",
":",
"if",
"is_invalid_enum_value",
"(",
"arg"... | https://github.com/mirumee/ariadne/blob/1b8b7ef0ed65cde95a6bd9e25500584a38393b71/ariadne/enums.py#L112-L119 | ||||
Qiskit/qiskit-terra | b66030e3b9192efdd3eb95cf25c6545fe0a13da4 | qiskit/transpiler/layout.py | python | Layout.order_based_on_type | (value1, value2) | return virtual, physical | decides which one is physical/virtual based on the type. Returns (virtual, physical) | decides which one is physical/virtual based on the type. Returns (virtual, physical) | [
"decides",
"which",
"one",
"is",
"physical",
"/",
"virtual",
"based",
"on",
"the",
"type",
".",
"Returns",
"(",
"virtual",
"physical",
")"
] | def order_based_on_type(value1, value2):
"""decides which one is physical/virtual based on the type. Returns (virtual, physical)"""
if isinstanceint(value1) and isinstance(value2, (Qubit, type(None))):
physical = int(value1)
virtual = value2
elif isinstanceint(value2) and... | [
"def",
"order_based_on_type",
"(",
"value1",
",",
"value2",
")",
":",
"if",
"isinstanceint",
"(",
"value1",
")",
"and",
"isinstance",
"(",
"value2",
",",
"(",
"Qubit",
",",
"type",
"(",
"None",
")",
")",
")",
":",
"physical",
"=",
"int",
"(",
"value1",... | https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/transpiler/layout.py#L87-L100 | |
meduza-corp/interstellar | 40a801ccd7856491726f5a126621d9318cabe2e1 | gsutil/third_party/boto/boto/route53/zone.py | python | Zone.delete_cname | (self, name, identifier=None, all=False) | return self.delete_record(record) | Delete a CNAME record matching name and identifier from
this Zone. Returns a Status object.
If there is more than one match delete all matching records if
all is True, otherwise throws TooManyRecordsException. | Delete a CNAME record matching name and identifier from
this Zone. Returns a Status object. | [
"Delete",
"a",
"CNAME",
"record",
"matching",
"name",
"and",
"identifier",
"from",
"this",
"Zone",
".",
"Returns",
"a",
"Status",
"object",
"."
] | def delete_cname(self, name, identifier=None, all=False):
"""
Delete a CNAME record matching name and identifier from
this Zone. Returns a Status object.
If there is more than one match delete all matching records if
all is True, otherwise throws TooManyRecordsException.
... | [
"def",
"delete_cname",
"(",
"self",
",",
"name",
",",
"identifier",
"=",
"None",
",",
"all",
"=",
"False",
")",
":",
"name",
"=",
"self",
".",
"route53connection",
".",
"_make_qualified",
"(",
"name",
")",
"record",
"=",
"self",
".",
"find_records",
"(",... | https://github.com/meduza-corp/interstellar/blob/40a801ccd7856491726f5a126621d9318cabe2e1/gsutil/third_party/boto/boto/route53/zone.py#L356-L367 | |
iosband/ts_tutorial | f28d3bbe88b16a2e61faab9ffe4ae7387880b16a | src/graph/agent_correlated.py | python | GibbsCorrelatedBB.pick_action | (self, observation) | return path | Greedy shortest path wrt Gibbs sample. | Greedy shortest path wrt Gibbs sample. | [
"Greedy",
"shortest",
"path",
"wrt",
"Gibbs",
"sample",
"."
] | def pick_action(self, observation):
"""Greedy shortest path wrt Gibbs sample."""
bootstrap_sample = self.get_sample()
self.internal_env.overwrite_edge_length(bootstrap_sample)
path = self.internal_env.get_shortest_path()
return path | [
"def",
"pick_action",
"(",
"self",
",",
"observation",
")",
":",
"bootstrap_sample",
"=",
"self",
".",
"get_sample",
"(",
")",
"self",
".",
"internal_env",
".",
"overwrite_edge_length",
"(",
"bootstrap_sample",
")",
"path",
"=",
"self",
".",
"internal_env",
".... | https://github.com/iosband/ts_tutorial/blob/f28d3bbe88b16a2e61faab9ffe4ae7387880b16a/src/graph/agent_correlated.py#L281-L287 | |
viewflow/viewflow | 2389bd379a2ab22cc277585df7c09514e273541d | viewflow/nodes/handler.py | python | HandlerActivation.execute | (self) | Run the callback. | Run the callback. | [
"Run",
"the",
"callback",
"."
] | def execute(self):
"""Run the callback."""
self.flow_task.handler(self) | [
"def",
"execute",
"(",
"self",
")",
":",
"self",
".",
"flow_task",
".",
"handler",
"(",
"self",
")"
] | https://github.com/viewflow/viewflow/blob/2389bd379a2ab22cc277585df7c09514e273541d/viewflow/nodes/handler.py#L14-L16 | ||
hash3liZer/WiFiBroot | d0cd2ccc0ed0c810092217488e1f06a6acb97cc3 | utils/tabulater__.py | python | _choose_width_fn | (has_invisible, enable_widechars, is_multiline) | return width_fn | Return a function to calculate visible cell width. | Return a function to calculate visible cell width. | [
"Return",
"a",
"function",
"to",
"calculate",
"visible",
"cell",
"width",
"."
] | def _choose_width_fn(has_invisible, enable_widechars, is_multiline):
"""Return a function to calculate visible cell width."""
if has_invisible:
line_width_fn = _visible_width
elif enable_widechars: # optional wide-character support if available
line_width_fn = wcwidth.wcswidth
else:
... | [
"def",
"_choose_width_fn",
"(",
"has_invisible",
",",
"enable_widechars",
",",
"is_multiline",
")",
":",
"if",
"has_invisible",
":",
"line_width_fn",
"=",
"_visible_width",
"elif",
"enable_widechars",
":",
"# optional wide-character support if available",
"line_width_fn",
"... | https://github.com/hash3liZer/WiFiBroot/blob/d0cd2ccc0ed0c810092217488e1f06a6acb97cc3/utils/tabulater__.py#L615-L627 | |
shiweibsw/Translation-Tools | 2fbbf902364e557fa7017f9a74a8797b7440c077 | venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/requests/structures.py | python | CaseInsensitiveDict.__len__ | (self) | return len(self._store) | [] | def __len__(self):
return len(self._store) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"_store",
")"
] | https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/requests/structures.py#L62-L63 | |||
appian42/kaggle-rsna-intracranial-hemorrhage | 54ea4cc228a03d8a2d7e3e10aa71dde6673c9a3d | src/meta/trainer.py | python | get_args | () | return parser.parse_args() | [] | def get_args():
parser = argparse.ArgumentParser()
parser.add_argument('--inputs-oof')
parser.add_argument('--inputs-test')
parser.add_argument('--output-dir', default='./meta')
parser.add_argument('--output-name')
parser.add_argument('--train-raw', default='./cache/train_raw.pkl')
parser.ad... | [
"def",
"get_args",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"'--inputs-oof'",
")",
"parser",
".",
"add_argument",
"(",
"'--inputs-test'",
")",
"parser",
".",
"add_argument",
"(",
"'--output-... | https://github.com/appian42/kaggle-rsna-intracranial-hemorrhage/blob/54ea4cc228a03d8a2d7e3e10aa71dde6673c9a3d/src/meta/trainer.py#L16-L25 | |||
TesterlifeRaymond/doraemon | d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333 | venv/lib/python3.6/site-packages/idna/intranges.py | python | intranges_contain | (int_, ranges) | return False | Determine if `int_` falls into one of the ranges in `ranges`. | Determine if `int_` falls into one of the ranges in `ranges`. | [
"Determine",
"if",
"int_",
"falls",
"into",
"one",
"of",
"the",
"ranges",
"in",
"ranges",
"."
] | def intranges_contain(int_, ranges):
"""Determine if `int_` falls into one of the ranges in `ranges`."""
tuple_ = _encode_range(int_, 0)
pos = bisect.bisect_left(ranges, tuple_)
# we could be immediately ahead of a tuple (start, end)
# with start < int_ <= end
if pos > 0:
left, right = _... | [
"def",
"intranges_contain",
"(",
"int_",
",",
"ranges",
")",
":",
"tuple_",
"=",
"_encode_range",
"(",
"int_",
",",
"0",
")",
"pos",
"=",
"bisect",
".",
"bisect_left",
"(",
"ranges",
",",
"tuple_",
")",
"# we could be immediately ahead of a tuple (start, end)",
... | https://github.com/TesterlifeRaymond/doraemon/blob/d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333/venv/lib/python3.6/site-packages/idna/intranges.py#L38-L53 | |
PyCQA/pylint | 3fc855f9d0fa8e6410be5a23cf954ffd5471b4eb | pylint/checkers/utils.py | python | is_node_in_type_annotation_context | (node: nodes.NodeNG) | Check if node is in type annotation context.
Check for 'AnnAssign', function 'Arguments',
or part of function return type anntation. | Check if node is in type annotation context. | [
"Check",
"if",
"node",
"is",
"in",
"type",
"annotation",
"context",
"."
] | def is_node_in_type_annotation_context(node: nodes.NodeNG) -> bool:
"""Check if node is in type annotation context.
Check for 'AnnAssign', function 'Arguments',
or part of function return type anntation.
"""
# pylint: disable=too-many-boolean-expressions
current_node, parent_node = node, node.p... | [
"def",
"is_node_in_type_annotation_context",
"(",
"node",
":",
"nodes",
".",
"NodeNG",
")",
"->",
"bool",
":",
"# pylint: disable=too-many-boolean-expressions",
"current_node",
",",
"parent_node",
"=",
"node",
",",
"node",
".",
"parent",
"while",
"True",
":",
"if",
... | https://github.com/PyCQA/pylint/blob/3fc855f9d0fa8e6410be5a23cf954ffd5471b4eb/pylint/checkers/utils.py#L1408-L1435 | ||
fonttools/fonttools | 892322aaff6a89bea5927379ec06bc0da3dfb7df | Lib/fontTools/misc/transform.py | python | Transform.scale | (self, x=1, y=None) | return self.transform((x, 0, 0, y, 0, 0)) | Return a new transformation, scaled by x, y. The 'y' argument
may be None, which implies to use the x value for y as well.
:Example:
>>> t = Transform()
>>> t.scale(5)
<Transform [5 0 0 5 0 0]>
>>> t.scale(5, 6)
<Transform [5 0 0 6 0 0]>
>>> | Return a new transformation, scaled by x, y. The 'y' argument
may be None, which implies to use the x value for y as well. | [
"Return",
"a",
"new",
"transformation",
"scaled",
"by",
"x",
"y",
".",
"The",
"y",
"argument",
"may",
"be",
"None",
"which",
"implies",
"to",
"use",
"the",
"x",
"value",
"for",
"y",
"as",
"well",
"."
] | def scale(self, x=1, y=None):
"""Return a new transformation, scaled by x, y. The 'y' argument
may be None, which implies to use the x value for y as well.
:Example:
>>> t = Transform()
>>> t.scale(5)
<Transform [5 0 0 5 0 0]>
>>> t.scale(5, 6)
<Transform [5 0 0 6 0 0]>
>>>
"""
if y is None... | [
"def",
"scale",
"(",
"self",
",",
"x",
"=",
"1",
",",
"y",
"=",
"None",
")",
":",
"if",
"y",
"is",
"None",
":",
"y",
"=",
"x",
"return",
"self",
".",
"transform",
"(",
"(",
"x",
",",
"0",
",",
"0",
",",
"y",
",",
"0",
",",
"0",
")",
")"... | https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/misc/transform.py#L224-L238 | |
CenterForOpenScience/osf.io | cc02691be017e61e2cd64f19b848b2f4c18dcc84 | api/base/filters.py | python | FilterMixin.convert_key | (self, field_name, field) | return source or field_name | Used so that that queries on fields with the source attribute set will work
:param basestring field_name: text representation of the field name
:param rest_framework.fields.Field field: Field instance | Used so that that queries on fields with the source attribute set will work
:param basestring field_name: text representation of the field name
:param rest_framework.fields.Field field: Field instance | [
"Used",
"so",
"that",
"that",
"queries",
"on",
"fields",
"with",
"the",
"source",
"attribute",
"set",
"will",
"work",
":",
"param",
"basestring",
"field_name",
":",
"text",
"representation",
"of",
"the",
"field",
"name",
":",
"param",
"rest_framework",
".",
... | def convert_key(self, field_name, field):
"""Used so that that queries on fields with the source attribute set will work
:param basestring field_name: text representation of the field name
:param rest_framework.fields.Field field: Field instance
"""
field = utils.decompose_field(... | [
"def",
"convert_key",
"(",
"self",
",",
"field_name",
",",
"field",
")",
":",
"field",
"=",
"utils",
".",
"decompose_field",
"(",
"field",
")",
"source",
"=",
"field",
".",
"source",
"if",
"source",
"==",
"'*'",
":",
"source",
"=",
"getattr",
"(",
"fie... | https://github.com/CenterForOpenScience/osf.io/blob/cc02691be017e61e2cd64f19b848b2f4c18dcc84/api/base/filters.py#L324-L333 | |
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/logging/__init__.py | python | FileHandler.emit | (self, record) | Emit a record.
If the stream was not opened because 'delay' was specified in the
constructor, open it before calling the superclass's emit. | Emit a record. | [
"Emit",
"a",
"record",
"."
] | def emit(self, record):
"""
Emit a record.
If the stream was not opened because 'delay' was specified in the
constructor, open it before calling the superclass's emit.
"""
if self.stream is None:
self.stream = self._open()
StreamHandler.emit(self, rec... | [
"def",
"emit",
"(",
"self",
",",
"record",
")",
":",
"if",
"self",
".",
"stream",
"is",
"None",
":",
"self",
".",
"stream",
"=",
"self",
".",
"_open",
"(",
")",
"StreamHandler",
".",
"emit",
"(",
"self",
",",
"record",
")"
] | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/logging/__init__.py#L1037-L1046 | ||
quodlibet/mutagen | 399513b167ed00c4b7a9ef98dfe591a276efb701 | mutagen/_util.py | python | BitReader.align | (self) | return bits | Align to the next byte, returns the amount of bits skipped | Align to the next byte, returns the amount of bits skipped | [
"Align",
"to",
"the",
"next",
"byte",
"returns",
"the",
"amount",
"of",
"bits",
"skipped"
] | def align(self):
"""Align to the next byte, returns the amount of bits skipped"""
bits = self._bits
self._buffer = 0
self._bits = 0
return bits | [
"def",
"align",
"(",
"self",
")",
":",
"bits",
"=",
"self",
".",
"_bits",
"self",
".",
"_buffer",
"=",
"0",
"self",
".",
"_bits",
"=",
"0",
"return",
"bits"
] | https://github.com/quodlibet/mutagen/blob/399513b167ed00c4b7a9ef98dfe591a276efb701/mutagen/_util.py#L1029-L1035 | |
bendmorris/static-python | 2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473 | Lib/decimal.py | python | Decimal.quantize | (self, exp, rounding=None, context=None, watchexp=True) | return ans | Quantize self so its exponent is the same as that of exp.
Similar to self._rescale(exp._exp) but with error checking. | Quantize self so its exponent is the same as that of exp. | [
"Quantize",
"self",
"so",
"its",
"exponent",
"is",
"the",
"same",
"as",
"that",
"of",
"exp",
"."
] | def quantize(self, exp, rounding=None, context=None, watchexp=True):
"""Quantize self so its exponent is the same as that of exp.
Similar to self._rescale(exp._exp) but with error checking.
"""
exp = _convert_other(exp, raiseit=True)
if context is None:
context = ge... | [
"def",
"quantize",
"(",
"self",
",",
"exp",
",",
"rounding",
"=",
"None",
",",
"context",
"=",
"None",
",",
"watchexp",
"=",
"True",
")",
":",
"exp",
"=",
"_convert_other",
"(",
"exp",
",",
"raiseit",
"=",
"True",
")",
"if",
"context",
"is",
"None",
... | https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/decimal.py#L2526-L2595 | |
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/core/ui/gui/exception_handling/user_reports_bug.py | python | user_reports_bug.report_bug | (self, widg) | [] | def report_bug(self, widg):
# Avoid "double clicking" in the OK button,
self.butt_send.set_sensitive(False)
# Report the bug
GithubBugReport.report_bug(self) | [
"def",
"report_bug",
"(",
"self",
",",
"widg",
")",
":",
"# Avoid \"double clicking\" in the OK button,",
"self",
".",
"butt_send",
".",
"set_sensitive",
"(",
"False",
")",
"# Report the bug",
"GithubBugReport",
".",
"report_bug",
"(",
"self",
")"
] | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/ui/gui/exception_handling/user_reports_bug.py#L91-L96 | ||||
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/ctypes/macholib/dylib.py | python | dylib_info | (filename) | return is_dylib.groupdict() | A dylib name can take one of the following four forms:
Location/Name.SomeVersion_Suffix.dylib
Location/Name.SomeVersion.dylib
Location/Name_Suffix.dylib
Location/Name.dylib
returns None if not found or a mapping equivalent to:
dict(
location='Location',
... | A dylib name can take one of the following four forms:
Location/Name.SomeVersion_Suffix.dylib
Location/Name.SomeVersion.dylib
Location/Name_Suffix.dylib
Location/Name.dylib | [
"A",
"dylib",
"name",
"can",
"take",
"one",
"of",
"the",
"following",
"four",
"forms",
":",
"Location",
"/",
"Name",
".",
"SomeVersion_Suffix",
".",
"dylib",
"Location",
"/",
"Name",
".",
"SomeVersion",
".",
"dylib",
"Location",
"/",
"Name_Suffix",
".",
"d... | def dylib_info(filename):
"""
A dylib name can take one of the following four forms:
Location/Name.SomeVersion_Suffix.dylib
Location/Name.SomeVersion.dylib
Location/Name_Suffix.dylib
Location/Name.dylib
returns None if not found or a mapping equivalent to:
dict(
... | [
"def",
"dylib_info",
"(",
"filename",
")",
":",
"is_dylib",
"=",
"DYLIB_RE",
".",
"match",
"(",
"filename",
")",
"if",
"not",
"is_dylib",
":",
"return",
"None",
"return",
"is_dylib",
".",
"groupdict",
"(",
")"
] | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/ctypes/macholib/dylib.py#L19-L42 | |
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1_load_balancer_status.py | python | V1LoadBalancerStatus.to_dict | (self) | return result | Returns the model properties as a dict | Returns the model properties as a dict | [
"Returns",
"the",
"model",
"properties",
"as",
"a",
"dict"
] | def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if has... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"for",
"attr",
",",
"_",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"openapi_types",
")",
":",
"value",
"=",
"getattr",
"(",
"self",
",",
"attr",
")",
"if",
"isinstance",
"(",
... | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_load_balancer_status.py#L78-L100 | |
lightforever/mlcomp | c78fdb77ec9c4ec8ff11beea50b90cab20903ad9 | mlcomp/db/providers/model.py | python | ModelProvider.change_dag | (self, project: int, name: str, to: int) | [] | def change_dag(self, project: int, name: str, to: int):
ids = self.query(Model.id). \
join(Dag). \
filter(Model.project == project). \
filter(Dag.name == name). \
filter(Dag.type == DagType.Pipe.value). \
all()
ids = [id[0] for id in ids]
... | [
"def",
"change_dag",
"(",
"self",
",",
"project",
":",
"int",
",",
"name",
":",
"str",
",",
"to",
":",
"int",
")",
":",
"ids",
"=",
"self",
".",
"query",
"(",
"Model",
".",
"id",
")",
".",
"join",
"(",
"Dag",
")",
".",
"filter",
"(",
"Model",
... | https://github.com/lightforever/mlcomp/blob/c78fdb77ec9c4ec8ff11beea50b90cab20903ad9/mlcomp/db/providers/model.py#L60-L73 | ||||
EmpireProject/EmPyre | c73854ed9d90d2bba1717d3fe6df758d18c20b8f | lib/common/messages.py | python | display_staleagents | (agents) | Take a stale agent dictionary and display everything nicely. | Take a stale agent dictionary and display everything nicely. | [
"Take",
"a",
"stale",
"agent",
"dictionary",
"and",
"display",
"everything",
"nicely",
"."
] | def display_staleagents(agents):
"""
Take a stale agent dictionary and display everything nicely.
"""
if len(agents) > 0:
agent_print(agents)
else:
print helpers.color("[!] No stale agents currently registered ") | [
"def",
"display_staleagents",
"(",
"agents",
")",
":",
"if",
"len",
"(",
"agents",
")",
">",
"0",
":",
"agent_print",
"(",
"agents",
")",
"else",
":",
"print",
"helpers",
".",
"color",
"(",
"\"[!] No stale agents currently registered \"",
")"
] | https://github.com/EmpireProject/EmPyre/blob/c73854ed9d90d2bba1717d3fe6df758d18c20b8f/lib/common/messages.py#L139-L146 | ||
jazzband/django-admin2 | 7770da8a4931db60326f87d9fa7a15b1ef704c4c | djadmin2/contrib/floppyforms.py | python | _create_splitdatetimewidget | (widget_class) | return create_new_widget | [] | def _create_splitdatetimewidget(widget_class):
def create_new_widget(original):
new_widget = widget_class(
attrs=original.attrs,
date_format=original.widgets[0].format,
time_format=original.widgets[1].format)
_copy_attributes(original, new_widget, _WIDGET_COMMON_A... | [
"def",
"_create_splitdatetimewidget",
"(",
"widget_class",
")",
":",
"def",
"create_new_widget",
"(",
"original",
")",
":",
"new_widget",
"=",
"widget_class",
"(",
"attrs",
"=",
"original",
".",
"attrs",
",",
"date_format",
"=",
"original",
".",
"widgets",
"[",
... | https://github.com/jazzband/django-admin2/blob/7770da8a4931db60326f87d9fa7a15b1ef704c4c/djadmin2/contrib/floppyforms.py#L58-L66 | |||
noxrepo/pox | 5f82461e01f8822bd7336603b361bff4ffbd2380 | pox/misc/telnetd/__init__.py | python | QTelnetHandler._can_we_disable | (self, opt) | return True | Is called when other side wants us to disable an option.
Returning True means we'll accept the other side's suggestion.
Overridable. | Is called when other side wants us to disable an option. | [
"Is",
"called",
"when",
"other",
"side",
"wants",
"us",
"to",
"disable",
"an",
"option",
"."
] | def _can_we_disable (self, opt):
"""
Is called when other side wants us to disable an option.
Returning True means we'll accept the other side's suggestion.
Overridable.
"""
return True | [
"def",
"_can_we_disable",
"(",
"self",
",",
"opt",
")",
":",
"return",
"True"
] | https://github.com/noxrepo/pox/blob/5f82461e01f8822bd7336603b361bff4ffbd2380/pox/misc/telnetd/__init__.py#L1008-L1016 | |
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/gui/plug/report/_bookdialog.py | python | BookDialog.make_document | (self) | Create a document of the type requested by the user. | Create a document of the type requested by the user. | [
"Create",
"a",
"document",
"of",
"the",
"type",
"requested",
"by",
"the",
"user",
"."
] | def make_document(self):
"""Create a document of the type requested by the user."""
user = User(uistate=self.uistate)
self.rptlist = []
selected_style = StyleSheet()
pstyle = self.paper_frame.get_paper_style()
self.doc = self.format(None, pstyle)
for item in sel... | [
"def",
"make_document",
"(",
"self",
")",
":",
"user",
"=",
"User",
"(",
"uistate",
"=",
"self",
".",
"uistate",
")",
"self",
".",
"rptlist",
"=",
"[",
"]",
"selected_style",
"=",
"StyleSheet",
"(",
")",
"pstyle",
"=",
"self",
".",
"paper_frame",
".",
... | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gui/plug/report/_bookdialog.py#L996-L1015 | ||
kovidgoyal/calibre | 2b41671370f2a9eb1109b9ae901ccf915f1bd0c8 | src/calibre/devices/smart_device_app/driver.py | python | synchronous | (tlockname) | return _synched | A decorator to place an instance based lock around a method | A decorator to place an instance based lock around a method | [
"A",
"decorator",
"to",
"place",
"an",
"instance",
"based",
"lock",
"around",
"a",
"method"
] | def synchronous(tlockname):
"""A decorator to place an instance based lock around a method """
def _synched(func):
@wraps(func)
def _synchronizer(self, *args, **kwargs):
with self.__getattribute__(tlockname):
return func(self, *args, **kwargs)
return _synchro... | [
"def",
"synchronous",
"(",
"tlockname",
")",
":",
"def",
"_synched",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"_synchronizer",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"self",
".",
"__getattribute... | https://github.com/kovidgoyal/calibre/blob/2b41671370f2a9eb1109b9ae901ccf915f1bd0c8/src/calibre/devices/smart_device_app/driver.py#L52-L61 | |
dansanderson/picotool | d8c51e58416f8010dc8c0fba3df5f0424b5bb852 | pico8/lua/lua.py | python | LuaASTEchoWriter._walk_FunctionName | (self, node) | [] | def _walk_FunctionName(self, node):
yield self._get_name(node, node.namepath[0])
if len(node.namepath) > 1:
for i in range(1, len(node.namepath)):
yield self._get_text(node, b'.')
yield self._get_name(node, node.namepath[i])
if node.methodname is not N... | [
"def",
"_walk_FunctionName",
"(",
"self",
",",
"node",
")",
":",
"yield",
"self",
".",
"_get_name",
"(",
"node",
",",
"node",
".",
"namepath",
"[",
"0",
"]",
")",
"if",
"len",
"(",
"node",
".",
"namepath",
")",
">",
"1",
":",
"for",
"i",
"in",
"r... | https://github.com/dansanderson/picotool/blob/d8c51e58416f8010dc8c0fba3df5f0424b5bb852/pico8/lua/lua.py#L982-L990 | ||||
kuhnertdm/wow-addon-updater | 9df13c70873f5e93f30eedb89010d99d42c7baf4 | packages/requests/sessions.py | python | SessionRedirectMixin.rebuild_auth | (self, prepared_request, response) | return | When being redirected we may want to strip authentication from the
request to avoid leaking credentials. This method intelligently removes
and reapplies authentication where possible to avoid credential loss. | When being redirected we may want to strip authentication from the
request to avoid leaking credentials. This method intelligently removes
and reapplies authentication where possible to avoid credential loss. | [
"When",
"being",
"redirected",
"we",
"may",
"want",
"to",
"strip",
"authentication",
"from",
"the",
"request",
"to",
"avoid",
"leaking",
"credentials",
".",
"This",
"method",
"intelligently",
"removes",
"and",
"reapplies",
"authentication",
"where",
"possible",
"t... | def rebuild_auth(self, prepared_request, response):
"""When being redirected we may want to strip authentication from the
request to avoid leaking credentials. This method intelligently removes
and reapplies authentication where possible to avoid credential loss.
"""
headers = pr... | [
"def",
"rebuild_auth",
"(",
"self",
",",
"prepared_request",
",",
"response",
")",
":",
"headers",
"=",
"prepared_request",
".",
"headers",
"url",
"=",
"prepared_request",
".",
"url",
"if",
"'Authorization'",
"in",
"headers",
":",
"# If we get redirected to a new ho... | https://github.com/kuhnertdm/wow-addon-updater/blob/9df13c70873f5e93f30eedb89010d99d42c7baf4/packages/requests/sessions.py#L221-L243 | |
eliben/pyelftools | 8f7a0becaface09435c4374947548b7851e3d1a2 | elftools/elf/sections.py | python | ARMAttributesSubsection.subsubsections | (self) | return list(self.iter_subsubsections()) | List of all subsubsections in the subsection. | List of all subsubsections in the subsection. | [
"List",
"of",
"all",
"subsubsections",
"in",
"the",
"subsection",
"."
] | def subsubsections(self):
""" List of all subsubsections in the subsection.
"""
return list(self.iter_subsubsections()) | [
"def",
"subsubsections",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
".",
"iter_subsubsections",
"(",
")",
")"
] | https://github.com/eliben/pyelftools/blob/8f7a0becaface09435c4374947548b7851e3d1a2/elftools/elf/sections.py#L430-L433 | |
microsoft/azure-devops-python-api | 451cade4c475482792cbe9e522c1fee32393139e | azure-devops/azure/devops/v6_0/pipelines_checks/pipelines_checks_client.py | python | PipelinesChecksClient.delete_check_configuration | (self, project, id) | DeleteCheckConfiguration.
[Preview API]
:param str project: Project ID or project name
:param int id: | DeleteCheckConfiguration.
[Preview API]
:param str project: Project ID or project name
:param int id: | [
"DeleteCheckConfiguration",
".",
"[",
"Preview",
"API",
"]",
":",
"param",
"str",
"project",
":",
"Project",
"ID",
"or",
"project",
"name",
":",
"param",
"int",
"id",
":"
] | def delete_check_configuration(self, project, id):
"""DeleteCheckConfiguration.
[Preview API]
:param str project: Project ID or project name
:param int id:
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('pro... | [
"def",
"delete_check_configuration",
"(",
"self",
",",
"project",
",",
"id",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"project",
"is",
"not",
"None",
":",
"route_values",
"[",
"'project'",
"]",
"=",
"self",
".",
"_serialize",
".",
"url",
"(",
"'pro... | https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v6_0/pipelines_checks/pipelines_checks_client.py#L46-L60 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/helpers/state.py | python | AsyncTrackStates.__exit__ | (
self,
exc_type: type[BaseException] | None,
exc_value: BaseException | None,
traceback: TracebackType | None,
) | Add changes states to changes list. | Add changes states to changes list. | [
"Add",
"changes",
"states",
"to",
"changes",
"list",
"."
] | def __exit__(
self,
exc_type: type[BaseException] | None,
exc_value: BaseException | None,
traceback: TracebackType | None,
) -> None:
"""Add changes states to changes list."""
self.states.extend(get_changed_since(self.hass.states.async_all(), self.now)) | [
"def",
"__exit__",
"(",
"self",
",",
"exc_type",
":",
"type",
"[",
"BaseException",
"]",
"|",
"None",
",",
"exc_value",
":",
"BaseException",
"|",
"None",
",",
"traceback",
":",
"TracebackType",
"|",
"None",
",",
")",
"->",
"None",
":",
"self",
".",
"s... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/helpers/state.py#L57-L64 | ||
nltk/nltk | 3f74ac55681667d7ef78b664557487145f51eb02 | nltk/inference/discourse.py | python | DrtGlueReadingCommand.to_fol | (self, expression) | return expression.fol() | :see: ReadingCommand.to_fol() | :see: ReadingCommand.to_fol() | [
":",
"see",
":",
"ReadingCommand",
".",
"to_fol",
"()"
] | def to_fol(self, expression):
""":see: ReadingCommand.to_fol()"""
return expression.fol() | [
"def",
"to_fol",
"(",
"self",
",",
"expression",
")",
":",
"return",
"expression",
".",
"fol",
"(",
")"
] | https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/inference/discourse.py#L164-L166 | |
getsentry/sentry | 83b1f25aac3e08075e0e2495bc29efaf35aca18a | src/sentry/incidents/models.py | python | AlertRuleTriggerManager.get_for_alert_rule | (self, alert_rule) | return triggers | Fetches the AlertRuleTriggers associated with an AlertRule. Attempts to fetch
from cache then hits the database | Fetches the AlertRuleTriggers associated with an AlertRule. Attempts to fetch
from cache then hits the database | [
"Fetches",
"the",
"AlertRuleTriggers",
"associated",
"with",
"an",
"AlertRule",
".",
"Attempts",
"to",
"fetch",
"from",
"cache",
"then",
"hits",
"the",
"database"
] | def get_for_alert_rule(self, alert_rule):
"""
Fetches the AlertRuleTriggers associated with an AlertRule. Attempts to fetch
from cache then hits the database
"""
cache_key = self._build_trigger_cache_key(alert_rule.id)
triggers = cache.get(cache_key)
if triggers i... | [
"def",
"get_for_alert_rule",
"(",
"self",
",",
"alert_rule",
")",
":",
"cache_key",
"=",
"self",
".",
"_build_trigger_cache_key",
"(",
"alert_rule",
".",
"id",
")",
"triggers",
"=",
"cache",
".",
"get",
"(",
"cache_key",
")",
"if",
"triggers",
"is",
"None",
... | https://github.com/getsentry/sentry/blob/83b1f25aac3e08075e0e2495bc29efaf35aca18a/src/sentry/incidents/models.py#L458-L468 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/signal/windows/windows.py | python | _len_guards | (M) | return M <= 1 | Handle small or incorrect window lengths | Handle small or incorrect window lengths | [
"Handle",
"small",
"or",
"incorrect",
"window",
"lengths"
] | def _len_guards(M):
"""Handle small or incorrect window lengths"""
if int(M) != M or M < 0:
raise ValueError('Window length M must be a non-negative integer')
return M <= 1 | [
"def",
"_len_guards",
"(",
"M",
")",
":",
"if",
"int",
"(",
"M",
")",
"!=",
"M",
"or",
"M",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"'Window length M must be a non-negative integer'",
")",
"return",
"M",
"<=",
"1"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/signal/windows/windows.py#L19-L23 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/combinatorics/permutations.py | python | _af_rmul | (a, b) | return [a[i] for i in b] | Return the product b*a; input and output are array forms. The ith value
is a[b[i]].
Examples
========
>>> from sympy.combinatorics.permutations import _af_rmul, Permutation
>>> Permutation.print_cyclic = False
>>> a, b = [1, 0, 2], [0, 2, 1]
>>> _af_rmul(a, b)
[1, 2, 0]
>>> [a[b[i... | Return the product b*a; input and output are array forms. The ith value
is a[b[i]]. | [
"Return",
"the",
"product",
"b",
"*",
"a",
";",
"input",
"and",
"output",
"are",
"array",
"forms",
".",
"The",
"ith",
"value",
"is",
"a",
"[",
"b",
"[",
"i",
"]]",
"."
] | def _af_rmul(a, b):
"""
Return the product b*a; input and output are array forms. The ith value
is a[b[i]].
Examples
========
>>> from sympy.combinatorics.permutations import _af_rmul, Permutation
>>> Permutation.print_cyclic = False
>>> a, b = [1, 0, 2], [0, 2, 1]
>>> _af_rmul(a,... | [
"def",
"_af_rmul",
"(",
"a",
",",
"b",
")",
":",
"return",
"[",
"a",
"[",
"i",
"]",
"for",
"i",
"in",
"b",
"]"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/combinatorics/permutations.py#L15-L44 | |
Gallopsled/pwntools | 1573957cc8b1957399b7cc9bfae0c6f80630d5d4 | pwnlib/log.py | python | Logger.log | (self, level, message, *args, **kwargs) | log(level, message, *args, **kwargs)
Logs a message with log level `level`. The ``pwnlib`` formatter will
use the default :mod:`logging` formater to format this message. | log(level, message, *args, **kwargs) | [
"log",
"(",
"level",
"message",
"*",
"args",
"**",
"kwargs",
")"
] | def log(self, level, message, *args, **kwargs):
"""log(level, message, *args, **kwargs)
Logs a message with log level `level`. The ``pwnlib`` formatter will
use the default :mod:`logging` formater to format this message.
"""
self._log(level, message, args, kwargs, None) | [
"def",
"log",
"(",
"self",
",",
"level",
",",
"message",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_log",
"(",
"level",
",",
"message",
",",
"args",
",",
"kwargs",
",",
"None",
")"
] | https://github.com/Gallopsled/pwntools/blob/1573957cc8b1957399b7cc9bfae0c6f80630d5d4/pwnlib/log.py#L459-L465 | ||
TkTech/notifico | 484c411cba3cc00b69dbf462c2f038a2d9a44f84 | notifico/services/hooks/appveyor.py | python | AppVeyorHook._create_summary | (cls, payload) | return cls._prefix_line(line, payload) | Create and return a one-line summary of the build | Create and return a one-line summary of the build | [
"Create",
"and",
"return",
"a",
"one",
"-",
"line",
"summary",
"of",
"the",
"build"
] | def _create_summary(cls, payload):
"""
Create and return a one-line summary of the build
"""
if payload['failed'] == True:
status_colour = HookService.colors['RED']
elif payload['passed'] == True:
status_colour = HookService.colors['GREEN']
lines ... | [
"def",
"_create_summary",
"(",
"cls",
",",
"payload",
")",
":",
"if",
"payload",
"[",
"'failed'",
"]",
"==",
"True",
":",
"status_colour",
"=",
"HookService",
".",
"colors",
"[",
"'RED'",
"]",
"elif",
"payload",
"[",
"'passed'",
"]",
"==",
"True",
":",
... | https://github.com/TkTech/notifico/blob/484c411cba3cc00b69dbf462c2f038a2d9a44f84/notifico/services/hooks/appveyor.py#L60-L99 | |
python-babel/babel | cc36c84a83dd447bf48a6af3eb03c97bf299e8cb | babel/dates.py | python | format_interval | (start, end, skeleton=None, tzinfo=None, fuzzy=True, locale=LC_TIME) | return _format_fallback_interval(start, end, skeleton, tzinfo, locale) | Format an interval between two instants according to the locale's rules.
>>> format_interval(date(2016, 1, 15), date(2016, 1, 17), "yMd", locale="fi")
u'15.\u201317.1.2016'
>>> format_interval(time(12, 12), time(16, 16), "Hm", locale="en_GB")
'12:12\u201316:16'
>>> format_interval(time(5, 12), ti... | Format an interval between two instants according to the locale's rules. | [
"Format",
"an",
"interval",
"between",
"two",
"instants",
"according",
"to",
"the",
"locale",
"s",
"rules",
"."
] | def format_interval(start, end, skeleton=None, tzinfo=None, fuzzy=True, locale=LC_TIME):
"""
Format an interval between two instants according to the locale's rules.
>>> format_interval(date(2016, 1, 15), date(2016, 1, 17), "yMd", locale="fi")
u'15.\u201317.1.2016'
>>> format_interval(time(12, 12)... | [
"def",
"format_interval",
"(",
"start",
",",
"end",
",",
"skeleton",
"=",
"None",
",",
"tzinfo",
"=",
"None",
",",
"fuzzy",
"=",
"True",
",",
"locale",
"=",
"LC_TIME",
")",
":",
"locale",
"=",
"Locale",
".",
"parse",
"(",
"locale",
")",
"# NB: The quot... | https://github.com/python-babel/babel/blob/cc36c84a83dd447bf48a6af3eb03c97bf299e8cb/babel/dates.py#L984-L1079 | |
klen/mixer | 39ef3b717d4ac9da1824cb9c242fd326fa00ba08 | mixer/_faker.py | python | MixerProvider.big_integer | (self) | return self.generator.random_int(-9223372036854775808, 9223372036854775807) | Get a big integer.
Get integer from -9223372036854775808 to 9223372036854775807. | Get a big integer. | [
"Get",
"a",
"big",
"integer",
"."
] | def big_integer(self):
""" Get a big integer.
Get integer from -9223372036854775808 to 9223372036854775807.
"""
return self.generator.random_int(-9223372036854775808, 9223372036854775807) | [
"def",
"big_integer",
"(",
"self",
")",
":",
"return",
"self",
".",
"generator",
".",
"random_int",
"(",
"-",
"9223372036854775808",
",",
"9223372036854775807",
")"
] | https://github.com/klen/mixer/blob/39ef3b717d4ac9da1824cb9c242fd326fa00ba08/mixer/_faker.py#L39-L45 | |
bendmorris/static-python | 2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473 | Lib/ftplib.py | python | FTP.transfercmd | (self, cmd, rest=None) | return self.ntransfercmd(cmd, rest)[0] | Like ntransfercmd() but returns only the socket. | Like ntransfercmd() but returns only the socket. | [
"Like",
"ntransfercmd",
"()",
"but",
"returns",
"only",
"the",
"socket",
"."
] | def transfercmd(self, cmd, rest=None):
"""Like ntransfercmd() but returns only the socket."""
return self.ntransfercmd(cmd, rest)[0] | [
"def",
"transfercmd",
"(",
"self",
",",
"cmd",
",",
"rest",
"=",
"None",
")",
":",
"return",
"self",
".",
"ntransfercmd",
"(",
"cmd",
",",
"rest",
")",
"[",
"0",
"]"
] | https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/ftplib.py#L392-L394 | |
Ultimaker/Uranium | 66da853cd9a04edd3a8a03526fac81e83c03f5aa | UM/Settings/SettingDefinition.py | python | SettingDefinition.getChild | (self, key: str) | return None | Get a child by key
:param key: :type{string} The key of the child to get.
:return: :type{SettingDefinition} The child with the specified key or None if not found. | Get a child by key | [
"Get",
"a",
"child",
"by",
"key"
] | def getChild(self, key: str) -> Optional["SettingDefinition"]:
"""Get a child by key
:param key: :type{string} The key of the child to get.
:return: :type{SettingDefinition} The child with the specified key or None if not found.
"""
if not self.__descendants:
self.... | [
"def",
"getChild",
"(",
"self",
",",
"key",
":",
"str",
")",
"->",
"Optional",
"[",
"\"SettingDefinition\"",
"]",
":",
"if",
"not",
"self",
".",
"__descendants",
":",
"self",
".",
"__descendants",
"=",
"self",
".",
"_updateDescendants",
"(",
")",
"if",
"... | https://github.com/Ultimaker/Uranium/blob/66da853cd9a04edd3a8a03526fac81e83c03f5aa/UM/Settings/SettingDefinition.py#L261-L280 | |
HaoZhang95/Python24 | b897224b8a0e6a5734f408df8c24846a98c553bf | 00Python/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/requests/cookies.py | python | create_cookie | (name, value, **kwargs) | return cookielib.Cookie(**result) | Make a cookie from underspecified parameters.
By default, the pair of `name` and `value` will be set for the domain ''
and sent on every request (this is sometimes called a "supercookie"). | Make a cookie from underspecified parameters. | [
"Make",
"a",
"cookie",
"from",
"underspecified",
"parameters",
"."
] | def create_cookie(name, value, **kwargs):
"""Make a cookie from underspecified parameters.
By default, the pair of `name` and `value` will be set for the domain ''
and sent on every request (this is sometimes called a "supercookie").
"""
result = dict(
version=0,
name=name,
... | [
"def",
"create_cookie",
"(",
"name",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"dict",
"(",
"version",
"=",
"0",
",",
"name",
"=",
"name",
",",
"value",
"=",
"value",
",",
"port",
"=",
"None",
",",
"domain",
"=",
"''",
",",
... | https://github.com/HaoZhang95/Python24/blob/b897224b8a0e6a5734f408df8c24846a98c553bf/00Python/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/requests/cookies.py#L437-L469 | |
spesmilo/electrum | bdbd59300fbd35b01605e66145458e5f396108e8 | electrum/gui/qt/main_window.py | python | ElectrumWindow.do_import_privkey | (self, password) | [] | def do_import_privkey(self, password):
if not self.wallet.can_import_privkey():
return
title = _('Import private keys')
header_layout = QHBoxLayout()
header_layout.addWidget(QLabel(_("Enter private keys")+':'))
header_layout.addWidget(InfoButton(WIF_HELP_TEXT), alignm... | [
"def",
"do_import_privkey",
"(",
"self",
",",
"password",
")",
":",
"if",
"not",
"self",
".",
"wallet",
".",
"can_import_privkey",
"(",
")",
":",
"return",
"title",
"=",
"_",
"(",
"'Import private keys'",
")",
"header_layout",
"=",
"QHBoxLayout",
"(",
")",
... | https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/gui/qt/main_window.py#L3179-L3186 | ||||
brightmart/slot_filling_intent_joint_model | 06ee6932bca2e07b3667e7edbef878a79cdcf2d1 | joint_model_knowl_v7_with_domain_knowledge_context_window/joint_intent_slots_knowledge_domain_predict.py | python | get_y_slots_by_knowledge | (sentence,sequence_length,enable_knowledge=1,knowledge_path=None) | return result | get y_slots using dictt.e.g. dictt={'slots': {'全部范围': '全', '房间': '储藏室', '设备名': '四开开关'}, 'user': '替我把储藏室四开开关全关闭一下', 'intent': '关设备<房间><全部范围><设备名>'} | get y_slots using dictt.e.g. dictt={'slots': {'全部范围': '全', '房间': '储藏室', '设备名': '四开开关'}, 'user': '替我把储藏室四开开关全关闭一下', 'intent': '关设备<房间><全部范围><设备名>'} | [
"get",
"y_slots",
"using",
"dictt",
".",
"e",
".",
"g",
".",
"dictt",
"=",
"{",
"slots",
":",
"{",
"全部范围",
":",
"全",
"房间",
":",
"储藏室",
"设备名",
":",
"四开开关",
"}",
"user",
":",
"替我把储藏室四开开关全关闭一下",
"intent",
":",
"关设备<房间",
">",
"<全部范围",
">",
"<设备名",
">... | def get_y_slots_by_knowledge(sentence,sequence_length,enable_knowledge=1,knowledge_path=None):
"""get y_slots using dictt.e.g. dictt={'slots': {'全部范围': '全', '房间': '储藏室', '设备名': '四开开关'}, 'user': '替我把储藏室四开开关全关闭一下', 'intent': '关设备<房间><全部范围><设备名>'}"""
#knowledge_dict=#{'储藏室': '房间', '全': '全部范围', '四开开关': '设备名'}
u... | [
"def",
"get_y_slots_by_knowledge",
"(",
"sentence",
",",
"sequence_length",
",",
"enable_knowledge",
"=",
"1",
",",
"knowledge_path",
"=",
"None",
")",
":",
"#knowledge_dict=#{'储藏室': '房间', '全': '全部范围', '四开开关': '设备名'}",
"user_speech_tokenized",
"=",
"tokenize_sentence",
"(",
... | https://github.com/brightmart/slot_filling_intent_joint_model/blob/06ee6932bca2e07b3667e7edbef878a79cdcf2d1/joint_model_knowl_v7_with_domain_knowledge_context_window/joint_intent_slots_knowledge_domain_predict.py#L179-L193 | |
ninuxorg/nodeshot | 2466f0a55f522b2696026f196436ce7ba3f1e5c6 | nodeshot/interop/sync/models/layer_external.py | python | LayerExternal.save | (self, *args, **kwargs) | call synchronizer "after_external_layer_saved" method
for any additional operation that must be executed after save | call synchronizer "after_external_layer_saved" method
for any additional operation that must be executed after save | [
"call",
"synchronizer",
"after_external_layer_saved",
"method",
"for",
"any",
"additional",
"operation",
"that",
"must",
"be",
"executed",
"after",
"save"
] | def save(self, *args, **kwargs):
"""
call synchronizer "after_external_layer_saved" method
for any additional operation that must be executed after save
"""
after_save = kwargs.pop('after_save', True)
super(LayerExternal, self).save(*args, **kwargs)
# call after_e... | [
"def",
"save",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"after_save",
"=",
"kwargs",
".",
"pop",
"(",
"'after_save'",
",",
"True",
")",
"super",
"(",
"LayerExternal",
",",
"self",
")",
".",
"save",
"(",
"*",
"args",
",",
... | https://github.com/ninuxorg/nodeshot/blob/2466f0a55f522b2696026f196436ce7ba3f1e5c6/nodeshot/interop/sync/models/layer_external.py#L84-L101 | ||
home-assistant/supervisor | 69c2517d5211b483fdfe968b0a2b36b672ee7ab2 | supervisor/dbus/hostname.py | python | Hostname.deployment | (self) | return self.properties[DBUS_ATTR_DEPLOYMENT] | Return local deployment type. | Return local deployment type. | [
"Return",
"local",
"deployment",
"type",
"."
] | def deployment(self) -> Optional[str]:
"""Return local deployment type."""
return self.properties[DBUS_ATTR_DEPLOYMENT] | [
"def",
"deployment",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"properties",
"[",
"DBUS_ATTR_DEPLOYMENT",
"]"
] | https://github.com/home-assistant/supervisor/blob/69c2517d5211b483fdfe968b0a2b36b672ee7ab2/supervisor/dbus/hostname.py#L58-L60 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/export/models/new.py | python | DataFile.get_blob | (self) | return blob | [] | def get_blob(self):
db = get_blob_db()
try:
blob = db.get(meta=self._meta)
except (KeyError, NotFound) as err:
raise NotFound(str(err))
return blob | [
"def",
"get_blob",
"(",
"self",
")",
":",
"db",
"=",
"get_blob_db",
"(",
")",
"try",
":",
"blob",
"=",
"db",
".",
"get",
"(",
"meta",
"=",
"self",
".",
"_meta",
")",
"except",
"(",
"KeyError",
",",
"NotFound",
")",
"as",
"err",
":",
"raise",
"Not... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/export/models/new.py#L2805-L2811 | |||
francisck/DanderSpritz_docs | 86bb7caca5a957147f120b18bb5c31f299914904 | Python/Core/Lib/decimal.py | python | _dlog10 | (c, e, p) | return _div_nearest(log_tenpower + log_d, 100) | Given integers c, e and p with c > 0, p >= 0, compute an integer
approximation to 10**p * log10(c*10**e), with an absolute error of
at most 1. Assumes that c*10**e is not exactly 1. | Given integers c, e and p with c > 0, p >= 0, compute an integer
approximation to 10**p * log10(c*10**e), with an absolute error of
at most 1. Assumes that c*10**e is not exactly 1. | [
"Given",
"integers",
"c",
"e",
"and",
"p",
"with",
"c",
">",
"0",
"p",
">",
"=",
"0",
"compute",
"an",
"integer",
"approximation",
"to",
"10",
"**",
"p",
"*",
"log10",
"(",
"c",
"*",
"10",
"**",
"e",
")",
"with",
"an",
"absolute",
"error",
"of",
... | def _dlog10(c, e, p):
"""Given integers c, e and p with c > 0, p >= 0, compute an integer
approximation to 10**p * log10(c*10**e), with an absolute error of
at most 1. Assumes that c*10**e is not exactly 1."""
p += 2
l = len(str(c))
f = e + l - (e + l >= 1)
if p > 0:
M = 10 ** p
... | [
"def",
"_dlog10",
"(",
"c",
",",
"e",
",",
"p",
")",
":",
"p",
"+=",
"2",
"l",
"=",
"len",
"(",
"str",
"(",
"c",
")",
")",
"f",
"=",
"e",
"+",
"l",
"-",
"(",
"e",
"+",
"l",
">=",
"1",
")",
"if",
"p",
">",
"0",
":",
"M",
"=",
"10",
... | https://github.com/francisck/DanderSpritz_docs/blob/86bb7caca5a957147f120b18bb5c31f299914904/Python/Core/Lib/decimal.py#L4731-L4752 | |
mandiant/idawasm | 51cb56d8664057790f1c94f44a189261a21cbbc9 | idawasm/processor.py | python | wasm_processor_t._get_section | (self, section_id) | fetch the section with the given id.
Args:
section_id (int): the section id.
Returns:
wasm.Structure: the section.
Raises:
KeyError: if the section is not found. | fetch the section with the given id. | [
"fetch",
"the",
"section",
"with",
"the",
"given",
"id",
"."
] | def _get_section(self, section_id):
'''
fetch the section with the given id.
Args:
section_id (int): the section id.
Returns:
wasm.Structure: the section.
Raises:
KeyError: if the section is not found.
'''
for i, section in enumera... | [
"def",
"_get_section",
"(",
"self",
",",
"section_id",
")",
":",
"for",
"i",
",",
"section",
"in",
"enumerate",
"(",
"self",
".",
"sections",
")",
":",
"if",
"i",
"==",
"0",
":",
"continue",
"if",
"section",
".",
"data",
".",
"id",
"!=",
"section_id"... | https://github.com/mandiant/idawasm/blob/51cb56d8664057790f1c94f44a189261a21cbbc9/idawasm/processor.py#L133-L155 | ||
statsmodels/statsmodels | debbe7ea6ba28fe5bdb78f09f8cac694bef98722 | statsmodels/discrete/discrete_margins.py | python | _margeff_cov_params_dummy | (model, cov_margins, params, exog, dummy_ind,
method, J) | return cov_margins | r"""
Returns the Jacobian for discrete regressors for use in margeff_cov_params.
For discrete regressors the marginal effect is
\Delta F = F(XB) | d = 1 - F(XB) | d = 0
The row of the Jacobian for this variable is given by
f(XB)*X | d = 1 - f(XB)*X | d = 0
Where F is the default prediction ... | r"""
Returns the Jacobian for discrete regressors for use in margeff_cov_params. | [
"r",
"Returns",
"the",
"Jacobian",
"for",
"discrete",
"regressors",
"for",
"use",
"in",
"margeff_cov_params",
"."
] | def _margeff_cov_params_dummy(model, cov_margins, params, exog, dummy_ind,
method, J):
r"""
Returns the Jacobian for discrete regressors for use in margeff_cov_params.
For discrete regressors the marginal effect is
\Delta F = F(XB) | d = 1 - F(XB) | d = 0
The row of the Jacobian for this ... | [
"def",
"_margeff_cov_params_dummy",
"(",
"model",
",",
"cov_margins",
",",
"params",
",",
"exog",
",",
"dummy_ind",
",",
"method",
",",
"J",
")",
":",
"for",
"i",
"in",
"dummy_ind",
":",
"exog0",
"=",
"exog",
".",
"copy",
"(",
")",
"exog1",
"=",
"exog"... | https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/discrete/discrete_margins.py#L190-L221 | |
biopython/biopython | 2dd97e71762af7b046d7f7f8a4f1e38db6b06c86 | Bio/Align/mauve.py | python | AlignmentWriter.write_file | (self, alignments) | return count | Write a file with the alignments, and return the number of alignments.
alignments - A Bio.Align.mauve.AlignmentIterator object. | Write a file with the alignments, and return the number of alignments. | [
"Write",
"a",
"file",
"with",
"the",
"alignments",
"and",
"return",
"the",
"number",
"of",
"alignments",
"."
] | def write_file(self, alignments):
"""Write a file with the alignments, and return the number of alignments.
alignments - A Bio.Align.mauve.AlignmentIterator object.
"""
class ListWithAttributes(list):
pass
try:
metadata = alignments.metadata
exc... | [
"def",
"write_file",
"(",
"self",
",",
"alignments",
")",
":",
"class",
"ListWithAttributes",
"(",
"list",
")",
":",
"pass",
"try",
":",
"metadata",
"=",
"alignments",
".",
"metadata",
"except",
"AttributeError",
":",
"metadata",
"=",
"{",
"}",
"alignments",... | https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/Align/mauve.py#L56-L73 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/requests/auth.py | python | HTTPDigestAuth.handle_redirect | (self, r, **kwargs) | Reset num_401_calls counter on redirects. | Reset num_401_calls counter on redirects. | [
"Reset",
"num_401_calls",
"counter",
"on",
"redirects",
"."
] | def handle_redirect(self, r, **kwargs):
"""Reset num_401_calls counter on redirects."""
if r.is_redirect:
self._thread_local.num_401_calls = 1 | [
"def",
"handle_redirect",
"(",
"self",
",",
"r",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"r",
".",
"is_redirect",
":",
"self",
".",
"_thread_local",
".",
"num_401_calls",
"=",
"1"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/requests/auth.py#L217-L220 | ||
jina-ai/jina | c77a492fcd5adba0fc3de5347bea83dd4e7d8087 | jina/hubble/helper.py | python | _get_install_options | (requirements_file: 'Path', excludes: Tuple[str] = ('jina',)) | return install_reqs, install_options | [] | def _get_install_options(requirements_file: 'Path', excludes: Tuple[str] = ('jina',)):
import pkg_resources
with requirements_file.open() as requirements:
install_options = []
install_reqs = []
for req in requirements:
req = req.strip()
if (not req) or req.starts... | [
"def",
"_get_install_options",
"(",
"requirements_file",
":",
"'Path'",
",",
"excludes",
":",
"Tuple",
"[",
"str",
"]",
"=",
"(",
"'jina'",
",",
")",
")",
":",
"import",
"pkg_resources",
"with",
"requirements_file",
".",
"open",
"(",
")",
"as",
"requirements... | https://github.com/jina-ai/jina/blob/c77a492fcd5adba0fc3de5347bea83dd4e7d8087/jina/hubble/helper.py#L369-L389 | |||
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/requests/packages/chardet/charsetprober.py | python | CharSetProber.filter_with_english_letters | (self, aBuf) | return aBuf | [] | def filter_with_english_letters(self, aBuf):
# TODO
return aBuf | [
"def",
"filter_with_english_letters",
"(",
"self",
",",
"aBuf",
")",
":",
"# TODO",
"return",
"aBuf"
] | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/requests/packages/chardet/charsetprober.py#L60-L62 | |||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/mistune.py | python | escape_link | (url) | return escape(url, quote=True, smart_amp=False) | Remove dangerous URL schemes like javascript: and escape afterwards. | Remove dangerous URL schemes like javascript: and escape afterwards. | [
"Remove",
"dangerous",
"URL",
"schemes",
"like",
"javascript",
":",
"and",
"escape",
"afterwards",
"."
] | def escape_link(url):
"""Remove dangerous URL schemes like javascript: and escape afterwards."""
lower_url = url.lower().strip('\x00\x1a \n\r\t')
for scheme in _scheme_blacklist:
if re.sub(r'[^A-Za-z0-9\/:]+', '', lower_url).startswith(scheme):
return ''
return escape(url, quote=Tru... | [
"def",
"escape_link",
"(",
"url",
")",
":",
"lower_url",
"=",
"url",
".",
"lower",
"(",
")",
".",
"strip",
"(",
"'\\x00\\x1a \\n\\r\\t'",
")",
"for",
"scheme",
"in",
"_scheme_blacklist",
":",
"if",
"re",
".",
"sub",
"(",
"r'[^A-Za-z0-9\\/:]+'",
",",
"''",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/mistune.py#L76-L83 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py | python | StrSQLTypeCompiler.__getattr__ | (self, key) | [] | def __getattr__(self, key):
if key.startswith("visit_"):
return self._visit_unknown
else:
raise AttributeError(key) | [
"def",
"__getattr__",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
".",
"startswith",
"(",
"\"visit_\"",
")",
":",
"return",
"self",
".",
"_visit_unknown",
"else",
":",
"raise",
"AttributeError",
"(",
"key",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py#L2960-L2964 | ||||
pageauc/pi-timolo | b146898190a5241788b3d7314bdf4d100a05f034 | source/pi-timolo.py | python | display_info | (motioncount, timelapsecount) | Display variable settings with plugin overlays if required | Display variable settings with plugin overlays if required | [
"Display",
"variable",
"settings",
"with",
"plugin",
"overlays",
"if",
"required"
] | def display_info(motioncount, timelapsecount):
''' Display variable settings with plugin overlays if required '''
if VERBOSE_ON:
print("----------------------------------- Settings "
"-----------------------------------")
print("Config File .. CONFIG_FILENAME=%s CONFIG_TITLE=%s"
... | [
"def",
"display_info",
"(",
"motioncount",
",",
"timelapsecount",
")",
":",
"if",
"VERBOSE_ON",
":",
"print",
"(",
"\"----------------------------------- Settings \"",
"\"-----------------------------------\"",
")",
"print",
"(",
"\"Config File .. CONFIG_FILENAME=%s CONFIG_TITLE... | https://github.com/pageauc/pi-timolo/blob/b146898190a5241788b3d7314bdf4d100a05f034/source/pi-timolo.py#L680-L828 | ||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/pyparsing/core.py | python | Char.__init__ | (
self,
charset: str,
as_keyword: bool = False,
exclude_chars: OptionalType[str] = None,
*,
asKeyword: bool = False,
excludeChars: OptionalType[str] = None,
) | [] | def __init__(
self,
charset: str,
as_keyword: bool = False,
exclude_chars: OptionalType[str] = None,
*,
asKeyword: bool = False,
excludeChars: OptionalType[str] = None,
):
asKeyword = asKeyword or as_keyword
excludeChars = excludeChars or exclu... | [
"def",
"__init__",
"(",
"self",
",",
"charset",
":",
"str",
",",
"as_keyword",
":",
"bool",
"=",
"False",
",",
"exclude_chars",
":",
"OptionalType",
"[",
"str",
"]",
"=",
"None",
",",
"*",
",",
"asKeyword",
":",
"bool",
"=",
"False",
",",
"excludeChars... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/pyparsing/core.py#L2850-L2868 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.