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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/orm/session.py | python | Session.is_active | (self) | return self.transaction and self.transaction.is_active | True if this :class:`.Session` is in "transaction mode" and
is not in "partial rollback" state.
The :class:`.Session` in its default mode of ``autocommit=False``
is essentially always in "transaction mode", in that a
:class:`.SessionTransaction` is associated with it as soon as
... | True if this :class:`.Session` is in "transaction mode" and
is not in "partial rollback" state. | [
"True",
"if",
"this",
":",
"class",
":",
".",
"Session",
"is",
"in",
"transaction",
"mode",
"and",
"is",
"not",
"in",
"partial",
"rollback",
"state",
"."
] | def is_active(self):
"""True if this :class:`.Session` is in "transaction mode" and
is not in "partial rollback" state.
The :class:`.Session` in its default mode of ``autocommit=False``
is essentially always in "transaction mode", in that a
:class:`.SessionTransaction` is associ... | [
"def",
"is_active",
"(",
"self",
")",
":",
"return",
"self",
".",
"transaction",
"and",
"self",
".",
"transaction",
".",
"is_active"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/orm/session.py#L2130-L2185 | |
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | haproxy/datadog_checks/haproxy/config_models/defaults.py | python | instance_send_distribution_buckets | (field, value) | return False | [] | def instance_send_distribution_buckets(field, value):
return False | [
"def",
"instance_send_distribution_buckets",
"(",
"field",
",",
"value",
")",
":",
"return",
"False"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/haproxy/datadog_checks/haproxy/config_models/defaults.py#L225-L226 | |||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/distlib/metadata.py | python | Metadata.__setattr__ | (self, key, value) | [] | def __setattr__(self, key, value):
self._validate_value(key, value)
common = object.__getattribute__(self, 'common_keys')
mapped = object.__getattribute__(self, 'mapped_keys')
if key in mapped:
lk, _ = mapped[key]
if self._legacy:
if lk is None:
... | [
"def",
"__setattr__",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"_validate_value",
"(",
"key",
",",
"value",
")",
"common",
"=",
"object",
".",
"__getattribute__",
"(",
"self",
",",
"'common_keys'",
")",
"mapped",
"=",
"object",
".",
... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/distlib/metadata.py#L793-L830 | ||||
khalim19/gimp-plugin-export-layers | b37255f2957ad322f4d332689052351cdea6e563 | export_layers/pygimplib/_lib/future/future/backports/http/cookiejar.py | python | CookieJar.__init__ | (self, policy=None) | [] | def __init__(self, policy=None):
if policy is None:
policy = DefaultCookiePolicy()
self._policy = policy
self._cookies_lock = _threading.RLock()
self._cookies = {} | [
"def",
"__init__",
"(",
"self",
",",
"policy",
"=",
"None",
")",
":",
"if",
"policy",
"is",
"None",
":",
"policy",
"=",
"DefaultCookiePolicy",
"(",
")",
"self",
".",
"_policy",
"=",
"policy",
"self",
".",
"_cookies_lock",
"=",
"_threading",
".",
"RLock",... | https://github.com/khalim19/gimp-plugin-export-layers/blob/b37255f2957ad322f4d332689052351cdea6e563/export_layers/pygimplib/_lib/future/future/backports/http/cookiejar.py#L1238-L1244 | ||||
digidotcom/xbee-python | 0757f4be0017530c205175fbee8f9f61be9614d1 | digi/xbee/packets/common.py | python | ExplicitRXIndicatorPacket.rf_data | (self, rf_data) | Sets the received RF data.
Args:
rf_data (Bytearray): the new received RF data. | Sets the received RF data. | [
"Sets",
"the",
"received",
"RF",
"data",
"."
] | def rf_data(self, rf_data):
"""
Sets the received RF data.
Args:
rf_data (Bytearray): the new received RF data.
"""
if rf_data is None:
self.__data = None
else:
self.__data = rf_data.copy() | [
"def",
"rf_data",
"(",
"self",
",",
"rf_data",
")",
":",
"if",
"rf_data",
"is",
"None",
":",
"self",
".",
"__data",
"=",
"None",
"else",
":",
"self",
".",
"__data",
"=",
"rf_data",
".",
"copy",
"(",
")"
] | https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/packets/common.py#L3088-L3098 | ||
praekeltfoundation/vumi | b74b5dac95df778519f54c670a353e4bda496df9 | vumi/application/base.py | python | ApplicationWorker.teardown_application | (self) | Clean-up of setup done in setup_application should happen here. | Clean-up of setup done in setup_application should happen here. | [
"Clean",
"-",
"up",
"of",
"setup",
"done",
"in",
"setup_application",
"should",
"happen",
"here",
"."
] | def teardown_application(self):
"""
Clean-up of setup done in setup_application should happen here.
"""
pass | [
"def",
"teardown_application",
"(",
"self",
")",
":",
"pass"
] | https://github.com/praekeltfoundation/vumi/blob/b74b5dac95df778519f54c670a353e4bda496df9/vumi/application/base.py#L129-L133 | ||
MeanEYE/Sunflower | 1024bbdde3b8e202ddad3553b321a7b6230bffc9 | sunflower/gui/main_window.py | python | MainWindow.register_popup_menu_action | (self, mime_types, menu_item) | Register handler method for popup menu which will be
displayed if file type matches any string in mime_types.
mime_types - tuple containing mime type strings
menu_item - menu item to be included in additional menu | Register handler method for popup menu which will be
displayed if file type matches any string in mime_types. | [
"Register",
"handler",
"method",
"for",
"popup",
"menu",
"which",
"will",
"be",
"displayed",
"if",
"file",
"type",
"matches",
"any",
"string",
"in",
"mime_types",
"."
] | def register_popup_menu_action(self, mime_types, menu_item):
"""Register handler method for popup menu which will be
displayed if file type matches any string in mime_types.
mime_types - tuple containing mime type strings
menu_item - menu item to be included in additional menu
"""
data = (mime_types, menu_... | [
"def",
"register_popup_menu_action",
"(",
"self",
",",
"mime_types",
",",
"menu_item",
")",
":",
"data",
"=",
"(",
"mime_types",
",",
"menu_item",
")",
"self",
".",
"popup_menu_actions",
".",
"append",
"(",
"data",
")"
] | https://github.com/MeanEYE/Sunflower/blob/1024bbdde3b8e202ddad3553b321a7b6230bffc9/sunflower/gui/main_window.py#L2277-L2285 | ||
nosmokingbandit/watcher | dadacd21a5790ee609058a98a17fcc8954d24439 | core/helpers.py | python | Conversions.human_datetime | (dt) | return dt.strftime('%A, %b %d, at %H:%M') | Converts datetime object into human-readable format.
:param dt: datetime object
Returns str date formatted as "Monday, Jan 1st, at 12:00" (24hr time) | Converts datetime object into human-readable format.
:param dt: datetime object | [
"Converts",
"datetime",
"object",
"into",
"human",
"-",
"readable",
"format",
".",
":",
"param",
"dt",
":",
"datetime",
"object"
] | def human_datetime(dt):
''' Converts datetime object into human-readable format.
:param dt: datetime object
Returns str date formatted as "Monday, Jan 1st, at 12:00" (24hr time)
'''
return dt.strftime('%A, %b %d, at %H:%M') | [
"def",
"human_datetime",
"(",
"dt",
")",
":",
"return",
"dt",
".",
"strftime",
"(",
"'%A, %b %d, at %H:%M'",
")"
] | https://github.com/nosmokingbandit/watcher/blob/dadacd21a5790ee609058a98a17fcc8954d24439/core/helpers.py#L92-L99 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/backends/backend_wx.py | python | _FigureCanvasWxBase._onMiddleButtonDown | (self, evt) | Start measuring on an axis. | Start measuring on an axis. | [
"Start",
"measuring",
"on",
"an",
"axis",
"."
] | def _onMiddleButtonDown(self, evt):
"""Start measuring on an axis."""
x = evt.GetX()
y = self.figure.bbox.height - evt.GetY()
evt.Skip()
self._set_capture(True)
FigureCanvasBase.button_press_event(self, x, y, 2, guiEvent=evt) | [
"def",
"_onMiddleButtonDown",
"(",
"self",
",",
"evt",
")",
":",
"x",
"=",
"evt",
".",
"GetX",
"(",
")",
"y",
"=",
"self",
".",
"figure",
".",
"bbox",
".",
"height",
"-",
"evt",
".",
"GetY",
"(",
")",
"evt",
".",
"Skip",
"(",
")",
"self",
".",
... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/backends/backend_wx.py#L960-L966 | ||
qutip/qutip | 52d01da181a21b810c3407812c670f35fdc647e8 | qutip/qip/qasm.py | python | QasmOutput.is_defined | (self, gate_name) | return gate_name in self.gate_name_map | Check if QASM gate definition exists for QuTiP gate.
Parameters
----------
gate_name: str
QuTiP gate name. | Check if QASM gate definition exists for QuTiP gate. | [
"Check",
"if",
"QASM",
"gate",
"definition",
"exists",
"for",
"QuTiP",
"gate",
"."
] | def is_defined(self, gate_name):
'''
Check if QASM gate definition exists for QuTiP gate.
Parameters
----------
gate_name: str
QuTiP gate name.
'''
return gate_name in self.gate_name_map | [
"def",
"is_defined",
"(",
"self",
",",
"gate_name",
")",
":",
"return",
"gate_name",
"in",
"self",
".",
"gate_name_map"
] | https://github.com/qutip/qutip/blob/52d01da181a21b810c3407812c670f35fdc647e8/qutip/qip/qasm.py#L947-L957 | |
DataBiosphere/toil | 2e148eee2114ece8dcc3ec8a83f36333266ece0d | src/toil/jobStores/abstractJobStore.py | python | AbstractJobStore.getSize | (cls, url: ParseResult) | return cls.get_size(url) | [] | def getSize(cls, url: ParseResult) -> None:
return cls.get_size(url) | [
"def",
"getSize",
"(",
"cls",
",",
"url",
":",
"ParseResult",
")",
"->",
"None",
":",
"return",
"cls",
".",
"get_size",
"(",
"url",
")"
] | https://github.com/DataBiosphere/toil/blob/2e148eee2114ece8dcc3ec8a83f36333266ece0d/src/toil/jobStores/abstractJobStore.py#L485-L486 | |||
OpenCobolIDE/OpenCobolIDE | c78d0d335378e5fe0a5e74f53c19b68b55e85388 | open_cobol_ide/extlibs/future/backports/http/client.py | python | HTTPConnection.putrequest | (self, method, url, skip_host=0, skip_accept_encoding=0) | Send a request to the server.
`method' specifies an HTTP request method, e.g. 'GET'.
`url' specifies the object being requested, e.g. '/index.html'.
`skip_host' if True does not add automatically a 'Host:' header
`skip_accept_encoding' if True does not add automatically an
'A... | Send a request to the server. | [
"Send",
"a",
"request",
"to",
"the",
"server",
"."
] | def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0):
"""Send a request to the server.
`method' specifies an HTTP request method, e.g. 'GET'.
`url' specifies the object being requested, e.g. '/index.html'.
`skip_host' if True does not add automatically a 'Host:' header... | [
"def",
"putrequest",
"(",
"self",
",",
"method",
",",
"url",
",",
"skip_host",
"=",
"0",
",",
"skip_accept_encoding",
"=",
"0",
")",
":",
"# if a prior response has been completed, then forget about it.",
"if",
"self",
".",
"__response",
"and",
"self",
".",
"__res... | https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/extlibs/future/backports/http/client.py#L930-L1044 | ||
SCSSoftware/BlenderTools | 96f323d3bdf2d8cb8ed7f882dcdf036277a802dd | addon/io_scs_tools/internals/shaders/eut2/sky/uv_rescale_ng.py | python | __init_rescale_component__ | (node_tree, uv_type, location, uv_socket, uv_x_socket, uv_y_socket,
v_scale_socket, rescale_socket, rescale_inv_socket, uv_output_socket) | Creates nodes for one UV rescale component.
:param node_tree: node tree of the uv rescale group
:type node_tree: bpy.types.NodeTree
:param uv_type: string for prefixing nodes
:type uv_type: str
:param location: location of the first component element
:type location: (int, int)
:param uv_soc... | Creates nodes for one UV rescale component. | [
"Creates",
"nodes",
"for",
"one",
"UV",
"rescale",
"component",
"."
] | def __init_rescale_component__(node_tree, uv_type, location, uv_socket, uv_x_socket, uv_y_socket,
v_scale_socket, rescale_socket, rescale_inv_socket, uv_output_socket):
"""Creates nodes for one UV rescale component.
:param node_tree: node tree of the uv rescale group
:type no... | [
"def",
"__init_rescale_component__",
"(",
"node_tree",
",",
"uv_type",
",",
"location",
",",
"uv_socket",
",",
"uv_x_socket",
",",
"uv_y_socket",
",",
"v_scale_socket",
",",
"rescale_socket",
",",
"rescale_inv_socket",
",",
"uv_output_socket",
")",
":",
"pos_x_shift",... | https://github.com/SCSSoftware/BlenderTools/blob/96f323d3bdf2d8cb8ed7f882dcdf036277a802dd/addon/io_scs_tools/internals/shaders/eut2/sky/uv_rescale_ng.py#L107-L175 | ||
lovelylain/pyctp | fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d | example/ctp/option/__init__.py | python | TraderApi.ReqQryInvestorPositionDetail | (self, pQryInvestorPositionDetail, nRequestID) | return 0 | 请求查询投资者持仓明细 | 请求查询投资者持仓明细 | [
"请求查询投资者持仓明细"
] | def ReqQryInvestorPositionDetail(self, pQryInvestorPositionDetail, nRequestID):
"""请求查询投资者持仓明细"""
return 0 | [
"def",
"ReqQryInvestorPositionDetail",
"(",
"self",
",",
"pQryInvestorPositionDetail",
",",
"nRequestID",
")",
":",
"return",
"0"
] | https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/example/ctp/option/__init__.py#L369-L371 | |
openstack/manila | 142990edc027e14839d5deaf4954dd6fc88de15e | manila/share/drivers/zfssa/zfssashare.py | python | ZFSSAShareDriver.extend_share | (self, share, new_size, share_server=None) | Extend a share to new_size. | Extend a share to new_size. | [
"Extend",
"a",
"share",
"to",
"new_size",
"."
] | def extend_share(self, share, new_size, share_server=None):
"""Extend a share to new_size."""
lcfg = self.configuration
free_space = self.zfssa.get_project_stats(lcfg.zfssa_pool,
lcfg.zfssa_project)
diff_space = int(new_size - share['siz... | [
"def",
"extend_share",
"(",
"self",
",",
"share",
",",
"new_size",
",",
"share_server",
"=",
"None",
")",
":",
"lcfg",
"=",
"self",
".",
"configuration",
"free_space",
"=",
"self",
".",
"zfssa",
".",
"get_project_stats",
"(",
"lcfg",
".",
"zfssa_pool",
","... | https://github.com/openstack/manila/blob/142990edc027e14839d5deaf4954dd6fc88de15e/manila/share/drivers/zfssa/zfssashare.py#L452-L469 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/tkinter/__init__.py | python | PanedWindow.proxy_place | (self, x, y) | return self.proxy("place", x, y) | Place the proxy at the given x and y coordinates. | Place the proxy at the given x and y coordinates. | [
"Place",
"the",
"proxy",
"at",
"the",
"given",
"x",
"and",
"y",
"coordinates",
"."
] | def proxy_place(self, x, y):
"""Place the proxy at the given x and y coordinates.
"""
return self.proxy("place", x, y) | [
"def",
"proxy_place",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"return",
"self",
".",
"proxy",
"(",
"\"place\"",
",",
"x",
",",
"y",
")"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/tkinter/__init__.py#L4422-L4425 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/distutils/ccompiler.py | python | CCompiler._need_link | (self, objects, output_file) | Return true if we need to relink the files listed in 'objects'
to recreate 'output_file'. | Return true if we need to relink the files listed in 'objects'
to recreate 'output_file'. | [
"Return",
"true",
"if",
"we",
"need",
"to",
"relink",
"the",
"files",
"listed",
"in",
"objects",
"to",
"recreate",
"output_file",
"."
] | def _need_link(self, objects, output_file):
"""Return true if we need to relink the files listed in 'objects'
to recreate 'output_file'.
"""
if self.force:
return True
else:
if self.dry_run:
newer = newer_group (objects, output_file, missin... | [
"def",
"_need_link",
"(",
"self",
",",
"objects",
",",
"output_file",
")",
":",
"if",
"self",
".",
"force",
":",
"return",
"True",
"else",
":",
"if",
"self",
".",
"dry_run",
":",
"newer",
"=",
"newer_group",
"(",
"objects",
",",
"output_file",
",",
"mi... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/distutils/ccompiler.py#L461-L472 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/schemes/hyperelliptic_curves/hyperelliptic_g2.py | python | HyperellipticCurve_g2.igusa_clebsch_invariants | (self) | return invariants.igusa_clebsch_invariants(4*f + h**2) | r"""
Return the Igusa-Clebsch invariants `I_2, I_4, I_6, I_{10}` of Igusa and Clebsch [IJ1960]_.
.. SEEALSO::
:meth:`sage.schemes.hyperelliptic_curves.invariants`
EXAMPLES::
sage: R.<x> = QQ[]
sage: f = x^5 - x + 2
sage: HyperellipticCurve(f).i... | r"""
Return the Igusa-Clebsch invariants `I_2, I_4, I_6, I_{10}` of Igusa and Clebsch [IJ1960]_. | [
"r",
"Return",
"the",
"Igusa",
"-",
"Clebsch",
"invariants",
"I_2",
"I_4",
"I_6",
"I_",
"{",
"10",
"}",
"of",
"Igusa",
"and",
"Clebsch",
"[",
"IJ1960",
"]",
"_",
"."
] | def igusa_clebsch_invariants(self):
r"""
Return the Igusa-Clebsch invariants `I_2, I_4, I_6, I_{10}` of Igusa and Clebsch [IJ1960]_.
.. SEEALSO::
:meth:`sage.schemes.hyperelliptic_curves.invariants`
EXAMPLES::
sage: R.<x> = QQ[]
sage: f = x^5 - x +... | [
"def",
"igusa_clebsch_invariants",
"(",
"self",
")",
":",
"f",
",",
"h",
"=",
"self",
".",
"hyperelliptic_polynomials",
"(",
")",
"return",
"invariants",
".",
"igusa_clebsch_invariants",
"(",
"4",
"*",
"f",
"+",
"h",
"**",
"2",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/schemes/hyperelliptic_curves/hyperelliptic_g2.py#L218-L253 | |
idapython/src | 839d93ac969bc1a152982464907445bc0d18a1f8 | python/idc.py | python | get_func_cmt | (ea, repeatable) | Retrieve function comment
@param ea: any address belonging to the function
@param repeatable: 1: get repeatable comment
0: get regular comment
@return: function comment string | Retrieve function comment | [
"Retrieve",
"function",
"comment"
] | def get_func_cmt(ea, repeatable):
"""
Retrieve function comment
@param ea: any address belonging to the function
@param repeatable: 1: get repeatable comment
0: get regular comment
@return: function comment string
"""
func = ida_funcs.get_func(ea)
if not func:
retu... | [
"def",
"get_func_cmt",
"(",
"ea",
",",
"repeatable",
")",
":",
"func",
"=",
"ida_funcs",
".",
"get_func",
"(",
"ea",
")",
"if",
"not",
"func",
":",
"return",
"\"\"",
"else",
":",
"comment",
"=",
"ida_funcs",
".",
"get_func_cmt",
"(",
"func",
",",
"repe... | https://github.com/idapython/src/blob/839d93ac969bc1a152982464907445bc0d18a1f8/python/idc.py#L3007-L3027 | ||
wrye-bash/wrye-bash | d495c47cfdb44475befa523438a40c4419cb386f | Mopy/bash/game/fallout3/records.py | python | fnv_only | (fnv_obj) | return if_fnv(fo3_version=None, fnv_version=fnv_obj) | Wrapper around if_fnv that resolves to None for FO3. Useful for things
that have been added in FNV as MelSet will ignore None elements. Can also
be used with Flags, but keep in mind that a None flag will still take up an
index in the flags list, so it's a good idea to specify flag indices
explicitly whe... | Wrapper around if_fnv that resolves to None for FO3. Useful for things
that have been added in FNV as MelSet will ignore None elements. Can also
be used with Flags, but keep in mind that a None flag will still take up an
index in the flags list, so it's a good idea to specify flag indices
explicitly whe... | [
"Wrapper",
"around",
"if_fnv",
"that",
"resolves",
"to",
"None",
"for",
"FO3",
".",
"Useful",
"for",
"things",
"that",
"have",
"been",
"added",
"in",
"FNV",
"as",
"MelSet",
"will",
"ignore",
"None",
"elements",
".",
"Can",
"also",
"be",
"used",
"with",
"... | def fnv_only(fnv_obj):
"""Wrapper around if_fnv that resolves to None for FO3. Useful for things
that have been added in FNV as MelSet will ignore None elements. Can also
be used with Flags, but keep in mind that a None flag will still take up an
index in the flags list, so it's a good idea to specify f... | [
"def",
"fnv_only",
"(",
"fnv_obj",
")",
":",
"return",
"if_fnv",
"(",
"fo3_version",
"=",
"None",
",",
"fnv_version",
"=",
"fnv_obj",
")"
] | https://github.com/wrye-bash/wrye-bash/blob/d495c47cfdb44475befa523438a40c4419cb386f/Mopy/bash/game/fallout3/records.py#L89-L95 | |
rowliny/DiffHelper | ab3a96f58f9579d0023aed9ebd785f4edf26f8af | Tool/SitePackages/tqdm/rich.py | python | tqdm_rich.reset | (self, total=None) | Resets to 0 iterations for repeated use.
Parameters
----------
total : int or float, optional. Total to use for the new bar. | Resets to 0 iterations for repeated use. | [
"Resets",
"to",
"0",
"iterations",
"for",
"repeated",
"use",
"."
] | def reset(self, total=None):
"""
Resets to 0 iterations for repeated use.
Parameters
----------
total : int or float, optional. Total to use for the new bar.
"""
if hasattr(self, '_prog'):
self._prog.reset(total=total)
super(tqdm_rich, self).... | [
"def",
"reset",
"(",
"self",
",",
"total",
"=",
"None",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'_prog'",
")",
":",
"self",
".",
"_prog",
".",
"reset",
"(",
"total",
"=",
"total",
")",
"super",
"(",
"tqdm_rich",
",",
"self",
")",
".",
"rese... | https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/tqdm/rich.py#L129-L139 | ||
gwastro/pycbc | 1e1c85534b9dba8488ce42df693230317ca63dea | pycbc/waveform/ringdown.py | python | qnm_time_decay | (tau, decay) | return -tau * numpy.log(decay) | Return the time at which the amplitude of the
ringdown falls to decay of the peak amplitude.
Parameters
----------
tau : float
The damping time of the sinusoid.
decay : float
The fraction of the peak amplitude.
Returns
-------
t_decay : float
The time at which t... | Return the time at which the amplitude of the
ringdown falls to decay of the peak amplitude. | [
"Return",
"the",
"time",
"at",
"which",
"the",
"amplitude",
"of",
"the",
"ringdown",
"falls",
"to",
"decay",
"of",
"the",
"peak",
"amplitude",
"."
] | def qnm_time_decay(tau, decay):
"""Return the time at which the amplitude of the
ringdown falls to decay of the peak amplitude.
Parameters
----------
tau : float
The damping time of the sinusoid.
decay : float
The fraction of the peak amplitude.
Returns
-------
t_de... | [
"def",
"qnm_time_decay",
"(",
"tau",
",",
"decay",
")",
":",
"return",
"-",
"tau",
"*",
"numpy",
".",
"log",
"(",
"decay",
")"
] | https://github.com/gwastro/pycbc/blob/1e1c85534b9dba8488ce42df693230317ca63dea/pycbc/waveform/ringdown.py#L221-L238 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/configparser.py | python | RawConfigParser.read_dict | (self, dictionary, source='<dict>') | Read configuration from a dictionary.
Keys are section names, values are dictionaries with keys and values
that should be present in the section. If the used dictionary type
preserves order, sections and their keys will be added in order.
All types held in the dictionary are converted ... | Read configuration from a dictionary. | [
"Read",
"configuration",
"from",
"a",
"dictionary",
"."
] | def read_dict(self, dictionary, source='<dict>'):
"""Read configuration from a dictionary.
Keys are section names, values are dictionaries with keys and values
that should be present in the section. If the used dictionary type
preserves order, sections and their keys will be added in or... | [
"def",
"read_dict",
"(",
"self",
",",
"dictionary",
",",
"source",
"=",
"'<dict>'",
")",
":",
"elements_added",
"=",
"set",
"(",
")",
"for",
"section",
",",
"keys",
"in",
"dictionary",
".",
"items",
"(",
")",
":",
"section",
"=",
"str",
"(",
"section",... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/configparser.py#L698-L727 | ||
frescobaldi/frescobaldi | 301cc977fc4ba7caa3df9e4bf905212ad5d06912 | frescobaldi_app/externalchanges/widget.py | python | ChangedDocumentsListDialog.slotButtonSave | (self) | Called when the user clicks Save. | Called when the user clicks Save. | [
"Called",
"when",
"the",
"user",
"clicks",
"Save",
"."
] | def slotButtonSave(self):
"""Called when the user clicks Save."""
self.saveDocuments(self.selectedDocuments()) | [
"def",
"slotButtonSave",
"(",
"self",
")",
":",
"self",
".",
"saveDocuments",
"(",
"self",
".",
"selectedDocuments",
"(",
")",
")"
] | https://github.com/frescobaldi/frescobaldi/blob/301cc977fc4ba7caa3df9e4bf905212ad5d06912/frescobaldi_app/externalchanges/widget.py#L223-L225 | ||
JetBrains/python-skeletons | 95ad24b666e475998e5d1cc02ed53a2188036167 | numpy/core/__init__.py | python | generic.__neg__ | (self, *args, **kwargs) | -self | -self | [
"-",
"self"
] | def __neg__(self, *args, **kwargs): # real signature unknown
""" -self """
pass | [
"def",
"__neg__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# real signature unknown",
"pass"
] | https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/numpy/core/__init__.py#L851-L853 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/master.py | python | AESFuncs._minion_event | (self, load) | Receive an event from the minion and fire it on the master event
interface
:param dict load: The minion payload | Receive an event from the minion and fire it on the master event
interface | [
"Receive",
"an",
"event",
"from",
"the",
"minion",
"and",
"fire",
"it",
"on",
"the",
"master",
"event",
"interface"
] | def _minion_event(self, load):
"""
Receive an event from the minion and fire it on the master event
interface
:param dict load: The minion payload
"""
load = self.__verify_load(load, ("id", "tok"))
if load is False:
return {}
# Route to master... | [
"def",
"_minion_event",
"(",
"self",
",",
"load",
")",
":",
"load",
"=",
"self",
".",
"__verify_load",
"(",
"load",
",",
"(",
"\"id\"",
",",
"\"tok\"",
")",
")",
"if",
"load",
"is",
"False",
":",
"return",
"{",
"}",
"# Route to master event bus",
"self",... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/master.py#L1592-L1605 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/site-packages/Crypto/Util/number.py | python | inverse | (u, v) | return u1 | inverse(u:long, v:long):long
Return the inverse of u mod v. | inverse(u:long, v:long):long
Return the inverse of u mod v. | [
"inverse",
"(",
"u",
":",
"long",
"v",
":",
"long",
")",
":",
"long",
"Return",
"the",
"inverse",
"of",
"u",
"mod",
"v",
"."
] | def inverse(u, v):
"""inverse(u:long, v:long):long
Return the inverse of u mod v.
"""
u3, v3 = long(u), long(v)
u1, v1 = 1L, 0L
while v3 > 0:
q=divmod(u3, v3)[0]
u1, v1 = v1, u1 - v1*q
u3, v3 = v3, u3 - v3*q
while u1<0:
u1 = u1 + v
return u1 | [
"def",
"inverse",
"(",
"u",
",",
"v",
")",
":",
"u3",
",",
"v3",
"=",
"long",
"(",
"u",
")",
",",
"long",
"(",
"v",
")",
"u1",
",",
"v1",
"=",
"1L",
",",
"0L",
"while",
"v3",
">",
"0",
":",
"q",
"=",
"divmod",
"(",
"u3",
",",
"v3",
")",... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/site-packages/Crypto/Util/number.py#L152-L164 | |
Mailu/Mailu | 1e53530164e9eaf77a89c322e34bff447ace5a28 | core/nginx/certwatcher.py | python | ChangeHandler.reexec_config | () | execute a reconfiguration of the system, which also reloads | execute a reconfiguration of the system, which also reloads | [
"execute",
"a",
"reconfiguration",
"of",
"the",
"system",
"which",
"also",
"reloads"
] | def reexec_config():
"execute a reconfiguration of the system, which also reloads"
print("Reconfiguring system")
system("/config.py") | [
"def",
"reexec_config",
"(",
")",
":",
"print",
"(",
"\"Reconfiguring system\"",
")",
"system",
"(",
"\"/config.py\"",
")"
] | https://github.com/Mailu/Mailu/blob/1e53530164e9eaf77a89c322e34bff447ace5a28/core/nginx/certwatcher.py#L32-L35 | ||
windelbouwman/ppci | 915c069e0667042c085ec42c78e9e3c9a5295324 | ppci/lang/c/codegenerator.py | python | CCodeGenerator.gen_local_init | (self, ptr, typ, expr) | return ptr, inc | Initialize a local slab of memory with an initial value | Initialize a local slab of memory with an initial value | [
"Initialize",
"a",
"local",
"slab",
"of",
"memory",
"with",
"an",
"initial",
"value"
] | def gen_local_init(self, ptr, typ, expr):
""" Initialize a local slab of memory with an initial value """
if isinstance(typ, (BasicType, types.PointerType, types.EnumType)):
value = self.gen_expr(expr, rvalue=True)
self._store_value(value, ptr)
inc = self.sizeof(typ)
... | [
"def",
"gen_local_init",
"(",
"self",
",",
"ptr",
",",
"typ",
",",
"expr",
")",
":",
"if",
"isinstance",
"(",
"typ",
",",
"(",
"BasicType",
",",
"types",
".",
"PointerType",
",",
"types",
".",
"EnumType",
")",
")",
":",
"value",
"=",
"self",
".",
"... | https://github.com/windelbouwman/ppci/blob/915c069e0667042c085ec42c78e9e3c9a5295324/ppci/lang/c/codegenerator.py#L854-L869 | |
Jrohy/multi-v2ray | 935547d0f39680885267558dfae68b228adeb28f | v2ray_util/util_core/client.py | python | ClientWriter.transform | (self) | [] | def transform(self):
user_json = None
if type(self.node) == Vmess:
self.client_config = self.load_template('client.json')
user_json = self.client_config["outbounds"][0]["settings"]["vnext"][0]
user_json["users"][0]["id"] = self.node.password
user_json["use... | [
"def",
"transform",
"(",
"self",
")",
":",
"user_json",
"=",
"None",
"if",
"type",
"(",
"self",
".",
"node",
")",
"==",
"Vmess",
":",
"self",
".",
"client_config",
"=",
"self",
".",
"load_template",
"(",
"'client.json'",
")",
"user_json",
"=",
"self",
... | https://github.com/Jrohy/multi-v2ray/blob/935547d0f39680885267558dfae68b228adeb28f/v2ray_util/util_core/client.py#L29-L83 | ||||
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/team_log.py | python | EventType.get_shared_link_change_visibility | (self) | return self._value | (sharing) Changed visibility of shared link
Only call this if :meth:`is_shared_link_change_visibility` is true.
:rtype: SharedLinkChangeVisibilityType | (sharing) Changed visibility of shared link | [
"(",
"sharing",
")",
"Changed",
"visibility",
"of",
"shared",
"link"
] | def get_shared_link_change_visibility(self):
"""
(sharing) Changed visibility of shared link
Only call this if :meth:`is_shared_link_change_visibility` is true.
:rtype: SharedLinkChangeVisibilityType
"""
if not self.is_shared_link_change_visibility():
raise ... | [
"def",
"get_shared_link_change_visibility",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_shared_link_change_visibility",
"(",
")",
":",
"raise",
"AttributeError",
"(",
"\"tag 'shared_link_change_visibility' not set\"",
")",
"return",
"self",
".",
"_value"
] | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L35727-L35737 | |
keikoproj/minion-manager | c4e89a5c4614f86f0e58acb919bb99cd9122c897 | cloud_provider/aws/asg_mm.py | python | AWSAutoscalinGroupMM.set_lc_info | (self, lc_info) | Sets the lc_info. | Sets the lc_info. | [
"Sets",
"the",
"lc_info",
"."
] | def set_lc_info(self, lc_info):
""" Sets the lc_info. """
assert lc_info is not None, "Can't set lc_info info to None!"
self.lc_info = lc_info | [
"def",
"set_lc_info",
"(",
"self",
",",
"lc_info",
")",
":",
"assert",
"lc_info",
"is",
"not",
"None",
",",
"\"Can't set lc_info info to None!\"",
"self",
".",
"lc_info",
"=",
"lc_info"
] | https://github.com/keikoproj/minion-manager/blob/c4e89a5c4614f86f0e58acb919bb99cd9122c897/cloud_provider/aws/asg_mm.py#L42-L45 | ||
Squarespace/pgbedrock | 58e46f98da72e81ae0c2f69463aa6e97ea7b8936 | pgbedrock/privileges.py | python | PrivilegeAnalyzer.get_schema_objects | (self, schema) | return {objname for objname, attr in object_owners.items() if attr['owner'] != self.rolename} | Get all objects of kind self.object_kind which are in the given schema and not owned by
self.rolename | Get all objects of kind self.object_kind which are in the given schema and not owned by
self.rolename | [
"Get",
"all",
"objects",
"of",
"kind",
"self",
".",
"object_kind",
"which",
"are",
"in",
"the",
"given",
"schema",
"and",
"not",
"owned",
"by",
"self",
".",
"rolename"
] | def get_schema_objects(self, schema):
""" Get all objects of kind self.object_kind which are in the given schema and not owned by
self.rolename """
object_owners = self.all_object_attrs.get(self.object_kind, dict()).get(schema, dict())
return {objname for objname, attr in object_owners.i... | [
"def",
"get_schema_objects",
"(",
"self",
",",
"schema",
")",
":",
"object_owners",
"=",
"self",
".",
"all_object_attrs",
".",
"get",
"(",
"self",
".",
"object_kind",
",",
"dict",
"(",
")",
")",
".",
"get",
"(",
"schema",
",",
"dict",
"(",
")",
")",
... | https://github.com/Squarespace/pgbedrock/blob/58e46f98da72e81ae0c2f69463aa6e97ea7b8936/pgbedrock/privileges.py#L272-L276 | |
reddit-archive/reddit | 753b17407e9a9dca09558526805922de24133d53 | r2/r2/controllers/apiv1/user.py | python | APIv1UserController.DELETE_friends | (self, friend_rel) | Stop being friends with a user. | Stop being friends with a user. | [
"Stop",
"being",
"friends",
"with",
"a",
"user",
"."
] | def DELETE_friends(self, friend_rel):
"""Stop being friends with a user."""
c.user.remove_friend(friend_rel._thing2)
if c.user.gold:
c.user.friend_rels_cache(_update=True)
response.status = 204 | [
"def",
"DELETE_friends",
"(",
"self",
",",
"friend_rel",
")",
":",
"c",
".",
"user",
".",
"remove_friend",
"(",
"friend_rel",
".",
"_thing2",
")",
"if",
"c",
".",
"user",
".",
"gold",
":",
"c",
".",
"user",
".",
"friend_rels_cache",
"(",
"_update",
"="... | https://github.com/reddit-archive/reddit/blob/753b17407e9a9dca09558526805922de24133d53/r2/r2/controllers/apiv1/user.py#L208-L213 | ||
CheckPointSW/Karta | b845928487b50a5b41acd532ae0399177a4356aa | src/core/function_context.py | python | CodeContext.matched | (self) | return self.match is not None | Check if the code context was matched with src/bin counterpart.
Return Value:
True iff the context was matched | Check if the code context was matched with src/bin counterpart. | [
"Check",
"if",
"the",
"code",
"context",
"was",
"matched",
"with",
"src",
"/",
"bin",
"counterpart",
"."
] | def matched(self):
"""Check if the code context was matched with src/bin counterpart.
Return Value:
True iff the context was matched
"""
return self.match is not None | [
"def",
"matched",
"(",
"self",
")",
":",
"return",
"self",
".",
"match",
"is",
"not",
"None"
] | https://github.com/CheckPointSW/Karta/blob/b845928487b50a5b41acd532ae0399177a4356aa/src/core/function_context.py#L19-L25 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.2/django/contrib/comments/moderation.py | python | Moderator.post_save_moderation | (self, sender, comment, request, **kwargs) | Apply any necessary post-save moderation steps to new
comments. | Apply any necessary post-save moderation steps to new
comments. | [
"Apply",
"any",
"necessary",
"post",
"-",
"save",
"moderation",
"steps",
"to",
"new",
"comments",
"."
] | def post_save_moderation(self, sender, comment, request, **kwargs):
"""
Apply any necessary post-save moderation steps to new
comments.
"""
model = comment.content_type.model_class()
if model not in self._registry:
return
self._registry[model].email(c... | [
"def",
"post_save_moderation",
"(",
"self",
",",
"sender",
",",
"comment",
",",
"request",
",",
"*",
"*",
"kwargs",
")",
":",
"model",
"=",
"comment",
".",
"content_type",
".",
"model_class",
"(",
")",
"if",
"model",
"not",
"in",
"self",
".",
"_registry"... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/contrib/comments/moderation.py#L340-L349 | ||
selfteaching/selfteaching-python-camp | 9982ee964b984595e7d664b07c389cddaf158f1e | exercises/1901050192/D13/mymodule/stats_word.py | python | stats_text | (text,count) | return stats_text_en(text,count) + stats_text_cn(text,count) | 合并英文词频和中文词频的结果 | 合并英文词频和中文词频的结果 | [
"合并英文词频和中文词频的结果"
] | def stats_text(text,count):
'''
合并英文词频和中文词频的结果
'''
if not isinstance(text,str):
raise ValueError('参考必须是str类型,输入类型%s'%type(text))
return stats_text_en(text,count) + stats_text_cn(text,count) | [
"def",
"stats_text",
"(",
"text",
",",
"count",
")",
":",
"if",
"not",
"isinstance",
"(",
"text",
",",
"str",
")",
":",
"raise",
"ValueError",
"(",
"'参考必须是str类型,输入类型%s'%type(text))",
"",
"",
"",
"",
"",
"",
"return",
"stats_text_en",
"(",
"text",
",",
... | https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/exercises/1901050192/D13/mymodule/stats_word.py#L25-L31 | |
alexmic/microtemplates | c45896b95bb577fdd831b54c7698e9856af7b170 | microtemplates/base.py | python | Compiler.__init__ | (self, template_string) | [] | def __init__(self, template_string):
self.template_string = template_string | [
"def",
"__init__",
"(",
"self",
",",
"template_string",
")",
":",
"self",
".",
"template_string",
"=",
"template_string"
] | https://github.com/alexmic/microtemplates/blob/c45896b95bb577fdd831b54c7698e9856af7b170/microtemplates/base.py#L246-L247 | ||||
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/utils/pathutils.py | python | _DataType.__hash__ | (self) | return hash((type(self), super().__hash__())) | [] | def __hash__(self):
return hash((type(self), super().__hash__())) | [
"def",
"__hash__",
"(",
"self",
")",
":",
"return",
"hash",
"(",
"(",
"type",
"(",
"self",
")",
",",
"super",
"(",
")",
".",
"__hash__",
"(",
")",
")",
")"
] | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/utils/pathutils.py#L16-L17 | |||
kellyjonbrazil/jc | e6900e2000bf265dfcfc09ffbfda39e9238661af | jc/parsers/history.py | python | parse | (data, raw=False, quiet=False) | Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary of raw structured data or
List of Dictionaries of proc... | Main text parsing function | [
"Main",
"text",
"parsing",
"function"
] | def parse(data, raw=False, quiet=False):
"""
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
quiet: (boolean) suppress warning messages if True
Returns:
Dictionary of raw st... | [
"def",
"parse",
"(",
"data",
",",
"raw",
"=",
"False",
",",
"quiet",
"=",
"False",
")",
":",
"jc",
".",
"utils",
".",
"compatibility",
"(",
"__name__",
",",
"info",
".",
"compatible",
",",
"quiet",
")",
"jc",
".",
"utils",
".",
"input_type_check",
"(... | https://github.com/kellyjonbrazil/jc/blob/e6900e2000bf265dfcfc09ffbfda39e9238661af/jc/parsers/history.py#L97-L134 | ||
bashtage/linearmodels | 9256269f01ff8c5f85e65342d66149a5636661b6 | linearmodels/panel/covariance.py | python | ACCovariance.cov | (self) | return (out + out.T) / 2 | Estimated covariance | Estimated covariance | [
"Estimated",
"covariance"
] | def cov(self) -> Float64Array:
"""Estimated covariance"""
x = self._x
nobs = x.shape[0]
xpxi = inv(x.T @ x / nobs)
eps = self.eps
assert self._time_ids is not None
time_ids = np.unique(self._time_ids.squeeze())
nperiods = len(time_ids)
bw = self._b... | [
"def",
"cov",
"(",
"self",
")",
"->",
"Float64Array",
":",
"x",
"=",
"self",
".",
"_x",
"nobs",
"=",
"x",
".",
"shape",
"[",
"0",
"]",
"xpxi",
"=",
"inv",
"(",
"x",
".",
"T",
"@",
"x",
"/",
"nobs",
")",
"eps",
"=",
"self",
".",
"eps",
"asse... | https://github.com/bashtage/linearmodels/blob/9256269f01ff8c5f85e65342d66149a5636661b6/linearmodels/panel/covariance.py#L549-L581 | |
upsert/lutron-caseta-pro | f5955c991c88c003752fee4df2d65ca028285d75 | custom_components/lutron_caseta_pro/__init__.py | python | request_configuration | (hass, config, host, bridge) | Request configuration from the user to configure a host. | Request configuration from the user to configure a host. | [
"Request",
"configuration",
"from",
"the",
"user",
"to",
"configure",
"a",
"host",
"."
] | async def request_configuration(hass, config, host, bridge):
"""Request configuration from the user to configure a host."""
configurator = hass.components.configurator
if host in _CONFIGURING:
configurator.notify_errors(
_CONFIGURING[host],
"Failed to process Lutron Integrat... | [
"async",
"def",
"request_configuration",
"(",
"hass",
",",
"config",
",",
"host",
",",
"bridge",
")",
":",
"configurator",
"=",
"hass",
".",
"components",
".",
"configurator",
"if",
"host",
"in",
"_CONFIGURING",
":",
"configurator",
".",
"notify_errors",
"(",
... | https://github.com/upsert/lutron-caseta-pro/blob/f5955c991c88c003752fee4df2d65ca028285d75/custom_components/lutron_caseta_pro/__init__.py#L75-L135 | ||
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/redis_model/queue.py | python | RedisQueue.__init__ | (self, key) | Need Message Queue | Need Message Queue | [
"Need",
"Message",
"Queue"
] | def __init__(self, key):
""" Need Message Queue """
self.key = key | [
"def",
"__init__",
"(",
"self",
",",
"key",
")",
":",
"self",
".",
"key",
"=",
"key"
] | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/redis_model/queue.py#L16-L18 | ||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/decimal.py | python | Context.exp | (self, a) | return a.exp(context=self) | Returns e ** a.
>>> c = ExtendedContext.copy()
>>> c.Emin = -999
>>> c.Emax = 999
>>> c.exp(Decimal('-Infinity'))
Decimal('0')
>>> c.exp(Decimal('-1'))
Decimal('0.367879441')
>>> c.exp(Decimal('0'))
Decimal('1')
>>> c.exp(Decimal('1'))
... | Returns e ** a. | [
"Returns",
"e",
"**",
"a",
"."
] | def exp(self, a):
"""Returns e ** a.
>>> c = ExtendedContext.copy()
>>> c.Emin = -999
>>> c.Emax = 999
>>> c.exp(Decimal('-Infinity'))
Decimal('0')
>>> c.exp(Decimal('-1'))
Decimal('0.367879441')
>>> c.exp(Decimal('0'))
Decimal('1')
... | [
"def",
"exp",
"(",
"self",
",",
"a",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"exp",
"(",
"context",
"=",
"self",
")"
] | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/decimal.py#L4451-L4473 | |
barseghyanartur/django-fobi | a998feae007d7fe3637429a80e42952ec7cda79f | examples/simple/context_processors.py | python | disable_admin_tools | (request) | return {'ADMIN_TOOLS_DISABLED': True} | Disable admin tools. | Disable admin tools. | [
"Disable",
"admin",
"tools",
"."
] | def disable_admin_tools(request):
"""Disable admin tools."""
return {'ADMIN_TOOLS_DISABLED': True} | [
"def",
"disable_admin_tools",
"(",
"request",
")",
":",
"return",
"{",
"'ADMIN_TOOLS_DISABLED'",
":",
"True",
"}"
] | https://github.com/barseghyanartur/django-fobi/blob/a998feae007d7fe3637429a80e42952ec7cda79f/examples/simple/context_processors.py#L6-L8 | |
robhagemans/pcbasic | c3a043b46af66623a801e18a38175be077251ada | pcbasic/basic/machine.py | python | Memory._set_memory | (self, addr, val) | Set the value at an emulated memory location. | Set the value at an emulated memory location. | [
"Set",
"the",
"value",
"at",
"an",
"emulated",
"memory",
"location",
"."
] | def _set_memory(self, addr, val):
"""Set the value at an emulated memory location."""
if addr >= self.rom_segment*0x10:
# ROM includes font memory
pass
elif addr >= self.ram_font_segment*0x10:
# RAM font memory
self._set_font_memory(addr, val)
... | [
"def",
"_set_memory",
"(",
"self",
",",
"addr",
",",
"val",
")",
":",
"if",
"addr",
">=",
"self",
".",
"rom_segment",
"*",
"0x10",
":",
"# ROM includes font memory",
"pass",
"elif",
"addr",
">=",
"self",
".",
"ram_font_segment",
"*",
"0x10",
":",
"# RAM fo... | https://github.com/robhagemans/pcbasic/blob/c3a043b46af66623a801e18a38175be077251ada/pcbasic/basic/machine.py#L436-L450 | ||
h2non/pook | d2970eff5ef7b611e786422145cff4f6d6df412e | pook/api.py | python | use | (network=False) | Creates a new isolated mock engine to be used via context manager.
Example::
with pook.use() as engine:
pook.mock('server.com/foo').reply(404)
res = requests.get('server.com/foo')
assert res.status_code == 404 | Creates a new isolated mock engine to be used via context manager. | [
"Creates",
"a",
"new",
"isolated",
"mock",
"engine",
"to",
"be",
"used",
"via",
"context",
"manager",
"."
] | def use(network=False):
"""
Creates a new isolated mock engine to be used via context manager.
Example::
with pook.use() as engine:
pook.mock('server.com/foo').reply(404)
res = requests.get('server.com/foo')
assert res.status_code == 404
"""
global _eng... | [
"def",
"use",
"(",
"network",
"=",
"False",
")",
":",
"global",
"_engine",
"# Create temporal engine",
"__engine",
"=",
"_engine",
"activated",
"=",
"__engine",
".",
"active",
"if",
"activated",
":",
"__engine",
".",
"disable",
"(",
")",
"_engine",
"=",
"Eng... | https://github.com/h2non/pook/blob/d2970eff5ef7b611e786422145cff4f6d6df412e/pook/api.py#L185-L219 | ||
mu-editor/mu | 5a5d7723405db588f67718a63a0ec0ecabebae33 | mu/modes/python3.py | python | KernelRunner.__init__ | (self, kernel_name, cwd, envars) | Initialise the kernel runner with a name of a kernel specification, a
target current working directory, any user-defined envars and the
path for the currently active virtualenv's site-packages. | Initialise the kernel runner with a name of a kernel specification, a
target current working directory, any user-defined envars and the
path for the currently active virtualenv's site-packages. | [
"Initialise",
"the",
"kernel",
"runner",
"with",
"a",
"name",
"of",
"a",
"kernel",
"specification",
"a",
"target",
"current",
"working",
"directory",
"any",
"user",
"-",
"defined",
"envars",
"and",
"the",
"path",
"for",
"the",
"currently",
"active",
"virtualen... | def __init__(self, kernel_name, cwd, envars):
"""
Initialise the kernel runner with a name of a kernel specification, a
target current working directory, any user-defined envars and the
path for the currently active virtualenv's site-packages.
"""
logger.debug(
... | [
"def",
"__init__",
"(",
"self",
",",
"kernel_name",
",",
"cwd",
",",
"envars",
")",
":",
"logger",
".",
"debug",
"(",
"\"About to create KernelRunner for %s, %s, %s \"",
",",
"kernel_name",
",",
"cwd",
",",
"envars",
",",
")",
"super",
"(",
")",
".",
"__init... | https://github.com/mu-editor/mu/blob/5a5d7723405db588f67718a63a0ec0ecabebae33/mu/modes/python3.py#L72-L87 | ||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | rpython/jit/metainterp/resumecode.py | python | Reader.jump | (self, size) | jump n items forward without returning anything | jump n items forward without returning anything | [
"jump",
"n",
"items",
"forward",
"without",
"returning",
"anything"
] | def jump(self, size):
""" jump n items forward without returning anything """
index = self.cur_pos
for i in range(size):
_, index = numb_next_item(self.code, index)
self.items_read += size
self.cur_pos = index | [
"def",
"jump",
"(",
"self",
",",
"size",
")",
":",
"index",
"=",
"self",
".",
"cur_pos",
"for",
"i",
"in",
"range",
"(",
"size",
")",
":",
"_",
",",
"index",
"=",
"numb_next_item",
"(",
"self",
".",
"code",
",",
"index",
")",
"self",
".",
"items_... | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/rpython/jit/metainterp/resumecode.py#L132-L138 | ||
spyder-ide/spyder | 55da47c032dfcf519600f67f8b30eab467f965e7 | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | python | DataFrameEditor._reset_model | (self, table, model) | Set the model in the given table. | Set the model in the given table. | [
"Set",
"the",
"model",
"in",
"the",
"given",
"table",
"."
] | def _reset_model(self, table, model):
"""Set the model in the given table."""
old_sel_model = table.selectionModel()
table.setModel(model)
if old_sel_model:
del old_sel_model | [
"def",
"_reset_model",
"(",
"self",
",",
"table",
",",
"model",
")",
":",
"old_sel_model",
"=",
"table",
".",
"selectionModel",
"(",
")",
"table",
".",
"setModel",
"(",
"model",
")",
"if",
"old_sel_model",
":",
"del",
"old_sel_model"
] | https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1153-L1158 | ||
zhaoweicai/Detectron-Cascade-RCNN | 5a297fcc16eab6c26b7b1a9fe2767c626730f03b | detectron/modeling/detector.py | python | DetectionModelHelper.DistributeCascadeProposals | (self, stage) | return outputs | Distribute proposals to their appropriate FPN levels.
by Zhaowei Cai for Cascade R-CNN
Input blobs:
- proposals_<j> are the decoded proposals from stage j; see
documentation from DecodeBBoxes.
If used during training, then the input blobs will also include:
[roi... | Distribute proposals to their appropriate FPN levels.
by Zhaowei Cai for Cascade R-CNN | [
"Distribute",
"proposals",
"to",
"their",
"appropriate",
"FPN",
"levels",
".",
"by",
"Zhaowei",
"Cai",
"for",
"Cascade",
"R",
"-",
"CNN"
] | def DistributeCascadeProposals(self, stage):
"""Distribute proposals to their appropriate FPN levels.
by Zhaowei Cai for Cascade R-CNN
Input blobs:
- proposals_<j> are the decoded proposals from stage j; see
documentation from DecodeBBoxes.
If used during training... | [
"def",
"DistributeCascadeProposals",
"(",
"self",
",",
"stage",
")",
":",
"stage_name",
"=",
"'_{}'",
".",
"format",
"(",
"stage",
")",
"# Prepare input blobs",
"blobs_in",
"=",
"[",
"'proposals'",
"+",
"stage_name",
"]",
"if",
"self",
".",
"train",
":",
"bl... | https://github.com/zhaoweicai/Detectron-Cascade-RCNN/blob/5a297fcc16eab6c26b7b1a9fe2767c626730f03b/detectron/modeling/detector.py#L256-L299 | |
zopefoundation/Zope | ea04dd670d1a48d4d5c879d3db38fc2e9b4330bb | src/ZPublisher/mapply.py | python | mapply | (object, positional=(), keyword={},
debug=None, maybe=None,
missing_name=default_missing_name,
handle_class=default_handle_class,
context=None, bind=0,
) | [] | def mapply(object, positional=(), keyword={},
debug=None, maybe=None,
missing_name=default_missing_name,
handle_class=default_handle_class,
context=None, bind=0,
):
if hasattr(object, '__bases__'):
f, names, defaults = handle_class(object, context)
... | [
"def",
"mapply",
"(",
"object",
",",
"positional",
"=",
"(",
")",
",",
"keyword",
"=",
"{",
"}",
",",
"debug",
"=",
"None",
",",
"maybe",
"=",
"None",
",",
"missing_name",
"=",
"default_missing_name",
",",
"handle_class",
"=",
"default_handle_class",
",",
... | https://github.com/zopefoundation/Zope/blob/ea04dd670d1a48d4d5c879d3db38fc2e9b4330bb/src/ZPublisher/mapply.py#L37-L87 | ||||
mchristopher/PokemonGo-DesktopMap | ec37575f2776ee7d64456e2a1f6b6b78830b4fe0 | app/pywin/Lib/ftplib.py | python | parse229 | (resp, peer) | return host, port | Parse the '229' response for a EPSV request.
Raises error_proto if it does not contain '(|||port|)'
Return ('host.addr.as.numbers', port#) tuple. | Parse the '229' response for a EPSV request.
Raises error_proto if it does not contain '(|||port|)'
Return ('host.addr.as.numbers', port#) tuple. | [
"Parse",
"the",
"229",
"response",
"for",
"a",
"EPSV",
"request",
".",
"Raises",
"error_proto",
"if",
"it",
"does",
"not",
"contain",
"(",
"|||port|",
")",
"Return",
"(",
"host",
".",
"addr",
".",
"as",
".",
"numbers",
"port#",
")",
"tuple",
"."
] | def parse229(resp, peer):
'''Parse the '229' response for a EPSV request.
Raises error_proto if it does not contain '(|||port|)'
Return ('host.addr.as.numbers', port#) tuple.'''
if resp[:3] != '229':
raise error_reply, resp
left = resp.find('(')
if left < 0: raise error_proto, resp
... | [
"def",
"parse229",
"(",
"resp",
",",
"peer",
")",
":",
"if",
"resp",
"[",
":",
"3",
"]",
"!=",
"'229'",
":",
"raise",
"error_reply",
",",
"resp",
"left",
"=",
"resp",
".",
"find",
"(",
"'('",
")",
"if",
"left",
"<",
"0",
":",
"raise",
"error_prot... | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pywin/Lib/ftplib.py#L844-L863 | |
benoitc/couchdbkit | 6be148640c00b54ee87a2f2d502e9d67fa5b45a8 | couchdbkit/ext/pylons/db.py | python | init_from_config | (config) | Initialize the database given a pylons config. This assumes the
configuration format layed out on the wiki. This will only initialize the
primary database.
This prefixes the database name with test_ if we're running unit tests. | Initialize the database given a pylons config. This assumes the
configuration format layed out on the wiki. This will only initialize the
primary database. | [
"Initialize",
"the",
"database",
"given",
"a",
"pylons",
"config",
".",
"This",
"assumes",
"the",
"configuration",
"format",
"layed",
"out",
"on",
"the",
"wiki",
".",
"This",
"will",
"only",
"initialize",
"the",
"primary",
"database",
"."
] | def init_from_config(config):
"""Initialize the database given a pylons config. This assumes the
configuration format layed out on the wiki. This will only initialize the
primary database.
This prefixes the database name with test_ if we're running unit tests.
"""
uri = config['couchdb.uri']
... | [
"def",
"init_from_config",
"(",
"config",
")",
":",
"uri",
"=",
"config",
"[",
"'couchdb.uri'",
"]",
"dbname",
"=",
"config",
"[",
"'couchdb.dbname'",
"]",
"config",
"[",
"'couchdb.db'",
"]",
"=",
"init_db",
"(",
"uri",
",",
"dbname",
")",
"config",
"[",
... | https://github.com/benoitc/couchdbkit/blob/6be148640c00b54ee87a2f2d502e9d67fa5b45a8/couchdbkit/ext/pylons/db.py#L12-L23 | ||
kennethreitz/bake | 3ee3d0ba2e7134035de01b803058e0d6033c00b2 | bake/bash.py | python | Bash.version | (self) | return matches.group(1) if matches else "version_unknown" | Returns the version number of the Bash-interpreter. | Returns the version number of the Bash-interpreter. | [
"Returns",
"the",
"version",
"number",
"of",
"the",
"Bash",
"-",
"interpreter",
"."
] | def version(self) -> str:
"""Returns the version number of the Bash-interpreter."""
matches = re.search(r"\bversion\s+(.+)\b", self.about)
# ...GNU Bash, version 4.4.19(1)-release ... --> 4.4.19(1)-release
return matches.group(1) if matches else "version_unknown" | [
"def",
"version",
"(",
"self",
")",
"->",
"str",
":",
"matches",
"=",
"re",
".",
"search",
"(",
"r\"\\bversion\\s+(.+)\\b\"",
",",
"self",
".",
"about",
")",
"# ...GNU Bash, version 4.4.19(1)-release ... --> 4.4.19(1)-release",
"return",
"matches",
".",
"group",
"("... | https://github.com/kennethreitz/bake/blob/3ee3d0ba2e7134035de01b803058e0d6033c00b2/bake/bash.py#L141-L145 | |
jupyter/jupyter_client | 263173095ceab87a572937f21f843886ffe356f1 | jupyter_client/multikernelmanager.py | python | MultiKernelManager.get_connection_info | (self, kernel_id: str) | Return a dictionary of connection data for a kernel.
Parameters
==========
kernel_id : uuid
The id of the kernel.
Returns
=======
connection_dict : dict
A dict of the information needed to connect to a kernel.
This includes the ip add... | Return a dictionary of connection data for a kernel. | [
"Return",
"a",
"dictionary",
"of",
"connection",
"data",
"for",
"a",
"kernel",
"."
] | def get_connection_info(self, kernel_id: str) -> t.Dict[str, t.Any]:
"""Return a dictionary of connection data for a kernel.
Parameters
==========
kernel_id : uuid
The id of the kernel.
Returns
=======
connection_dict : dict
A dict of the... | [
"def",
"get_connection_info",
"(",
"self",
",",
"kernel_id",
":",
"str",
")",
"->",
"t",
".",
"Dict",
"[",
"str",
",",
"t",
".",
"Any",
"]",
":"
] | https://github.com/jupyter/jupyter_client/blob/263173095ceab87a572937f21f843886ffe356f1/jupyter_client/multikernelmanager.py#L427-L442 | ||
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/provisioningserver/config.py | python | Configuration.__init__ | (self, store) | Initialise a new `Configuration` object.
:param store: A dict-like object. | Initialise a new `Configuration` object. | [
"Initialise",
"a",
"new",
"Configuration",
"object",
"."
] | def __init__(self, store):
"""Initialise a new `Configuration` object.
:param store: A dict-like object.
"""
super().__init__()
# Use the super-class's __setattr__() because it's redefined later on
# to prevent accidentally setting attributes that are not options.
... | [
"def",
"__init__",
"(",
"self",
",",
"store",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"# Use the super-class's __setattr__() because it's redefined later on",
"# to prevent accidentally setting attributes that are not options.",
"super",
"(",
")",
".",
"__se... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/provisioningserver/config.py#L661-L669 | ||
VisionLearningGroup/DA_Detection | 730eaca8528d22ed3aa6b4dbc1965828a697cf9a | lib/datasets/pascal_voc_cyclewater.py | python | pascal_voc_cyclewater._test_pascal_annotation | (self, index) | return count | Load image and bounding boxes info from XML file in the PASCAL VOC
format. | Load image and bounding boxes info from XML file in the PASCAL VOC
format. | [
"Load",
"image",
"and",
"bounding",
"boxes",
"info",
"from",
"XML",
"file",
"in",
"the",
"PASCAL",
"VOC",
"format",
"."
] | def _test_pascal_annotation(self, index):
"""
Load image and bounding boxes info from XML file in the PASCAL VOC
format.
"""
filename = os.path.join(self._data_path, 'Annotations', index + '.xml')
tree = ET.parse(filename)
objs = tree.findall('object')
num... | [
"def",
"_test_pascal_annotation",
"(",
"self",
",",
"index",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_data_path",
",",
"'Annotations'",
",",
"index",
"+",
"'.xml'",
")",
"tree",
"=",
"ET",
".",
"parse",
"(",
"filen... | https://github.com/VisionLearningGroup/DA_Detection/blob/730eaca8528d22ed3aa6b4dbc1965828a697cf9a/lib/datasets/pascal_voc_cyclewater.py#L210-L226 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/CPython/27/Lib/distutils/ccompiler.py | python | CCompiler.set_executables | (self, **args) | Define the executables (and options for them) that will be run
to perform the various stages of compilation. The exact set of
executables that may be specified here depends on the compiler
class (via the 'executables' class attribute), but most will have:
compiler the C/C++ compi... | Define the executables (and options for them) that will be run
to perform the various stages of compilation. The exact set of
executables that may be specified here depends on the compiler
class (via the 'executables' class attribute), but most will have:
compiler the C/C++ compi... | [
"Define",
"the",
"executables",
"(",
"and",
"options",
"for",
"them",
")",
"that",
"will",
"be",
"run",
"to",
"perform",
"the",
"various",
"stages",
"of",
"compilation",
".",
"The",
"exact",
"set",
"of",
"executables",
"that",
"may",
"be",
"specified",
"he... | def set_executables(self, **args):
"""Define the executables (and options for them) that will be run
to perform the various stages of compilation. The exact set of
executables that may be specified here depends on the compiler
class (via the 'executables' class attribute), but most will... | [
"def",
"set_executables",
"(",
"self",
",",
"*",
"*",
"args",
")",
":",
"# Note that some CCompiler implementation classes will define class",
"# attributes 'cpp', 'cc', etc. with hard-coded executable names;",
"# this is appropriate when a compiler class is for exactly one",
"# compiler/O... | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/distutils/ccompiler.py#L179-L210 | ||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/ip_messaging/v1/credential.py | python | CredentialList.__init__ | (self, version) | Initialize the CredentialList
:param Version version: Version that contains the resource
:returns: twilio.rest.ip_messaging.v1.credential.CredentialList
:rtype: twilio.rest.ip_messaging.v1.credential.CredentialList | Initialize the CredentialList | [
"Initialize",
"the",
"CredentialList"
] | def __init__(self, version):
"""
Initialize the CredentialList
:param Version version: Version that contains the resource
:returns: twilio.rest.ip_messaging.v1.credential.CredentialList
:rtype: twilio.rest.ip_messaging.v1.credential.CredentialList
"""
super(Cred... | [
"def",
"__init__",
"(",
"self",
",",
"version",
")",
":",
"super",
"(",
"CredentialList",
",",
"self",
")",
".",
"__init__",
"(",
"version",
")",
"# Path Solution",
"self",
".",
"_solution",
"=",
"{",
"}",
"self",
".",
"_uri",
"=",
"'/Credentials'",
".",... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/ip_messaging/v1/credential.py#L19-L32 | ||
axcore/tartube | 36dd493642923fe8b9190a41db596c30c043ae90 | tartube/config.py | python | SystemPrefWin.on_custom_dl_export_button_clicked | (self, button, treeview) | Called from callback in self.setup_operations_custom_dl_tab().
Exports the selected downloads.CustomDLManager object to a JSON file.
Args:
button (Gtk.Button): The widget clicked | Called from callback in self.setup_operations_custom_dl_tab(). | [
"Called",
"from",
"callback",
"in",
"self",
".",
"setup_operations_custom_dl_tab",
"()",
"."
] | def on_custom_dl_export_button_clicked(self, button, treeview):
"""Called from callback in self.setup_operations_custom_dl_tab().
Exports the selected downloads.CustomDLManager object to a JSON file.
Args:
button (Gtk.Button): The widget clicked
"""
selection = ... | [
"def",
"on_custom_dl_export_button_clicked",
"(",
"self",
",",
"button",
",",
"treeview",
")",
":",
"selection",
"=",
"treeview",
".",
"get_selection",
"(",
")",
"(",
"model",
",",
"path_list",
")",
"=",
"selection",
".",
"get_selected_rows",
"(",
")",
"if",
... | https://github.com/axcore/tartube/blob/36dd493642923fe8b9190a41db596c30c043ae90/tartube/config.py#L24274-L24299 | ||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/rebulk/validators.py | python | allways_true | (match) | return True | A validator which is allways true
:param match:
:return: | A validator which is allways true
:param match:
:return: | [
"A",
"validator",
"which",
"is",
"allways",
"true",
":",
"param",
"match",
":",
":",
"return",
":"
] | def allways_true(match): # pylint:disable=unused-argument
"""
A validator which is allways true
:param match:
:return:
"""
return True | [
"def",
"allways_true",
"(",
"match",
")",
":",
"# pylint:disable=unused-argument",
"return",
"True"
] | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/rebulk/validators.py#L75-L81 | |
munki/munki | 4b778f0e5a73ed3df9eb62d93c5227efb29eebe3 | code/client/munkilib/appleupdates/au.py | python | AppleUpdates.check_for_software_updates | (self, force_check=True) | Check if Apple Software Updates are available, if needed or forced.
Args:
force_check: Boolean. If True, forces a check, otherwise only checks
if the last check is deemed outdated.
Returns:
Integer. -1 if there was an error, otherwise the number of available
... | Check if Apple Software Updates are available, if needed or forced. | [
"Check",
"if",
"Apple",
"Software",
"Updates",
"are",
"available",
"if",
"needed",
"or",
"forced",
"."
] | def check_for_software_updates(self, force_check=True):
"""Check if Apple Software Updates are available, if needed or forced.
Args:
force_check: Boolean. If True, forces a check, otherwise only checks
if the last check is deemed outdated.
Returns:
Integer. -1 ... | [
"def",
"check_for_software_updates",
"(",
"self",
",",
"force_check",
"=",
"True",
")",
":",
"before_hash",
"=",
"munkihash",
".",
"getsha256hash",
"(",
"self",
".",
"applesync",
".",
"apple_download_catalog_path",
")",
"msg",
"=",
"'Checking Apple Software Update cat... | https://github.com/munki/munki/blob/4b778f0e5a73ed3df9eb62d93c5227efb29eebe3/code/client/munkilib/appleupdates/au.py#L291-L344 | ||
mongodb/mongo-python-driver | c760f900f2e4109a247c2ffc8ad3549362007772 | pymongo/pool.py | python | SocketInfo._raise_if_not_writable | (self, unacknowledged) | Raise NotPrimaryError on unacknowledged write if this socket is not
writable. | Raise NotPrimaryError on unacknowledged write if this socket is not
writable. | [
"Raise",
"NotPrimaryError",
"on",
"unacknowledged",
"write",
"if",
"this",
"socket",
"is",
"not",
"writable",
"."
] | def _raise_if_not_writable(self, unacknowledged):
"""Raise NotPrimaryError on unacknowledged write if this socket is not
writable.
"""
if unacknowledged and not self.is_writable:
# Write won't succeed, bail as if we'd received a not primary error.
raise NotPrimary... | [
"def",
"_raise_if_not_writable",
"(",
"self",
",",
"unacknowledged",
")",
":",
"if",
"unacknowledged",
"and",
"not",
"self",
".",
"is_writable",
":",
"# Write won't succeed, bail as if we'd received a not primary error.",
"raise",
"NotPrimaryError",
"(",
"\"not primary\"",
... | https://github.com/mongodb/mongo-python-driver/blob/c760f900f2e4109a247c2ffc8ad3549362007772/pymongo/pool.py#L754-L761 | ||
jason9693/MusicTransformer-tensorflow2.0 | f7c06c0cb2e9cdddcbf6db779cb39cd650282778 | preprocess.py | python | TFRecordsConverter.process_midi_from_dir | (self, midi_root) | return es_seq_list, ctrl_seq_list | :param midi_root: midi 데이터가 저장되어있는 디렉터리 위치.
:return: | :param midi_root: midi 데이터가 저장되어있는 디렉터리 위치.
:return: | [
":",
"param",
"midi_root",
":",
"midi",
"데이터가",
"저장되어있는",
"디렉터리",
"위치",
".",
":",
"return",
":"
] | def process_midi_from_dir(self, midi_root):
"""
:param midi_root: midi 데이터가 저장되어있는 디렉터리 위치.
:return:
"""
midi_paths = list(utils.find_files_by_extensions(midi_root, ['.mid', '.midi', '.MID']))
es_seq_list = []
ctrl_seq_list = []
for path in Bar('Processin... | [
"def",
"process_midi_from_dir",
"(",
"self",
",",
"midi_root",
")",
":",
"midi_paths",
"=",
"list",
"(",
"utils",
".",
"find_files_by_extensions",
"(",
"midi_root",
",",
"[",
"'.mid'",
",",
"'.midi'",
",",
"'.MID'",
"]",
")",
")",
"es_seq_list",
"=",
"[",
... | https://github.com/jason9693/MusicTransformer-tensorflow2.0/blob/f7c06c0cb2e9cdddcbf6db779cb39cd650282778/preprocess.py#L73-L100 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.4/django/contrib/gis/gdal/geometries.py | python | OGRGeometry.difference | (self, other) | return self._geomgen(capi.geom_diff, other) | Returns a new geometry consisting of the region which is the difference
of this geometry and the other. | Returns a new geometry consisting of the region which is the difference
of this geometry and the other. | [
"Returns",
"a",
"new",
"geometry",
"consisting",
"of",
"the",
"region",
"which",
"is",
"the",
"difference",
"of",
"this",
"geometry",
"and",
"the",
"other",
"."
] | def difference(self, other):
"""
Returns a new geometry consisting of the region which is the difference
of this geometry and the other.
"""
return self._geomgen(capi.geom_diff, other) | [
"def",
"difference",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"_geomgen",
"(",
"capi",
".",
"geom_diff",
",",
"other",
")"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.4/django/contrib/gis/gdal/geometries.py#L512-L517 | |
shichao-an/leetcode-python | 6c523ef4759a57433e10271b584eece16f9f05f3 | minimum_window_substring/solution.py | python | Solution.contains | (self, d, td) | return True | [] | def contains(self, d, td):
for k in td:
if k not in d or d[k] < td[k]:
return False
return True | [
"def",
"contains",
"(",
"self",
",",
"d",
",",
"td",
")",
":",
"for",
"k",
"in",
"td",
":",
"if",
"k",
"not",
"in",
"d",
"or",
"d",
"[",
"k",
"]",
"<",
"td",
"[",
"k",
"]",
":",
"return",
"False",
"return",
"True"
] | https://github.com/shichao-an/leetcode-python/blob/6c523ef4759a57433e10271b584eece16f9f05f3/minimum_window_substring/solution.py#L39-L43 | |||
DIYer22/boxx | d271bc375a33e01e616a0f74ce028e6d77d1820e | boxx/ylimg/ylimgTool.py | python | frombgr | (img) | return img | [] | def frombgr(img):
img = torgb(img)
if img.ndim >= 3 and img.shape[-1] == 3 :
img = img[...,[2,1,0]]
return img | [
"def",
"frombgr",
"(",
"img",
")",
":",
"img",
"=",
"torgb",
"(",
"img",
")",
"if",
"img",
".",
"ndim",
">=",
"3",
"and",
"img",
".",
"shape",
"[",
"-",
"1",
"]",
"==",
"3",
":",
"img",
"=",
"img",
"[",
"...",
",",
"[",
"2",
",",
"1",
","... | https://github.com/DIYer22/boxx/blob/d271bc375a33e01e616a0f74ce028e6d77d1820e/boxx/ylimg/ylimgTool.py#L195-L199 | |||
arjunvekariyagithub/camelyon16-grand-challenge | 660000a79775fbc5cfa8c5b44a591e62ce714089 | camelyon16/inception/inception_eval.py | python | _eval_once | (saver, summary_writer, accuracy, summary_op, confusion_matrix_op) | Runs Eval once.
Args:
saver: Saver.
summary_writer: Summary writer.
top_1_op: Top 1 op.
top_5_op: Top 5 op.
summary_op: Summary op. | Runs Eval once. | [
"Runs",
"Eval",
"once",
"."
] | def _eval_once(saver, summary_writer, accuracy, summary_op, confusion_matrix_op):
# def _eval_once(saver, summary_writer, accuracy, summary_op, confusion_matrix_op, logits, labels, dense_labels):
"""Runs Eval once.
Args:
saver: Saver.
summary_writer: Summary writer.
top_1_op: Top 1 op.
... | [
"def",
"_eval_once",
"(",
"saver",
",",
"summary_writer",
",",
"accuracy",
",",
"summary_op",
",",
"confusion_matrix_op",
")",
":",
"# def _eval_once(saver, summary_writer, accuracy, summary_op, confusion_matrix_op, logits, labels, dense_labels):",
"with",
"tf",
".",
"Session",
... | https://github.com/arjunvekariyagithub/camelyon16-grand-challenge/blob/660000a79775fbc5cfa8c5b44a591e62ce714089/camelyon16/inception/inception_eval.py#L67-L170 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/docutils-0.14/docutils/utils/math/math2html.py | python | Cloner.create | (cls, type) | return clone | Create an object of a given class. | Create an object of a given class. | [
"Create",
"an",
"object",
"of",
"a",
"given",
"class",
"."
] | def create(cls, type):
"Create an object of a given class."
clone = type.__new__(type)
clone.__init__()
return clone | [
"def",
"create",
"(",
"cls",
",",
"type",
")",
":",
"clone",
"=",
"type",
".",
"__new__",
"(",
"type",
")",
"clone",
".",
"__init__",
"(",
")",
"return",
"clone"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/docutils-0.14/docutils/utils/math/math2html.py#L1327-L1331 | |
microsoft/unilm | 65f15af2a307ebb64cfb25adf54375b002e6fe8d | infoxlm/fairseq/fairseq/optim/fp16_optimizer.py | python | FP16Optimizer.build_optimizer | (cls, args, params) | return cls(args, params, fp32_optimizer, fp32_params) | Args:
args (argparse.Namespace): fairseq args
params (iterable): iterable of parameters to optimize | Args:
args (argparse.Namespace): fairseq args
params (iterable): iterable of parameters to optimize | [
"Args",
":",
"args",
"(",
"argparse",
".",
"Namespace",
")",
":",
"fairseq",
"args",
"params",
"(",
"iterable",
")",
":",
"iterable",
"of",
"parameters",
"to",
"optimize"
] | def build_optimizer(cls, args, params):
"""
Args:
args (argparse.Namespace): fairseq args
params (iterable): iterable of parameters to optimize
"""
fp32_params = cls.build_fp32_params(params)
fp32_optimizer = optim.build_optimizer(args, [fp32_params])
... | [
"def",
"build_optimizer",
"(",
"cls",
",",
"args",
",",
"params",
")",
":",
"fp32_params",
"=",
"cls",
".",
"build_fp32_params",
"(",
"params",
")",
"fp32_optimizer",
"=",
"optim",
".",
"build_optimizer",
"(",
"args",
",",
"[",
"fp32_params",
"]",
")",
"re... | https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/infoxlm/fairseq/fairseq/optim/fp16_optimizer.py#L201-L209 | |
OneDrive/onedrive-sdk-python | e5642f8cad8eea37a4f653c1a23dfcfc06c37110 | src/onedrivesdk/model/drive.py | python | Drive.drive_type | (self) | Gets and sets the driveType
Returns:
str:
The driveType | Gets and sets the driveType
Returns:
str:
The driveType | [
"Gets",
"and",
"sets",
"the",
"driveType",
"Returns",
":",
"str",
":",
"The",
"driveType"
] | def drive_type(self):
"""
Gets and sets the driveType
Returns:
str:
The driveType
"""
if "driveType" in self._prop_dict:
return self._prop_dict["driveType"]
else:
return None | [
"def",
"drive_type",
"(",
"self",
")",
":",
"if",
"\"driveType\"",
"in",
"self",
".",
"_prop_dict",
":",
"return",
"self",
".",
"_prop_dict",
"[",
"\"driveType\"",
"]",
"else",
":",
"return",
"None"
] | https://github.com/OneDrive/onedrive-sdk-python/blob/e5642f8cad8eea37a4f653c1a23dfcfc06c37110/src/onedrivesdk/model/drive.py#L40-L51 | ||
apache/libcloud | 90971e17bfd7b6bb97b2489986472c531cc8e140 | libcloud/common/osc.py | python | OSCRequestSigner.__init__ | (self, access_key: str, access_secret: str, version: str, connection) | :param access_key: Access key.
:type access_key: ``str``
:param access_secret: Access secret.
:type access_secret: ``str``
:param version: API version.
:type version: ``str``
:param connection: Connection instance.
:type connection: :class:`Connection` | :param access_key: Access key.
:type access_key: ``str`` | [
":",
"param",
"access_key",
":",
"Access",
"key",
".",
":",
"type",
"access_key",
":",
"str"
] | def __init__(self, access_key: str, access_secret: str, version: str, connection):
"""
:param access_key: Access key.
:type access_key: ``str``
:param access_secret: Access secret.
:type access_secret: ``str``
:param version: API version.
:type version: ``str``
... | [
"def",
"__init__",
"(",
"self",
",",
"access_key",
":",
"str",
",",
"access_secret",
":",
"str",
",",
"version",
":",
"str",
",",
"connection",
")",
":",
"self",
".",
"access_key",
"=",
"access_key",
"self",
".",
"access_secret",
"=",
"access_secret",
"sel... | https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/common/osc.py#L32-L49 | ||
timkpaine/pyEX | 254acd2b0cf7cb7183100106f4ecc11d1860c46a | pyEX/stocks/insiderSummary.py | python | insiderSummary | (symbol, token="", version="stable", filter="", format="json") | return _get(
"stock/{symbol}/insider-summary".format(symbol=_quoteSymbols(symbol)),
token=token,
version=version,
filter=filter,
format=format,
) | Returns aggregated insiders summary data for the last 6 months.
https://iexcloud.io/docs/api/#insider-summary
Updates at 5am, 6am ET every day
Args:
symbol (str): Ticker to request
token (str): Access token
version (str): API version
filter (str): filters: https://iexcloud.... | Returns aggregated insiders summary data for the last 6 months. | [
"Returns",
"aggregated",
"insiders",
"summary",
"data",
"for",
"the",
"last",
"6",
"months",
"."
] | def insiderSummary(symbol, token="", version="stable", filter="", format="json"):
"""Returns aggregated insiders summary data for the last 6 months.
https://iexcloud.io/docs/api/#insider-summary
Updates at 5am, 6am ET every day
Args:
symbol (str): Ticker to request
token (str): Access ... | [
"def",
"insiderSummary",
"(",
"symbol",
",",
"token",
"=",
"\"\"",
",",
"version",
"=",
"\"stable\"",
",",
"filter",
"=",
"\"\"",
",",
"format",
"=",
"\"json\"",
")",
":",
"_raiseIfNotStr",
"(",
"symbol",
")",
"return",
"_get",
"(",
"\"stock/{symbol}/insider... | https://github.com/timkpaine/pyEX/blob/254acd2b0cf7cb7183100106f4ecc11d1860c46a/pyEX/stocks/insiderSummary.py#L23-L46 | |
ucfopen/canvasapi | 3f1a71e23c86a49dbaa6e84f6c0e81c297b86e36 | canvasapi/user.py | python | User.add_observee | (self, observee_id, **kwargs) | return User(self._requester, response.json()) | Registers a user as being observed by the given user.
:calls: `PUT /api/v1/users/:user_id/observees/:observee_id \
<https://canvas.instructure.com/doc/api/user_observees.html#method.user_observees.update>`_
:param observee_id: The login id for the user to observe.
:type observee_id: in... | Registers a user as being observed by the given user. | [
"Registers",
"a",
"user",
"as",
"being",
"observed",
"by",
"the",
"given",
"user",
"."
] | def add_observee(self, observee_id, **kwargs):
"""
Registers a user as being observed by the given user.
:calls: `PUT /api/v1/users/:user_id/observees/:observee_id \
<https://canvas.instructure.com/doc/api/user_observees.html#method.user_observees.update>`_
:param observee_id: ... | [
"def",
"add_observee",
"(",
"self",
",",
"observee_id",
",",
"*",
"*",
"kwargs",
")",
":",
"response",
"=",
"self",
".",
"_requester",
".",
"request",
"(",
"\"PUT\"",
",",
"\"users/{}/observees/{}\"",
".",
"format",
"(",
"self",
".",
"id",
",",
"observee_i... | https://github.com/ucfopen/canvasapi/blob/3f1a71e23c86a49dbaa6e84f6c0e81c297b86e36/canvasapi/user.py#L18-L35 | |
morganstanley/treadmill | f18267c665baf6def4374d21170198f63ff1cde4 | lib/python/treadmill/services/localdisk_service.py | python | _uniqueid | (app_unique_name) | return TREADMILL_LV_PREFIX + uniqueid | Create unique volume name based on unique app name. | Create unique volume name based on unique app name. | [
"Create",
"unique",
"volume",
"name",
"based",
"on",
"unique",
"app",
"name",
"."
] | def _uniqueid(app_unique_name):
"""Create unique volume name based on unique app name.
"""
_, uniqueid = app_unique_name.rsplit('-', 1)
return TREADMILL_LV_PREFIX + uniqueid | [
"def",
"_uniqueid",
"(",
"app_unique_name",
")",
":",
"_",
",",
"uniqueid",
"=",
"app_unique_name",
".",
"rsplit",
"(",
"'-'",
",",
"1",
")",
"return",
"TREADMILL_LV_PREFIX",
"+",
"uniqueid"
] | https://github.com/morganstanley/treadmill/blob/f18267c665baf6def4374d21170198f63ff1cde4/lib/python/treadmill/services/localdisk_service.py#L29-L33 | |
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/sre_compile.py | python | _compile_charset | (charset, flags, code, fixup=None, fixes=None) | [] | def _compile_charset(charset, flags, code, fixup=None, fixes=None):
# compile charset subprogram
emit = code.append
for op, av in _optimize_charset(charset, fixup, fixes,
flags & SRE_FLAG_UNICODE):
emit(OPCODES[op])
if op is NEGATE:
pass
... | [
"def",
"_compile_charset",
"(",
"charset",
",",
"flags",
",",
"code",
",",
"fixup",
"=",
"None",
",",
"fixes",
"=",
"None",
")",
":",
"# compile charset subprogram",
"emit",
"=",
"code",
".",
"append",
"for",
"op",
",",
"av",
"in",
"_optimize_charset",
"("... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/sre_compile.py#L227-L253 | ||||
GoogleCloudPlatform/python-runtime | 440934bf88ebda516684e8fb1c8cb1027ca3d2d0 | scripts/gen_dockerfile.py | python | parse_args | (argv) | return args | Parse and validate command line flags | Parse and validate command line flags | [
"Parse",
"and",
"validate",
"command",
"line",
"flags"
] | def parse_args(argv):
"""Parse and validate command line flags"""
parser = argparse.ArgumentParser()
parser.add_argument(
'--base-image',
type=functools.partial(
validation_utils.validate_arg_regex, flag_regex=IMAGE_REGEX),
default='gcr.io/google-appengine/python:latest',... | [
"def",
"parse_args",
"(",
"argv",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"'--base-image'",
",",
"type",
"=",
"functools",
".",
"partial",
"(",
"validation_utils",
".",
"validate_arg_regex",
","... | https://github.com/GoogleCloudPlatform/python-runtime/blob/440934bf88ebda516684e8fb1c8cb1027ca3d2d0/scripts/gen_dockerfile.py#L237-L268 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/solvers/pde.py | python | pde_1st_linear_variable_coeff | (eq, func, order, match, solvefun) | r"""
Solves a first order linear partial differential equation
with variable coefficients. The general form of this partial differential equation is
.. math:: a(x, y) \frac{df(x, y)}{dx} + a(x, y) \frac{df(x, y)}{dy}
+ c(x, y) f(x, y) - G(x, y)
where `a(x, y)`, `b(x, y)`, `c(x, y)` and... | r"""
Solves a first order linear partial differential equation
with variable coefficients. The general form of this partial differential equation is | [
"r",
"Solves",
"a",
"first",
"order",
"linear",
"partial",
"differential",
"equation",
"with",
"variable",
"coefficients",
".",
"The",
"general",
"form",
"of",
"this",
"partial",
"differential",
"equation",
"is"
] | def pde_1st_linear_variable_coeff(eq, func, order, match, solvefun):
r"""
Solves a first order linear partial differential equation
with variable coefficients. The general form of this partial differential equation is
.. math:: a(x, y) \frac{df(x, y)}{dx} + a(x, y) \frac{df(x, y)}{dy}
+... | [
"def",
"pde_1st_linear_variable_coeff",
"(",
"eq",
",",
"func",
",",
"order",
",",
"match",
",",
"solvefun",
")",
":",
"from",
"sympy",
".",
"integrals",
".",
"integrals",
"import",
"integrate",
"from",
"sympy",
".",
"solvers",
".",
"ode",
"import",
"dsolve"... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/solvers/pde.py#L662-L788 | ||
lisa-lab/pylearn2 | af81e5c362f0df4df85c3e54e23b2adeec026055 | pylearn2/models/rbm.py | python | GaussianBinaryRBM.mean_v_given_h | (self, h) | return self.energy_function.mean_V_given_H(h) | Compute the mean activation of the visibles given hidden unit
configurations for a set of training examples.
Parameters
----------
h : tensor_like
Theano symbolic representing the hidden unit states for a batch
of training examples, with the first dimension index... | Compute the mean activation of the visibles given hidden unit
configurations for a set of training examples. | [
"Compute",
"the",
"mean",
"activation",
"of",
"the",
"visibles",
"given",
"hidden",
"unit",
"configurations",
"for",
"a",
"set",
"of",
"training",
"examples",
"."
] | def mean_v_given_h(self, h):
"""
Compute the mean activation of the visibles given hidden unit
configurations for a set of training examples.
Parameters
----------
h : tensor_like
Theano symbolic representing the hidden unit states for a batch
of ... | [
"def",
"mean_v_given_h",
"(",
"self",
",",
"h",
")",
":",
"return",
"self",
".",
"energy_function",
".",
"mean_V_given_H",
"(",
"h",
")"
] | https://github.com/lisa-lab/pylearn2/blob/af81e5c362f0df4df85c3e54e23b2adeec026055/pylearn2/models/rbm.py#L980-L999 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/cat/v20180409/models.py | python | UpdateProbeTaskConfigurationListRequest.__init__ | (self) | r"""
:param TaskIds: 任务 ID
:type TaskIds: list of str
:param Nodes: 拨测节点
:type Nodes: list of str
:param Interval: 拨测间隔
:type Interval: int
:param Parameters: 拨测参数
:type Parameters: str
:param Cron: 定时任务cron表达式
:type Cron: str | r"""
:param TaskIds: 任务 ID
:type TaskIds: list of str
:param Nodes: 拨测节点
:type Nodes: list of str
:param Interval: 拨测间隔
:type Interval: int
:param Parameters: 拨测参数
:type Parameters: str
:param Cron: 定时任务cron表达式
:type Cron: str | [
"r",
":",
"param",
"TaskIds",
":",
"任务",
"ID",
":",
"type",
"TaskIds",
":",
"list",
"of",
"str",
":",
"param",
"Nodes",
":",
"拨测节点",
":",
"type",
"Nodes",
":",
"list",
"of",
"str",
":",
"param",
"Interval",
":",
"拨测间隔",
":",
"type",
"Interval",
":"... | def __init__(self):
r"""
:param TaskIds: 任务 ID
:type TaskIds: list of str
:param Nodes: 拨测节点
:type Nodes: list of str
:param Interval: 拨测间隔
:type Interval: int
:param Parameters: 拨测参数
:type Parameters: str
:param Cron: 定时任务cron表达式
:... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"TaskIds",
"=",
"None",
"self",
".",
"Nodes",
"=",
"None",
"self",
".",
"Interval",
"=",
"None",
"self",
".",
"Parameters",
"=",
"None",
"self",
".",
"Cron",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cat/v20180409/models.py#L3516-L3533 | ||
tribe29/checkmk | 6260f2512e159e311f426e16b84b19d0b8e9ad0c | cmk/gui/plugins/openapi/restful_objects/decorators.py | python | _schema_name | (schema_name: str) | return schema_name[:-6] if schema_name.endswith("Schema") else schema_name | Remove the suffix 'Schema' from a schema-name.
Examples:
>>> _schema_name("BakeSchema")
'Bake'
>>> _schema_name("BakeSchemaa")
'BakeSchemaa'
Args:
schema_name:
The name of the Schema.
Returns:
The name of the Schema, maybe stripped of the suff... | Remove the suffix 'Schema' from a schema-name. | [
"Remove",
"the",
"suffix",
"Schema",
"from",
"a",
"schema",
"-",
"name",
"."
] | def _schema_name(schema_name: str):
"""Remove the suffix 'Schema' from a schema-name.
Examples:
>>> _schema_name("BakeSchema")
'Bake'
>>> _schema_name("BakeSchemaa")
'BakeSchemaa'
Args:
schema_name:
The name of the Schema.
Returns:
The nam... | [
"def",
"_schema_name",
"(",
"schema_name",
":",
"str",
")",
":",
"return",
"schema_name",
"[",
":",
"-",
"6",
"]",
"if",
"schema_name",
".",
"endswith",
"(",
"\"Schema\"",
")",
"else",
"schema_name"
] | https://github.com/tribe29/checkmk/blob/6260f2512e159e311f426e16b84b19d0b8e9ad0c/cmk/gui/plugins/openapi/restful_objects/decorators.py#L987-L1006 | |
facebookresearch/pytorch3d | fddd6a700fa9685c1ce2d4b266c111d7db424ecc | pytorch3d/structures/meshes.py | python | Meshes.update_padded | (self, new_verts_padded) | return new | This function allows for an update of verts_padded without having to
explicitly convert it to the list representation for heterogeneous batches.
Returns a Meshes structure with updated padded tensors and copies of the
auxiliary tensors at construction time.
It updates self._verts_padded ... | This function allows for an update of verts_padded without having to
explicitly convert it to the list representation for heterogeneous batches.
Returns a Meshes structure with updated padded tensors and copies of the
auxiliary tensors at construction time.
It updates self._verts_padded ... | [
"This",
"function",
"allows",
"for",
"an",
"update",
"of",
"verts_padded",
"without",
"having",
"to",
"explicitly",
"convert",
"it",
"to",
"the",
"list",
"representation",
"for",
"heterogeneous",
"batches",
".",
"Returns",
"a",
"Meshes",
"structure",
"with",
"up... | def update_padded(self, new_verts_padded):
"""
This function allows for an update of verts_padded without having to
explicitly convert it to the list representation for heterogeneous batches.
Returns a Meshes structure with updated padded tensors and copies of the
auxiliary tenso... | [
"def",
"update_padded",
"(",
"self",
",",
"new_verts_padded",
")",
":",
"def",
"check_shapes",
"(",
"x",
",",
"size",
")",
":",
"if",
"x",
".",
"shape",
"[",
"0",
"]",
"!=",
"size",
"[",
"0",
"]",
":",
"raise",
"ValueError",
"(",
"\"new values must hav... | https://github.com/facebookresearch/pytorch3d/blob/fddd6a700fa9685c1ce2d4b266c111d7db424ecc/pytorch3d/structures/meshes.py#L1402-L1494 | |
leo-editor/leo-editor | 383d6776d135ef17d73d935a2f0ecb3ac0e99494 | leo/core/leoNodes.py | python | Position.parents | (self, copy=True) | Yield all parent positions of p. | Yield all parent positions of p. | [
"Yield",
"all",
"parent",
"positions",
"of",
"p",
"."
] | def parents(self, copy=True):
"""Yield all parent positions of p."""
p = self
p = p.parent()
while p:
yield p.copy() if copy else p
p.moveToParent() | [
"def",
"parents",
"(",
"self",
",",
"copy",
"=",
"True",
")",
":",
"p",
"=",
"self",
"p",
"=",
"p",
".",
"parent",
"(",
")",
"while",
"p",
":",
"yield",
"p",
".",
"copy",
"(",
")",
"if",
"copy",
"else",
"p",
"p",
".",
"moveToParent",
"(",
")"... | https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/core/leoNodes.py#L516-L522 | ||
p2pool/p2pool | 53c438bbada06b9d4a9a465bc13f7694a7a322b7 | wstools/XMLSchema.py | python | Sequence.__init__ | (self, parent) | [] | def __init__(self, parent):
XMLSchemaComponent.__init__(self, parent)
self.annotation = None
self.content = None | [
"def",
"__init__",
"(",
"self",
",",
"parent",
")",
":",
"XMLSchemaComponent",
".",
"__init__",
"(",
"self",
",",
"parent",
")",
"self",
".",
"annotation",
"=",
"None",
"self",
".",
"content",
"=",
"None"
] | https://github.com/p2pool/p2pool/blob/53c438bbada06b9d4a9a465bc13f7694a7a322b7/wstools/XMLSchema.py#L2162-L2165 | ||||
dask/dask | c2b962fec1ba45440fe928869dc64cfe9cc36506 | dask/array/reductions.py | python | cumprod | (x, axis=None, dtype=None, out=None, method="sequential") | return cumreduction(
np.cumprod,
_cumprod_merge,
1,
x,
axis,
dtype,
out=out,
method=method,
preop=np.prod,
) | Dask added an additional keyword-only argument ``method``.
method : {'sequential', 'blelloch'}, optional
Choose which method to use to perform the cumprod. Default is 'sequential'.
* 'sequential' performs the cumprod of each prior block before the current block.
* 'blelloch' is a work-eff... | Dask added an additional keyword-only argument ``method``. | [
"Dask",
"added",
"an",
"additional",
"keyword",
"-",
"only",
"argument",
"method",
"."
] | def cumprod(x, axis=None, dtype=None, out=None, method="sequential"):
"""Dask added an additional keyword-only argument ``method``.
method : {'sequential', 'blelloch'}, optional
Choose which method to use to perform the cumprod. Default is 'sequential'.
* 'sequential' performs the cumprod of ... | [
"def",
"cumprod",
"(",
"x",
",",
"axis",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"out",
"=",
"None",
",",
"method",
"=",
"\"sequential\"",
")",
":",
"return",
"cumreduction",
"(",
"np",
".",
"cumprod",
",",
"_cumprod_merge",
",",
"1",
",",
"x",
... | https://github.com/dask/dask/blob/c2b962fec1ba45440fe928869dc64cfe9cc36506/dask/array/reductions.py#L1469-L1491 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/rings/polynomial/groebner_fan.py | python | GroebnerFan._gfan_mod | (self) | Return the extra options to the ``gfan`` command that are used
by this object to account for working modulo a prime or in the
presence of extra symmetries.
EXAMPLES::
sage: R.<x,y> = PolynomialRing(QQ,2)
sage: gf = R.ideal([x^3-y,y^3-x-1]).groebner_fan()
sag... | Return the extra options to the ``gfan`` command that are used
by this object to account for working modulo a prime or in the
presence of extra symmetries. | [
"Return",
"the",
"extra",
"options",
"to",
"the",
"gfan",
"command",
"that",
"are",
"used",
"by",
"this",
"object",
"to",
"account",
"for",
"working",
"modulo",
"a",
"prime",
"or",
"in",
"the",
"presence",
"of",
"extra",
"symmetries",
"."
] | def _gfan_mod(self):
"""
Return the extra options to the ``gfan`` command that are used
by this object to account for working modulo a prime or in the
presence of extra symmetries.
EXAMPLES::
sage: R.<x,y> = PolynomialRing(QQ,2)
sage: gf = R.ideal([x^3-y... | [
"def",
"_gfan_mod",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"__gfan_mod",
"except",
"AttributeError",
":",
"mod",
"=",
"''",
"# p = self.characteristic()",
"# if p:",
"# mod += ' --mod %s' % p",
"# else:",
"# mod += ''",
"if",
"self",
".",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/polynomial/groebner_fan.py#L1079-L1109 | ||
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/provisioningserver/register_command.py | python | add_arguments | (parser) | Add this command's options to the `ArgumentParser`.
Specified by the `ActionScript` interface. | Add this command's options to the `ArgumentParser`. | [
"Add",
"this",
"command",
"s",
"options",
"to",
"the",
"ArgumentParser",
"."
] | def add_arguments(parser):
"""Add this command's options to the `ArgumentParser`.
Specified by the `ActionScript` interface.
"""
parser.description = dedent(
"""\
Examples of command usage (with interactive input):
- Supplying both URL and shared secret (not prompted for either... | [
"def",
"add_arguments",
"(",
"parser",
")",
":",
"parser",
".",
"description",
"=",
"dedent",
"(",
"\"\"\"\\\n Examples of command usage (with interactive input):\n\n - Supplying both URL and shared secret (not prompted for either):\n\n # maas-rack register --secret <sha... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/provisioningserver/register_command.py#L35-L99 | ||
kornia/kornia | b12d6611b1c41d47b2c93675f0ea344b5314a688 | kornia/feature/affine_shape.py | python | LAFAffNetShapeEstimator.forward | (self, laf: torch.Tensor, img: torch.Tensor) | return laf_out | Args:
laf: shape [BxNx2x3]
img: shape [Bx1xHxW]
Returns:
laf_out shape [BxNx2x3] | Args:
laf: shape [BxNx2x3]
img: shape [Bx1xHxW] | [
"Args",
":",
"laf",
":",
"shape",
"[",
"BxNx2x3",
"]",
"img",
":",
"shape",
"[",
"Bx1xHxW",
"]"
] | def forward(self, laf: torch.Tensor, img: torch.Tensor) -> torch.Tensor:
"""
Args:
laf: shape [BxNx2x3]
img: shape [Bx1xHxW]
Returns:
laf_out shape [BxNx2x3]
"""
raise_error_if_laf_is_not_valid(laf)
img_message: str = f"Invalid img sha... | [
"def",
"forward",
"(",
"self",
",",
"laf",
":",
"torch",
".",
"Tensor",
",",
"img",
":",
"torch",
".",
"Tensor",
")",
"->",
"torch",
".",
"Tensor",
":",
"raise_error_if_laf_is_not_valid",
"(",
"laf",
")",
"img_message",
":",
"str",
"=",
"f\"Invalid img sha... | https://github.com/kornia/kornia/blob/b12d6611b1c41d47b2c93675f0ea344b5314a688/kornia/feature/affine_shape.py#L199-L227 | |
postgres/pgadmin4 | 374c5e952fa594d749fadf1f88076c1cba8c5f64 | web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py | python | TypeView.create | (self, gid, sid, did, scid) | This function will creates new the type object
Args:
gid: Server Group ID
sid: Server ID
did: Database ID
scid: Schema ID
tid: Type ID | This function will creates new the type object | [
"This",
"function",
"will",
"creates",
"new",
"the",
"type",
"object"
] | def create(self, gid, sid, did, scid):
"""
This function will creates new the type object
Args:
gid: Server Group ID
sid: Server ID
did: Database ID
scid: Schema ID
tid: Type ID
"""
data = request.form if request.form else ... | [
"def",
"create",
"(",
"self",
",",
"gid",
",",
"sid",
",",
"did",
",",
"scid",
")",
":",
"data",
"=",
"request",
".",
"form",
"if",
"request",
".",
"form",
"else",
"json",
".",
"loads",
"(",
"request",
".",
"data",
",",
"encoding",
"=",
"'utf-8'",
... | https://github.com/postgres/pgadmin4/blob/374c5e952fa594d749fadf1f88076c1cba8c5f64/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py#L1001-L1074 | ||
larryhastings/gilectomy | 4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a | Lib/numbers.py | python | Complex.__complex__ | (self) | Return a builtin complex instance. Called for complex(self). | Return a builtin complex instance. Called for complex(self). | [
"Return",
"a",
"builtin",
"complex",
"instance",
".",
"Called",
"for",
"complex",
"(",
"self",
")",
"."
] | def __complex__(self):
"""Return a builtin complex instance. Called for complex(self).""" | [
"def",
"__complex__",
"(",
"self",
")",
":"
] | https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/numbers.py#L46-L47 | ||
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/pip/_internal/utils/logging.py | python | MaxLevelFilter.filter | (self, record) | return record.levelno < self.level | [] | def filter(self, record):
return record.levelno < self.level | [
"def",
"filter",
"(",
"self",
",",
"record",
")",
":",
"return",
"record",
".",
"levelno",
"<",
"self",
".",
"level"
] | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_internal/utils/logging.py#L257-L258 | |||
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/waffit/libs/BeautifulSoup.py | python | BeautifulStoneSoup.isSelfClosingTag | (self, name) | return self.SELF_CLOSING_TAGS.has_key(name) \
or self.instanceSelfClosingTags.has_key(name) | Returns true iff the given string is the name of a
self-closing tag according to this parser. | Returns true iff the given string is the name of a
self-closing tag according to this parser. | [
"Returns",
"true",
"iff",
"the",
"given",
"string",
"is",
"the",
"name",
"of",
"a",
"self",
"-",
"closing",
"tag",
"according",
"to",
"this",
"parser",
"."
] | def isSelfClosingTag(self, name):
"""Returns true iff the given string is the name of a
self-closing tag according to this parser."""
return self.SELF_CLOSING_TAGS.has_key(name) \
or self.instanceSelfClosingTags.has_key(name) | [
"def",
"isSelfClosingTag",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"SELF_CLOSING_TAGS",
".",
"has_key",
"(",
"name",
")",
"or",
"self",
".",
"instanceSelfClosingTags",
".",
"has_key",
"(",
"name",
")"
] | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/waffit/libs/BeautifulSoup.py#L1150-L1154 | |
numenta/nupic | b9ebedaf54f49a33de22d8d44dff7c765cdb5548 | external/linux32/lib/python2.6/site-packages/matplotlib/text.py | python | TextWithDash.update_coords | (self, renderer) | Computes the actual *x*, *y* coordinates for text based on the
input *x*, *y* and the *dashlength*. Since the rotation is
with respect to the actual canvas's coordinates we need to map
back and forth. | Computes the actual *x*, *y* coordinates for text based on the
input *x*, *y* and the *dashlength*. Since the rotation is
with respect to the actual canvas's coordinates we need to map
back and forth. | [
"Computes",
"the",
"actual",
"*",
"x",
"*",
"*",
"y",
"*",
"coordinates",
"for",
"text",
"based",
"on",
"the",
"input",
"*",
"x",
"*",
"*",
"y",
"*",
"and",
"the",
"*",
"dashlength",
"*",
".",
"Since",
"the",
"rotation",
"is",
"with",
"respect",
"t... | def update_coords(self, renderer):
"""
Computes the actual *x*, *y* coordinates for text based on the
input *x*, *y* and the *dashlength*. Since the rotation is
with respect to the actual canvas's coordinates we need to map
back and forth.
"""
dashx, dashy = self.... | [
"def",
"update_coords",
"(",
"self",
",",
"renderer",
")",
":",
"dashx",
",",
"dashy",
"=",
"self",
".",
"get_position",
"(",
")",
"dashlength",
"=",
"self",
".",
"get_dashlength",
"(",
")",
"# Shortcircuit this process if we don't have a dash",
"if",
"dashlength"... | https://github.com/numenta/nupic/blob/b9ebedaf54f49a33de22d8d44dff7c765cdb5548/external/linux32/lib/python2.6/site-packages/matplotlib/text.py#L1039-L1121 | ||
PaddlePaddle/PARL | 5fb7a5d2b5d0f0dac57fdf4acb9e79485c7efa96 | parl/core/fluid/model.py | python | Model.__init__ | (self, model_id=None) | Args:
model_id (String): user-specified model_id (default: None) | Args:
model_id (String): user-specified model_id (default: None) | [
"Args",
":",
"model_id",
"(",
"String",
")",
":",
"user",
"-",
"specified",
"model_id",
"(",
"default",
":",
"None",
")"
] | def __init__(self, model_id=None):
"""
Args:
model_id (String): user-specified model_id (default: None)
"""
super(Model, self).__init__()
if model_id is not None:
global_model_helper.register_model_id(model_id)
self.__model_id = model_id
... | [
"def",
"__init__",
"(",
"self",
",",
"model_id",
"=",
"None",
")",
":",
"super",
"(",
"Model",
",",
"self",
")",
".",
"__init__",
"(",
")",
"if",
"model_id",
"is",
"not",
"None",
":",
"global_model_helper",
".",
"register_model_id",
"(",
"model_id",
")",... | https://github.com/PaddlePaddle/PARL/blob/5fb7a5d2b5d0f0dac57fdf4acb9e79485c7efa96/parl/core/fluid/model.py#L70-L80 | ||
Nuitka/Nuitka | 39262276993757fa4e299f497654065600453fc9 | nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Node/Alias.py | python | Alias.sconsign | (self) | An Alias is not recorded in .sconsign files | An Alias is not recorded in .sconsign files | [
"An",
"Alias",
"is",
"not",
"recorded",
"in",
".",
"sconsign",
"files"
] | def sconsign(self):
"""An Alias is not recorded in .sconsign files"""
pass | [
"def",
"sconsign",
"(",
"self",
")",
":",
"pass"
] | https://github.com/Nuitka/Nuitka/blob/39262276993757fa4e299f497654065600453fc9/nuitka/build/inline_copy/lib/scons-4.3.0/SCons/Node/Alias.py#L131-L133 | ||
1012598167/flask_mongodb_game | 60c7e0351586656ec38f851592886338e50b4110 | python_flask/venv/Lib/site-packages/pymongo/client_session.py | python | _ServerSession.transaction_id | (self) | return Int64(self._transaction_id) | Positive 64-bit integer. | Positive 64-bit integer. | [
"Positive",
"64",
"-",
"bit",
"integer",
"."
] | def transaction_id(self):
"""Positive 64-bit integer."""
return Int64(self._transaction_id) | [
"def",
"transaction_id",
"(",
"self",
")",
":",
"return",
"Int64",
"(",
"self",
".",
"_transaction_id",
")"
] | https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pymongo/client_session.py#L857-L859 | |
EtienneCmb/visbrain | b599038e095919dc193b12d5e502d127de7d03c9 | visbrain/gui/sleep/visuals/visuals.py | python | Detection.build_line | (self, data) | Build detections reports.
Parameters
----------
data : array_like
Data vector for a spcefic channel. | Build detections reports. | [
"Build",
"detections",
"reports",
"."
] | def build_line(self, data):
"""Build detections reports.
Parameters
----------
data : array_like
Data vector for a spcefic channel.
"""
for num, k in enumerate(self):
if self[k]['index'].size:
# Get the channel number :
... | [
"def",
"build_line",
"(",
"self",
",",
"data",
")",
":",
"for",
"num",
",",
"k",
"in",
"enumerate",
"(",
"self",
")",
":",
"if",
"self",
"[",
"k",
"]",
"[",
"'index'",
"]",
".",
"size",
":",
"# Get the channel number :",
"nb",
"=",
"self",
".",
"ch... | https://github.com/EtienneCmb/visbrain/blob/b599038e095919dc193b12d5e502d127de7d03c9/visbrain/gui/sleep/visuals/visuals.py#L86-L115 | ||
1012598167/flask_mongodb_game | 60c7e0351586656ec38f851592886338e50b4110 | python_flask/venv/Lib/site-packages/pymongo/encryption.py | python | ClientEncryption.__init__ | (self, kms_providers, key_vault_namespace, key_vault_client,
codec_options) | Explicit client side encryption.
The ClientEncryption class encapsulates explicit operations on a key
vault collection that cannot be done directly on a MongoClient. Similar
to configuring auto encryption on a MongoClient, it is constructed with
a MongoClient (to a MongoDB cluster conta... | Explicit client side encryption. | [
"Explicit",
"client",
"side",
"encryption",
"."
] | def __init__(self, kms_providers, key_vault_namespace, key_vault_client,
codec_options):
"""Explicit client side encryption.
The ClientEncryption class encapsulates explicit operations on a key
vault collection that cannot be done directly on a MongoClient. Similar
to c... | [
"def",
"__init__",
"(",
"self",
",",
"kms_providers",
",",
"key_vault_namespace",
",",
"key_vault_client",
",",
"codec_options",
")",
":",
"if",
"not",
"_HAVE_PYMONGOCRYPT",
":",
"raise",
"ConfigurationError",
"(",
"\"client side encryption requires the pymongocrypt library... | https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pymongo/encryption.py#L345-L406 | ||
ialbert/biostar-central | 2dc7bd30691a50b2da9c2833ba354056bc686afa | biostar/accounts/templatetags/accounts_tags.py | python | show_email | (target, user=None) | return email | [] | def show_email(target, user=None):
# Show the email to the same user.
if target == user:
return target.email
try:
head, tail = target.email.split("@")
email = head[0] + "*" * len(tail) + "@" + tail
except Exception as exc:
return "*" * 10
return email | [
"def",
"show_email",
"(",
"target",
",",
"user",
"=",
"None",
")",
":",
"# Show the email to the same user.",
"if",
"target",
"==",
"user",
":",
"return",
"target",
".",
"email",
"try",
":",
"head",
",",
"tail",
"=",
"target",
".",
"email",
".",
"split",
... | https://github.com/ialbert/biostar-central/blob/2dc7bd30691a50b2da9c2833ba354056bc686afa/biostar/accounts/templatetags/accounts_tags.py#L27-L39 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.