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
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/vendor/tomli/_parser.py
python
parse_multiline_str
(src: str, pos: Pos, *, literal: bool)
return pos, result + (delim * 2)
[]
def parse_multiline_str(src: str, pos: Pos, *, literal: bool) -> Tuple[Pos, str]: pos += 3 if src.startswith("\n", pos): pos += 1 if literal: delim = "'" end_pos = skip_until( src, pos, "'''", error_on=ILLEGAL_MULTILINE_LITERAL_STR_CHA...
[ "def", "parse_multiline_str", "(", "src", ":", "str", ",", "pos", ":", "Pos", ",", "*", ",", "literal", ":", "bool", ")", "->", "Tuple", "[", "Pos", ",", "str", "]", ":", "pos", "+=", "3", "if", "src", ".", "startswith", "(", "\"\\n\"", ",", "pos...
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/tomli/_parser.py#L520-L548
zim-desktop-wiki/zim-desktop-wiki
fe717d7ee64e5c06d90df90eb87758e5e72d25c5
zim/formats/__init__.py
python
Visitor.append
(self, tag, attrib=None, text=None)
Convenience function to open a tag, append text and close it immediatly. Can raise L{VisitorStop} or L{VisitorSkip}, see C{start()} for the conditions. @param tag: the tag name @param attrib: optional dict with attributes @param text: formatted text @implementation: optional for subclasses, default impl...
Convenience function to open a tag, append text and close it immediatly.
[ "Convenience", "function", "to", "open", "a", "tag", "append", "text", "and", "close", "it", "immediatly", "." ]
def append(self, tag, attrib=None, text=None): '''Convenience function to open a tag, append text and close it immediatly. Can raise L{VisitorStop} or L{VisitorSkip}, see C{start()} for the conditions. @param tag: the tag name @param attrib: optional dict with attributes @param text: formatted text @i...
[ "def", "append", "(", "self", ",", "tag", ",", "attrib", "=", "None", ",", "text", "=", "None", ")", ":", "self", ".", "start", "(", "tag", ",", "attrib", ")", "if", "text", "is", "not", "None", ":", "self", ".", "text", "(", "text", ")", "self...
https://github.com/zim-desktop-wiki/zim-desktop-wiki/blob/fe717d7ee64e5c06d90df90eb87758e5e72d25c5/zim/formats/__init__.py#L802-L818
SigmaHQ/sigma
6f7d28b52a6468b2430e8d7dfefb79dc01e2f1af
tools/sigma/backends/elasticsearch.py
python
ElasticSearchRuleBackend.map_risk_score
(self, level)
[]
def map_risk_score(self, level): if level not in ["low","medium","high","critical"]: level = "medium" if level == "low": return 5 elif level == "medium": return 35 elif level == "high": return 65 elif level == "critical": ...
[ "def", "map_risk_score", "(", "self", ",", "level", ")", ":", "if", "level", "not", "in", "[", "\"low\"", ",", "\"medium\"", ",", "\"high\"", ",", "\"critical\"", "]", ":", "level", "=", "\"medium\"", "if", "level", "==", "\"low\"", ":", "return", "5", ...
https://github.com/SigmaHQ/sigma/blob/6f7d28b52a6468b2430e8d7dfefb79dc01e2f1af/tools/sigma/backends/elasticsearch.py#L1557-L1567
bigaidream-projects/drmad
a4bb6010595d956f29c5a42a095bab76a60b29eb
cpu_ver/hyperserver/experimentResult/meta30/server_mnist.py
python
Logger.write
(self, message)
[]
def write(self, message): self.terminal.write(message) self.log.write(message)
[ "def", "write", "(", "self", ",", "message", ")", ":", "self", ".", "terminal", ".", "write", "(", "message", ")", "self", ".", "log", ".", "write", "(", "message", ")" ]
https://github.com/bigaidream-projects/drmad/blob/a4bb6010595d956f29c5a42a095bab76a60b29eb/cpu_ver/hyperserver/experimentResult/meta30/server_mnist.py#L235-L237
larryhastings/gilectomy
4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a
Lib/pathlib.py
python
PurePath.joinpath
(self, *args)
return self._make_child(args)
Combine this path with one or several arguments, and return a new path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored).
Combine this path with one or several arguments, and return a new path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored).
[ "Combine", "this", "path", "with", "one", "or", "several", "arguments", "and", "return", "a", "new", "path", "representing", "either", "a", "subpath", "(", "if", "all", "arguments", "are", "relative", "paths", ")", "or", "a", "totally", "different", "path", ...
def joinpath(self, *args): """Combine this path with one or several arguments, and return a new path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). """ return self._make_child(args)
[ "def", "joinpath", "(", "self", ",", "*", "args", ")", ":", "return", "self", ".", "_make_child", "(", "args", ")" ]
https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/pathlib.py#L880-L886
kornia/kornia
b12d6611b1c41d47b2c93675f0ea344b5314a688
kornia/filters/filter.py
python
_compute_padding
(kernel_size: List[int])
return out_padding
Compute padding tuple.
Compute padding tuple.
[ "Compute", "padding", "tuple", "." ]
def _compute_padding(kernel_size: List[int]) -> List[int]: """Compute padding tuple.""" # 4 or 6 ints: (padding_left, padding_right,padding_top,padding_bottom) # https://pytorch.org/docs/stable/nn.html#torch.nn.functional.pad if len(kernel_size) < 2: raise AssertionError(kernel_size) comput...
[ "def", "_compute_padding", "(", "kernel_size", ":", "List", "[", "int", "]", ")", "->", "List", "[", "int", "]", ":", "# 4 or 6 ints: (padding_left, padding_right,padding_top,padding_bottom)", "# https://pytorch.org/docs/stable/nn.html#torch.nn.functional.pad", "if", "len", ...
https://github.com/kornia/kornia/blob/b12d6611b1c41d47b2c93675f0ea344b5314a688/kornia/filters/filter.py#L10-L30
007gzs/dingtalk-sdk
7979da2e259fdbc571728cae2425a04dbc65850a
dingtalk/client/api/taobao.py
python
TbALiJianKangZhuiSuMa.alibaba_alihealth_drug_kyt_dr_singlerelation
( self, code, ref_ent_id, des_ref_ent_id )
return self._top_request( "alibaba.alihealth.drug.kyt.dr.singlerelation", { "code": code, "ref_ent_id": ref_ent_id, "des_ref_ent_id": des_ref_ent_id } )
多融单码查贸易 单码关联关系查询 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=42648 :param code: 追溯码 :param ref_ent_id: 接口调用企业的唯一标识(接口调用者) :param des_ref_ent_id: 目标企业唯一标识(为哪个企业查询,一般与入参ref_ent_id一样)
多融单码查贸易 单码关联关系查询 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=42648
[ "多融单码查贸易", "单码关联关系查询", "文档地址:https", ":", "//", "open", "-", "doc", ".", "dingtalk", ".", "com", "/", "docs", "/", "api", ".", "htm?apiId", "=", "42648" ]
def alibaba_alihealth_drug_kyt_dr_singlerelation( self, code, ref_ent_id, des_ref_ent_id ): """ 多融单码查贸易 单码关联关系查询 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=42648 :param code: 追溯码 :param ref_ent_id: 接口调用企业的唯一标...
[ "def", "alibaba_alihealth_drug_kyt_dr_singlerelation", "(", "self", ",", "code", ",", "ref_ent_id", ",", "des_ref_ent_id", ")", ":", "return", "self", ".", "_top_request", "(", "\"alibaba.alihealth.drug.kyt.dr.singlerelation\"", ",", "{", "\"code\"", ":", "code", ",", ...
https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L90781-L90803
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/fileinput.py
python
isfirstline
()
return _state.isfirstline()
Returns true the line just read is the first line of its file, otherwise returns false.
Returns true the line just read is the first line of its file, otherwise returns false.
[ "Returns", "true", "the", "line", "just", "read", "is", "the", "first", "line", "of", "its", "file", "otherwise", "returns", "false", "." ]
def isfirstline(): """ Returns true the line just read is the first line of its file, otherwise returns false. """ if not _state: raise RuntimeError("no active input()") return _state.isfirstline()
[ "def", "isfirstline", "(", ")", ":", "if", "not", "_state", ":", "raise", "RuntimeError", "(", "\"no active input()\"", ")", "return", "_state", ".", "isfirstline", "(", ")" ]
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/fileinput.py#L165-L172
rigetti/pyquil
36987ecb78d5dc85d299dd62395b7669a1cedd5a
pyquil/api/_quantum_computer.py
python
_parse_name
(name: str, as_qvm: Optional[bool], noisy: Optional[bool])
return name, qvm_type, noisy
Try to figure out whether we're getting a (noisy) qvm, and the associated qpu name. See :py:func:`get_qc` for examples of valid names + flags.
Try to figure out whether we're getting a (noisy) qvm, and the associated qpu name.
[ "Try", "to", "figure", "out", "whether", "we", "re", "getting", "a", "(", "noisy", ")", "qvm", "and", "the", "associated", "qpu", "name", "." ]
def _parse_name(name: str, as_qvm: Optional[bool], noisy: Optional[bool]) -> Tuple[str, Optional[str], bool]: """ Try to figure out whether we're getting a (noisy) qvm, and the associated qpu name. See :py:func:`get_qc` for examples of valid names + flags. """ qvm_type: Optional[str] parts = na...
[ "def", "_parse_name", "(", "name", ":", "str", ",", "as_qvm", ":", "Optional", "[", "bool", "]", ",", "noisy", ":", "Optional", "[", "bool", "]", ")", "->", "Tuple", "[", "str", ",", "Optional", "[", "str", "]", ",", "bool", "]", ":", "qvm_type", ...
https://github.com/rigetti/pyquil/blob/36987ecb78d5dc85d299dd62395b7669a1cedd5a/pyquil/api/_quantum_computer.py#L442-L485
gleeda/memtriage
c24f4859995cccb9d88ccc0118d90693019cc1d5
volatility/volatility/plugins/overlays/windows/windows.py
python
_POOL_HEADER.get_object
(self, struct_name, object_type = None, use_top_down = False, skip_type_check = False)
Get the windows object contained within this pool using whichever method is best for the target OS. @param struct_name: the name of the structure to cast such as _EPROCESS. @param object_type: the name of the executive object. If there is no executive object in the pool alloca...
Get the windows object contained within this pool using whichever method is best for the target OS.
[ "Get", "the", "windows", "object", "contained", "within", "this", "pool", "using", "whichever", "method", "is", "best", "for", "the", "target", "OS", "." ]
def get_object(self, struct_name, object_type = None, use_top_down = False, skip_type_check = False): """Get the windows object contained within this pool using whichever method is best for the target OS. @param struct_name: the name of the structure to cast such as _EPROCESS. ...
[ "def", "get_object", "(", "self", ",", "struct_name", ",", "object_type", "=", "None", ",", "use_top_down", "=", "False", ",", "skip_type_check", "=", "False", ")", ":", "if", "use_top_down", ":", "return", "self", ".", "get_object_top_down", "(", "struct_name...
https://github.com/gleeda/memtriage/blob/c24f4859995cccb9d88ccc0118d90693019cc1d5/volatility/volatility/plugins/overlays/windows/windows.py#L1239-L1260
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/jinja2/debug.py
python
_init_ugly_crap
()
return tb_set_next
This function implements a few ugly things so that we can patch the traceback objects. The function returned allows resetting `tb_next` on any python traceback object. Do not attempt to use this on non cpython interpreters
This function implements a few ugly things so that we can patch the traceback objects. The function returned allows resetting `tb_next` on any python traceback object. Do not attempt to use this on non cpython interpreters
[ "This", "function", "implements", "a", "few", "ugly", "things", "so", "that", "we", "can", "patch", "the", "traceback", "objects", ".", "The", "function", "returned", "allows", "resetting", "tb_next", "on", "any", "python", "traceback", "object", ".", "Do", ...
def _init_ugly_crap(): """This function implements a few ugly things so that we can patch the traceback objects. The function returned allows resetting `tb_next` on any python traceback object. Do not attempt to use this on non cpython interpreters """ import ctypes from types import Trace...
[ "def", "_init_ugly_crap", "(", ")", ":", "import", "ctypes", "from", "types", "import", "TracebackType", "# figure out side of _Py_ssize_t", "if", "hasattr", "(", "ctypes", ".", "pythonapi", ",", "'Py_InitModule4_64'", ")", ":", "_Py_ssize_t", "=", "ctypes", ".", ...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/jinja2/debug.py#L267-L326
Vector35/binaryninja-api
d9661f34eec6855d495a10eaafc2a8e2679756a7
python/database.py
python
Snapshot.first_parent
(self)
return Snapshot(handle=handle)
Get the first parent of the snapshot, or None if it has no parents (read-only)
Get the first parent of the snapshot, or None if it has no parents (read-only)
[ "Get", "the", "first", "parent", "of", "the", "snapshot", "or", "None", "if", "it", "has", "no", "parents", "(", "read", "-", "only", ")" ]
def first_parent(self) -> Optional['Snapshot']: """Get the first parent of the snapshot, or None if it has no parents (read-only)""" handle = core.BNGetSnapshotFirstParent(self.handle) if handle is None: return None return Snapshot(handle=handle)
[ "def", "first_parent", "(", "self", ")", "->", "Optional", "[", "'Snapshot'", "]", ":", "handle", "=", "core", ".", "BNGetSnapshotFirstParent", "(", "self", ".", "handle", ")", "if", "handle", "is", "None", ":", "return", "None", "return", "Snapshot", "(",...
https://github.com/Vector35/binaryninja-api/blob/d9661f34eec6855d495a10eaafc2a8e2679756a7/python/database.py#L152-L157
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/tornado/web.py
python
RequestHandler.log_exception
( self, typ: "Optional[Type[BaseException]]", value: Optional[BaseException], tb: Optional[TracebackType], )
Override to customize logging of uncaught exceptions. By default logs instances of `HTTPError` as warnings without stack traces (on the ``tornado.general`` logger), and all other exceptions as errors with stack traces (on the ``tornado.application`` logger). .. versionadded:: 3...
Override to customize logging of uncaught exceptions.
[ "Override", "to", "customize", "logging", "of", "uncaught", "exceptions", "." ]
def log_exception( self, typ: "Optional[Type[BaseException]]", value: Optional[BaseException], tb: Optional[TracebackType], ) -> None: """Override to customize logging of uncaught exceptions. By default logs instances of `HTTPError` as warnings without stack ...
[ "def", "log_exception", "(", "self", ",", "typ", ":", "\"Optional[Type[BaseException]]\"", ",", "value", ":", "Optional", "[", "BaseException", "]", ",", "tb", ":", "Optional", "[", "TracebackType", "]", ",", ")", "->", "None", ":", "if", "isinstance", "(", ...
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/tornado/web.py#L1768-L1794
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/websocket_api/messages.py
python
result_message
(iden: int, result: Any = None)
return {"id": iden, "type": const.TYPE_RESULT, "success": True, "result": result}
Return a success result message.
Return a success result message.
[ "Return", "a", "success", "result", "message", "." ]
def result_message(iden: int, result: Any = None) -> dict[str, Any]: """Return a success result message.""" return {"id": iden, "type": const.TYPE_RESULT, "success": True, "result": result}
[ "def", "result_message", "(", "iden", ":", "int", ",", "result", ":", "Any", "=", "None", ")", "->", "dict", "[", "str", ",", "Any", "]", ":", "return", "{", "\"id\"", ":", "iden", ",", "\"type\"", ":", "const", ".", "TYPE_RESULT", ",", "\"success\""...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/websocket_api/messages.py#L35-L37
giantbranch/python-hacker-code
addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d
我手敲的代码(中文注释)/chapter11/volatility/plugins/malware/malfind.py
python
MalwareEPROCESS.IsWow64
(self)
return hasattr(self, 'Wow64Process') and self.Wow64Process.v() != 0
Returns True if this is a wow64 process
Returns True if this is a wow64 process
[ "Returns", "True", "if", "this", "is", "a", "wow64", "process" ]
def IsWow64(self): """Returns True if this is a wow64 process""" return hasattr(self, 'Wow64Process') and self.Wow64Process.v() != 0
[ "def", "IsWow64", "(", "self", ")", ":", "return", "hasattr", "(", "self", ",", "'Wow64Process'", ")", "and", "self", ".", "Wow64Process", ".", "v", "(", ")", "!=", "0" ]
https://github.com/giantbranch/python-hacker-code/blob/addbc8c73e7e6fb9e4fcadcec022fa1d3da4b96d/我手敲的代码(中文注释)/chapter11/volatility/plugins/malware/malfind.py#L56-L58
redhat-cop/openshift-toolkit
16bf5b054fd5bdfb5018c1f4e06b80470fde716f
disconnected_registry/docker-registry-sync.py
python
pull_images
(remote_registry, image_name)
return exit_with_error
[]
def pull_images(remote_registry, image_name): logging.info("Pulling %s/%s" % (remote_registry, image_name.strip())) exit_with_error = False for pulled_image in generate_realtime_output(["docker", "pull", "%s/%s" % (remote_registry, ...
[ "def", "pull_images", "(", "remote_registry", ",", "image_name", ")", ":", "logging", ".", "info", "(", "\"Pulling %s/%s\"", "%", "(", "remote_registry", ",", "image_name", ".", "strip", "(", ")", ")", ")", "exit_with_error", "=", "False", "for", "pulled_image...
https://github.com/redhat-cop/openshift-toolkit/blob/16bf5b054fd5bdfb5018c1f4e06b80470fde716f/disconnected_registry/docker-registry-sync.py#L238-L248
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/sympy/combinatorics/permutations.py
python
Cycle.__init__
(self, *args)
Load up a Cycle instance with the values for the cycle. Examples ======== >>> from sympy.combinatorics.permutations import Cycle >>> Cycle(1, 2, 6) (1 2 6)
Load up a Cycle instance with the values for the cycle.
[ "Load", "up", "a", "Cycle", "instance", "with", "the", "values", "for", "the", "cycle", "." ]
def __init__(self, *args): """Load up a Cycle instance with the values for the cycle. Examples ======== >>> from sympy.combinatorics.permutations import Cycle >>> Cycle(1, 2, 6) (1 2 6) """ if not args: return if len(args) == 1: ...
[ "def", "__init__", "(", "self", ",", "*", "args", ")", ":", "if", "not", "args", ":", "return", "if", "len", "(", "args", ")", "==", "1", ":", "if", "isinstance", "(", "args", "[", "0", "]", ",", "Permutation", ")", ":", "for", "c", "in", "args...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/combinatorics/permutations.py#L431-L459
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
calendarserver/tools/dashview.py
python
Dashboard.processKeys
(self)
Check for a key press.
Check for a key press.
[ "Check", "for", "a", "key", "press", "." ]
def processKeys(self): """ Check for a key press. """ try: self.windows[-1].window.keypad(1) c = self.windows[-1].window.getkey() except: c = -1 if c == "q": sys.exit(0) elif c == " ": self.paused = not s...
[ "def", "processKeys", "(", "self", ")", ":", "try", ":", "self", ".", "windows", "[", "-", "1", "]", ".", "window", ".", "keypad", "(", "1", ")", "c", "=", "self", ".", "windows", "[", "-", "1", "]", ".", "window", ".", "getkey", "(", ")", "e...
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/calendarserver/tools/dashview.py#L303-L360
fonttools/fonttools
892322aaff6a89bea5927379ec06bc0da3dfb7df
Lib/fontTools/mtiLib/__init__.py
python
makeAnchor
(data, klass=ot.Anchor)
return anchor
[]
def makeAnchor(data, klass=ot.Anchor): assert len(data) <= 2 anchor = klass() anchor.Format = 1 anchor.XCoordinate,anchor.YCoordinate = intSplitComma(data[0]) if len(data) > 1 and data[1] != '': anchor.Format = 2 anchor.AnchorPoint = int(data[1]) return anchor
[ "def", "makeAnchor", "(", "data", ",", "klass", "=", "ot", ".", "Anchor", ")", ":", "assert", "len", "(", "data", ")", "<=", "2", "anchor", "=", "klass", "(", ")", "anchor", ".", "Format", "=", "1", "anchor", ".", "XCoordinate", ",", "anchor", ".",...
https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/mtiLib/__init__.py#L347-L355
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/physics/quantum/qft.py
python
RkGate.get_target_matrix
(self, format='sympy')
[]
def get_target_matrix(self, format='sympy'): if format == 'sympy': return Matrix([[1, 0], [0, exp(Integer(2)*pi*I/(Integer(2)**self.k))]]) raise NotImplementedError( 'Invalid format for the R_k gate: %r' % format)
[ "def", "get_target_matrix", "(", "self", ",", "format", "=", "'sympy'", ")", ":", "if", "format", "==", "'sympy'", ":", "return", "Matrix", "(", "[", "[", "1", ",", "0", "]", ",", "[", "0", ",", "exp", "(", "Integer", "(", "2", ")", "*", "pi", ...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/physics/quantum/qft.py#L85-L89
cronyo/cronyo
cd5abab0871b68bf31b18aac934303928130a441
cronyo/vendor/requests/cookies.py
python
MockRequest.get_origin_req_host
(self)
return self.get_host()
[]
def get_origin_req_host(self): return self.get_host()
[ "def", "get_origin_req_host", "(", "self", ")", ":", "return", "self", ".", "get_host", "(", ")" ]
https://github.com/cronyo/cronyo/blob/cd5abab0871b68bf31b18aac934303928130a441/cronyo/vendor/requests/cookies.py#L48-L49
OpenMDAO/OpenMDAO-Framework
f2e37b7de3edeaaeb2d251b375917adec059db9b
openmdao.devtools/src/openmdao/devtools/releasetools.py
python
_get_release_parser
()
return top_parser
Sets up the 'release' arg parser and all of its subcommand parsers.
Sets up the 'release' arg parser and all of its subcommand parsers.
[ "Sets", "up", "the", "release", "arg", "parser", "and", "all", "of", "its", "subcommand", "parsers", "." ]
def _get_release_parser(): """Sets up the 'release' arg parser and all of its subcommand parsers.""" top_parser = ArgumentParser() subparsers = top_parser.add_subparsers(title='subcommands') parser = subparsers.add_parser('finalize', description="push the release to the production area ...
[ "def", "_get_release_parser", "(", ")", ":", "top_parser", "=", "ArgumentParser", "(", ")", "subparsers", "=", "top_parser", ".", "add_subparsers", "(", "title", "=", "'subcommands'", ")", "parser", "=", "subparsers", ".", "add_parser", "(", "'finalize'", ",", ...
https://github.com/OpenMDAO/OpenMDAO-Framework/blob/f2e37b7de3edeaaeb2d251b375917adec059db9b/openmdao.devtools/src/openmdao/devtools/releasetools.py#L473-L546
microsoft/DeepSpeed
3a4cb042433a2e8351887922f8362d3752c52a42
deepspeed/runtime/pipe/topology.py
python
ProcessTopology.get_axis_comm_lists
(self, axis)
return lists
Construct lists suitable for a communicator group along axis ``axis``. Example: >>> topo = Topo(axes=['pipe', 'data', 'model'], dims=[2, 2, 2]) >>> topo.get_axis_comm_lists('pipe') [ [0, 4], # data=0, model=0 [1, 5], # data=0, model=1 ...
Construct lists suitable for a communicator group along axis ``axis``.
[ "Construct", "lists", "suitable", "for", "a", "communicator", "group", "along", "axis", "axis", "." ]
def get_axis_comm_lists(self, axis): """ Construct lists suitable for a communicator group along axis ``axis``. Example: >>> topo = Topo(axes=['pipe', 'data', 'model'], dims=[2, 2, 2]) >>> topo.get_axis_comm_lists('pipe') [ [0, 4], # data=0, model=0 ...
[ "def", "get_axis_comm_lists", "(", "self", ",", "axis", ")", ":", "# We don't want to RuntimeError because it allows us to write more generalized", "# code for hybrid parallelisms.", "if", "axis", "not", "in", "self", ".", "axes", ":", "return", "[", "]", "# Grab all axes b...
https://github.com/microsoft/DeepSpeed/blob/3a4cb042433a2e8351887922f8362d3752c52a42/deepspeed/runtime/pipe/topology.py#L131-L169
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/integer_vectors_mod_permgroup.py
python
IntegerVectorsModPermutationGroup_with_constraints.permutation_group
(self)
return self._permgroup
r""" Returns the permutation group given to define ``self``. EXAMPLES:: sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3)]]), 5) sage: I.permutation_group() Permutation Group with generators [(1,2,3)]
r""" Returns the permutation group given to define ``self``.
[ "r", "Returns", "the", "permutation", "group", "given", "to", "define", "self", "." ]
def permutation_group(self): r""" Returns the permutation group given to define ``self``. EXAMPLES:: sage: I = IntegerVectorsModPermutationGroup(PermutationGroup([[(1,2,3)]]), 5) sage: I.permutation_group() Permutation Group with generators [(1,2,3)] ...
[ "def", "permutation_group", "(", "self", ")", ":", "return", "self", ".", "_permgroup" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/integer_vectors_mod_permgroup.py#L667-L677
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/oauthlib/oauth1/rfc5849/signature.py
python
verify_hmac_sha1
(request, client_secret=None, resource_owner_secret=None)
return match
Verify a HMAC-SHA1 signature. Per `section 3.4`_ of the spec. .. _`section 3.4`: https://tools.ietf.org/html/rfc5849#section-3.4 To satisfy `RFC2616 section 5.2`_ item 1, the request argument's uri attribute MUST be an absolute URI whose netloc part identifies the origin server or gateway on whic...
Verify a HMAC-SHA1 signature.
[ "Verify", "a", "HMAC", "-", "SHA1", "signature", "." ]
def verify_hmac_sha1(request, client_secret=None, resource_owner_secret=None): """Verify a HMAC-SHA1 signature. Per `section 3.4`_ of the spec. .. _`section 3.4`: https://tools.ietf.org/html/rfc5849#section-3.4 To satisfy `RFC2616 section 5.2`_ item 1, the request argument's uri ...
[ "def", "verify_hmac_sha1", "(", "request", ",", "client_secret", "=", "None", ",", "resource_owner_secret", "=", "None", ")", ":", "norm_params", "=", "normalize_parameters", "(", "request", ".", "params", ")", "uri", "=", "normalize_base_string_uri", "(", "reques...
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/oauthlib/oauth1/rfc5849/signature.py#L609-L634
lsbardel/python-stdnet
78db5320bdedc3f28c5e4f38cda13a4469e35db7
stdnet/utils/dates.py
python
Intervals.__reduce__
(self)
return list, (list(self),)
[]
def __reduce__(self): return list, (list(self),)
[ "def", "__reduce__", "(", "self", ")", ":", "return", "list", ",", "(", "list", "(", "self", ")", ",", ")" ]
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/utils/dates.py#L39-L40
kozec/syncthing-gtk
01eeeb9ed485232e145bf39d90142832e1c9751e
syncthing_gtk/infobox.py
python
InfoBox.recolor
(self, *a)
Called to computes actual color every time when self.color or self.hilight_factor changes.
Called to computes actual color every time when self.color or self.hilight_factor changes.
[ "Called", "to", "computes", "actual", "color", "every", "time", "when", "self", ".", "color", "or", "self", ".", "hilight_factor", "changes", "." ]
def recolor(self, *a): """ Called to computes actual color every time when self.color or self.hilight_factor changes. """ if self.dark_color is None: self.real_color = tuple([ min(1.0, x + HILIGHT_INTENSITY * math.sin(self.hilight_factor)) for x in self.color]) else: # Darken colors when dark backgrou...
[ "def", "recolor", "(", "self", ",", "*", "a", ")", ":", "if", "self", ".", "dark_color", "is", "None", ":", "self", ".", "real_color", "=", "tuple", "(", "[", "min", "(", "1.0", ",", "x", "+", "HILIGHT_INTENSITY", "*", "math", ".", "sin", "(", "s...
https://github.com/kozec/syncthing-gtk/blob/01eeeb9ed485232e145bf39d90142832e1c9751e/syncthing_gtk/infobox.py#L287-L305
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/encodings/cp1257.py
python
IncrementalEncoder.encode
(self, input, final=False)
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
[]
def encode(self, input, final=False): return codecs.charmap_encode(input,self.errors,encoding_table)[0]
[ "def", "encode", "(", "self", ",", "input", ",", "final", "=", "False", ")", ":", "return", "codecs", ".", "charmap_encode", "(", "input", ",", "self", ".", "errors", ",", "encoding_table", ")", "[", "0", "]" ]
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/encodings/cp1257.py#L18-L19
itayhubara/BinaryNet.pytorch
b99870af6e73992896ab5db5ea26b83d2adb1201
preprocess.py
python
Saturation.__init__
(self, var)
[]
def __init__(self, var): self.var = var
[ "def", "__init__", "(", "self", ",", "var", ")", ":", "self", ".", "var", "=", "var" ]
https://github.com/itayhubara/BinaryNet.pytorch/blob/b99870af6e73992896ab5db5ea26b83d2adb1201/preprocess.py#L141-L142
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/numbers.py
python
Complex.__div__
(self, other)
self / other without __future__ division May promote to float.
self / other without __future__ division
[ "self", "/", "other", "without", "__future__", "division" ]
def __div__(self, other): """self / other without __future__ division May promote to float. """ raise NotImplementedError
[ "def", "__div__", "(", "self", ",", "other", ")", ":", "raise", "NotImplementedError" ]
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/numbers.py#L111-L116
mu-editor/mu
5a5d7723405db588f67718a63a0ec0ecabebae33
mu/interface/themes.py
python
Theme.apply_to
(cls, lexer)
[]
def apply_to(cls, lexer): # Apply a font for all styles lexer.setFont(Font().load()) for name, font in cls.__dict__.items(): if not isinstance(font, Font): continue if hasattr(lexer, name): style_num = getattr(lexer, name) ...
[ "def", "apply_to", "(", "cls", ",", "lexer", ")", ":", "# Apply a font for all styles", "lexer", ".", "setFont", "(", "Font", "(", ")", ".", "load", "(", ")", ")", "for", "name", ",", "font", "in", "cls", ".", "__dict__", ".", "items", "(", ")", ":",...
https://github.com/mu-editor/mu/blob/5a5d7723405db588f67718a63a0ec0ecabebae33/mu/interface/themes.py#L102-L114
schapman1974/tinymongo
73e31ad8b46804c73987084260f98f30e9e7b3ee
tinymongo/results.py
python
UpdateResult.modified_count
(self)
The number of documents modified.
The number of documents modified.
[ "The", "number", "of", "documents", "modified", "." ]
def modified_count(self): """The number of documents modified. """
[ "def", "modified_count", "(", "self", ")", ":" ]
https://github.com/schapman1974/tinymongo/blob/73e31ad8b46804c73987084260f98f30e9e7b3ee/tinymongo/results.py#L78-L80
lspvic/CopyNet
2cc44dd672115fe88a2d76bd59b76fb2d7389bb4
nmt/nmt/model.py
python
Model._build_bidirectional_rnn
(self, inputs, sequence_length, dtype, hparams, num_bi_layers, num_bi_residual_layers, base_gpu=0)
return tf.concat(bi_outputs, -1), bi_state
Create and call biddirectional RNN cells. Args: num_residual_layers: Number of residual layers from top to bottom. For example, if `num_bi_layers=4` and `num_residual_layers=2`, the last 2 RNN layers in each RNN cell will be wrapped with `ResidualWrapper`. base_gpu: The gpu device id to...
Create and call biddirectional RNN cells.
[ "Create", "and", "call", "biddirectional", "RNN", "cells", "." ]
def _build_bidirectional_rnn(self, inputs, sequence_length, dtype, hparams, num_bi_layers, num_bi_residual_layers, base_gpu=0): """Create and call biddirectional RNN cells. Args: nu...
[ "def", "_build_bidirectional_rnn", "(", "self", ",", "inputs", ",", "sequence_length", ",", "dtype", ",", "hparams", ",", "num_bi_layers", ",", "num_bi_residual_layers", ",", "base_gpu", "=", "0", ")", ":", "# Construct forward and backward cells", "fw_cell", "=", "...
https://github.com/lspvic/CopyNet/blob/2cc44dd672115fe88a2d76bd59b76fb2d7389bb4/nmt/nmt/model.py#L633-L672
XKNX/xknx
1deeeb3dc0978aebacf14492a84e1f1eaf0970ed
xknx/knxip/connectionstate_response.py
python
ConnectionStateResponse.__str__
(self)
return ( "<ConnectionStateResponse " f'CommunicationChannelID="{self.communication_channel_id}" ' f'status_code="{self.status_code}" />' )
Return object as readable string.
Return object as readable string.
[ "Return", "object", "as", "readable", "string", "." ]
def __str__(self) -> str: """Return object as readable string.""" return ( "<ConnectionStateResponse " f'CommunicationChannelID="{self.communication_channel_id}" ' f'status_code="{self.status_code}" />' )
[ "def", "__str__", "(", "self", ")", "->", "str", ":", "return", "(", "\"<ConnectionStateResponse \"", "f'CommunicationChannelID=\"{self.communication_channel_id}\" '", "f'status_code=\"{self.status_code}\" />'", ")" ]
https://github.com/XKNX/xknx/blob/1deeeb3dc0978aebacf14492a84e1f1eaf0970ed/xknx/knxip/connectionstate_response.py#L54-L60
frappe/frappe
b64cab6867dfd860f10ccaf41a4ec04bc890b583
frappe/commands/utils.py
python
postgres
(context)
Enter into postgres console for a given site.
Enter into postgres console for a given site.
[ "Enter", "into", "postgres", "console", "for", "a", "given", "site", "." ]
def postgres(context): """ Enter into postgres console for a given site. """ site = get_site(context) frappe.init(site=site) _psql()
[ "def", "postgres", "(", "context", ")", ":", "site", "=", "get_site", "(", "context", ")", "frappe", ".", "init", "(", "site", "=", "site", ")", "_psql", "(", ")" ]
https://github.com/frappe/frappe/blob/b64cab6867dfd860f10ccaf41a4ec04bc890b583/frappe/commands/utils.py#L441-L447
GeekLiB/caffe-model
f21e52032c92f36eb6622846f6e6710bcd3f2054
cls/inception-resnet-v2/inception_resnet.py
python
fc_relu_drop
(bottom, num_output=1024, dropout_ratio=0.5)
return fc, relu, drop
[]
def fc_relu_drop(bottom, num_output=1024, dropout_ratio=0.5): fc = L.InnerProduct(bottom, num_output=num_output, param=[dict(lr_mult=1, decay_mult=1), dict(lr_mult=2, decay_mult=0)], weight_filler=dict(type='xavier', std=1), bias_filler=dict(ty...
[ "def", "fc_relu_drop", "(", "bottom", ",", "num_output", "=", "1024", ",", "dropout_ratio", "=", "0.5", ")", ":", "fc", "=", "L", ".", "InnerProduct", "(", "bottom", ",", "num_output", "=", "num_output", ",", "param", "=", "[", "dict", "(", "lr_mult", ...
https://github.com/GeekLiB/caffe-model/blob/f21e52032c92f36eb6622846f6e6710bcd3f2054/cls/inception-resnet-v2/inception_resnet.py#L6-L14
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/distlib/util.py
python
FileOperator.copy_file
(self, infile, outfile, check=True)
Copy a file respecting dry-run and force flags.
Copy a file respecting dry-run and force flags.
[ "Copy", "a", "file", "respecting", "dry", "-", "run", "and", "force", "flags", "." ]
def copy_file(self, infile, outfile, check=True): """Copy a file respecting dry-run and force flags. """ self.ensure_dir(os.path.dirname(outfile)) logger.info('Copying %s to %s', infile, outfile) if not self.dry_run: msg = None if check: if...
[ "def", "copy_file", "(", "self", ",", "infile", ",", "outfile", ",", "check", "=", "True", ")", ":", "self", ".", "ensure_dir", "(", "os", ".", "path", ".", "dirname", "(", "outfile", ")", ")", "logger", ".", "info", "(", "'Copying %s to %s'", ",", "...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/distlib/util.py#L513-L528
VLSIDA/OpenRAM
f66aac3264598eeae31225c62b6a4af52412d407
compiler/characterizer/elmore.py
python
elmore.get_lib_values
(self, load_slews)
return (sram_data, port_data)
Return the analytical model results for the SRAM.
Return the analytical model results for the SRAM.
[ "Return", "the", "analytical", "model", "results", "for", "the", "SRAM", "." ]
def get_lib_values(self, load_slews): """ Return the analytical model results for the SRAM. """ if OPTS.num_rw_ports > 1 or OPTS.num_w_ports > 0 and OPTS.num_r_ports > 0: debug.warning("In analytical mode, all ports have the timing of the first read port.") # Probe s...
[ "def", "get_lib_values", "(", "self", ",", "load_slews", ")", ":", "if", "OPTS", ".", "num_rw_ports", ">", "1", "or", "OPTS", ".", "num_w_ports", ">", "0", "and", "OPTS", ".", "num_r_ports", ">", "0", ":", "debug", ".", "warning", "(", "\"In analytical m...
https://github.com/VLSIDA/OpenRAM/blob/f66aac3264598eeae31225c62b6a4af52412d407/compiler/characterizer/elmore.py#L40-L96
vispy/vispy
26256fdc2574259dd227022fbce0767cae4e244b
examples/demo/gloo/galaxy/galaxy_specrend.py
python
spectrum_to_xyz
(spec_intens, temp)
return(x, y, z)
Calculate the CIE X, Y, and Z coordinates corresponding to a light source with spectral distribution given by the function SPEC_INTENS, which is called with a series of wavelengths between 380 and 780 nm (the argument is expressed in meters), which returns emittance at that wavelength in arbitrary...
Calculate the CIE X, Y, and Z coordinates corresponding to a light source with spectral distribution given by the function SPEC_INTENS, which is called with a series of wavelengths between 380 and 780 nm (the argument is expressed in meters), which returns emittance at that wavelength in arbitrary...
[ "Calculate", "the", "CIE", "X", "Y", "and", "Z", "coordinates", "corresponding", "to", "a", "light", "source", "with", "spectral", "distribution", "given", "by", "the", "function", "SPEC_INTENS", "which", "is", "called", "with", "a", "series", "of", "wavelengt...
def spectrum_to_xyz(spec_intens, temp): """ Calculate the CIE X, Y, and Z coordinates corresponding to a light source with spectral distribution given by the function SPEC_INTENS, which is called with a series of wavelengths between 380 and 780 nm (the argument is expressed in meters), which re...
[ "def", "spectrum_to_xyz", "(", "spec_intens", ",", "temp", ")", ":", "cie_colour_match", "=", "[", "[", "0.0014", ",", "0.0000", ",", "0.0065", "]", ",", "[", "0.0022", ",", "0.0001", ",", "0.0105", "]", ",", "[", "0.0042", ",", "0.0001", ",", "0.0201"...
https://github.com/vispy/vispy/blob/26256fdc2574259dd227022fbce0767cae4e244b/examples/demo/gloo/galaxy/galaxy_specrend.py#L239-L369
scrapy/scrapy
b04cfa48328d5d5749dca6f50fa34e0cfc664c89
scrapy/core/scraper.py
python
Slot.add_response_request
(self, result: Union[Response, Failure], request: Request)
return deferred
[]
def add_response_request(self, result: Union[Response, Failure], request: Request) -> Deferred: deferred = Deferred() self.queue.append((result, request, deferred)) if isinstance(result, Response): self.active_size += max(len(result.body), self.MIN_RESPONSE_SIZE) else: ...
[ "def", "add_response_request", "(", "self", ",", "result", ":", "Union", "[", "Response", ",", "Failure", "]", ",", "request", ":", "Request", ")", "->", "Deferred", ":", "deferred", "=", "Deferred", "(", ")", "self", ".", "queue", ".", "append", "(", ...
https://github.com/scrapy/scrapy/blob/b04cfa48328d5d5749dca6f50fa34e0cfc664c89/scrapy/core/scraper.py#L41-L48
tendenci/tendenci
0f2c348cc0e7d41bc56f50b00ce05544b083bf1d
tendenci/apps/memberships/notices/views.py
python
membership_notice_log_view
(request, id, template_name="memberships/notices/log_view.html")
return render_to_resp(request=request, template_name=template_name, context={'log': log, 'log_records': log_records})
[]
def membership_notice_log_view(request, id, template_name="memberships/notices/log_view.html"): if not has_perm(request.user, 'memberships.change_notice'): raise Http403 log = get_object_or_404(NoticeLog, id=id) log_records = log.default_log_records.all() return...
[ "def", "membership_notice_log_view", "(", "request", ",", "id", ",", "template_name", "=", "\"memberships/notices/log_view.html\"", ")", ":", "if", "not", "has_perm", "(", "request", ".", "user", ",", "'memberships.change_notice'", ")", ":", "raise", "Http403", "log...
https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/memberships/notices/views.py#L40-L51
jellyfin/jellyfin-kodi
e21e059e000f06890b33e2794a7e57959fdf19a3
jellyfin_kodi/entrypoint/context.py
python
Context.select_menu
(self)
return self._selected_option
Display the select dialog. Favorites, Refresh, Delete (opt), Settings.
Display the select dialog. Favorites, Refresh, Delete (opt), Settings.
[ "Display", "the", "select", "dialog", ".", "Favorites", "Refresh", "Delete", "(", "opt", ")", "Settings", "." ]
def select_menu(self): ''' Display the select dialog. Favorites, Refresh, Delete (opt), Settings. ''' options = [] if self.item['Type'] not in ('Season'): if self.item['UserData'].get('IsFavorite'): options.append(OPTIONS['RemoveFav']) ...
[ "def", "select_menu", "(", "self", ")", ":", "options", "=", "[", "]", "if", "self", ".", "item", "[", "'Type'", "]", "not", "in", "(", "'Season'", ")", ":", "if", "self", ".", "item", "[", "'UserData'", "]", ".", "get", "(", "'IsFavorite'", ")", ...
https://github.com/jellyfin/jellyfin-kodi/blob/e21e059e000f06890b33e2794a7e57959fdf19a3/jellyfin_kodi/entrypoint/context.py#L125-L153
meetbill/zabbix_manager
739e5b51facf19cc6bda2b50f29108f831cf833e
ZabbixTool/lib_zabbix/w_lib/mylib/xlwt/antlr.py
python
Queue.removeFirst
(self)
[]
def removeFirst(self): self.buffer.pop(0)
[ "def", "removeFirst", "(", "self", ")", ":", "self", ".", "buffer", ".", "pop", "(", "0", ")" ]
https://github.com/meetbill/zabbix_manager/blob/739e5b51facf19cc6bda2b50f29108f831cf833e/ZabbixTool/lib_zabbix/w_lib/mylib/xlwt/antlr.py#L715-L716
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/lxml-3.3.6/src/lxml/html/__init__.py
python
fragments_fromstring
(html, no_leading_text=False, base_url=None, parser=None, **kw)
return elements
Parses several HTML elements, returning a list of elements. The first item in the list may be a string (though leading whitespace is removed). If no_leading_text is true, then it will be an error if there is leading text, and it will always be a list of only elements. base_url will set the docume...
Parses several HTML elements, returning a list of elements.
[ "Parses", "several", "HTML", "elements", "returning", "a", "list", "of", "elements", "." ]
def fragments_fromstring(html, no_leading_text=False, base_url=None, parser=None, **kw): """ Parses several HTML elements, returning a list of elements. The first item in the list may be a string (though leading whitespace is removed). If no_leading_text is true, then it will ...
[ "def", "fragments_fromstring", "(", "html", ",", "no_leading_text", "=", "False", ",", "base_url", "=", "None", ",", "parser", "=", "None", ",", "*", "*", "kw", ")", ":", "if", "parser", "is", "None", ":", "parser", "=", "html_parser", "# FIXME: check what...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/lxml-3.3.6/src/lxml/html/__init__.py#L606-L643
Phype/telnet-iot-honeypot
f1d4b75245d72990d339668f37a1670fc85c0c9b
honeypot/shell/commands/base.py
python
StaticProc.run
(self, env, args)
return self.result
[]
def run(self, env, args): env.write(self.output) return self.result
[ "def", "run", "(", "self", ",", "env", ",", "args", ")", ":", "env", ".", "write", "(", "self", ".", "output", ")", "return", "self", ".", "result" ]
https://github.com/Phype/telnet-iot-honeypot/blob/f1d4b75245d72990d339668f37a1670fc85c0c9b/honeypot/shell/commands/base.py#L25-L27
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/core/function.py
python
Subs._hashable_content
(self)
return (self._expr.xreplace(self.canonical_variables),)
[]
def _hashable_content(self): return (self._expr.xreplace(self.canonical_variables),)
[ "def", "_hashable_content", "(", "self", ")", ":", "return", "(", "self", ".", "_expr", ".", "xreplace", "(", "self", ".", "canonical_variables", ")", ",", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/core/function.py#L1553-L1554
AdrianVollmer/PowerHub
faf39c34a3299f1c6da6eba9992f6a7c36b951ac
powerhub/flask.py
python
export_loot
()
return jsonify(loot)
Export all loot entries
Export all loot entries
[ "Export", "all", "loot", "entries" ]
def export_loot(): """Export all loot entries""" lootbox = get_loot() loot = [{ "id": lb.id, "lsass": get_lsass_goodies(lb.lsass), "hive": get_hive_goodies(lb.hive), "sysinfo": parse_sysinfo(lb.sysinfo,) } for lb in lootbox] return jsonify(loot)
[ "def", "export_loot", "(", ")", ":", "lootbox", "=", "get_loot", "(", ")", "loot", "=", "[", "{", "\"id\"", ":", "lb", ".", "id", ",", "\"lsass\"", ":", "get_lsass_goodies", "(", "lb", ".", "lsass", ")", ",", "\"hive\"", ":", "get_hive_goodies", "(", ...
https://github.com/AdrianVollmer/PowerHub/blob/faf39c34a3299f1c6da6eba9992f6a7c36b951ac/powerhub/flask.py#L224-L233
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/models.py
python
Response.iter_content
(self, chunk_size=1, decode_unicode=False)
return chunks
Iterates over the response data. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. The chunk size is the number of bytes it should read into memory. This is not necessarily the length of each item returned as decoding can ...
Iterates over the response data. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. The chunk size is the number of bytes it should read into memory. This is not necessarily the length of each item returned as decoding can ...
[ "Iterates", "over", "the", "response", "data", ".", "When", "stream", "=", "True", "is", "set", "on", "the", "request", "this", "avoids", "reading", "the", "content", "at", "once", "into", "memory", "for", "large", "responses", ".", "The", "chunk", "size",...
def iter_content(self, chunk_size=1, decode_unicode=False): """Iterates over the response data. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. The chunk size is the number of bytes it should read into memory. This is no...
[ "def", "iter_content", "(", "self", ",", "chunk_size", "=", "1", ",", "decode_unicode", "=", "False", ")", ":", "def", "generate", "(", ")", ":", "# Special case for urllib3.", "if", "hasattr", "(", "self", ".", "raw", ",", "'stream'", ")", ":", "try", "...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/models.py#L655-L708
obonaventure/cnp3
155b3a61690f282a7c72fe117fcd3b83c7c09035
book-2nd/mcq-ex/mcq/mcq.py
python
epub_add_javascript
(app, doctree, docname)
[]
def epub_add_javascript(app, doctree, docname): builder = app.builder if not hasattr(builder, 'name') or not builder.name.startswith('epub'): return # Current epub3 builders does not include .js files in the .epub builder.media_types.update({'.js': 'text/javascript'}) # The page.html template used does not inclu...
[ "def", "epub_add_javascript", "(", "app", ",", "doctree", ",", "docname", ")", ":", "builder", "=", "app", ".", "builder", "if", "not", "hasattr", "(", "builder", ",", "'name'", ")", "or", "not", "builder", ".", "name", ".", "startswith", "(", "'epub'", ...
https://github.com/obonaventure/cnp3/blob/155b3a61690f282a7c72fe117fcd3b83c7c09035/book-2nd/mcq-ex/mcq/mcq.py#L409-L416
swcarpentry/r-novice-gapminder
16a4dccf2cfdf7f474c026f7c981dd24110227f5
bin/lesson_check.py
python
CheckEpisode.check_metadata_fields
(self, expected)
Check metadata fields.
Check metadata fields.
[ "Check", "metadata", "fields", "." ]
def check_metadata_fields(self, expected): """Check metadata fields.""" for (name, type_) in expected: if name not in self.metadata: self.reporter.add(self.filename, 'Missing metadata field {0}', name) ...
[ "def", "check_metadata_fields", "(", "self", ",", "expected", ")", ":", "for", "(", "name", ",", "type_", ")", "in", "expected", ":", "if", "name", "not", "in", "self", ".", "metadata", ":", "self", ".", "reporter", ".", "add", "(", "self", ".", "fil...
https://github.com/swcarpentry/r-novice-gapminder/blob/16a4dccf2cfdf7f474c026f7c981dd24110227f5/bin/lesson_check.py#L566-L576
jhpyle/docassemble
b90c84e57af59aa88b3404d44d0b125c70f832cc
docassemble_base/docassemble/base/mako/runtime.py
python
_render
(template, callable_, args, data, as_unicode=False)
return context._pop_buffer().getvalue()
create a Context and return the string output of the given template and template callable.
create a Context and return the string output of the given template and template callable.
[ "create", "a", "Context", "and", "return", "the", "string", "output", "of", "the", "given", "template", "and", "template", "callable", "." ]
def _render(template, callable_, args, data, as_unicode=False): """create a Context and return the string output of the given template and template callable.""" if as_unicode: buf = util.FastEncodingBuffer(as_unicode=True) elif template.bytestring_passthrough: buf = compat.StringIO() ...
[ "def", "_render", "(", "template", ",", "callable_", ",", "args", ",", "data", ",", "as_unicode", "=", "False", ")", ":", "if", "as_unicode", ":", "buf", "=", "util", ".", "FastEncodingBuffer", "(", "as_unicode", "=", "True", ")", "elif", "template", "."...
https://github.com/jhpyle/docassemble/blob/b90c84e57af59aa88b3404d44d0b125c70f832cc/docassemble_base/docassemble/base/mako/runtime.py#L811-L830
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit - MAC OSX/tools/inject/lib/core/common.py
python
prioritySortColumns
(columns)
return sorted(sorted(columns, key=len), lambda x, y: -1 if _(x) and not _(y) else 1 if not _(x) and _(y) else 0)
Sorts given column names by length in ascending order while those containing string 'id' go first >>> prioritySortColumns(['password', 'userid', 'name']) ['userid', 'name', 'password']
Sorts given column names by length in ascending order while those containing string 'id' go first
[ "Sorts", "given", "column", "names", "by", "length", "in", "ascending", "order", "while", "those", "containing", "string", "id", "go", "first" ]
def prioritySortColumns(columns): """ Sorts given column names by length in ascending order while those containing string 'id' go first >>> prioritySortColumns(['password', 'userid', 'name']) ['userid', 'name', 'password'] """ _ = lambda x: x and "id" in x.lower() return sorted(sorted(...
[ "def", "prioritySortColumns", "(", "columns", ")", ":", "_", "=", "lambda", "x", ":", "x", "and", "\"id\"", "in", "x", ".", "lower", "(", ")", "return", "sorted", "(", "sorted", "(", "columns", ",", "key", "=", "len", ")", ",", "lambda", "x", ",", ...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/inject/lib/core/common.py#L3910-L3920
laspy/laspy
c9d9b9c0e8d84288134c02bf4ecec3964f5afa29
laspy/laswriter.py
python
LazrsPointWriter.write_points
(self, points: PackedPointRecord)
[]
def write_points(self, points: PackedPointRecord) -> None: assert ( self.compressor is not None ), "Trying to write points without having written header" points_bytes = np.frombuffer(points.array, np.uint8) self.compressor.compress_many(points_bytes)
[ "def", "write_points", "(", "self", ",", "points", ":", "PackedPointRecord", ")", "->", "None", ":", "assert", "(", "self", ".", "compressor", "is", "not", "None", ")", ",", "\"Trying to write points without having written header\"", "points_bytes", "=", "np", "."...
https://github.com/laspy/laspy/blob/c9d9b9c0e8d84288134c02bf4ecec3964f5afa29/laspy/laswriter.py#L355-L360
javiribera/locating-objects-without-bboxes
e51f75ec925f67bb4054ab4a6e9b20d1d8e689cc
object-locator/losses.py
python
averaged_hausdorff_distance
(set1, set2, max_ahd=np.inf)
return res
Compute the Averaged Hausdorff Distance function between two unordered sets of points (the function is symmetric). Batches are not supported, so squeeze your inputs first! :param set1: Array/list where each row/element is an N-dimensional point. :param set2: Array/list where each row/element is an N-dim...
Compute the Averaged Hausdorff Distance function between two unordered sets of points (the function is symmetric). Batches are not supported, so squeeze your inputs first! :param set1: Array/list where each row/element is an N-dimensional point. :param set2: Array/list where each row/element is an N-dim...
[ "Compute", "the", "Averaged", "Hausdorff", "Distance", "function", "between", "two", "unordered", "sets", "of", "points", "(", "the", "function", "is", "symmetric", ")", ".", "Batches", "are", "not", "supported", "so", "squeeze", "your", "inputs", "first!", ":...
def averaged_hausdorff_distance(set1, set2, max_ahd=np.inf): """ Compute the Averaged Hausdorff Distance function between two unordered sets of points (the function is symmetric). Batches are not supported, so squeeze your inputs first! :param set1: Array/list where each row/element is an N-dimensio...
[ "def", "averaged_hausdorff_distance", "(", "set1", ",", "set2", ",", "max_ahd", "=", "np", ".", "inf", ")", ":", "if", "len", "(", "set1", ")", "==", "0", "or", "len", "(", "set2", ")", "==", "0", ":", "return", "max_ahd", "set1", "=", "np", ".", ...
https://github.com/javiribera/locating-objects-without-bboxes/blob/e51f75ec925f67bb4054ab4a6e9b20d1d8e689cc/object-locator/losses.py#L56-L85
gem/oq-engine
1bdb88f3914e390abcbd285600bfd39477aae47c
openquake/hazardlib/gsim/drouet_2015_brazil.py
python
_compute_magnitude_term
(C, ctx)
return C['c2'] * (ctx.mag - 8.0) + C['c3'] * (ctx.mag - 8.0) ** 2
This computes the term f1 equation 8 Drouet & Cotton (2015)
This computes the term f1 equation 8 Drouet & Cotton (2015)
[ "This", "computes", "the", "term", "f1", "equation", "8", "Drouet", "&", "Cotton", "(", "2015", ")" ]
def _compute_magnitude_term(C, ctx): """ This computes the term f1 equation 8 Drouet & Cotton (2015) """ return C['c2'] * (ctx.mag - 8.0) + C['c3'] * (ctx.mag - 8.0) ** 2
[ "def", "_compute_magnitude_term", "(", "C", ",", "ctx", ")", ":", "return", "C", "[", "'c2'", "]", "*", "(", "ctx", ".", "mag", "-", "8.0", ")", "+", "C", "[", "'c3'", "]", "*", "(", "ctx", ".", "mag", "-", "8.0", ")", "**", "2" ]
https://github.com/gem/oq-engine/blob/1bdb88f3914e390abcbd285600bfd39477aae47c/openquake/hazardlib/gsim/drouet_2015_brazil.py#L53-L57
quantumlib/OpenFermion
6187085f2a7707012b68370b625acaeed547e62b
src/openfermion/transforms/opconversions/jordan_wigner.py
python
_jordan_wigner_diagonal_coulomb_hamiltonian
(operator)
return qubit_operator
[]
def _jordan_wigner_diagonal_coulomb_hamiltonian(operator): n_qubits = count_qubits(operator) qubit_operator = QubitOperator((), operator.constant) # Transform diagonal one-body terms for p in range(n_qubits): coefficient = operator.one_body[p, p] + operator.two_body[p, p] qubit_operator...
[ "def", "_jordan_wigner_diagonal_coulomb_hamiltonian", "(", "operator", ")", ":", "n_qubits", "=", "count_qubits", "(", "operator", ")", "qubit_operator", "=", "QubitOperator", "(", "(", ")", ",", "operator", ".", "constant", ")", "# Transform diagonal one-body terms", ...
https://github.com/quantumlib/OpenFermion/blob/6187085f2a7707012b68370b625acaeed547e62b/src/openfermion/transforms/opconversions/jordan_wigner.py#L93-L125
OlafenwaMoses/ImageAI
fe2d6bab3ddb1027c54abe7eb961364928869a30
imageai/Detection/keras_retinanet/utils/transform.py
python
scaling
(factor)
return np.array([ [factor[0], 0, 0], [0, factor[1], 0], [0, 0, 1] ])
Construct a homogeneous 2D scaling matrix. Args factor: a 2D vector for X and Y scaling Returns the zoom matrix as 3 by 3 numpy array
Construct a homogeneous 2D scaling matrix. Args factor: a 2D vector for X and Y scaling Returns the zoom matrix as 3 by 3 numpy array
[ "Construct", "a", "homogeneous", "2D", "scaling", "matrix", ".", "Args", "factor", ":", "a", "2D", "vector", "for", "X", "and", "Y", "scaling", "Returns", "the", "zoom", "matrix", "as", "3", "by", "3", "numpy", "array" ]
def scaling(factor): """ Construct a homogeneous 2D scaling matrix. Args factor: a 2D vector for X and Y scaling Returns the zoom matrix as 3 by 3 numpy array """ return np.array([ [factor[0], 0, 0], [0, factor[1], 0], [0, 0, 1] ])
[ "def", "scaling", "(", "factor", ")", ":", "return", "np", ".", "array", "(", "[", "[", "factor", "[", "0", "]", ",", "0", ",", "0", "]", ",", "[", "0", ",", "factor", "[", "1", "]", ",", "0", "]", ",", "[", "0", ",", "0", ",", "1", "]"...
https://github.com/OlafenwaMoses/ImageAI/blob/fe2d6bab3ddb1027c54abe7eb961364928869a30/imageai/Detection/keras_retinanet/utils/transform.py#L148-L159
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/core/compute_management_client_composite_operations.py
python
ComputeManagementClientCompositeOperations.attach_instance_pool_instance_and_wait_for_state
(self, instance_pool_id, attach_instance_pool_instance_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={})
Calls :py:func:`~oci.core.ComputeManagementClient.attach_instance_pool_instance` and waits for the :py:class:`~oci.core.models.InstancePoolInstance` acted upon to enter the given state(s). :param str instance_pool_id: (required) The `OCID`__ of the instance pool. __ https://doc...
Calls :py:func:`~oci.core.ComputeManagementClient.attach_instance_pool_instance` and waits for the :py:class:`~oci.core.models.InstancePoolInstance` acted upon to enter the given state(s).
[ "Calls", ":", "py", ":", "func", ":", "~oci", ".", "core", ".", "ComputeManagementClient", ".", "attach_instance_pool_instance", "and", "waits", "for", "the", ":", "py", ":", "class", ":", "~oci", ".", "core", ".", "models", ".", "InstancePoolInstance", "act...
def attach_instance_pool_instance_and_wait_for_state(self, instance_pool_id, attach_instance_pool_instance_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.core.ComputeManagementClient.attach_instance_pool_instance` and waits for the :py:class:`~oci.core.mode...
[ "def", "attach_instance_pool_instance_and_wait_for_state", "(", "self", ",", "instance_pool_id", ",", "attach_instance_pool_instance_details", ",", "wait_for_states", "=", "[", "]", ",", "operation_kwargs", "=", "{", "}", ",", "waiter_kwargs", "=", "{", "}", ")", ":",...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/core/compute_management_client_composite_operations.py#L70-L111
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/query/terms.py
python
Term.__eq__
(self, other)
return (other and self.__class__ is other.__class__ and self.fieldname == other.fieldname and self.text == other.text and self.boost == other.boost)
[]
def __eq__(self, other): return (other and self.__class__ is other.__class__ and self.fieldname == other.fieldname and self.text == other.text and self.boost == other.boost)
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "return", "(", "other", "and", "self", ".", "__class__", "is", "other", ".", "__class__", "and", "self", ".", "fieldname", "==", "other", ".", "fieldname", "and", "self", ".", "text", "==", "other",...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/query/terms.py#L55-L60
deepfakes/faceswap
09c7d8aca3c608d1afad941ea78e9fd9b64d9219
tools/sort/sort.py
python
Sort.calc_landmarks_face_yaw
(flm)
return var_r - var_l
Calculate the amount of yaw in a face
Calculate the amount of yaw in a face
[ "Calculate", "the", "amount", "of", "yaw", "in", "a", "face" ]
def calc_landmarks_face_yaw(flm): """ Calculate the amount of yaw in a face """ var_l = ((flm[27][0] - flm[0][0]) + (flm[28][0] - flm[1][0]) + (flm[29][0] - flm[2][0])) / 3.0 var_r = ((flm[16][0] - flm[27][0]) + (flm[15][0] - flm[28][0]) ...
[ "def", "calc_landmarks_face_yaw", "(", "flm", ")", ":", "var_l", "=", "(", "(", "flm", "[", "27", "]", "[", "0", "]", "-", "flm", "[", "0", "]", "[", "0", "]", ")", "+", "(", "flm", "[", "28", "]", "[", "0", "]", "-", "flm", "[", "1", "]"...
https://github.com/deepfakes/faceswap/blob/09c7d8aca3c608d1afad941ea78e9fd9b64d9219/tools/sort/sort.py#L909-L917
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/api/authentication_v1beta1_api.py
python
AuthenticationV1beta1Api.get_api_resources
(self, **kwargs)
return self.get_api_resources_with_http_info(**kwargs)
get_api_resources # noqa: E501 get available resources # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_api_resources(async_req=True) >>> result = thread.get() :...
get_api_resources # noqa: E501
[ "get_api_resources", "#", "noqa", ":", "E501" ]
def get_api_resources(self, **kwargs): # noqa: E501 """get_api_resources # noqa: E501 get available resources # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_api_resour...
[ "def", "get_api_resources", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "return", "self", ".", "get_api_resources_with_http_info", "(", "*", "*", "kwargs", ")" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/api/authentication_v1beta1_api.py#L168-L190
WoLpH/python-progressbar
7f045a251435ed4d0ecb2b0ce78a9c15af8529cb
progressbar/widgets.py
python
MultiRangeBar.__call__
(self, progress, data, width)
return left + middle + right
Updates the progress bar and its subcomponents
Updates the progress bar and its subcomponents
[ "Updates", "the", "progress", "bar", "and", "its", "subcomponents" ]
def __call__(self, progress, data, width): '''Updates the progress bar and its subcomponents''' left = converters.to_unicode(self.left(progress, data, width)) right = converters.to_unicode(self.right(progress, data, width)) width -= progress.custom_len(left) + progress.custom_len(right)...
[ "def", "__call__", "(", "self", ",", "progress", ",", "data", ",", "width", ")", ":", "left", "=", "converters", ".", "to_unicode", "(", "self", ".", "left", "(", "progress", ",", "data", ",", "width", ")", ")", "right", "=", "converters", ".", "to_u...
https://github.com/WoLpH/python-progressbar/blob/7f045a251435ed4d0ecb2b0ce78a9c15af8529cb/progressbar/widgets.py#L843-L870
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/pandas/types/concat.py
python
_concat_sparse
(to_concat, axis=0, typs=None)
return result
provide concatenation of an sparse/dense array of arrays each of which is a single dtype Parameters ---------- to_concat : array of arrays axis : axis to provide concatenation typs : set of to_concat dtypes Returns ------- a single array, preserving the combined dtypes
provide concatenation of an sparse/dense array of arrays each of which is a single dtype
[ "provide", "concatenation", "of", "an", "sparse", "/", "dense", "array", "of", "arrays", "each", "of", "which", "is", "a", "single", "dtype" ]
def _concat_sparse(to_concat, axis=0, typs=None): """ provide concatenation of an sparse/dense array of arrays each of which is a single dtype Parameters ---------- to_concat : array of arrays axis : axis to provide concatenation typs : set of to_concat dtypes Returns ------- ...
[ "def", "_concat_sparse", "(", "to_concat", ",", "axis", "=", "0", ",", "typs", "=", "None", ")", ":", "from", "pandas", ".", "sparse", ".", "array", "import", "SparseArray", ",", "_make_index", "def", "convert_sparse", "(", "x", ",", "axis", ")", ":", ...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/pandas/types/concat.py#L412-L480
liqd/adhocracy
a143e7101f788f56c78e00bd30b2fe2e15bf3552
src/adhocracy/controllers/user.py
python
UserController._settings_result
(self, updated, user, setting_name, message=None)
return unicode(message)
Sets a redirect code and location header, stores a flash message and returns the message. If *message* is not None, a message is chosen depending on the boolean value of *updated*. The redirect *location* URL is chosen based on the instance and *setting_name*. This method will *...
Sets a redirect code and location header, stores a flash message and returns the message. If *message* is not None, a message is chosen depending on the boolean value of *updated*. The redirect *location* URL is chosen based on the instance and *setting_name*.
[ "Sets", "a", "redirect", "code", "and", "location", "header", "stores", "a", "flash", "message", "and", "returns", "the", "message", ".", "If", "*", "message", "*", "is", "not", "None", "a", "message", "is", "chosen", "depending", "on", "the", "boolean", ...
def _settings_result(self, updated, user, setting_name, message=None): ''' Sets a redirect code and location header, stores a flash message and returns the message. If *message* is not None, a message is chosen depending on the boolean value of *updated*. The redirect *location* ...
[ "def", "_settings_result", "(", "self", ",", "updated", ",", "user", ",", "setting_name", ",", "message", "=", "None", ")", ":", "if", "updated", ":", "event", ".", "emit", "(", "event", ".", "T_USER_EDIT", ",", "c", ".", "user", ")", "message", "=", ...
https://github.com/liqd/adhocracy/blob/a143e7101f788f56c78e00bd30b2fe2e15bf3552/src/adhocracy/controllers/user.py#L348-L383
lanl/qmasm
2222dff00753e6c34c44be2dadf4844ec5caa504
src/qmasm/parse.py
python
Environment.pop
(self)
Discard the top of the environment stack.
Discard the top of the environment stack.
[ "Discard", "the", "top", "of", "the", "environment", "stack", "." ]
def pop(self): "Discard the top of the environment stack." self.stack.pop() self.self_copy = None
[ "def", "pop", "(", "self", ")", ":", "self", ".", "stack", ".", "pop", "(", ")", "self", ".", "self_copy", "=", "None" ]
https://github.com/lanl/qmasm/blob/2222dff00753e6c34c44be2dadf4844ec5caa504/src/qmasm/parse.py#L50-L53
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/rumps/rumps.py
python
Window.title
(self)
return self._alert.messageText()
The text positioned at the top of the window in larger font. If not a string, will use the string representation of the object.
The text positioned at the top of the window in larger font. If not a string, will use the string representation of the object.
[ "The", "text", "positioned", "at", "the", "top", "of", "the", "window", "in", "larger", "font", ".", "If", "not", "a", "string", "will", "use", "the", "string", "representation", "of", "the", "object", "." ]
def title(self): """The text positioned at the top of the window in larger font. If not a string, will use the string representation of the object. """ return self._alert.messageText()
[ "def", "title", "(", "self", ")", ":", "return", "self", ".", "_alert", ".", "messageText", "(", ")" ]
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/rumps/rumps.py#L920-L924
sympy/sympy
d822fcba181155b85ff2b29fe525adbafb22b448
sympy/physics/quantum/operatorordering.py
python
normal_ordered_form
(expr, independent=False, recursive_limit=10, _recursive_depth=0)
Write an expression with bosonic or fermionic operators on normal ordered form, where each term is normally ordered. Note that this normal ordered form is equivalent to the original expression. Parameters ========== expr : expression The expression write on normal ordered form. recurs...
Write an expression with bosonic or fermionic operators on normal ordered form, where each term is normally ordered. Note that this normal ordered form is equivalent to the original expression.
[ "Write", "an", "expression", "with", "bosonic", "or", "fermionic", "operators", "on", "normal", "ordered", "form", "where", "each", "term", "is", "normally", "ordered", ".", "Note", "that", "this", "normal", "ordered", "form", "is", "equivalent", "to", "the", ...
def normal_ordered_form(expr, independent=False, recursive_limit=10, _recursive_depth=0): """Write an expression with bosonic or fermionic operators on normal ordered form, where each term is normally ordered. Note that this normal ordered form is equivalent to the original expressio...
[ "def", "normal_ordered_form", "(", "expr", ",", "independent", "=", "False", ",", "recursive_limit", "=", "10", ",", "_recursive_depth", "=", "0", ")", ":", "if", "_recursive_depth", ">", "recursive_limit", ":", "warnings", ".", "warn", "(", "\"Too many recursio...
https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/physics/quantum/operatorordering.py#L169-L210
glumpy/glumpy
46a7635c08d3a200478397edbe0371a6c59cd9d7
glumpy/ext/png.py
python
Writer.convert_ppm_and_pgm
(self, ppmfile, pgmfile, outfile)
Convert a PPM and PGM file containing raw pixel data into a PNG outfile with the parameters set in the writer object.
Convert a PPM and PGM file containing raw pixel data into a PNG outfile with the parameters set in the writer object.
[ "Convert", "a", "PPM", "and", "PGM", "file", "containing", "raw", "pixel", "data", "into", "a", "PNG", "outfile", "with", "the", "parameters", "set", "in", "the", "writer", "object", "." ]
def convert_ppm_and_pgm(self, ppmfile, pgmfile, outfile): """ Convert a PPM and PGM file containing raw pixel data into a PNG outfile with the parameters set in the writer object. """ pixels = array('B') pixels.fromfile(ppmfile, (self.bitdepth/8) *...
[ "def", "convert_ppm_and_pgm", "(", "self", ",", "ppmfile", ",", "pgmfile", ",", "outfile", ")", ":", "pixels", "=", "array", "(", "'B'", ")", "pixels", ".", "fromfile", "(", "ppmfile", ",", "(", "self", ".", "bitdepth", "/", "8", ")", "*", "self", "....
https://github.com/glumpy/glumpy/blob/46a7635c08d3a200478397edbe0371a6c59cd9d7/glumpy/ext/png.py#L862-L881
dronekit/dronekit-python
1d89e82807ce543bae5e36426641b717e187c589
dronekit/__init__.py
python
Vehicle.parameters
(self)
return self._parameters
The (editable) parameters for this vehicle (:py:class:`Parameters`).
The (editable) parameters for this vehicle (:py:class:`Parameters`).
[ "The", "(", "editable", ")", "parameters", "for", "this", "vehicle", "(", ":", "py", ":", "class", ":", "Parameters", ")", "." ]
def parameters(self): """ The (editable) parameters for this vehicle (:py:class:`Parameters`). """ return self._parameters
[ "def", "parameters", "(", "self", ")", ":", "return", "self", ".", "_parameters" ]
https://github.com/dronekit/dronekit-python/blob/1d89e82807ce543bae5e36426641b717e187c589/dronekit/__init__.py#L2046-L2050
HuberTRoy/MusicBox
82fdf21809b7f018c616c4d1c78cfbf04cd5d9e3
MusicPlayer/apis/apiRequestsBase.py
python
requestsExceptionFilter
(func)
return _filter
若某一函数出错(一般是网络请求), 会再次进行2次重新请求,否则会传回False @requestsExceptionFilter def test(): requests.get('http://www.thereAreNothing.com') test() --- False
若某一函数出错(一般是网络请求), 会再次进行2次重新请求,否则会传回False
[ "若某一函数出错", "(", "一般是网络请求", ")", "会再次进行2次重新请求,否则会传回False" ]
def requestsExceptionFilter(func): """ 若某一函数出错(一般是网络请求), 会再次进行2次重新请求,否则会传回False @requestsExceptionFilter def test(): requests.get('http://www.thereAreNothing.com') test() --- False """ def _filter(*args, **kwargs): for i in range(3): try: ...
[ "def", "requestsExceptionFilter", "(", "func", ")", ":", "def", "_filter", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "i", "in", "range", "(", "3", ")", ":", "try", ":", "return", "func", "(", "*", "args", ",", "*", "*", "kwargs"...
https://github.com/HuberTRoy/MusicBox/blob/82fdf21809b7f018c616c4d1c78cfbf04cd5d9e3/MusicPlayer/apis/apiRequestsBase.py#L45-L67
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/flask_babelplus/core.py
python
Babel.default_timezone
(self)
return timezone(state.app.config['BABEL_DEFAULT_TIMEZONE'])
The default timezone from the configuration as instance of a `pytz.timezone` object.
The default timezone from the configuration as instance of a `pytz.timezone` object.
[ "The", "default", "timezone", "from", "the", "configuration", "as", "instance", "of", "a", "pytz", ".", "timezone", "object", "." ]
def default_timezone(self): """The default timezone from the configuration as instance of a `pytz.timezone` object. """ state = get_state() return timezone(state.app.config['BABEL_DEFAULT_TIMEZONE'])
[ "def", "default_timezone", "(", "self", ")", ":", "state", "=", "get_state", "(", ")", "return", "timezone", "(", "state", ".", "app", ".", "config", "[", "'BABEL_DEFAULT_TIMEZONE'", "]", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/flask_babelplus/core.py#L163-L168
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/smarty/binary_sensor.py
python
BoostSensor.update
(self)
Update state.
Update state.
[ "Update", "state", "." ]
def update(self) -> None: """Update state.""" _LOGGER.debug("Updating sensor %s", self._attr_name) self._attr_is_on = self._smarty.boost
[ "def", "update", "(", "self", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"Updating sensor %s\"", ",", "self", ".", "_attr_name", ")", "self", ".", "_attr_is_on", "=", "self", ".", "_smarty", ".", "boost" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/smarty/binary_sensor.py#L67-L70
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/_sre.py
python
_OpcodeDispatcher.count_repetitions
(self, ctx, maxcount)
return count
Returns the number of repetitions of a single item, starting from the current string position. The code pointer is expected to point to a REPEAT_ONE operation (with the repeated 4 ahead).
Returns the number of repetitions of a single item, starting from the current string position. The code pointer is expected to point to a REPEAT_ONE operation (with the repeated 4 ahead).
[ "Returns", "the", "number", "of", "repetitions", "of", "a", "single", "item", "starting", "from", "the", "current", "string", "position", ".", "The", "code", "pointer", "is", "expected", "to", "point", "to", "a", "REPEAT_ONE", "operation", "(", "with", "the"...
def count_repetitions(self, ctx, maxcount): """Returns the number of repetitions of a single item, starting from the current string position. The code pointer is expected to point to a REPEAT_ONE operation (with the repeated 4 ahead).""" count = 0 real_maxcount = ctx.state.end - ...
[ "def", "count_repetitions", "(", "self", ",", "ctx", ",", "maxcount", ")", ":", "count", "=", "0", "real_maxcount", "=", "ctx", ".", "state", ".", "end", "-", "ctx", ".", "string_position", "if", "maxcount", "<", "real_maxcount", "and", "maxcount", "!=", ...
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/_sre.py#L1130-L1157
Blizzard/heroprotocol
3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c
heroprotocol/versions/protocol55288.py
python
decode_replay_header
(contents)
return decoder.instance(replay_header_typeid)
Decodes and return the replay header from the contents byte string.
Decodes and return the replay header from the contents byte string.
[ "Decodes", "and", "return", "the", "replay", "header", "from", "the", "contents", "byte", "string", "." ]
def decode_replay_header(contents): """Decodes and return the replay header from the contents byte string.""" decoder = VersionedDecoder(contents, typeinfos) return decoder.instance(replay_header_typeid)
[ "def", "decode_replay_header", "(", "contents", ")", ":", "decoder", "=", "VersionedDecoder", "(", "contents", ",", "typeinfos", ")", "return", "decoder", ".", "instance", "(", "replay_header_typeid", ")" ]
https://github.com/Blizzard/heroprotocol/blob/3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c/heroprotocol/versions/protocol55288.py#L431-L434
debian-calibre/calibre
020fc81d3936a64b2ac51459ecb796666ab6a051
src/calibre/constants.py
python
get_windows_username
()
return winutil.username()
Return the user name of the currently logged in user as a unicode string. Note that usernames on windows are case insensitive, the case of the value returned depends on what the user typed into the login box at login time.
Return the user name of the currently logged in user as a unicode string. Note that usernames on windows are case insensitive, the case of the value returned depends on what the user typed into the login box at login time.
[ "Return", "the", "user", "name", "of", "the", "currently", "logged", "in", "user", "as", "a", "unicode", "string", ".", "Note", "that", "usernames", "on", "windows", "are", "case", "insensitive", "the", "case", "of", "the", "value", "returned", "depends", ...
def get_windows_username(): ''' Return the user name of the currently logged in user as a unicode string. Note that usernames on windows are case insensitive, the case of the value returned depends on what the user typed into the login box at login time. ''' return winutil.username()
[ "def", "get_windows_username", "(", ")", ":", "return", "winutil", ".", "username", "(", ")" ]
https://github.com/debian-calibre/calibre/blob/020fc81d3936a64b2ac51459ecb796666ab6a051/src/calibre/constants.py#L421-L427
openstack/ironic
b392dc19bcd29cef5a69ec00d2f18a7a19a679e5
ironic/conductor/rpcapi.py
python
ConductorAPI.inject_nmi
(self, context, node_id, topic=None)
return cctxt.call(context, 'inject_nmi', node_id=node_id)
Inject NMI for a node. Inject NMI (Non Maskable Interrupt) for a node immediately. Be aware that not all drivers support this. :param context: request context. :param node_id: node id or uuid. :param topic: RPC topic. Defaults to self.topic. :raises: NodeLocked if node ...
Inject NMI for a node.
[ "Inject", "NMI", "for", "a", "node", "." ]
def inject_nmi(self, context, node_id, topic=None): """Inject NMI for a node. Inject NMI (Non Maskable Interrupt) for a node immediately. Be aware that not all drivers support this. :param context: request context. :param node_id: node id or uuid. :param topic: RPC topi...
[ "def", "inject_nmi", "(", "self", ",", "context", ",", "node_id", ",", "topic", "=", "None", ")", ":", "cctxt", "=", "self", ".", "_prepare_call", "(", "topic", "=", "topic", ",", "version", "=", "'1.40'", ")", "return", "cctxt", ".", "call", "(", "c...
https://github.com/openstack/ironic/blob/b392dc19bcd29cef5a69ec00d2f18a7a19a679e5/ironic/conductor/rpcapi.py#L811-L829
OpnTec/open-event-server
a48f7e4c6002db6fb4dc06bac6508536a0dc585e
app/models/user.py
python
User.can_access_panel
(self, panel_name)
return False
Check if user can access an Admin Panel
Check if user can access an Admin Panel
[ "Check", "if", "user", "can", "access", "an", "Admin", "Panel" ]
def can_access_panel(self, panel_name): """Check if user can access an Admin Panel """ if self.is_staff: return True custom_sys_roles = UserSystemRole.query.filter_by(user=self) for custom_role in custom_sys_roles: if custom_role.role.can_access(panel_nam...
[ "def", "can_access_panel", "(", "self", ",", "panel_name", ")", ":", "if", "self", ".", "is_staff", ":", "return", "True", "custom_sys_roles", "=", "UserSystemRole", ".", "query", ".", "filter_by", "(", "user", "=", "self", ")", "for", "custom_role", "in", ...
https://github.com/OpnTec/open-event-server/blob/a48f7e4c6002db6fb4dc06bac6508536a0dc585e/app/models/user.py#L298-L309
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/boto-2.46.1/boto/elasticache/layer1.py
python
ElastiCacheConnection.describe_cache_subnet_groups
(self, cache_subnet_group_name=None, max_records=None, marker=None)
return self._make_request( action='DescribeCacheSubnetGroups', verb='POST', path='/', params=params)
The DescribeCacheSubnetGroups operation returns a list of cache subnet group descriptions. If a subnet group name is specified, the list will contain only the description of that group. :type cache_subnet_group_name: string :param cache_subnet_group_name: The name of the cache s...
The DescribeCacheSubnetGroups operation returns a list of cache subnet group descriptions. If a subnet group name is specified, the list will contain only the description of that group.
[ "The", "DescribeCacheSubnetGroups", "operation", "returns", "a", "list", "of", "cache", "subnet", "group", "descriptions", ".", "If", "a", "subnet", "group", "name", "is", "specified", "the", "list", "will", "contain", "only", "the", "description", "of", "that",...
def describe_cache_subnet_groups(self, cache_subnet_group_name=None, max_records=None, marker=None): """ The DescribeCacheSubnetGroups operation returns a list of cache subnet group descriptions. If a subnet group name is specified, the list will cont...
[ "def", "describe_cache_subnet_groups", "(", "self", ",", "cache_subnet_group_name", "=", "None", ",", "max_records", "=", "None", ",", "marker", "=", "None", ")", ":", "params", "=", "{", "}", "if", "cache_subnet_group_name", "is", "not", "None", ":", "params"...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/boto-2.46.1/boto/elasticache/layer1.py#L813-L851
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
web2py/gluon/contrib/dbg.py
python
Qdb.user_call
(self, frame, argument_list)
This method is called when there is the remote possibility that we ever need to stop in this function.
This method is called when there is the remote possibility that we ever need to stop in this function.
[ "This", "method", "is", "called", "when", "there", "is", "the", "remote", "possibility", "that", "we", "ever", "need", "to", "stop", "in", "this", "function", "." ]
def user_call(self, frame, argument_list): """This method is called when there is the remote possibility that we ever need to stop in this function.""" if self._wait_for_mainpyfile or self._wait_for_breakpoint: return if self.stop_here(frame): self.interaction(fra...
[ "def", "user_call", "(", "self", ",", "frame", ",", "argument_list", ")", ":", "if", "self", ".", "_wait_for_mainpyfile", "or", "self", ".", "_wait_for_breakpoint", ":", "return", "if", "self", ".", "stop_here", "(", "frame", ")", ":", "self", ".", "intera...
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/gluon/contrib/dbg.py#L121-L127
PaddlePaddle/PGL
e48545f2814523c777b8a9a9188bf5a7f00d6e52
legacy/pgl/contrib/ogb/linkproppred/dataset_pgl.py
python
PglLinkPropPredDataset.get_edge_split
(self)
return { "train_edge": np.array( train_idx[:, :2], dtype="int64"), "train_edge_label": np.array( train_idx[:, 2], dtype=target_type), "valid_edge": np.array( valid_idx[:, :2], dtype="int64"), "valid_edge_label": np.array( ...
Train/Validation/Test split
Train/Validation/Test split
[ "Train", "/", "Validation", "/", "Test", "split" ]
def get_edge_split(self): """Train/Validation/Test split """ split_type = self.meta_info[self.name]["split"] path = osp.join(self.root, "split", split_type) train_idx = pd.read_csv( osp.join(path, "train.csv.gz"), compression="gzip", header=None).values ...
[ "def", "get_edge_split", "(", "self", ")", ":", "split_type", "=", "self", ".", "meta_info", "[", "self", ".", "name", "]", "[", "\"split\"", "]", "path", "=", "osp", ".", "join", "(", "self", ".", "root", ",", "\"split\"", ",", "split_type", ")", "t...
https://github.com/PaddlePaddle/PGL/blob/e48545f2814523c777b8a9a9188bf5a7f00d6e52/legacy/pgl/contrib/ogb/linkproppred/dataset_pgl.py#L98-L132
Chia-Network/chia-blockchain
34d44c1324ae634a0896f7b02eaa2802af9526cd
chia/wallet/wallet_action_store.py
python
WalletActionStore.create_action
( self, name: str, wallet_id: int, type: int, callback: str, done: bool, data: str, in_transaction: bool )
Creates Wallet Action
Creates Wallet Action
[ "Creates", "Wallet", "Action" ]
async def create_action( self, name: str, wallet_id: int, type: int, callback: str, done: bool, data: str, in_transaction: bool ): """ Creates Wallet Action """ if not in_transaction: await self.db_wrapper.lock.acquire() try: cursor = await sel...
[ "async", "def", "create_action", "(", "self", ",", "name", ":", "str", ",", "wallet_id", ":", "int", ",", "type", ":", "int", ",", "callback", ":", "str", ",", "done", ":", "bool", ",", "data", ":", "str", ",", "in_transaction", ":", "bool", ")", "...
https://github.com/Chia-Network/chia-blockchain/blob/34d44c1324ae634a0896f7b02eaa2802af9526cd/chia/wallet/wallet_action_store.py#L68-L85
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/dev/solver/recover/static_force.py
python
_recover_force_cbar
(f06_file, op2, model: BDF, dof_map, isubcase, xb, eids_str, element_name, fdtype='float32', title: str='', subtitle: str='', label: str='', page_num: int=1, page_stamp='PAGE %s')
return neids
Recovers static CBAR force. .. todo:: doesn't support CBAR-100
Recovers static CBAR force.
[ "Recovers", "static", "CBAR", "force", "." ]
def _recover_force_cbar(f06_file, op2, model: BDF, dof_map, isubcase, xb, eids_str, element_name, fdtype='float32', title: str='', subtitle: str='', label: str='', page_num: int=1, page_stamp='PAGE %s') -> None: """ ...
[ "def", "_recover_force_cbar", "(", "f06_file", ",", "op2", ",", "model", ":", "BDF", ",", "dof_map", ",", "isubcase", ",", "xb", ",", "eids_str", ",", "element_name", ",", "fdtype", "=", "'float32'", ",", "title", ":", "str", "=", "''", ",", "subtitle", ...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/dev/solver/recover/static_force.py#L168-L199
cuthbertLab/music21
bd30d4663e52955ed922c10fdf541419d8c67671
music21/sieve.py
python
Sieve.compress
(self, z=None)
Set this sieve to its compressed state.
Set this sieve to its compressed state.
[ "Set", "this", "sieve", "to", "its", "compressed", "state", "." ]
def compress(self, z=None): ''' Set this sieve to its compressed state. ''' if z is not None and z != self._z: # only process if z has changed self._z = z self._resClear('cmp') # clear compressed residuals self._initCompression() # may update self._...
[ "def", "compress", "(", "self", ",", "z", "=", "None", ")", ":", "if", "z", "is", "not", "None", "and", "z", "!=", "self", ".", "_z", ":", "# only process if z has changed", "self", ".", "_z", "=", "z", "self", ".", "_resClear", "(", "'cmp'", ")", ...
https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/sieve.py#L1172-L1183
rembo10/headphones
b3199605be1ebc83a7a8feab6b1e99b64014187c
lib/cherrypy/wsgiserver/wsgiserver2.py
python
HTTPRequest.read_request_headers
(self)
return True
Read self.rfile into self.inheaders. Return success.
Read self.rfile into self.inheaders. Return success.
[ "Read", "self", ".", "rfile", "into", "self", ".", "inheaders", ".", "Return", "success", "." ]
def read_request_headers(self): """Read self.rfile into self.inheaders. Return success.""" # then all the http headers try: read_headers(self.rfile, self.inheaders) except ValueError: ex = sys.exc_info()[1] self.simple_response("400 Bad Request", ex.a...
[ "def", "read_request_headers", "(", "self", ")", ":", "# then all the http headers", "try", ":", "read_headers", "(", "self", ".", "rfile", ",", "self", ".", "inheaders", ")", "except", "ValueError", ":", "ex", "=", "sys", ".", "exc_info", "(", ")", "[", "...
https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/cherrypy/wsgiserver/wsgiserver2.py#L734-L811
cdr-stats/cdr-stats
9c4b7868d44024ab4fca24de6f03d64f62d56e26
cdr_stats/daemon.py
python
Daemon.restart
(self)
Restart the daemon
Restart the daemon
[ "Restart", "the", "daemon" ]
def restart(self): """ Restart the daemon """ self.stop() self.start()
[ "def", "restart", "(", "self", ")", ":", "self", ".", "stop", "(", ")", "self", ".", "start", "(", ")" ]
https://github.com/cdr-stats/cdr-stats/blob/9c4b7868d44024ab4fca24de6f03d64f62d56e26/cdr_stats/daemon.py#L173-L178
uqfoundation/multiprocess
028cc73f02655e6451d92e5147d19d8c10aebe50
py2.7/multiprocess/process.py
python
active_children
()
return list(_current_process._children)
Return list of process objects corresponding to live child processes
Return list of process objects corresponding to live child processes
[ "Return", "list", "of", "process", "objects", "corresponding", "to", "live", "child", "processes" ]
def active_children(): ''' Return list of process objects corresponding to live child processes ''' _cleanup() return list(_current_process._children)
[ "def", "active_children", "(", ")", ":", "_cleanup", "(", ")", "return", "list", "(", "_current_process", ".", "_children", ")" ]
https://github.com/uqfoundation/multiprocess/blob/028cc73f02655e6451d92e5147d19d8c10aebe50/py2.7/multiprocess/process.py#L65-L70
securityclippy/elasticintel
aa08d3e9f5ab1c000128e95161139ce97ff0e334
ingest_feed_lambda/numpy/ma/timer_comparison.py
python
ModuleTester.test_5
(self)
Tests inplace w/ scalar
Tests inplace w/ scalar
[ "Tests", "inplace", "w", "/", "scalar" ]
def test_5(self): """ Tests inplace w/ scalar """ x = self.arange(10) y = self.arange(10) xm = self.arange(10) xm[2] = self.masked x += 1 assert self.allequal(x, y+1) xm += 1 assert self.allequal(xm, y+1) x = self.arange(1...
[ "def", "test_5", "(", "self", ")", ":", "x", "=", "self", ".", "arange", "(", "10", ")", "y", "=", "self", ".", "arange", "(", "10", ")", "xm", "=", "self", ".", "arange", "(", "10", ")", "xm", "[", "2", "]", "=", "self", ".", "masked", "x"...
https://github.com/securityclippy/elasticintel/blob/aa08d3e9f5ab1c000128e95161139ce97ff0e334/ingest_feed_lambda/numpy/ma/timer_comparison.py#L238-L288
square/pylink
a2d9fbd3add62ffd06ba737c5ea82b8491fdc425
pylink/jlink.py
python
JLink.core_name
(self)
return ctypes.string_at(buf).decode()
Returns the name of the target ARM core. Args: self (JLink): the ``JLink`` instance Returns: The target core's name.
Returns the name of the target ARM core.
[ "Returns", "the", "name", "of", "the", "target", "ARM", "core", "." ]
def core_name(self): """Returns the name of the target ARM core. Args: self (JLink): the ``JLink`` instance Returns: The target core's name. """ buf_size = self.MAX_BUF_SIZE buf = (ctypes.c_char * buf_size)() self._dll.JLINKARM_Core2CoreName(...
[ "def", "core_name", "(", "self", ")", ":", "buf_size", "=", "self", ".", "MAX_BUF_SIZE", "buf", "=", "(", "ctypes", ".", "c_char", "*", "buf_size", ")", "(", ")", "self", ".", "_dll", ".", "JLINKARM_Core2CoreName", "(", "self", ".", "core_cpu", "(", ")...
https://github.com/square/pylink/blob/a2d9fbd3add62ffd06ba737c5ea82b8491fdc425/pylink/jlink.py#L2382-L2394
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/geometry/hyperbolic_space/hyperbolic_model.py
python
HyperbolicModel.is_conformal
(self)
return self._conformal
Return ``True`` if ``self`` is a conformal model. EXAMPLES:: sage: UHP = HyperbolicPlane().UHP() sage: UHP.is_conformal() True
Return ``True`` if ``self`` is a conformal model.
[ "Return", "True", "if", "self", "is", "a", "conformal", "model", "." ]
def is_conformal(self): """ Return ``True`` if ``self`` is a conformal model. EXAMPLES:: sage: UHP = HyperbolicPlane().UHP() sage: UHP.is_conformal() True """ return self._conformal
[ "def", "is_conformal", "(", "self", ")", ":", "return", "self", ".", "_conformal" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/geometry/hyperbolic_space/hyperbolic_model.py#L214-L224
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/fileserver/svnfs.py
python
find_file
(path, tgt_env="base", **kwargs)
return fnd
Find the first file to match the path and ref. This operates similarly to the roots file sever but with assumptions of the directory structure based on svn standard practices.
Find the first file to match the path and ref. This operates similarly to the roots file sever but with assumptions of the directory structure based on svn standard practices.
[ "Find", "the", "first", "file", "to", "match", "the", "path", "and", "ref", ".", "This", "operates", "similarly", "to", "the", "roots", "file", "sever", "but", "with", "assumptions", "of", "the", "directory", "structure", "based", "on", "svn", "standard", ...
def find_file(path, tgt_env="base", **kwargs): # pylint: disable=W0613 """ Find the first file to match the path and ref. This operates similarly to the roots file sever but with assumptions of the directory structure based on svn standard practices. """ fnd = {"path": "", "rel": ""} if os....
[ "def", "find_file", "(", "path", ",", "tgt_env", "=", "\"base\"", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=W0613", "fnd", "=", "{", "\"path\"", ":", "\"\"", ",", "\"rel\"", ":", "\"\"", "}", "if", "os", ".", "path", ".", "isabs", "(", "p...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/fileserver/svnfs.py#L581-L623
nschloe/quadpy
c4c076d8ddfa968486a2443a95e2fb3780dcde0f
src/quadpy/c3/_helpers.py
python
register
(in_schemes)
[]
def register(in_schemes): for scheme in in_schemes: schemes[scheme.__name__] = scheme
[ "def", "register", "(", "in_schemes", ")", ":", "for", "scheme", "in", "in_schemes", ":", "schemes", "[", "scheme", ".", "__name__", "]", "=", "scheme" ]
https://github.com/nschloe/quadpy/blob/c4c076d8ddfa968486a2443a95e2fb3780dcde0f/src/quadpy/c3/_helpers.py#L12-L14
armijnhemel/binaryanalysis-ng
34c655ed71d3d022ee49c4e1271002b2ebf40001
src/parsers/image/gif/UnpackParser.py
python
GifUnpackParser.set_metadata_and_labels
(self)
sets metadata and labels for the unpackresults
sets metadata and labels for the unpackresults
[ "sets", "metadata", "and", "labels", "for", "the", "unpackresults" ]
def set_metadata_and_labels(self): """sets metadata and labels for the unpackresults""" extensions = [ x.body for x in self.data.blocks if x.block_type == self.data.BlockType.extension ] labels = ['gif', 'graphics'] metadata = { 'width': self.data.logical_screen_descript...
[ "def", "set_metadata_and_labels", "(", "self", ")", ":", "extensions", "=", "[", "x", ".", "body", "for", "x", "in", "self", ".", "data", ".", "blocks", "if", "x", ".", "block_type", "==", "self", ".", "data", ".", "BlockType", ".", "extension", "]", ...
https://github.com/armijnhemel/binaryanalysis-ng/blob/34c655ed71d3d022ee49c4e1271002b2ebf40001/src/parsers/image/gif/UnpackParser.py#L51-L154
pypa/setuptools
9f37366aab9cd8f6baa23e6a77cfdb8daf97757e
pkg_resources/_vendor/pyparsing.py
python
Or.parseImpl
( self, instring, loc, doActions=True )
[]
def parseImpl( self, instring, loc, doActions=True ): maxExcLoc = -1 maxException = None matches = [] for e in self.exprs: try: loc2 = e.tryParse( instring, loc ) except ParseException as err: err.__traceback__ = None ...
[ "def", "parseImpl", "(", "self", ",", "instring", ",", "loc", ",", "doActions", "=", "True", ")", ":", "maxExcLoc", "=", "-", "1", "maxException", "=", "None", "matches", "=", "[", "]", "for", "e", "in", "self", ".", "exprs", ":", "try", ":", "loc2...
https://github.com/pypa/setuptools/blob/9f37366aab9cd8f6baa23e6a77cfdb8daf97757e/pkg_resources/_vendor/pyparsing.py#L3465-L3500
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v1_cluster_role.py
python
V1ClusterRole.aggregation_rule
(self)
return self._aggregation_rule
Gets the aggregation_rule of this V1ClusterRole. # noqa: E501 :return: The aggregation_rule of this V1ClusterRole. # noqa: E501 :rtype: V1AggregationRule
Gets the aggregation_rule of this V1ClusterRole. # noqa: E501
[ "Gets", "the", "aggregation_rule", "of", "this", "V1ClusterRole", ".", "#", "noqa", ":", "E501" ]
def aggregation_rule(self): """Gets the aggregation_rule of this V1ClusterRole. # noqa: E501 :return: The aggregation_rule of this V1ClusterRole. # noqa: E501 :rtype: V1AggregationRule """ return self._aggregation_rule
[ "def", "aggregation_rule", "(", "self", ")", ":", "return", "self", ".", "_aggregation_rule" ]
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_cluster_role.py#L76-L83
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/sql/ddl.py
python
CreateSchema.__init__
(self, name, quote=None, **kw)
Create a new :class:`.CreateSchema` construct.
Create a new :class:`.CreateSchema` construct.
[ "Create", "a", "new", ":", "class", ":", ".", "CreateSchema", "construct", "." ]
def __init__(self, name, quote=None, **kw): """Create a new :class:`.CreateSchema` construct.""" self.quote = quote super(CreateSchema, self).__init__(name, **kw)
[ "def", "__init__", "(", "self", ",", "name", ",", "quote", "=", "None", ",", "*", "*", "kw", ")", ":", "self", ".", "quote", "=", "quote", "super", "(", "CreateSchema", ",", "self", ")", ".", "__init__", "(", "name", ",", "*", "*", "kw", ")" ]
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/sql/ddl.py#L436-L440
haiwen/seafile-docker
2d2461d4c8cab3458ec9832611c419d47506c300
scripts_7.1/utils/__init__.py
python
setup_colorlog
()
[]
def setup_colorlog(): logging.config.dictConfig({ 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'standard': { 'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s' }, 'colored': { '()': 'colorlog.C...
[ "def", "setup_colorlog", "(", ")", ":", "logging", ".", "config", ".", "dictConfig", "(", "{", "'version'", ":", "1", ",", "'disable_existing_loggers'", ":", "False", ",", "'formatters'", ":", "{", "'standard'", ":", "{", "'format'", ":", "'%(asctime)s [%(leve...
https://github.com/haiwen/seafile-docker/blob/2d2461d4c8cab3458ec9832611c419d47506c300/scripts_7.1/utils/__init__.py#L92-L128
nltk/nltk
3f74ac55681667d7ef78b664557487145f51eb02
nltk/sem/hole.py
python
HoleSemantics._plug_nodes
(self, queue, potential_labels, plug_acc, record)
Plug the nodes in `queue' with the labels in `potential_labels'. Each element of `queue' is a tuple of the node to plug and the list of ancestor holes from the root of the graph to that node. `potential_labels' is a set of the labels which are still available for plugging. `pl...
Plug the nodes in `queue' with the labels in `potential_labels'.
[ "Plug", "the", "nodes", "in", "queue", "with", "the", "labels", "in", "potential_labels", "." ]
def _plug_nodes(self, queue, potential_labels, plug_acc, record): """ Plug the nodes in `queue' with the labels in `potential_labels'. Each element of `queue' is a tuple of the node to plug and the list of ancestor holes from the root of the graph to that node. `potential_label...
[ "def", "_plug_nodes", "(", "self", ",", "queue", ",", "potential_labels", ",", "plug_acc", ",", "record", ")", ":", "if", "queue", "!=", "[", "]", ":", "(", "node", ",", "ancestors", ")", "=", "queue", "[", "0", "]", "if", "node", "in", "self", "."...
https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/sem/hole.py#L173-L204
waleedka/hiddenlayer
45243d51fd78cb6edc45cca50d29b04fb4b35511
hiddenlayer/history.py
python
History.log
(self, step, **kwargs)
Record metrics at a specific step. E.g. my_history.log(34, loss=2.3, accuracy=0.2) Okay to call multiple times for the same step. New values overwrite older ones if they have the same metric name. step: An integer or tuple of integers. If a tuple, then the first value is c...
Record metrics at a specific step. E.g.
[ "Record", "metrics", "at", "a", "specific", "step", ".", "E", ".", "g", "." ]
def log(self, step, **kwargs): """Record metrics at a specific step. E.g. my_history.log(34, loss=2.3, accuracy=0.2) Okay to call multiple times for the same step. New values overwrite older ones if they have the same metric name. step: An integer or tuple of integers. If a tu...
[ "def", "log", "(", "self", ",", "step", ",", "*", "*", "kwargs", ")", ":", "assert", "isinstance", "(", "step", ",", "(", "int", ",", "tuple", ")", ")", ",", "\"Step must be an int or a tuple of two ints\"", "self", ".", "step", "=", "step", "# Any new met...
https://github.com/waleedka/hiddenlayer/blob/45243d51fd78cb6edc45cca50d29b04fb4b35511/hiddenlayer/history.py#L67-L88
pytorch/examples
151944ecaf9ba2c8288ee550143ae7ffdaa90a80
imagenet/main.py
python
validate
(val_loader, model, criterion, args)
return top1.avg
[]
def validate(val_loader, model, criterion, args): batch_time = AverageMeter('Time', ':6.3f', Summary.NONE) losses = AverageMeter('Loss', ':.4e', Summary.NONE) top1 = AverageMeter('Acc@1', ':6.2f', Summary.AVERAGE) top5 = AverageMeter('Acc@5', ':6.2f', Summary.AVERAGE) progress = ProgressMeter( ...
[ "def", "validate", "(", "val_loader", ",", "model", ",", "criterion", ",", "args", ")", ":", "batch_time", "=", "AverageMeter", "(", "'Time'", ",", "':6.3f'", ",", "Summary", ".", "NONE", ")", "losses", "=", "AverageMeter", "(", "'Loss'", ",", "':.4e'", ...
https://github.com/pytorch/examples/blob/151944ecaf9ba2c8288ee550143ae7ffdaa90a80/imagenet/main.py#L313-L353
zh-plus/video-to-pose3D
c1e14af8d184f08d510826852da5a06c57d4a4ec
common/loss.py
python
mpjpe
(predicted, target)
return torch.mean(torch.norm(predicted - target, dim=len(target.shape) - 1))
Mean per-joint position error (i.e. mean Euclidean distance), often referred to as "Protocol #1" in many papers.
Mean per-joint position error (i.e. mean Euclidean distance), often referred to as "Protocol #1" in many papers.
[ "Mean", "per", "-", "joint", "position", "error", "(", "i", ".", "e", ".", "mean", "Euclidean", "distance", ")", "often", "referred", "to", "as", "Protocol", "#1", "in", "many", "papers", "." ]
def mpjpe(predicted, target): """ Mean per-joint position error (i.e. mean Euclidean distance), often referred to as "Protocol #1" in many papers. """ assert predicted.shape == target.shape return torch.mean(torch.norm(predicted - target, dim=len(target.shape) - 1))
[ "def", "mpjpe", "(", "predicted", ",", "target", ")", ":", "assert", "predicted", ".", "shape", "==", "target", ".", "shape", "return", "torch", ".", "mean", "(", "torch", ".", "norm", "(", "predicted", "-", "target", ",", "dim", "=", "len", "(", "ta...
https://github.com/zh-plus/video-to-pose3D/blob/c1e14af8d184f08d510826852da5a06c57d4a4ec/common/loss.py#L12-L18