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
Azure/azure-cli
6c1b085a0910c6c2139006fcbd8ade44006eb6dd
src/azure-cli/azure/cli/command_modules/batch/_command_type.py
python
BatchArgumentTree._is_silent
(self, name)
return arg['path'] in pformat.SILENT_PARAMETERS or full_path in pformat.SILENT_PARAMETERS
Whether argument should not be exposed
Whether argument should not be exposed
[ "Whether", "argument", "should", "not", "be", "exposed" ]
def _is_silent(self, name): """Whether argument should not be exposed""" arg = self._arg_tree[name] full_path = full_name(arg) return arg['path'] in pformat.SILENT_PARAMETERS or full_path in pformat.SILENT_PARAMETERS
[ "def", "_is_silent", "(", "self", ",", "name", ")", ":", "arg", "=", "self", ".", "_arg_tree", "[", "name", "]", "full_path", "=", "full_name", "(", "arg", ")", "return", "arg", "[", "'path'", "]", "in", "pformat", ".", "SILENT_PARAMETERS", "or", "full...
https://github.com/Azure/azure-cli/blob/6c1b085a0910c6c2139006fcbd8ade44006eb6dd/src/azure-cli/azure/cli/command_modules/batch/_command_type.py#L202-L206
tenzir/threatbus
a26096e7b61b3eddf25c445d40a6cd2ea4420558
plugins/backbones/threatbus_rabbitmq/threatbus_rabbitmq/plugin.py
python
provision
( topic: str, msg: Union[Indicator, Sighting, SnapshotEnvelope, SnapshotRequest] )
Provisions the given `msg` to all subscribers of `topic`. @param topic The topic string to use for provisioning @param msg The message to provision
Provisions the given `msg` to all subscribers of `topic`.
[ "Provisions", "the", "given", "msg", "to", "all", "subscribers", "of", "topic", "." ]
def provision( topic: str, msg: Union[Indicator, Sighting, SnapshotEnvelope, SnapshotRequest] ): """ Provisions the given `msg` to all subscribers of `topic`. @param topic The topic string to use for provisioning @param msg The message to provision """ global subscriptions, lock, logger ...
[ "def", "provision", "(", "topic", ":", "str", ",", "msg", ":", "Union", "[", "Indicator", ",", "Sighting", ",", "SnapshotEnvelope", ",", "SnapshotRequest", "]", ")", ":", "global", "subscriptions", ",", "lock", ",", "logger", "lock", ".", "acquire", "(", ...
https://github.com/tenzir/threatbus/blob/a26096e7b61b3eddf25c445d40a6cd2ea4420558/plugins/backbones/threatbus_rabbitmq/threatbus_rabbitmq/plugin.py#L24-L38
evennia/evennia
fa79110ba6b219932f22297838e8ac72ebc0be0e
evennia/server/portal/portalsessionhandler.py
python
PortalSessionHandler.data_out
(self, session, **kwargs)
Called by server for having the portal relay messages and data to the correct session protocol. Args: session (Session): Session sending data. Keyword Args: kwargs (any): Each key is a command instruction to the protocol on the form key = [[args],{kwargs...
Called by server for having the portal relay messages and data to the correct session protocol.
[ "Called", "by", "server", "for", "having", "the", "portal", "relay", "messages", "and", "data", "to", "the", "correct", "session", "protocol", "." ]
def data_out(self, session, **kwargs): """ Called by server for having the portal relay messages and data to the correct session protocol. Args: session (Session): Session sending data. Keyword Args: kwargs (any): Each key is a command instruction to the...
[ "def", "data_out", "(", "self", ",", "session", ",", "*", "*", "kwargs", ")", ":", "# from evennia.server.profiling.timetrace import timetrace # DEBUG", "# text = timetrace(text, \"portalsessionhandler.data_out\") # DEBUG", "# distribute outgoing data to the correct session methods.", ...
https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/server/portal/portalsessionhandler.py#L428-L463
osirislab/CTF-Solutions
bc0650f327823c1511b31f4d9bcda35248f2fb34
BkP2017/rsa-buffet/Arithmetic.py
python
bitlength
(x)
return n
Calculates the bitlength of x
Calculates the bitlength of x
[ "Calculates", "the", "bitlength", "of", "x" ]
def bitlength(x): ''' Calculates the bitlength of x ''' assert x >= 0 n = 0 while x > 0: n = n+1 x = x>>1 return n
[ "def", "bitlength", "(", "x", ")", ":", "assert", "x", ">=", "0", "n", "=", "0", "while", "x", ">", "0", ":", "n", "=", "n", "+", "1", "x", "=", "x", ">>", "1", "return", "n" ]
https://github.com/osirislab/CTF-Solutions/blob/bc0650f327823c1511b31f4d9bcda35248f2fb34/BkP2017/rsa-buffet/Arithmetic.py#L44-L53
apache/libcloud
90971e17bfd7b6bb97b2489986472c531cc8e140
libcloud/compute/drivers/outscale.py
python
OutscaleNodeDriver.ex_list_nets_access_points
( self, net_access_point_ids: List[str] = None, net_ids: List[str] = None, service_names: List[str] = None, states: List[str] = None, tag_keys: List[str] = None, tag_values: List[str] = None, tags: List[str] = None, dry_run: bool = False, )
return response.json()
Describes one or more Net access points. :param net_access_point_ids: The IDs of the Net access points. :type net_access_point_ids: ``list`` of ``str`` :param net_ids: The IDs of the Nets. :type net_ids: ``list`` of ``str`` :param service_names: The ...
Describes one or more Net access points.
[ "Describes", "one", "or", "more", "Net", "access", "points", "." ]
def ex_list_nets_access_points( self, net_access_point_ids: List[str] = None, net_ids: List[str] = None, service_names: List[str] = None, states: List[str] = None, tag_keys: List[str] = None, tag_values: List[str] = None, tags: List[str] = None, dr...
[ "def", "ex_list_nets_access_points", "(", "self", ",", "net_access_point_ids", ":", "List", "[", "str", "]", "=", "None", ",", "net_ids", ":", "List", "[", "str", "]", "=", "None", ",", "service_names", ":", "List", "[", "str", "]", "=", "None", ",", "...
https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/compute/drivers/outscale.py#L4913-L4982
bobbui/json-logging-python
efbe367527203a88e0fec9f81ccb2f1e9252b1bf
json_logging/framework_base.py
python
BaseResponseInfoExtractor.get_content_type
(self, response)
get response's MIME/media type :param response: response object
get response's MIME/media type
[ "get", "response", "s", "MIME", "/", "media", "type" ]
def get_content_type(self, response): """ get response's MIME/media type :param response: response object """ raise NotImplementedError
[ "def", "get_content_type", "(", "self", ",", "response", ")", ":", "raise", "NotImplementedError" ]
https://github.com/bobbui/json-logging-python/blob/efbe367527203a88e0fec9f81ccb2f1e9252b1bf/json_logging/framework_base.py#L151-L157
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/_php_runtime.py
python
_run_file
(file_path, globals_, script_dir=_SCRIPT_DIR)
Execute the file at the specified path with the passed-in globals.
Execute the file at the specified path with the passed-in globals.
[ "Execute", "the", "file", "at", "the", "specified", "path", "with", "the", "passed", "-", "in", "globals", "." ]
def _run_file(file_path, globals_, script_dir=_SCRIPT_DIR): """Execute the file at the specified path with the passed-in globals.""" script_name = os.path.basename(file_path) sys.path = _SYS_PATH_ADDITIONS[script_name] + sys.path if 'google' in sys.modules: del sys.modules['google'] script_dir = _...
[ "def", "_run_file", "(", "file_path", ",", "globals_", ",", "script_dir", "=", "_SCRIPT_DIR", ")", ":", "script_name", "=", "os", ".", "path", ".", "basename", "(", "file_path", ")", "sys", ".", "path", "=", "_SYS_PATH_ADDITIONS", "[", "script_name", "]", ...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/_php_runtime.py#L176-L193
xtiankisutsa/MARA_Framework
ac4ac88bfd38f33ae8780a606ed09ab97177c562
tools/qark/qark/lib/plyj/parser.py
python
ClassParser.p_formal_parameter_list_opt2
(self, p)
formal_parameter_list_opt : empty
formal_parameter_list_opt : empty
[ "formal_parameter_list_opt", ":", "empty" ]
def p_formal_parameter_list_opt2(self, p): '''formal_parameter_list_opt : empty''' p[0] = []
[ "def", "p_formal_parameter_list_opt2", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "[", "]" ]
https://github.com/xtiankisutsa/MARA_Framework/blob/ac4ac88bfd38f33ae8780a606ed09ab97177c562/tools/qark/qark/lib/plyj/parser.py#L1488-L1490
chen3feng/blade-build
360b4c9ddb9087fb811af3aef2830301cf48805e
src/blade/target_tags.py
python
_convert_expression
(expr, func_name)
return ''.join(tokens), None
Convert a filter expression into a python expression.
Convert a filter expression into a python expression.
[ "Convert", "a", "filter", "expression", "into", "a", "python", "expression", "." ]
def _convert_expression(expr, func_name): """Convert a filter expression into a python expression.""" tokens = [] stack = [] for pos, token in _token_iter(expr): if token is None: error = 'Invalid expression: "%s"' % expr[pos:] return None, error if token.isspace...
[ "def", "_convert_expression", "(", "expr", ",", "func_name", ")", ":", "tokens", "=", "[", "]", "stack", "=", "[", "]", "for", "pos", ",", "token", "in", "_token_iter", "(", "expr", ")", ":", "if", "token", "is", "None", ":", "error", "=", "'Invalid ...
https://github.com/chen3feng/blade-build/blob/360b4c9ddb9087fb811af3aef2830301cf48805e/src/blade/target_tags.py#L39-L70
qibinlou/SinaWeibo-Emotion-Classification
f336fc104abd68b0ec4180fe2ed80fafe49cb790
nltk/featstruct.py
python
Feature.display
(self)
return self._display
Custom display location: can be prefix, or slash.
Custom display location: can be prefix, or slash.
[ "Custom", "display", "location", ":", "can", "be", "prefix", "or", "slash", "." ]
def display(self): """Custom display location: can be prefix, or slash.""" return self._display
[ "def", "display", "(", "self", ")", ":", "return", "self", ".", "_display" ]
https://github.com/qibinlou/SinaWeibo-Emotion-Classification/blob/f336fc104abd68b0ec4180fe2ed80fafe49cb790/nltk/featstruct.py#L1809-L1811
exodrifter/unity-python
bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d
Lib/lib2to3/pytree.py
python
Node.pre_order
(self)
Return a pre-order iterator for the tree.
Return a pre-order iterator for the tree.
[ "Return", "a", "pre", "-", "order", "iterator", "for", "the", "tree", "." ]
def pre_order(self): """Return a pre-order iterator for the tree.""" yield self for child in self.children: for node in child.pre_order(): yield node
[ "def", "pre_order", "(", "self", ")", ":", "yield", "self", "for", "child", "in", "self", ".", "children", ":", "for", "node", "in", "child", ".", "pre_order", "(", ")", ":", "yield", "node" ]
https://github.com/exodrifter/unity-python/blob/bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d/Lib/lib2to3/pytree.py#L301-L306
glitchdotcom/WebPutty
4f5da5eb2b4668cbf3c15cf002feacd1d95d2ef7
ziplibs/flask/app.py
python
Flask.create_url_adapter
(self, request)
return self.url_map.bind_to_environ(request.environ, server_name=self.config['SERVER_NAME'])
Creates a URL adapter for the given request. The URL adapter is created at a point where the request context is not yet set up so the request is passed explicitly. .. versionadded:: 0.6
Creates a URL adapter for the given request. The URL adapter is created at a point where the request context is not yet set up so the request is passed explicitly.
[ "Creates", "a", "URL", "adapter", "for", "the", "given", "request", ".", "The", "URL", "adapter", "is", "created", "at", "a", "point", "where", "the", "request", "context", "is", "not", "yet", "set", "up", "so", "the", "request", "is", "passed", "explici...
def create_url_adapter(self, request): """Creates a URL adapter for the given request. The URL adapter is created at a point where the request context is not yet set up so the request is passed explicitly. .. versionadded:: 0.6 """ return self.url_map.bind_to_environ(re...
[ "def", "create_url_adapter", "(", "self", ",", "request", ")", ":", "return", "self", ".", "url_map", ".", "bind_to_environ", "(", "request", ".", "environ", ",", "server_name", "=", "self", ".", "config", "[", "'SERVER_NAME'", "]", ")" ]
https://github.com/glitchdotcom/WebPutty/blob/4f5da5eb2b4668cbf3c15cf002feacd1d95d2ef7/ziplibs/flask/app.py#L747-L755
deepjyoti30/ytmdl
0227541f303739a01e27a6d74499229d9bf44f84
ytmdl/yt.py
python
get_youtube_streams
(url)
return url
Get both audio & video stream urls for youtube using youtube-dl. PS: I don't know how youtube-dl does the magic
Get both audio & video stream urls for youtube using youtube-dl.
[ "Get", "both", "audio", "&", "video", "stream", "urls", "for", "youtube", "using", "youtube", "-", "dl", "." ]
def get_youtube_streams(url): """Get both audio & video stream urls for youtube using youtube-dl. PS: I don't know how youtube-dl does the magic """ cli = "youtube-dl -g {}".format(url) output, error = utility.exe(cli) stream_urls = output.split("\n") url = stream_urls[1] return url
[ "def", "get_youtube_streams", "(", "url", ")", ":", "cli", "=", "\"youtube-dl -g {}\"", ".", "format", "(", "url", ")", "output", ",", "error", "=", "utility", ".", "exe", "(", "cli", ")", "stream_urls", "=", "output", ".", "split", "(", "\"\\n\"", ")", ...
https://github.com/deepjyoti30/ytmdl/blob/0227541f303739a01e27a6d74499229d9bf44f84/ytmdl/yt.py#L24-L34
kovidgoyal/calibre
2b41671370f2a9eb1109b9ae901ccf915f1bd0c8
src/calibre/devices/winusb.py
python
get_usb_info
(usbdev, debug=False)
return ans
The USB info (manufacturer/product names and serial number) Requires communication with the hub the device is connected to. :param usbdev: A usb device as returned by :function:`scan_usb_devices`
The USB info (manufacturer/product names and serial number) Requires communication with the hub the device is connected to.
[ "The", "USB", "info", "(", "manufacturer", "/", "product", "names", "and", "serial", "number", ")", "Requires", "communication", "with", "the", "hub", "the", "device", "is", "connected", "to", "." ]
def get_usb_info(usbdev, debug=False): # {{{ ''' The USB info (manufacturer/product names and serial number) Requires communication with the hub the device is connected to. :param usbdev: A usb device as returned by :function:`scan_usb_devices` ''' ans = {} hub_map = {devinfo.DevInst:path for ...
[ "def", "get_usb_info", "(", "usbdev", ",", "debug", "=", "False", ")", ":", "# {{{", "ans", "=", "{", "}", "hub_map", "=", "{", "devinfo", ".", "DevInst", ":", "path", "for", "devinfo", ",", "path", "in", "DeviceSet", "(", "guid", "=", "GUID_DEVINTERFA...
https://github.com/kovidgoyal/calibre/blob/2b41671370f2a9eb1109b9ae901ccf915f1bd0c8/src/calibre/devices/winusb.py#L879-L925
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/nova/nova/compute/cells_api.py
python
ComputeCellsAPI._cell_read_only
(self, cell_name)
return False
Is the target cell in a read-only mode?
Is the target cell in a read-only mode?
[ "Is", "the", "target", "cell", "in", "a", "read", "-", "only", "mode?" ]
def _cell_read_only(self, cell_name): """Is the target cell in a read-only mode?""" # FIXME(comstud): Add support for this. return False
[ "def", "_cell_read_only", "(", "self", ",", "cell_name", ")", ":", "# FIXME(comstud): Add support for this.", "return", "False" ]
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/compute/cells_api.py#L97-L100
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
docker/oso-host-monitoring/src/vendor/prometheus_client/core.py
python
_LabelWrapper.labels
(self, *labelvalues)
Return the child for the given labelset. All metrics can have labels, allowing grouping of related time series. Taking a counter as an example: from prometheus_client import Counter c = Counter('my_requests_total', 'HTTP Failures', ['method', 'endpoint']) c.labels(...
Return the child for the given labelset.
[ "Return", "the", "child", "for", "the", "given", "labelset", "." ]
def labels(self, *labelvalues): '''Return the child for the given labelset. All metrics can have labels, allowing grouping of related time series. Taking a counter as an example: from prometheus_client import Counter c = Counter('my_requests_total', 'HTTP Failures', ['...
[ "def", "labels", "(", "self", ",", "*", "labelvalues", ")", ":", "if", "len", "(", "labelvalues", ")", "==", "1", "and", "type", "(", "labelvalues", "[", "0", "]", ")", "==", "dict", ":", "if", "sorted", "(", "labelvalues", "[", "0", "]", ".", "k...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/docker/oso-host-monitoring/src/vendor/prometheus_client/core.py#L256-L290
chaostoolkit/chaostoolkit-kubernetes
4fe9b65209d849efd4c97e99d9eb31fde38a8c84
chaosk8s/crd/actions.py
python
replace_custom_object
( group: str, version: str, plural: str, name: str, ns: str = "default", force: bool = False, resource: Dict[str, Any] = None, resource_as_yaml_file: str = None, secrets: Secrets = None, )
Replace a custom object in the given namespace. The resource must be the new version to apply. Read more about custom resources here: https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/
Replace a custom object in the given namespace. The resource must be the new version to apply.
[ "Replace", "a", "custom", "object", "in", "the", "given", "namespace", ".", "The", "resource", "must", "be", "the", "new", "version", "to", "apply", "." ]
def replace_custom_object( group: str, version: str, plural: str, name: str, ns: str = "default", force: bool = False, resource: Dict[str, Any] = None, resource_as_yaml_file: str = None, secrets: Secrets = None, ) -> Dict[str, Any]: """ Replace a custom object in the given na...
[ "def", "replace_custom_object", "(", "group", ":", "str", ",", "version", ":", "str", ",", "plural", ":", "str", ",", "name", ":", "str", ",", "ns", ":", "str", "=", "\"default\"", ",", "force", ":", "bool", "=", "False", ",", "resource", ":", "Dict"...
https://github.com/chaostoolkit/chaostoolkit-kubernetes/blob/4fe9b65209d849efd4c97e99d9eb31fde38a8c84/chaosk8s/crd/actions.py#L175-L204
CvvT/dumpDex
92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1
python/idaapi.py
python
openM
(*args)
return _idaapi.openM(*args)
openM(file) -> FILE *
openM(file) -> FILE *
[ "openM", "(", "file", ")", "-", ">", "FILE", "*" ]
def openM(*args): """ openM(file) -> FILE * """ return _idaapi.openM(*args)
[ "def", "openM", "(", "*", "args", ")", ":", "return", "_idaapi", ".", "openM", "(", "*", "args", ")" ]
https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L25344-L25348
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/django/core/management/commands/shell.py
python
Command._ipython_pre_100
(self)
Start IPython pre-1.0.0
Start IPython pre-1.0.0
[ "Start", "IPython", "pre", "-", "1", ".", "0", ".", "0" ]
def _ipython_pre_100(self): """Start IPython pre-1.0.0""" from IPython.frontend.terminal.ipapp import TerminalIPythonApp app = TerminalIPythonApp.instance() app.initialize(argv=[]) app.start()
[ "def", "_ipython_pre_100", "(", "self", ")", ":", "from", "IPython", ".", "frontend", ".", "terminal", ".", "ipapp", "import", "TerminalIPythonApp", "app", "=", "TerminalIPythonApp", ".", "instance", "(", ")", "app", ".", "initialize", "(", "argv", "=", "[",...
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/django/core/management/commands/shell.py#L28-L33
matplotlib/matplotlib
8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322
lib/matplotlib/gridspec.py
python
GridSpecBase.set_height_ratios
(self, height_ratios)
Set the relative heights of the rows. *height_ratios* must be of length *nrows*. Each row gets a relative height of ``height_ratios[i] / sum(height_ratios)``.
Set the relative heights of the rows.
[ "Set", "the", "relative", "heights", "of", "the", "rows", "." ]
def set_height_ratios(self, height_ratios): """ Set the relative heights of the rows. *height_ratios* must be of length *nrows*. Each row gets a relative height of ``height_ratios[i] / sum(height_ratios)``. """ if height_ratios is None: height_ratios = [1] * ...
[ "def", "set_height_ratios", "(", "self", ",", "height_ratios", ")", ":", "if", "height_ratios", "is", "None", ":", "height_ratios", "=", "[", "1", "]", "*", "self", ".", "_nrows", "elif", "len", "(", "height_ratios", ")", "!=", "self", ".", "_nrows", ":"...
https://github.com/matplotlib/matplotlib/blob/8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322/lib/matplotlib/gridspec.py#L123-L135
py2neo-org/py2neo
2e46bbf4d622f53282e796ffc521fc4bc6d0b60d
py2neo/__init__.py
python
ConnectionProfile.host
(self)
return self.address.host
The host name or IP address of the remote server. If unspecified, and uninfluenced by environment variables, this will default to ``'localhost'``.
The host name or IP address of the remote server. If unspecified, and uninfluenced by environment variables, this will default to ``'localhost'``.
[ "The", "host", "name", "or", "IP", "address", "of", "the", "remote", "server", ".", "If", "unspecified", "and", "uninfluenced", "by", "environment", "variables", "this", "will", "default", "to", "localhost", "." ]
def host(self): """ The host name or IP address of the remote server. If unspecified, and uninfluenced by environment variables, this will default to ``'localhost'``. """ return self.address.host
[ "def", "host", "(", "self", ")", ":", "return", "self", ".", "address", ".", "host" ]
https://github.com/py2neo-org/py2neo/blob/2e46bbf4d622f53282e796ffc521fc4bc6d0b60d/py2neo/__init__.py#L375-L380
beerfactory/hbmqtt
07c4c70f061003f208ad7e510b6e8fce4d7b3a6c
hbmqtt/version.py
python
get_version
(version=None)
return str(main + sub)
Returns a PEP 386-compliant version number from VERSION.
Returns a PEP 386-compliant version number from VERSION.
[ "Returns", "a", "PEP", "386", "-", "compliant", "version", "number", "from", "VERSION", "." ]
def get_version(version=None): "Returns a PEP 386-compliant version number from VERSION." if version is None: from hbmqtt import VERSION as version else: assert len(version) == 5 assert version[3] in ('alpha', 'beta', 'rc', 'final') # Now build the two parts of the version numbe...
[ "def", "get_version", "(", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "from", "hbmqtt", "import", "VERSION", "as", "version", "else", ":", "assert", "len", "(", "version", ")", "==", "5", "assert", "version", "[", "3", "]", ...
https://github.com/beerfactory/hbmqtt/blob/07c4c70f061003f208ad7e510b6e8fce4d7b3a6c/hbmqtt/version.py#L10-L36
HypoX64/DeepMosaics
b311aaac319439a0a1e8004b4a64c4222c55f38c
util/data.py
python
normalize
(data)
return (data.astype(np.float32)/255.0-0.5)/0.5
normalize to -1 ~ 1
normalize to -1 ~ 1
[ "normalize", "to", "-", "1", "~", "1" ]
def normalize(data): ''' normalize to -1 ~ 1 ''' return (data.astype(np.float32)/255.0-0.5)/0.5
[ "def", "normalize", "(", "data", ")", ":", "return", "(", "data", ".", "astype", "(", "np", ".", "float32", ")", "/", "255.0", "-", "0.5", ")", "/", "0.5" ]
https://github.com/HypoX64/DeepMosaics/blob/b311aaac319439a0a1e8004b4a64c4222c55f38c/util/data.py#L17-L21
WikidPad/WikidPad
558109638807bc76b4672922686e416ab2d5f79c
WikidPad/lib/whoosh/query/qcore.py
python
Query.estimate_size
(self, ixreader)
Returns an estimate of how many documents this query could potentially match (for example, the estimated size of a simple term query is the document frequency of the term). It is permissible to overestimate, but not to underestimate.
Returns an estimate of how many documents this query could potentially match (for example, the estimated size of a simple term query is the document frequency of the term). It is permissible to overestimate, but not to underestimate.
[ "Returns", "an", "estimate", "of", "how", "many", "documents", "this", "query", "could", "potentially", "match", "(", "for", "example", "the", "estimated", "size", "of", "a", "simple", "term", "query", "is", "the", "document", "frequency", "of", "the", "term...
def estimate_size(self, ixreader): """Returns an estimate of how many documents this query could potentially match (for example, the estimated size of a simple term query is the document frequency of the term). It is permissible to overestimate, but not to underestimate. """ ...
[ "def", "estimate_size", "(", "self", ",", "ixreader", ")", ":", "raise", "NotImplementedError" ]
https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/whoosh/query/qcore.py#L486-L492
robhagemans/pcbasic
c3a043b46af66623a801e18a38175be077251ada
docsrc/man.py
python
makeman
()
Convert HTML sources to manfile.
Convert HTML sources to manfile.
[ "Convert", "HTML", "sources", "to", "manfile", "." ]
def makeman(): """Convert HTML sources to manfile.""" title_html = '<h1>pcbasic</h1><p>%s</p>\n' % SETUP_DATA['description'] desc_html = '<h3>Description</h2><p>%s</p>\n' % SETUP_DATA['long_description'] options_html = open(OPTIONS_HTML).read() examples_html = open(EXAMPLE_HTML).read() more_html...
[ "def", "makeman", "(", ")", ":", "title_html", "=", "'<h1>pcbasic</h1><p>%s</p>\\n'", "%", "SETUP_DATA", "[", "'description'", "]", "desc_html", "=", "'<h3>Description</h2><p>%s</p>\\n'", "%", "SETUP_DATA", "[", "'long_description'", "]", "options_html", "=", "open", ...
https://github.com/robhagemans/pcbasic/blob/c3a043b46af66623a801e18a38175be077251ada/docsrc/man.py#L84-L99
sympy/sympy
d822fcba181155b85ff2b29fe525adbafb22b448
sympy/combinatorics/fp_groups.py
python
simplify_presentation
(*args, change_gens=False)
return gens, rels
For an instance of `FpGroup`, return a simplified isomorphic copy of the group (e.g. remove redundant generators or relators). Alternatively, a list of generators and relators can be passed in which case the simplified lists will be returned. By default, the generators of the group are unchanged. If yo...
For an instance of `FpGroup`, return a simplified isomorphic copy of the group (e.g. remove redundant generators or relators). Alternatively, a list of generators and relators can be passed in which case the simplified lists will be returned.
[ "For", "an", "instance", "of", "FpGroup", "return", "a", "simplified", "isomorphic", "copy", "of", "the", "group", "(", "e", ".", "g", ".", "remove", "redundant", "generators", "or", "relators", ")", ".", "Alternatively", "a", "list", "of", "generators", "...
def simplify_presentation(*args, change_gens=False): ''' For an instance of `FpGroup`, return a simplified isomorphic copy of the group (e.g. remove redundant generators or relators). Alternatively, a list of generators and relators can be passed in which case the simplified lists will be returned. ...
[ "def", "simplify_presentation", "(", "*", "args", ",", "change_gens", "=", "False", ")", ":", "if", "len", "(", "args", ")", "==", "1", ":", "if", "not", "isinstance", "(", "args", "[", "0", "]", ",", "FpGroup", ")", ":", "raise", "TypeError", "(", ...
https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/combinatorics/fp_groups.py#L947-L1001
n1nj4sec/pupy
a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39
pupy/external/creddump7/framework/newobj.py
python
Obj.values
(self)
return valdict
Return a dictionary of this object's members and their values
Return a dictionary of this object's members and their values
[ "Return", "a", "dictionary", "of", "this", "object", "s", "members", "and", "their", "values" ]
def values(self): """Return a dictionary of this object's members and their values""" valdict = {} for k in self.members(): valdict[k] = getattr(self, k) return valdict
[ "def", "values", "(", "self", ")", ":", "valdict", "=", "{", "}", "for", "k", "in", "self", ".", "members", "(", ")", ":", "valdict", "[", "k", "]", "=", "getattr", "(", "self", ",", "k", ")", "return", "valdict" ]
https://github.com/n1nj4sec/pupy/blob/a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39/pupy/external/creddump7/framework/newobj.py#L123-L129
GoogleCloudPlatform/PerfKitBenchmarker
6e3412d7d5e414b8ca30ed5eaf970cef1d919a67
perfkitbenchmarker/providers/aws/aws_nfs_service.py
python
AwsEfsCommands.GetFiler
(self, token)
return file_systems[0]
Returns the filer using the creation token or None.
Returns the filer using the creation token or None.
[ "Returns", "the", "filer", "using", "the", "creation", "token", "or", "None", "." ]
def GetFiler(self, token): """Returns the filer using the creation token or None.""" args = ['describe-file-systems', '--creation-token', token] response = self._IssueAwsCommand(args) file_systems = response['FileSystems'] if not file_systems: return None assert len(file_systems) < 2, 'Too...
[ "def", "GetFiler", "(", "self", ",", "token", ")", ":", "args", "=", "[", "'describe-file-systems'", ",", "'--creation-token'", ",", "token", "]", "response", "=", "self", ".", "_IssueAwsCommand", "(", "args", ")", "file_systems", "=", "response", "[", "'Fil...
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/providers/aws/aws_nfs_service.py#L186-L194
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/preview/sync/service/document/document_permission.py
python
DocumentPermissionList.__repr__
(self)
return '<Twilio.Preview.Sync.DocumentPermissionList>'
Provide a friendly representation :returns: Machine friendly representation :rtype: str
Provide a friendly representation
[ "Provide", "a", "friendly", "representation" ]
def __repr__(self): """ Provide a friendly representation :returns: Machine friendly representation :rtype: str """ return '<Twilio.Preview.Sync.DocumentPermissionList>'
[ "def", "__repr__", "(", "self", ")", ":", "return", "'<Twilio.Preview.Sync.DocumentPermissionList>'" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/preview/sync/service/document/document_permission.py#L147-L154
Netflix/brutal
13052ddbaf873acd9c9dac54b19a42ab7b70f7a9
brutal/protocols/core.py
python
ProtocolBackend.handle_event
(self, event)
takes events, tags them with the current backend, and places them on bot event_queue
takes events, tags them with the current backend, and places them on bot event_queue
[ "takes", "events", "tags", "them", "with", "the", "current", "backend", "and", "places", "them", "on", "bot", "event_queue" ]
def handle_event(self, event): """ takes events, tags them with the current backend, and places them on bot event_queue """ if isinstance(event, Event): event.source_client = self event.source_client_id = self.id self.bot.new_event(event) elif ...
[ "def", "handle_event", "(", "self", ",", "event", ")", ":", "if", "isinstance", "(", "event", ",", "Event", ")", ":", "event", ".", "source_client", "=", "self", "event", ".", "source_client_id", "=", "self", ".", "id", "self", ".", "bot", ".", "new_ev...
https://github.com/Netflix/brutal/blob/13052ddbaf873acd9c9dac54b19a42ab7b70f7a9/brutal/protocols/core.py#L48-L61
ioflo/ioflo
177ac656d7c4ff801aebb0d8b401db365a5248ce
ioflo/aio/tcp/serving.py
python
Acceptor.accept
(self)
return (cs, ca)
Accept new connection nonblocking Returns duple (cs, ca) of connected socket and connected host address Otherwise if no new connection returns (None, None)
Accept new connection nonblocking Returns duple (cs, ca) of connected socket and connected host address Otherwise if no new connection returns (None, None)
[ "Accept", "new", "connection", "nonblocking", "Returns", "duple", "(", "cs", "ca", ")", "of", "connected", "socket", "and", "connected", "host", "address", "Otherwise", "if", "no", "new", "connection", "returns", "(", "None", "None", ")" ]
def accept(self): """ Accept new connection nonblocking Returns duple (cs, ca) of connected socket and connected host address Otherwise if no new connection returns (None, None) """ # accept new virtual connected socket created from server socket try: ...
[ "def", "accept", "(", "self", ")", ":", "# accept new virtual connected socket created from server socket", "try", ":", "cs", ",", "ca", "=", "self", ".", "ss", ".", "accept", "(", ")", "# virtual connection (socket, host address)", "except", "socket", ".", "error", ...
https://github.com/ioflo/ioflo/blob/177ac656d7c4ff801aebb0d8b401db365a5248ce/ioflo/aio/tcp/serving.py#L674-L691
spesmilo/electrum
bdbd59300fbd35b01605e66145458e5f396108e8
electrum/plugins/trustedcoin/qt.py
python
Plugin.auth_dialog
(self, window)
return pw.get_amount()
[]
def auth_dialog(self, window): d = WindowModalDialog(window, _("Authorization")) vbox = QVBoxLayout(d) pw = AmountEdit(None, is_int = True) msg = _('Please enter your Google Authenticator code') vbox.addWidget(QLabel(msg)) grid = QGridLayout() grid.setSpacing(8) ...
[ "def", "auth_dialog", "(", "self", ",", "window", ")", ":", "d", "=", "WindowModalDialog", "(", "window", ",", "_", "(", "\"Authorization\"", ")", ")", "vbox", "=", "QVBoxLayout", "(", "d", ")", "pw", "=", "AmountEdit", "(", "None", ",", "is_int", "=",...
https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/plugins/trustedcoin/qt.py#L109-L127
XKNX/xknx
1deeeb3dc0978aebacf14492a84e1f1eaf0970ed
xknx/devices/cover.py
python
Cover.position_reached
(self)
return self.travelcalculator.position_reached()
Return if cover has reached its final position.
Return if cover has reached its final position.
[ "Return", "if", "cover", "has", "reached", "its", "final", "position", "." ]
def position_reached(self) -> bool: """Return if cover has reached its final position.""" return self.travelcalculator.position_reached()
[ "def", "position_reached", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "travelcalculator", ".", "position_reached", "(", ")" ]
https://github.com/XKNX/xknx/blob/1deeeb3dc0978aebacf14492a84e1f1eaf0970ed/xknx/devices/cover.py#L321-L323
wishinlife/SyncY
71597eb523cc411e5f41558570d3814d52cfe92e
v2.6.0-src/files/syncy.py
python
SyncY.__del__
(self)
[]
def __del__(self): if self.__class__.oldSTDERR is not None: sys.stderr.flush() sys.stderr.close() sys.stderr = self.__class__.oldSTDERR sys.stdout = self.__class__.oldSTDOUT if os.path.exists(__PIDFILE__): with open(__PIDFILE__, 'r') as pidh: ...
[ "def", "__del__", "(", "self", ")", ":", "if", "self", ".", "__class__", ".", "oldSTDERR", "is", "not", "None", ":", "sys", ".", "stderr", ".", "flush", "(", ")", "sys", ".", "stderr", ".", "close", "(", ")", "sys", ".", "stderr", "=", "self", "....
https://github.com/wishinlife/SyncY/blob/71597eb523cc411e5f41558570d3814d52cfe92e/v2.6.0-src/files/syncy.py#L363-L373
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/sklearn/svm/base.py
python
_fit_liblinear
(X, y, C, fit_intercept, intercept_scaling, class_weight, penalty, dual, verbose, max_iter, tol, random_state=None, multi_class='ovr', loss='logistic_regression', epsilon=0.1, sample_weight=None)
return coef_, intercept_, n_iter_
Used by Logistic Regression (and CV) and LinearSVC. Preprocessing is done in this function before supplying it to liblinear. Parameters ---------- X : {array-like, sparse matrix}, shape (n_samples, n_features) Training vector, where n_samples in the number of samples and n_features is ...
Used by Logistic Regression (and CV) and LinearSVC.
[ "Used", "by", "Logistic", "Regression", "(", "and", "CV", ")", "and", "LinearSVC", "." ]
def _fit_liblinear(X, y, C, fit_intercept, intercept_scaling, class_weight, penalty, dual, verbose, max_iter, tol, random_state=None, multi_class='ovr', loss='logistic_regression', epsilon=0.1, sample_weight=None): """Used by Logistic Regre...
[ "def", "_fit_liblinear", "(", "X", ",", "y", ",", "C", ",", "fit_intercept", ",", "intercept_scaling", ",", "class_weight", ",", "penalty", ",", "dual", ",", "verbose", ",", "max_iter", ",", "tol", ",", "random_state", "=", "None", ",", "multi_class", "=",...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/sklearn/svm/base.py#L775-L929
hzlzh/AlfredWorkflow.com
7055f14f6922c80ea5943839eb0caff11ae57255
Sources/Workflows/Toggl-Time-Tracking/alp/request/requests/packages/oauthlib/common.py
python
decode_params_utf8
(params)
return decoded
Ensures that all parameters in a list of 2-element tuples are decoded to unicode using UTF-8.
Ensures that all parameters in a list of 2-element tuples are decoded to unicode using UTF-8.
[ "Ensures", "that", "all", "parameters", "in", "a", "list", "of", "2", "-", "element", "tuples", "are", "decoded", "to", "unicode", "using", "UTF", "-", "8", "." ]
def decode_params_utf8(params): """Ensures that all parameters in a list of 2-element tuples are decoded to unicode using UTF-8. """ decoded = [] for k, v in params: decoded.append(( k.decode('utf-8') if isinstance(k, str) else k, v.decode('utf-8') if isinstance(v, st...
[ "def", "decode_params_utf8", "(", "params", ")", ":", "decoded", "=", "[", "]", "for", "k", ",", "v", "in", "params", ":", "decoded", ".", "append", "(", "(", "k", ".", "decode", "(", "'utf-8'", ")", "if", "isinstance", "(", "k", ",", "str", ")", ...
https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/Toggl-Time-Tracking/alp/request/requests/packages/oauthlib/common.py#L57-L66
jhpyle/docassemble
b90c84e57af59aa88b3404d44d0b125c70f832cc
docassemble_base/docassemble/base/functions.py
python
defined
(var)
return True
Returns true if the variable has already been defined. Otherwise, returns false.
Returns true if the variable has already been defined. Otherwise, returns false.
[ "Returns", "true", "if", "the", "variable", "has", "already", "been", "defined", ".", "Otherwise", "returns", "false", "." ]
def defined(var): """Returns true if the variable has already been defined. Otherwise, returns false.""" str(var) if not isinstance(var, str): raise Exception("defined() must be given a string") if not re.search(r'[A-Za-z][A-Za-z0-9\_]*', var): raise Exception("defined() must be given a...
[ "def", "defined", "(", "var", ")", ":", "str", "(", "var", ")", "if", "not", "isinstance", "(", "var", ",", "str", ")", ":", "raise", "Exception", "(", "\"defined() must be given a string\"", ")", "if", "not", "re", ".", "search", "(", "r'[A-Za-z][A-Za-z0-...
https://github.com/jhpyle/docassemble/blob/b90c84e57af59aa88b3404d44d0b125c70f832cc/docassemble_base/docassemble/base/functions.py#L3934-L4008
frappe/frappe
b64cab6867dfd860f10ccaf41a4ec04bc890b583
frappe/core/doctype/user/user.py
python
get_active_users
()
return frappe.db.sql("""select count(*) from `tabUser` where enabled = 1 and user_type != 'Website User' and name not in ({}) and hour(timediff(now(), last_active)) < 72""".format(", ".join(["%s"]*len(STANDARD_USERS))), STANDARD_USERS)[0][0]
Returns No. of system users who logged in, in the last 3 days
Returns No. of system users who logged in, in the last 3 days
[ "Returns", "No", ".", "of", "system", "users", "who", "logged", "in", "in", "the", "last", "3", "days" ]
def get_active_users(): """Returns No. of system users who logged in, in the last 3 days""" return frappe.db.sql("""select count(*) from `tabUser` where enabled = 1 and user_type != 'Website User' and name not in ({}) and hour(timediff(now(), last_active)) < 72""".format(", ".join(["%s"]*len(STANDARD_USERS))), ...
[ "def", "get_active_users", "(", ")", ":", "return", "frappe", ".", "db", ".", "sql", "(", "\"\"\"select count(*) from `tabUser`\n\t\twhere enabled = 1 and user_type != 'Website User'\n\t\tand name not in ({})\n\t\tand hour(timediff(now(), last_active)) < 72\"\"\"", ".", "format", "(", ...
https://github.com/frappe/frappe/blob/b64cab6867dfd860f10ccaf41a4ec04bc890b583/frappe/core/doctype/user/user.py#L884-L889
ray-project/ray
703c1610348615dcb8c2d141a0c46675084660f5
python/ray/tune/web_server.py
python
TuneClient.get_all_trials
(self, timeout=None)
return self._deserialize(response)
Returns a list of all trials' information.
Returns a list of all trials' information.
[ "Returns", "a", "list", "of", "all", "trials", "information", "." ]
def get_all_trials(self, timeout=None): """Returns a list of all trials' information.""" response = requests.get(urljoin(self._path, "trials"), timeout=timeout) return self._deserialize(response)
[ "def", "get_all_trials", "(", "self", ",", "timeout", "=", "None", ")", ":", "response", "=", "requests", ".", "get", "(", "urljoin", "(", "self", ".", "_path", ",", "\"trials\"", ")", ",", "timeout", "=", "timeout", ")", "return", "self", ".", "_deser...
https://github.com/ray-project/ray/blob/703c1610348615dcb8c2d141a0c46675084660f5/python/ray/tune/web_server.py#L38-L41
yidao620c/core-algorithm
73f249e00d0e57eb2cea5a4c527ad7ae89ae7c08
algorithms/ch01structure/tree/bisearch_tree.py
python
inOrderWalkNode
(node)
中序遍历二叉搜索树,从小到大输出元素
中序遍历二叉搜索树,从小到大输出元素
[ "中序遍历二叉搜索树,从小到大输出元素" ]
def inOrderWalkNode(node): """中序遍历二叉搜索树,从小到大输出元素""" if node: inOrderWalkNode(node.left) print(node.key), inOrderWalkNode(node.right)
[ "def", "inOrderWalkNode", "(", "node", ")", ":", "if", "node", ":", "inOrderWalkNode", "(", "node", ".", "left", ")", "print", "(", "node", ".", "key", ")", ",", "inOrderWalkNode", "(", "node", ".", "right", ")" ]
https://github.com/yidao620c/core-algorithm/blob/73f249e00d0e57eb2cea5a4c527ad7ae89ae7c08/algorithms/ch01structure/tree/bisearch_tree.py#L30-L35
yandex/yandex-tank
b41bcc04396c4ed46fc8b28a261197320854fd33
yandextank/plugins/JMeter/reader.py
python
JMeterStatAggregator.__init__
(self, source)
[]
def __init__(self, source): self.worker = agg.Worker({"allThreads": ["max"]}, False) self.source = source
[ "def", "__init__", "(", "self", ",", "source", ")", ":", "self", ".", "worker", "=", "agg", ".", "Worker", "(", "{", "\"allThreads\"", ":", "[", "\"max\"", "]", "}", ",", "False", ")", "self", ".", "source", "=", "source" ]
https://github.com/yandex/yandex-tank/blob/b41bcc04396c4ed46fc8b28a261197320854fd33/yandextank/plugins/JMeter/reader.py#L138-L140
fake-name/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
WebMirror/management/rss_parser_funcs/feed_parse_extractMytranslationsOrg.py
python
extractMytranslationsOrg
(item)
return False
Parser for 'mytranslations.org'
Parser for 'mytranslations.org'
[ "Parser", "for", "mytranslations", ".", "org" ]
def extractMytranslationsOrg(item): ''' Parser for 'mytranslations.org' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('PRC', 'PRC', 'translated'), ('Loiterous', 'Lo...
[ "def", "extractMytranslationsOrg", "(", "item", ")", ":", "vol", ",", "chp", ",", "frag", ",", "postfix", "=", "extractVolChapterFragmentPostfix", "(", "item", "[", "'title'", "]", ")", "if", "not", "(", "chp", "or", "vol", ")", "or", "\"preview\"", "in", ...
https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractMytranslationsOrg.py#L2-L21
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v7/services/services/landing_page_view_service/client.py
python
LandingPageViewServiceClient._get_default_mtls_endpoint
(api_endpoint)
return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com")
Convert api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: str: converted m...
Convert api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. Args: api_endpoint (Optional[str]): the api endpoint to convert. Returns: str: converted m...
[ "Convert", "api", "endpoint", "to", "mTLS", "endpoint", ".", "Convert", "*", ".", "sandbox", ".", "googleapis", ".", "com", "and", "*", ".", "googleapis", ".", "com", "to", "*", ".", "mtls", ".", "sandbox", ".", "googleapis", ".", "com", "and", "*", ...
def _get_default_mtls_endpoint(api_endpoint): """Convert api endpoint to mTLS endpoint. Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. Args: api_endpoint (Optional[str]): the api endpoint ...
[ "def", "_get_default_mtls_endpoint", "(", "api_endpoint", ")", ":", "if", "not", "api_endpoint", ":", "return", "api_endpoint", "mtls_endpoint_re", "=", "re", ".", "compile", "(", "r\"(?P<name>[^.]+)(?P<mtls>\\.mtls)?(?P<sandbox>\\.sandbox)?(?P<googledomain>\\.googleapis\\.com)?\...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/landing_page_view_service/client.py#L79-L105
IntelAI/models
1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c
models/object_detection/tensorflow/rfcn/inference/fp32/eval_util.py
python
write_metrics
(metrics, global_step, summary_dir)
Write metrics to a summary directory. Args: metrics: A dictionary containing metric names and values. global_step: Global step at which the metrics are computed. summary_dir: Directory to write tensorflow summaries to.
Write metrics to a summary directory.
[ "Write", "metrics", "to", "a", "summary", "directory", "." ]
def write_metrics(metrics, global_step, summary_dir): """Write metrics to a summary directory. Args: metrics: A dictionary containing metric names and values. global_step: Global step at which the metrics are computed. summary_dir: Directory to write tensorflow summaries to. """ logging.info('Writi...
[ "def", "write_metrics", "(", "metrics", ",", "global_step", ",", "summary_dir", ")", ":", "logging", ".", "info", "(", "'Writing metrics to tf summary.'", ")", "summary_writer", "=", "tf", ".", "compat", ".", "v1", ".", "summary", ".", "FileWriterCache", ".", ...
https://github.com/IntelAI/models/blob/1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c/models/object_detection/tensorflow/rfcn/inference/fp32/eval_util.py#L53-L69
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/gui/widgets/fanchart2way.py
python
FanChart2WayWidget.cell_address_under_cursor_asc
(self, rads, radius)
return generation, selected
Determine the cell address in the fan under the cursor position x and y. None if outside of diagram
Determine the cell address in the fan under the cursor position x and y. None if outside of diagram
[ "Determine", "the", "cell", "address", "in", "the", "fan", "under", "the", "cursor", "position", "x", "and", "y", ".", "None", "if", "outside", "of", "diagram" ]
def cell_address_under_cursor_asc(self, rads, radius): """ Determine the cell address in the fan under the cursor position x and y. None if outside of diagram """ generation, selected = None, None for gen in range(self.generations_asc): radiusin, radi...
[ "def", "cell_address_under_cursor_asc", "(", "self", ",", "rads", ",", "radius", ")", ":", "generation", ",", "selected", "=", "None", ",", "None", "for", "gen", "in", "range", "(", "self", ".", "generations_asc", ")", ":", "radiusin", ",", "radiusout", "=...
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gui/widgets/fanchart2way.py#L574-L593
truenas/middleware
b11ec47d6340324f5a32287ffb4012e5d709b934
src/middlewared/middlewared/plugins/iscsi.py
python
iSCSITargetAuthorizedInitiator.do_update
(self, id, data)
return await self.get_instance(id)
Update iSCSI initiator of `id`.
Update iSCSI initiator of `id`.
[ "Update", "iSCSI", "initiator", "of", "id", "." ]
async def do_update(self, id, data): """ Update iSCSI initiator of `id`. """ old = await self.get_instance(id) new = old.copy() new.update(data) await self.compress(new) await self.middleware.call( 'datastore.update', self._config.datastore, ...
[ "async", "def", "do_update", "(", "self", ",", "id", ",", "data", ")", ":", "old", "=", "await", "self", ".", "get_instance", "(", "id", ")", "new", "=", "old", ".", "copy", "(", ")", "new", ".", "update", "(", "data", ")", "await", "self", ".", ...
https://github.com/truenas/middleware/blob/b11ec47d6340324f5a32287ffb4012e5d709b934/src/middlewared/middlewared/plugins/iscsi.py#L968-L984
F8LEFT/DecLLVM
d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c
python/idaapi.py
python
lvar_locator_t.is_scattered
(self, *args)
return _idaapi.lvar_locator_t_is_scattered(self, *args)
is_scattered(self) -> bool
is_scattered(self) -> bool
[ "is_scattered", "(", "self", ")", "-", ">", "bool" ]
def is_scattered(self, *args): """ is_scattered(self) -> bool """ return _idaapi.lvar_locator_t_is_scattered(self, *args)
[ "def", "is_scattered", "(", "self", ",", "*", "args", ")", ":", "return", "_idaapi", ".", "lvar_locator_t_is_scattered", "(", "self", ",", "*", "args", ")" ]
https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L35771-L35775
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
web2py-rest/scripts/cpdb.py
python
console.cmd_vars
(self, *args)
-2|vars|Show variables
-2|vars|Show variables
[ "-", "2|vars|Show", "variables" ]
def cmd_vars(self, *args): '''-2|vars|Show variables''' print ("variables\r\n" + "-" * 79) for i, j in self.configvars.items(): value = self.parfmt(repr(getattr(self, j)), 52) print ("| %20s | %52s |" % (i, value[0])) for k in value[1:]: print ("| %20s | %52s ...
[ "def", "cmd_vars", "(", "self", ",", "*", "args", ")", ":", "print", "(", "\"variables\\r\\n\"", "+", "\"-\"", "*", "79", ")", "for", "i", ",", "j", "in", "self", ".", "configvars", ".", "items", "(", ")", ":", "value", "=", "self", ".", "parfmt", ...
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py-rest/scripts/cpdb.py#L379-L388
PaddlePaddle/PaddleDetection
635e3e0a80f3d05751cdcfca8af04ee17c601a92
ppdet/modeling/backbones/swin_transformer.py
python
window_reverse
(windows, window_size, H, W)
return x
Args: windows: (num_windows*B, window_size, window_size, C) window_size (int): Window size H (int): Height of image W (int): Width of image Returns: x: (B, H, W, C)
Args: windows: (num_windows*B, window_size, window_size, C) window_size (int): Window size H (int): Height of image W (int): Width of image Returns: x: (B, H, W, C)
[ "Args", ":", "windows", ":", "(", "num_windows", "*", "B", "window_size", "window_size", "C", ")", "window_size", "(", "int", ")", ":", "Window", "size", "H", "(", "int", ")", ":", "Height", "of", "image", "W", "(", "int", ")", ":", "Width", "of", ...
def window_reverse(windows, window_size, H, W): """ Args: windows: (num_windows*B, window_size, window_size, C) window_size (int): Window size H (int): Height of image W (int): Width of image Returns: x: (B, H, W, C) """ B = int(windows.shape[0] / (H * W / win...
[ "def", "window_reverse", "(", "windows", ",", "window_size", ",", "H", ",", "W", ")", ":", "B", "=", "int", "(", "windows", ".", "shape", "[", "0", "]", "/", "(", "H", "*", "W", "/", "window_size", "/", "window_size", ")", ")", "x", "=", "windows...
https://github.com/PaddlePaddle/PaddleDetection/blob/635e3e0a80f3d05751cdcfca8af04ee17c601a92/ppdet/modeling/backbones/swin_transformer.py#L121-L135
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
source/addons/share/wizard/share_wizard.py
python
share_wizard._cleanup_action_context
(self, context_str, user_id)
return result
Returns a dict representing the context_str evaluated (safe_eval) as a dict where items that are not useful for shared actions have been removed. If the evaluation of context_str as a dict fails, context_str is returned unaltered. :param user_id: the integer uid to be passed...
Returns a dict representing the context_str evaluated (safe_eval) as a dict where items that are not useful for shared actions have been removed. If the evaluation of context_str as a dict fails, context_str is returned unaltered.
[ "Returns", "a", "dict", "representing", "the", "context_str", "evaluated", "(", "safe_eval", ")", "as", "a", "dict", "where", "items", "that", "are", "not", "useful", "for", "shared", "actions", "have", "been", "removed", ".", "If", "the", "evaluation", "of"...
def _cleanup_action_context(self, context_str, user_id): """Returns a dict representing the context_str evaluated (safe_eval) as a dict where items that are not useful for shared actions have been removed. If the evaluation of context_str as a dict fails, context_str is returned...
[ "def", "_cleanup_action_context", "(", "self", ",", "context_str", ",", "user_id", ")", ":", "result", "=", "False", "if", "context_str", ":", "try", ":", "context", "=", "safe_eval", "(", "context_str", ",", "tools", ".", "UnquoteEvalContext", "(", ")", ","...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/source/addons/share/wizard/share_wizard.py#L305-L330
nortikin/sverchok
7b460f01317c15f2681bfa3e337c5e7346f3711b
nodes/generator/box_mk2.py
python
SvBoxNodeMk2.draw_buttons_ext
(self, context, layout)
draw buttons on the N-panel
draw buttons on the N-panel
[ "draw", "buttons", "on", "the", "N", "-", "panel" ]
def draw_buttons_ext(self, context, layout): '''draw buttons on the N-panel''' layout.prop(self, "origin", expand=True) layout.label(text="Simplify Output:") layout.prop(self, "correct_output", expand=True) layout.separator() layout.label(text="List Match:") layo...
[ "def", "draw_buttons_ext", "(", "self", ",", "context", ",", "layout", ")", ":", "layout", ".", "prop", "(", "self", ",", "\"origin\"", ",", "expand", "=", "True", ")", "layout", ".", "label", "(", "text", "=", "\"Simplify Output:\"", ")", "layout", ".",...
https://github.com/nortikin/sverchok/blob/7b460f01317c15f2681bfa3e337c5e7346f3711b/nodes/generator/box_mk2.py#L328-L341
ahmetcemturan/SFACT
7576e29ba72b33e5058049b77b7b558875542747
fabmetheus_utilities/gcodec.py
python
DistanceFeedRate.addFlowRateLine
(self, flowRate)
Add a flow rate line.
Add a flow rate line.
[ "Add", "a", "flow", "rate", "line", "." ]
def addFlowRateLine(self, flowRate): 'Add a flow rate line.' self.output.write('M108 S%s\n' % euclidean.getFourSignificantFigures(flowRate))
[ "def", "addFlowRateLine", "(", "self", ",", "flowRate", ")", ":", "self", ".", "output", ".", "write", "(", "'M108 S%s\\n'", "%", "euclidean", ".", "getFourSignificantFigures", "(", "flowRate", ")", ")" ]
https://github.com/ahmetcemturan/SFACT/blob/7576e29ba72b33e5058049b77b7b558875542747/fabmetheus_utilities/gcodec.py#L268-L270
aiidateam/aiida-core
c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2
aiida/orm/nodes/data/array/projection.py
python
ProjectionData.get_pdos
(self, **kwargs)
return out_list
Retrieves all the pdos arrays corresponding to the input kwargs :param kwargs: inputs describing the orbitals associated with the pdos arrays :return: a list of tuples containing the orbital, energy array and pdos array associated with all orbitals that correspon...
Retrieves all the pdos arrays corresponding to the input kwargs
[ "Retrieves", "all", "the", "pdos", "arrays", "corresponding", "to", "the", "input", "kwargs" ]
def get_pdos(self, **kwargs): """ Retrieves all the pdos arrays corresponding to the input kwargs :param kwargs: inputs describing the orbitals associated with the pdos arrays :return: a list of tuples containing the orbital, energy array and pdos ...
[ "def", "get_pdos", "(", "self", ",", "*", "*", "kwargs", ")", ":", "retrieve_indices", ",", "all_orbitals", "=", "self", ".", "_find_orbitals_and_indices", "(", "*", "*", "kwargs", ")", "out_list", "=", "[", "(", "all_orbitals", "[", "i", "]", ",", "self...
https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/orm/nodes/data/array/projection.py#L123-L138
osirislab/Fentanyl
6635ec80bade773125c3444bf8ab1bb0761f4aec
main.py
python
undo
()
[]
def undo(): if ftl.undo() is None: print "Nothing to undo"
[ "def", "undo", "(", ")", ":", "if", "ftl", ".", "undo", "(", ")", "is", "None", ":", "print", "\"Nothing to undo\"" ]
https://github.com/osirislab/Fentanyl/blob/6635ec80bade773125c3444bf8ab1bb0761f4aec/main.py#L97-L99
coinbase/coinbase-python
497c28158f529e8c7d0228521b4386a890baf088
coinbase/wallet/client.py
python
Client.commit_withdrawal
(self, account_id, withdrawal_id, **params)
return self._make_api_object(response, Withdrawal)
https://developers.coinbase.com/api/v2#commit-a-withdrawal
https://developers.coinbase.com/api/v2#commit-a-withdrawal
[ "https", ":", "//", "developers", ".", "coinbase", ".", "com", "/", "api", "/", "v2#commit", "-", "a", "-", "withdrawal" ]
def commit_withdrawal(self, account_id, withdrawal_id, **params): """https://developers.coinbase.com/api/v2#commit-a-withdrawal""" response = self._post( 'v2', 'accounts', account_id, 'withdrawals', withdrawal_id, 'commit', data=params) return self._make_api_object(respon...
[ "def", "commit_withdrawal", "(", "self", ",", "account_id", ",", "withdrawal_id", ",", "*", "*", "params", ")", ":", "response", "=", "self", ".", "_post", "(", "'v2'", ",", "'accounts'", ",", "account_id", ",", "'withdrawals'", ",", "withdrawal_id", ",", ...
https://github.com/coinbase/coinbase-python/blob/497c28158f529e8c7d0228521b4386a890baf088/coinbase/wallet/client.py#L534-L539
privacyidea/privacyidea
9490c12ddbf77a34ac935b082d09eb583dfafa2c
privacyidea/lib/eventhandler/responsemangler.py
python
ResponseManglerEventHandler.allowed_positions
(cls)
return ["post"]
This returns the allowed positions of the event handler definition. The ResponseMangler can only be located at the "post" position :return: list of allowed positions
This returns the allowed positions of the event handler definition. The ResponseMangler can only be located at the "post" position
[ "This", "returns", "the", "allowed", "positions", "of", "the", "event", "handler", "definition", ".", "The", "ResponseMangler", "can", "only", "be", "located", "at", "the", "post", "position" ]
def allowed_positions(cls): """ This returns the allowed positions of the event handler definition. The ResponseMangler can only be located at the "post" position :return: list of allowed positions """ return ["post"]
[ "def", "allowed_positions", "(", "cls", ")", ":", "return", "[", "\"post\"", "]" ]
https://github.com/privacyidea/privacyidea/blob/9490c12ddbf77a34ac935b082d09eb583dfafa2c/privacyidea/lib/eventhandler/responsemangler.py#L60-L67
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/CPython/27/Lib/xml/dom/expatbuilder.py
python
parseFragment
(file, context, namespaces=True)
return result
Parse a fragment of a document, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. 'file' may be either a file name or an open file object.
Parse a fragment of a document, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment.
[ "Parse", "a", "fragment", "of", "a", "document", "given", "the", "context", "from", "which", "it", "was", "originally", "extracted", ".", "context", "should", "be", "the", "parent", "of", "the", "node", "(", "s", ")", "which", "are", "in", "the", "fragme...
def parseFragment(file, context, namespaces=True): """Parse a fragment of a document, given the context from which it was originally extracted. context should be the parent of the node(s) which are in the fragment. 'file' may be either a file name or an open file object. """ if namespaces: ...
[ "def", "parseFragment", "(", "file", ",", "context", ",", "namespaces", "=", "True", ")", ":", "if", "namespaces", ":", "builder", "=", "FragmentBuilderNS", "(", "context", ")", "else", ":", "builder", "=", "FragmentBuilder", "(", "context", ")", "if", "is...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/xml/dom/expatbuilder.py#L943-L963
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/core/management/commands/compilemessages.py
python
Command.handle
(self, **options)
[]
def handle(self, **options): locale = options['locale'] exclude = options['exclude'] self.verbosity = options['verbosity'] if options['fuzzy']: self.program_options = self.program_options + ['-f'] if find_command(self.program) is None: raise CommandError(...
[ "def", "handle", "(", "self", ",", "*", "*", "options", ")", ":", "locale", "=", "options", "[", "'locale'", "]", "exclude", "=", "options", "[", "'exclude'", "]", "self", ".", "verbosity", "=", "options", "[", "'verbosity'", "]", "if", "options", "[",...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/core/management/commands/compilemessages.py#L53-L103
Yelp/paasta
6c08c04a577359509575c794b973ea84d72accf9
paasta_tools/cli/cmds/cook_image.py
python
paasta_cook_image
(args, service=None, soa_dir=None)
Build a docker image
Build a docker image
[ "Build", "a", "docker", "image" ]
def paasta_cook_image(args, service=None, soa_dir=None): """Build a docker image""" if not service: service = args.service if service.startswith("services-"): service = service.split("services-", 1)[1] if not soa_dir: soa_dir = args.yelpsoa_config_root validate_service_name(s...
[ "def", "paasta_cook_image", "(", "args", ",", "service", "=", "None", ",", "soa_dir", "=", "None", ")", ":", "if", "not", "service", ":", "service", "=", "args", ".", "service", "if", "service", ".", "startswith", "(", "\"services-\"", ")", ":", "service...
https://github.com/Yelp/paasta/blob/6c08c04a577359509575c794b973ea84d72accf9/paasta_tools/cli/cmds/cook_image.py#L60-L109
Pyomo/pyomo
dbd4faee151084f343b893cc2b0c04cf2b76fd92
pyomo/core/base/expression.py
python
ScalarExpression.expr
(self)
Return expression on this expression.
Return expression on this expression.
[ "Return", "expression", "on", "this", "expression", "." ]
def expr(self): """Return expression on this expression.""" if self._constructed: return _GeneralExpressionData.expr.fget(self) raise ValueError( "Accessing the expression of expression '%s' " "before the Expression has been constructed (there " "i...
[ "def", "expr", "(", "self", ")", ":", "if", "self", ".", "_constructed", ":", "return", "_GeneralExpressionData", ".", "expr", ".", "fget", "(", "self", ")", "raise", "ValueError", "(", "\"Accessing the expression of expression '%s' \"", "\"before the Expression has b...
https://github.com/Pyomo/pyomo/blob/dbd4faee151084f343b893cc2b0c04cf2b76fd92/pyomo/core/base/expression.py#L393-L401
cgre-aachen/gempy
6ad16c46fc6616c9f452fba85d31ce32decd8b10
gempy/core/data.py
python
AdditionalData.update_structure
(self)
Update fields dependent on input data sucha as structure and universal kriging grade
Update fields dependent on input data sucha as structure and universal kriging grade
[ "Update", "fields", "dependent", "on", "input", "data", "sucha", "as", "structure", "and", "universal", "kriging", "grade" ]
def update_structure(self): """ Update fields dependent on input data sucha as structure and universal kriging grade """ self.structure_data.update_structure_from_input() if len(self.kriging_data.df.loc['values', 'drift equations']) < \ self.structure_data.df.loc[...
[ "def", "update_structure", "(", "self", ")", ":", "self", ".", "structure_data", ".", "update_structure_from_input", "(", ")", "if", "len", "(", "self", ".", "kriging_data", ".", "df", ".", "loc", "[", "'values'", ",", "'drift equations'", "]", ")", "<", "...
https://github.com/cgre-aachen/gempy/blob/6ad16c46fc6616c9f452fba85d31ce32decd8b10/gempy/core/data.py#L1355-L1362
henkelis/sonospy
841f52010fd6e1e932d8f1a8896ad4e5a0667b8a
web2py/gluon/sneaky2.py
python
Sneaky.__init__
(self, bind_addr, wsgi_app, numthreads = 10, server_name = SERVER_NAME, max_threads = None, request_queue_size = None, timeout = 10, shutdown_timeout = 5, numprocesses=1, dispatcherpo...
Example:: s = Sneaky('127.0.0.1:8000',test_wsgi_app,100) s.start() :bind_addr can be ('127.0.0.1',8000) or '127.0.0.1:8000' :wsgi_app is a generic WSGI application :numthreads is the min number of threads (10 by default) :server_name ("Skeaky" by default) :max_t...
Example::
[ "Example", "::" ]
def __init__(self, bind_addr, wsgi_app, numthreads = 10, server_name = SERVER_NAME, max_threads = None, request_queue_size = None, timeout = 10, shutdown_timeout = 5, numprocesses=1, ...
[ "def", "__init__", "(", "self", ",", "bind_addr", ",", "wsgi_app", ",", "numthreads", "=", "10", ",", "server_name", "=", "SERVER_NAME", ",", "max_threads", "=", "None", ",", "request_queue_size", "=", "None", ",", "timeout", "=", "10", ",", "shutdown_timeou...
https://github.com/henkelis/sonospy/blob/841f52010fd6e1e932d8f1a8896ad4e5a0667b8a/web2py/gluon/sneaky2.py#L366-L406
everydo/ztq
0237239626c9662ffa47879b590a534b2287c5d1
ztq_worker/ztq_worker/command_execute.py
python
cancel_transform
(pid, timestamp)
取消 转换
取消 转换
[ "取消", "转换" ]
def cancel_transform(pid, timestamp): """ 取消 转换 """ kill(pid)
[ "def", "cancel_transform", "(", "pid", ",", "timestamp", ")", ":", "kill", "(", "pid", ")" ]
https://github.com/everydo/ztq/blob/0237239626c9662ffa47879b590a534b2287c5d1/ztq_worker/ztq_worker/command_execute.py#L97-L99
django-parler/django-parler
577ca2f4a80713a9272c48db30e914a4d9332358
parler/managers.py
python
TranslatableQuerySet._clone
(self)
return c
[]
def _clone(self): c = super()._clone() c._language = self._language return c
[ "def", "_clone", "(", "self", ")", ":", "c", "=", "super", "(", ")", ".", "_clone", "(", ")", "c", ".", "_language", "=", "self", ".", "_language", "return", "c" ]
https://github.com/django-parler/django-parler/blob/577ca2f4a80713a9272c48db30e914a4d9332358/parler/managers.py#L26-L29
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/agw/flatnotebook.py
python
FNBRendererVC71.DrawTab
(self, pageContainer, dc, posx, tabIdx, tabWidth, tabHeight, btnStatus)
Draws a tab using the `VC71` style. :param `pageContainer`: an instance of :class:`FlatNotebook`; :param `dc`: an instance of :class:`wx.DC`; :param `posx`: the x position of the tab; :param `tabIdx`: the index of the tab; :param `tabWidth`: the tab's width; :param `tabH...
Draws a tab using the `VC71` style.
[ "Draws", "a", "tab", "using", "the", "VC71", "style", "." ]
def DrawTab(self, pageContainer, dc, posx, tabIdx, tabWidth, tabHeight, btnStatus): """ Draws a tab using the `VC71` style. :param `pageContainer`: an instance of :class:`FlatNotebook`; :param `dc`: an instance of :class:`wx.DC`; :param `posx`: the x position of the tab; ...
[ "def", "DrawTab", "(", "self", ",", "pageContainer", ",", "dc", ",", "posx", ",", "tabIdx", ",", "tabWidth", ",", "tabHeight", ",", "btnStatus", ")", ":", "# Visual studio 7.1 style", "borderPen", "=", "wx", ".", "Pen", "(", "wx", ".", "SystemSettings", "....
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/flatnotebook.py#L2801-L2908
kubeflow/pipelines
bea751c9259ff0ae85290f873170aae89284ba8e
backend/api/python_http_client/kfp_server_api/api/pipeline_service_api.py
python
PipelineServiceApi.delete_pipeline_version
(self, version_id, **kwargs)
return self.delete_pipeline_version_with_http_info(version_id, **kwargs)
Deletes a pipeline version by pipeline version ID. If the deleted pipeline version is the default pipeline version, the pipeline's default version changes to the pipeline's most recent pipeline version. If there are no remaining pipeline versions, the pipeline will have no default version. Examines the run_service_api....
Deletes a pipeline version by pipeline version ID. If the deleted pipeline version is the default pipeline version, the pipeline's default version changes to the pipeline's most recent pipeline version. If there are no remaining pipeline versions, the pipeline will have no default version. Examines the run_service_api....
[ "Deletes", "a", "pipeline", "version", "by", "pipeline", "version", "ID", ".", "If", "the", "deleted", "pipeline", "version", "is", "the", "default", "pipeline", "version", "the", "pipeline", "s", "default", "version", "changes", "to", "the", "pipeline", "s", ...
def delete_pipeline_version(self, version_id, **kwargs): # noqa: E501 """Deletes a pipeline version by pipeline version ID. If the deleted pipeline version is the default pipeline version, the pipeline's default version changes to the pipeline's most recent pipeline version. If there are no remaining pipeline ...
[ "def", "delete_pipeline_version", "(", "self", ",", "version_id", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "return", "self", ".", "delete_pipeline_version_with_http_info", "(", "version_id", ",",...
https://github.com/kubeflow/pipelines/blob/bea751c9259ff0ae85290f873170aae89284ba8e/backend/api/python_http_client/kfp_server_api/api/pipeline_service_api.py#L413-L439
Cadene/pretrained-models.pytorch
8aae3d8f1135b6b13fed79c1d431e3449fdbf6e0
pretrainedmodels/models/inceptionresnetv2.py
python
Mixed_7a.__init__
(self)
[]
def __init__(self): super(Mixed_7a, self).__init__() self.branch0 = nn.Sequential( BasicConv2d(1088, 256, kernel_size=1, stride=1), BasicConv2d(256, 384, kernel_size=3, stride=2) ) self.branch1 = nn.Sequential( BasicConv2d(1088, 256, kernel_size=1, s...
[ "def", "__init__", "(", "self", ")", ":", "super", "(", "Mixed_7a", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "branch0", "=", "nn", ".", "Sequential", "(", "BasicConv2d", "(", "1088", ",", "256", ",", "kernel_size", "=", "1", ",", "...
https://github.com/Cadene/pretrained-models.pytorch/blob/8aae3d8f1135b6b13fed79c1d431e3449fdbf6e0/pretrainedmodels/models/inceptionresnetv2.py#L173-L192
TengXiaoDai/DistributedCrawling
f5c2439e6ce68dd9b49bde084d76473ff9ed4963
Lib/site-packages/pkg_resources/__init__.py
python
VersionConflict.with_context
(self, required_by)
return ContextualVersionConflict(*args)
If required_by is non-empty, return a version of self that is a ContextualVersionConflict.
If required_by is non-empty, return a version of self that is a ContextualVersionConflict.
[ "If", "required_by", "is", "non", "-", "empty", "return", "a", "version", "of", "self", "that", "is", "a", "ContextualVersionConflict", "." ]
def with_context(self, required_by): """ If required_by is non-empty, return a version of self that is a ContextualVersionConflict. """ if not required_by: return self args = self.args + (required_by,) return ContextualVersionConflict(*args)
[ "def", "with_context", "(", "self", ",", "required_by", ")", ":", "if", "not", "required_by", ":", "return", "self", "args", "=", "self", ".", "args", "+", "(", "required_by", ",", ")", "return", "ContextualVersionConflict", "(", "*", "args", ")" ]
https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/site-packages/pkg_resources/__init__.py#L348-L356
django-oscar/django-oscar-accounts
8a6dc3b42306979779f048b4d3ed0a9fd4a2f794
src/oscar_accounts/dashboard/views.py
python
AccountCreateView.form_valid
(self, form)
return http.HttpResponseRedirect( reverse('accounts_dashboard:accounts-detail', kwargs={'pk': account.id}))
[]
def form_valid(self, form): account = form.save() # Load transaction source = form.get_source_account() amount = form.cleaned_data['initial_amount'] try: facade.transfer(source, account, amount, user=self.request.user, ...
[ "def", "form_valid", "(", "self", ",", "form", ")", ":", "account", "=", "form", ".", "save", "(", ")", "# Load transaction", "source", "=", "form", ".", "get_source_account", "(", ")", "amount", "=", "form", ".", "cleaned_data", "[", "'initial_amount'", "...
https://github.com/django-oscar/django-oscar-accounts/blob/8a6dc3b42306979779f048b4d3ed0a9fd4a2f794/src/oscar_accounts/dashboard/views.py#L92-L112
google/trax
d6cae2067dedd0490b78d831033607357e975015
trax/layers/research/sparsity.py
python
FavorAttention.forward
(self, inputs)
return renormalized_attention, mask
[]
def forward(self, inputs): query, key, value, mask = inputs if self._use_approximate_softmax: query_prime = self.nonnegative_softmax_kernel_feature_creator(query, True) key_prime = self.nonnegative_softmax_kernel_feature_creator(key, False) else: query_prime = self.relu(query) + self._nume...
[ "def", "forward", "(", "self", ",", "inputs", ")", ":", "query", ",", "key", ",", "value", ",", "mask", "=", "inputs", "if", "self", ".", "_use_approximate_softmax", ":", "query_prime", "=", "self", ".", "nonnegative_softmax_kernel_feature_creator", "(", "quer...
https://github.com/google/trax/blob/d6cae2067dedd0490b78d831033607357e975015/trax/layers/research/sparsity.py#L911-L935
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Lib/site-packages/pythonwin/pywin/framework/app.py
python
CheckCreateDefaultGUI
()
return rc
Checks and creates if necessary a default GUI environment.
Checks and creates if necessary a default GUI environment.
[ "Checks", "and", "creates", "if", "necessary", "a", "default", "GUI", "environment", "." ]
def CheckCreateDefaultGUI(): """Checks and creates if necessary a default GUI environment. """ rc = HaveGoodGUI() if not rc: CreateDefaultGUI() return rc
[ "def", "CheckCreateDefaultGUI", "(", ")", ":", "rc", "=", "HaveGoodGUI", "(", ")", "if", "not", "rc", ":", "CreateDefaultGUI", "(", ")", "return", "rc" ]
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/site-packages/pythonwin/pywin/framework/app.py#L399-L405
ring04h/wyportmap
c4201e2313504e780a7f25238eba2a2d3223e739
libnmap/objects/host.py
python
NmapHost.os_fingerprint
(self)
return rval
Returns the fingerprint of the scanned system. :return: string
Returns the fingerprint of the scanned system.
[ "Returns", "the", "fingerprint", "of", "the", "scanned", "system", "." ]
def os_fingerprint(self): """ Returns the fingerprint of the scanned system. :return: string """ rval = '' if self.os is not None: rval = "\n".join(self.os.fingerprints) return rval
[ "def", "os_fingerprint", "(", "self", ")", ":", "rval", "=", "''", "if", "self", ".", "os", "is", "not", "None", ":", "rval", "=", "\"\\n\"", ".", "join", "(", "self", ".", "os", ".", "fingerprints", ")", "return", "rval" ]
https://github.com/ring04h/wyportmap/blob/c4201e2313504e780a7f25238eba2a2d3223e739/libnmap/objects/host.py#L333-L342
Guanghan/lighttrack
a980585acb4189da12f5d3dec68b5c3cd1b69de9
detector/detector_utils.py
python
compute_ap
(recall, precision)
return ap
Compute the average precision, given the recall and precision curves. Code originally from https://github.com/rbgirshick/py-faster-rcnn. # Arguments recall: The recall curve (list). precision: The precision curve (list). # Returns The average precision as computed in py-faster-rc...
Compute the average precision, given the recall and precision curves. Code originally from https://github.com/rbgirshick/py-faster-rcnn.
[ "Compute", "the", "average", "precision", "given", "the", "recall", "and", "precision", "curves", ".", "Code", "originally", "from", "https", ":", "//", "github", ".", "com", "/", "rbgirshick", "/", "py", "-", "faster", "-", "rcnn", "." ]
def compute_ap(recall, precision): """ Compute the average precision, given the recall and precision curves. Code originally from https://github.com/rbgirshick/py-faster-rcnn. # Arguments recall: The recall curve (list). precision: The precision curve (list). # Returns The av...
[ "def", "compute_ap", "(", "recall", ",", "precision", ")", ":", "# correct AP calculation", "# first append sentinel values at the end", "mrec", "=", "np", ".", "concatenate", "(", "(", "[", "0.0", "]", ",", "recall", ",", "[", "1.0", "]", ")", ")", "mpre", ...
https://github.com/Guanghan/lighttrack/blob/a980585acb4189da12f5d3dec68b5c3cd1b69de9/detector/detector_utils.py#L124-L149
s-leger/archipack
5a6243bf1edf08a6b429661ce291dacb551e5f8a
pygeos/geomgraph.py
python
DirectedEdgeStar._computeDepths
(self, start: int, end: int, startDepth: int)
return currDepth
* Compute the DirectedEdge depths for a subsequence of the edge array. * * @return the last depth assigned (from the R side of the last edge visited)
* Compute the DirectedEdge depths for a subsequence of the edge array. * *
[ "*", "Compute", "the", "DirectedEdge", "depths", "for", "a", "subsequence", "of", "the", "edge", "array", ".", "*", "*" ]
def _computeDepths(self, start: int, end: int, startDepth: int) -> int: """ * Compute the DirectedEdge depths for a subsequence of the edge array. * * @return the last depth assigned (from the R side of the last edge visited) """ currDepth = startDepth for i in...
[ "def", "_computeDepths", "(", "self", ",", "start", ":", "int", ",", "end", ":", "int", ",", "startDepth", ":", "int", ")", "->", "int", ":", "currDepth", "=", "startDepth", "for", "i", "in", "range", "(", "start", ",", "end", ")", ":", "de", "=", ...
https://github.com/s-leger/archipack/blob/5a6243bf1edf08a6b429661ce291dacb551e5f8a/pygeos/geomgraph.py#L2221-L2233
ambakick/Person-Detection-and-Tracking
f925394ac29b5cf321f1ce89a71b193381519a0b
meta_architectures/faster_rcnn_meta_arch.py
python
FasterRCNNMetaArch._loss_rpn
(self, rpn_box_encodings, rpn_objectness_predictions_with_background, anchors, groundtruth_boxlists, groundtruth_classes_with_background_list, groundtruth_weights_list)
return loss_dict
Computes scalar RPN loss tensors. Uses self._proposal_target_assigner to obtain regression and classification targets for the first stage RPN, samples a "minibatch" of anchors to participate in the loss computation, and returns the RPN losses. Args: rpn_box_encodings: A 4-D float tensor of shape...
Computes scalar RPN loss tensors.
[ "Computes", "scalar", "RPN", "loss", "tensors", "." ]
def _loss_rpn(self, rpn_box_encodings, rpn_objectness_predictions_with_background, anchors, groundtruth_boxlists, groundtruth_classes_with_background_list, groundtruth_weights_list): """Computes scalar RPN loss tensors. Uses self._proposal_target_assigner to obta...
[ "def", "_loss_rpn", "(", "self", ",", "rpn_box_encodings", ",", "rpn_objectness_predictions_with_background", ",", "anchors", ",", "groundtruth_boxlists", ",", "groundtruth_classes_with_background_list", ",", "groundtruth_weights_list", ")", ":", "with", "tf", ".", "name_sc...
https://github.com/ambakick/Person-Detection-and-Tracking/blob/f925394ac29b5cf321f1ce89a71b193381519a0b/meta_architectures/faster_rcnn_meta_arch.py#L1616-L1694
1012598167/flask_mongodb_game
60c7e0351586656ec38f851592886338e50b4110
python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_internal/download.py
python
_copy_dist_from_dir
(link_path, location)
Copy distribution files in `link_path` to `location`. Invoked when user requests to install a local directory. E.g.: pip install . pip install ~/dev/git-repos/python-prompt-toolkit
Copy distribution files in `link_path` to `location`.
[ "Copy", "distribution", "files", "in", "link_path", "to", "location", "." ]
def _copy_dist_from_dir(link_path, location): """Copy distribution files in `link_path` to `location`. Invoked when user requests to install a local directory. E.g.: pip install . pip install ~/dev/git-repos/python-prompt-toolkit """ # Note: This is currently VERY SLOW if you have a ...
[ "def", "_copy_dist_from_dir", "(", "link_path", ",", "location", ")", ":", "# Note: This is currently VERY SLOW if you have a lot of data in the", "# directory, because it copies everything with `shutil.copytree`.", "# What it should really do is build an sdist and install that.", "# See https...
https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_internal/download.py#L770-L803
q1x/zabbix-gnomes
a3f62f567bedbd66df24247b0c8803567d9e5c0e
zgetevent.py
python
get_terminal_height
(fd=1)
return height
Returns height of terminal if it is a tty, 999 otherwise :param fd: file descriptor (default: 1=stdout)
Returns height of terminal if it is a tty, 999 otherwise
[ "Returns", "height", "of", "terminal", "if", "it", "is", "a", "tty", "999", "otherwise" ]
def get_terminal_height(fd=1): """ Returns height of terminal if it is a tty, 999 otherwise :param fd: file descriptor (default: 1=stdout) """ if os.isatty(fd): height = get_terminal_size(fd)[0] else: height = 999 return height
[ "def", "get_terminal_height", "(", "fd", "=", "1", ")", ":", "if", "os", ".", "isatty", "(", "fd", ")", ":", "height", "=", "get_terminal_size", "(", "fd", ")", "[", "0", "]", "else", ":", "height", "=", "999", "return", "height" ]
https://github.com/q1x/zabbix-gnomes/blob/a3f62f567bedbd66df24247b0c8803567d9e5c0e/zgetevent.py#L102-L113
shiyanhui/Young
184d2d85831b0c54db1002fad9ac1bce98738bf6
app/community/document.py
python
TopicDocument.get_topic_number
(node_id=None)
统计某节点下共有多少话题
统计某节点下共有多少话题
[ "统计某节点下共有多少话题" ]
def get_topic_number(node_id=None): '''统计某节点下共有多少话题''' if node_id: count = yield TopicDocument.find({ 'nodes': DBRef( NodeDocument.meta['collection'], ObjectId(node_id) ) }).count() else: ...
[ "def", "get_topic_number", "(", "node_id", "=", "None", ")", ":", "if", "node_id", ":", "count", "=", "yield", "TopicDocument", ".", "find", "(", "{", "'nodes'", ":", "DBRef", "(", "NodeDocument", ".", "meta", "[", "'collection'", "]", ",", "ObjectId", "...
https://github.com/shiyanhui/Young/blob/184d2d85831b0c54db1002fad9ac1bce98738bf6/app/community/document.py#L347-L360
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/glance/glance/store/__init__.py
python
delete_from_backend
(context, uri, **kwargs)
Removes chunks of data from backend specified by uri
Removes chunks of data from backend specified by uri
[ "Removes", "chunks", "of", "data", "from", "backend", "specified", "by", "uri" ]
def delete_from_backend(context, uri, **kwargs): """Removes chunks of data from backend specified by uri""" loc = location.get_location_from_uri(uri) store = get_store_from_uri(context, uri, loc) try: return store.delete(loc) except NotImplementedError: raise exception.StoreDeleteNo...
[ "def", "delete_from_backend", "(", "context", ",", "uri", ",", "*", "*", "kwargs", ")", ":", "loc", "=", "location", ".", "get_location_from_uri", "(", "uri", ")", "store", "=", "get_store_from_uri", "(", "context", ",", "uri", ",", "loc", ")", "try", ":...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/glance/glance/store/__init__.py#L231-L239
fofix/fofix
7730d1503c66562b901f62b33a5bd46c3d5e5c34
fofix/game/song/song.py
python
Song.refreshVolumes
(self)
Refresh the miss volume after a pause
Refresh the miss volume after a pause
[ "Refresh", "the", "miss", "volume", "after", "a", "pause" ]
def refreshVolumes(self): """ Refresh the miss volume after a pause """ if self.singleTrackSong: # force single-track miss volume setting instead self.missVolume = self.engine.config.get("audio", "single_track_miss_volume") else: self.missVolume = self.engine....
[ "def", "refreshVolumes", "(", "self", ")", ":", "if", "self", ".", "singleTrackSong", ":", "# force single-track miss volume setting instead", "self", ".", "missVolume", "=", "self", ".", "engine", ".", "config", ".", "get", "(", "\"audio\"", ",", "\"single_track_...
https://github.com/fofix/fofix/blob/7730d1503c66562b901f62b33a5bd46c3d5e5c34/fofix/game/song/song.py#L1957-L1965
locuslab/deq
1fb7059d6d89bb26d16da80ab9489dcc73fc5472
MDEQ-Vision/tools/seg_train.py
python
parse_args
()
return args
[]
def parse_args(): parser = argparse.ArgumentParser(description='Train segmentation network') parser.add_argument('--cfg', help='experiment configure file name', required=True, type=str) parser.add_argument('--modelDir', ...
[ "def", "parse_args", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Train segmentation network'", ")", "parser", ".", "add_argument", "(", "'--cfg'", ",", "help", "=", "'experiment configure file name'", ",", "required", ...
https://github.com/locuslab/deq/blob/1fb7059d6d89bb26d16da80ab9489dcc73fc5472/MDEQ-Vision/tools/seg_train.py#L34-L70
spender-sandbox/cuckoo-modified
eb93ef3d41b8fee51b4330306dcd315d8101e021
lib/cuckoo/common/office/pyparsing.py
python
pyparsing_common.stripHTMLTags
(s, l, tokens)
return pyparsing_common._html_stripper.transformString(tokens[0])
Parse action to remove HTML tags from web page HTML source Example:: # strip HTML links from normal text text = '<td>More info at the <a href="http://pyparsing.wikispaces.com">pyparsing</a> wiki page</td>' td,td_end = makeHTMLTags("TD") table_text = td + SkipTo(...
Parse action to remove HTML tags from web page HTML source
[ "Parse", "action", "to", "remove", "HTML", "tags", "from", "web", "page", "HTML", "source" ]
def stripHTMLTags(s, l, tokens): """ Parse action to remove HTML tags from web page HTML source Example:: # strip HTML links from normal text text = '<td>More info at the <a href="http://pyparsing.wikispaces.com">pyparsing</a> wiki page</td>' td,td_end = mak...
[ "def", "stripHTMLTags", "(", "s", ",", "l", ",", "tokens", ")", ":", "return", "pyparsing_common", ".", "_html_stripper", ".", "transformString", "(", "tokens", "[", "0", "]", ")" ]
https://github.com/spender-sandbox/cuckoo-modified/blob/eb93ef3d41b8fee51b4330306dcd315d8101e021/lib/cuckoo/common/office/pyparsing.py#L5601-L5613
jinfagang/alfred
dd7420d1410f82f9dadf07a30b6fad5a71168001
alfred/dl/torch/train/fastai_optim.py
python
OptimWrapper.__getstate__
(self)
return self.opt.__getstate__()
[]
def __getstate__(self): return self.opt.__getstate__()
[ "def", "__getstate__", "(", "self", ")", ":", "return", "self", ".", "opt", ".", "__getstate__", "(", ")" ]
https://github.com/jinfagang/alfred/blob/dd7420d1410f82f9dadf07a30b6fad5a71168001/alfred/dl/torch/train/fastai_optim.py#L197-L198
qiniu/python-sdk
c160e086d4cb5591f389f2891f6da09b3451951c
qiniu/auth.py
python
Auth.__init__
(self, access_key, secret_key)
初始化Auth类
初始化Auth类
[ "初始化Auth类" ]
def __init__(self, access_key, secret_key): """初始化Auth类""" self.__checkKey(access_key, secret_key) self.__access_key = access_key self.__secret_key = b(secret_key)
[ "def", "__init__", "(", "self", ",", "access_key", ",", "secret_key", ")", ":", "self", ".", "__checkKey", "(", "access_key", ",", "secret_key", ")", "self", ".", "__access_key", "=", "access_key", "self", ".", "__secret_key", "=", "b", "(", "secret_key", ...
https://github.com/qiniu/python-sdk/blob/c160e086d4cb5591f389f2891f6da09b3451951c/qiniu/auth.py#L52-L56
securityclippy/elasticintel
aa08d3e9f5ab1c000128e95161139ce97ff0e334
ingest_feed_lambda/numpy/lib/type_check.py
python
isrealobj
(x)
return not iscomplexobj(x)
Return True if x is a not complex type or an array of complex numbers. The type of the input is checked, not the value. So even if the input has an imaginary part equal to zero, `isrealobj` evaluates to False if the data type is complex. Parameters ---------- x : any The input can be o...
Return True if x is a not complex type or an array of complex numbers.
[ "Return", "True", "if", "x", "is", "a", "not", "complex", "type", "or", "an", "array", "of", "complex", "numbers", "." ]
def isrealobj(x): """ Return True if x is a not complex type or an array of complex numbers. The type of the input is checked, not the value. So even if the input has an imaginary part equal to zero, `isrealobj` evaluates to False if the data type is complex. Parameters ---------- x : ...
[ "def", "isrealobj", "(", "x", ")", ":", "return", "not", "iscomplexobj", "(", "x", ")" ]
https://github.com/securityclippy/elasticintel/blob/aa08d3e9f5ab1c000128e95161139ce97ff0e334/ingest_feed_lambda/numpy/lib/type_check.py#L291-L323
facelessuser/BracketHighlighter
223ffd4ceafd58686503e3328934c039e959a88c
bh_regions.py
python
get_bracket_regions
(settings, minimap)
Get styled regions for brackets to use.
Get styled regions for brackets to use.
[ "Get", "styled", "regions", "for", "brackets", "to", "use", "." ]
def get_bracket_regions(settings, minimap): """Get styled regions for brackets to use.""" icon_path = "Packages/BracketHighlighter/icons" styles = settings.get("bracket_styles", DEFAULT_STYLES) user_styles = settings.get("user_bracket_styles", {}) # Merge user styles with default style object ...
[ "def", "get_bracket_regions", "(", "settings", ",", "minimap", ")", ":", "icon_path", "=", "\"Packages/BracketHighlighter/icons\"", "styles", "=", "settings", ".", "get", "(", "\"bracket_styles\"", ",", "DEFAULT_STYLES", ")", "user_styles", "=", "settings", ".", "ge...
https://github.com/facelessuser/BracketHighlighter/blob/223ffd4ceafd58686503e3328934c039e959a88c/bh_regions.py#L129-L157
zvtvz/zvt
054bf8a3e7a049df7087c324fa87e8effbaf5bdc
src/zvt/factors/algorithm.py
python
macd
( s: pd.Series, slow: int = 26, fast: int = 12, n: int = 9, return_type: str = "df", normal: bool = False, count_live_dead: bool = False, )
[]
def macd( s: pd.Series, slow: int = 26, fast: int = 12, n: int = 9, return_type: str = "df", normal: bool = False, count_live_dead: bool = False, ): # 短期均线 ema_fast = ema(s, window=fast) # 长期均线 ema_slow = ema(s, window=slow) # 短期均线 - 长期均线 = 趋势的力度 diff: pd.Series = em...
[ "def", "macd", "(", "s", ":", "pd", ".", "Series", ",", "slow", ":", "int", "=", "26", ",", "fast", ":", "int", "=", "12", ",", "n", ":", "int", "=", "9", ",", "return_type", ":", "str", "=", "\"df\"", ",", "normal", ":", "bool", "=", "False"...
https://github.com/zvtvz/zvt/blob/054bf8a3e7a049df7087c324fa87e8effbaf5bdc/src/zvt/factors/algorithm.py#L30-L72
weechat/scripts
99ec0e7eceefabb9efb0f11ec26d45d6e8e84335
python/urlserver.py
python
urlserver_server_fd_cb
(data, fd)
return weechat.WEECHAT_RC_OK
Callback for server socket.
Callback for server socket.
[ "Callback", "for", "server", "socket", "." ]
def urlserver_server_fd_cb(data, fd): """Callback for server socket.""" global urlserver, urlserver_settings if not urlserver['socket']: return weechat.WEECHAT_RC_OK conn, addr = urlserver['socket'].accept() if urlserver_settings['debug'] == 'on': weechat.prnt('', 'urlserver: connect...
[ "def", "urlserver_server_fd_cb", "(", "data", ",", "fd", ")", ":", "global", "urlserver", ",", "urlserver_settings", "if", "not", "urlserver", "[", "'socket'", "]", ":", "return", "weechat", ".", "WEECHAT_RC_OK", "conn", ",", "addr", "=", "urlserver", "[", "...
https://github.com/weechat/scripts/blob/99ec0e7eceefabb9efb0f11ec26d45d6e8e84335/python/urlserver.py#L637-L736
dansanderson/picotool
d8c51e58416f8010dc8c0fba3df5f0424b5bb852
pico8/lua/lua.py
python
LuaMinifyWriter.__init__
(self, *args, **kwargs)
[]
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._name_factory = MinifyNameFactory()
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "_name_factory", "=", "MinifyNameFactory", "(", ")" ]
https://github.com/dansanderson/picotool/blob/d8c51e58416f8010dc8c0fba3df5f0424b5bb852/pico8/lua/lua.py#L1339-L1341
selimsef/dfdc_deepfake_challenge
89c6290490bac96b29193a4061b3db9dd3933e36
training/datasets/classifier_dataset.py
python
blackout_convex_hull
(img)
[]
def blackout_convex_hull(img): try: rect = detector(img)[0] sp = predictor(img, rect) landmarks = np.array([[p.x, p.y] for p in sp.parts()]) outline = landmarks[[*range(17), *range(26, 16, -1)]] Y, X = skimage.draw.polygon(outline[:, 1], outline[:, 0]) cropped_img = n...
[ "def", "blackout_convex_hull", "(", "img", ")", ":", "try", ":", "rect", "=", "detector", "(", "img", ")", "[", "0", "]", "sp", "=", "predictor", "(", "img", ",", "rect", ")", "landmarks", "=", "np", ".", "array", "(", "[", "[", "p", ".", "x", ...
https://github.com/selimsef/dfdc_deepfake_challenge/blob/89c6290490bac96b29193a4061b3db9dd3933e36/training/datasets/classifier_dataset.py#L54-L85
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/calendar.py
python
isleap
(year)
return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
Return True for leap years, False for non-leap years.
Return True for leap years, False for non-leap years.
[ "Return", "True", "for", "leap", "years", "False", "for", "non", "-", "leap", "years", "." ]
def isleap(year): """Return True for leap years, False for non-leap years.""" return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
[ "def", "isleap", "(", "year", ")", ":", "return", "year", "%", "4", "==", "0", "and", "(", "year", "%", "100", "!=", "0", "or", "year", "%", "400", "==", "0", ")" ]
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/calendar.py#L97-L99
OpenWaterAnalytics/pyswmm
a73409b2a9ebf4131ba42fc4c03a69453fc29d9a
pyswmm/links.py
python
Link.volume
(self)
return self._model.getLinkResult(self._linkid, LinkResults.newVolume.value)
Get Link Results for Volume. If Simulation is not running this method will raise a warning and return 0. :return: Parameter Value :rtype: float Examples: >>> from pyswmm import Simulation, Links >>> >>> with Simulation('tests/data/TestModel1_weirSettin...
Get Link Results for Volume.
[ "Get", "Link", "Results", "for", "Volume", "." ]
def volume(self): """ Get Link Results for Volume. If Simulation is not running this method will raise a warning and return 0. :return: Parameter Value :rtype: float Examples: >>> from pyswmm import Simulation, Links >>> >>> with Simula...
[ "def", "volume", "(", "self", ")", ":", "return", "self", ".", "_model", ".", "getLinkResult", "(", "self", ".", "_linkid", ",", "LinkResults", ".", "newVolume", ".", "value", ")" ]
https://github.com/OpenWaterAnalytics/pyswmm/blob/a73409b2a9ebf4131ba42fc4c03a69453fc29d9a/pyswmm/links.py#L668-L693
skggm/skggm
46797d526bfd1c1717831463f17d9a752882c1b2
inverse_covariance/metrics.py
python
ebic
(covariance, precision, n_samples, n_features, gamma=0)
return ( -2.0 * l_theta + precision_nnz * np.log(n_samples) + 4.0 * precision_nnz * np.log(n_features) * gamma )
Extended Bayesian Information Criteria for model selection. When using path mode, use this as an alternative to cross-validation for finding lambda. See: "Extended Bayesian Information Criteria for Gaussian Graphical Models" R. Foygel and M. Drton, NIPS 2010 Parameters ---------- ...
Extended Bayesian Information Criteria for model selection.
[ "Extended", "Bayesian", "Information", "Criteria", "for", "model", "selection", "." ]
def ebic(covariance, precision, n_samples, n_features, gamma=0): """ Extended Bayesian Information Criteria for model selection. When using path mode, use this as an alternative to cross-validation for finding lambda. See: "Extended Bayesian Information Criteria for Gaussian Graphical Mode...
[ "def", "ebic", "(", "covariance", ",", "precision", ",", "n_samples", ",", "n_features", ",", "gamma", "=", "0", ")", ":", "l_theta", "=", "-", "np", ".", "sum", "(", "covariance", "*", "precision", ")", "+", "fast_logdet", "(", "precision", ")", "l_th...
https://github.com/skggm/skggm/blob/46797d526bfd1c1717831463f17d9a752882c1b2/inverse_covariance/metrics.py#L79-L130
dickreuter/Poker
b7642f0277e267e1a44eab957c4c7d1d8f50f4ee
poker/vboxapi/__init__.py
python
VirtualBoxManager.interruptWaitEvents
(self)
return self.platform.interruptWaitEvents()
See PlatformBase::interruptWaitEvents().
See PlatformBase::interruptWaitEvents().
[ "See", "PlatformBase", "::", "interruptWaitEvents", "()", "." ]
def interruptWaitEvents(self): """ See PlatformBase::interruptWaitEvents(). """ return self.platform.interruptWaitEvents()
[ "def", "interruptWaitEvents", "(", "self", ")", ":", "return", "self", ".", "platform", ".", "interruptWaitEvents", "(", ")" ]
https://github.com/dickreuter/Poker/blob/b7642f0277e267e1a44eab957c4c7d1d8f50f4ee/poker/vboxapi/__init__.py#L1111-L1113
nfvlabs/openmano
b09eabec0a168aeda8adc3ea99f734e45e810205
openmano/openmanoclient.py
python
openmanoclient.list_scenarios
(self, all_tenants=False, **kwargs)
return self._list_item("scenarios", all_tenants, kwargs)
Obtain a list of scenarios Params: can be filtered by 'uuid','name','description','public', "tenant_id" Return: Raises an exception on error Obtain a dictionary with format {'scenarios':[{scenario1_info},{scenario2_info},...]}}
Obtain a list of scenarios Params: can be filtered by 'uuid','name','description','public', "tenant_id" Return: Raises an exception on error Obtain a dictionary with format {'scenarios':[{scenario1_info},{scenario2_info},...]}}
[ "Obtain", "a", "list", "of", "scenarios", "Params", ":", "can", "be", "filtered", "by", "uuid", "name", "description", "public", "tenant_id", "Return", ":", "Raises", "an", "exception", "on", "error", "Obtain", "a", "dictionary", "with", "format", "{", "scen...
def list_scenarios(self, all_tenants=False, **kwargs): '''Obtain a list of scenarios Params: can be filtered by 'uuid','name','description','public', "tenant_id" Return: Raises an exception on error Obtain a dictionary with format {'scenarios':[{scenario1_info},{scenario2_info},....
[ "def", "list_scenarios", "(", "self", ",", "all_tenants", "=", "False", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_list_item", "(", "\"scenarios\"", ",", "all_tenants", ",", "kwargs", ")" ]
https://github.com/nfvlabs/openmano/blob/b09eabec0a168aeda8adc3ea99f734e45e810205/openmano/openmanoclient.py#L671-L677
taehoonlee/tensornets
c9b1d78f806892193efdebee2789a47fd148b984
tensornets/contrib_layers/rev_block_lib.py
python
RevBlock._forward
(self, x1, x2)
Run forward through the reversible layers.
Run forward through the reversible layers.
[ "Run", "forward", "through", "the", "reversible", "layers", "." ]
def _forward(self, x1, x2): """Run forward through the reversible layers.""" side_inputs = [self.f_side_input, self.g_side_input] flat_side_inputs = nest.flatten(side_inputs) def _forward_wrap(x1_, x2_, *flat_side_inputs): f_side, g_side = nest.pack_sequence_as(side_inputs, flat_side_inputs) ...
[ "def", "_forward", "(", "self", ",", "x1", ",", "x2", ")", ":", "side_inputs", "=", "[", "self", ".", "f_side_input", ",", "self", ".", "g_side_input", "]", "flat_side_inputs", "=", "nest", ".", "flatten", "(", "side_inputs", ")", "def", "_forward_wrap", ...
https://github.com/taehoonlee/tensornets/blob/c9b1d78f806892193efdebee2789a47fd148b984/tensornets/contrib_layers/rev_block_lib.py#L335-L362
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/orthopolys.py
python
dup_spherical_bessel_fn
(n, K)
return dup_lshift(seq[n], 1, K)
Low-level implementation of fn(n, x)
Low-level implementation of fn(n, x)
[ "Low", "-", "level", "implementation", "of", "fn", "(", "n", "x", ")" ]
def dup_spherical_bessel_fn(n, K): """ Low-level implementation of fn(n, x) """ seq = [[K.one], [K.one, K.zero]] for i in xrange(2, n + 1): a = dup_mul_ground(dup_lshift(seq[-1], 1, K), K(2*i - 1), K) seq.append(dup_sub(a, seq[-2], K)) return dup_lshift(seq[n], 1, K)
[ "def", "dup_spherical_bessel_fn", "(", "n", ",", "K", ")", ":", "seq", "=", "[", "[", "K", ".", "one", "]", ",", "[", "K", ".", "one", ",", "K", ".", "zero", "]", "]", "for", "i", "in", "xrange", "(", "2", ",", "n", "+", "1", ")", ":", "a...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/orthopolys.py#L260-L268
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/py_compile.py
python
PyCompileError.__str__
(self)
return self.msg
[]
def __str__(self): return self.msg
[ "def", "__str__", "(", "self", ")", ":", "return", "self", ".", "msg" ]
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/py_compile.py#L61-L62
pmbarrett314/curses-menu
574d2b32db937be9442ce9140c42368668bd7d77
cursesmenu/items/submenu_item.py
python
SubmenuItem.submenu
(self)
return self._submenu
Get the submenu associated with this item.
Get the submenu associated with this item.
[ "Get", "the", "submenu", "associated", "with", "this", "item", "." ]
def submenu(self) -> Optional[CursesMenu]: """Get the submenu associated with this item.""" return self._submenu
[ "def", "submenu", "(", "self", ")", "->", "Optional", "[", "CursesMenu", "]", ":", "return", "self", ".", "_submenu" ]
https://github.com/pmbarrett314/curses-menu/blob/574d2b32db937be9442ce9140c42368668bd7d77/cursesmenu/items/submenu_item.py#L44-L46
carpedm20/SPIRAL-tensorflow
2cca458f5d0d856c7bb73e877eea24906eda522f
models/policy.py
python
Policy.__init__
(self, args, env, scope_name, image_shape, action_sizes, data_format)
[]
def __init__(self, args, env, scope_name, image_shape, action_sizes, data_format): self.args = args scale = args.scale self.lstm_size = args.lstm_size if data_format == 'channels_first' and args.dynamic_channel: self.image_shape = list(image_shape[-1:] + ima...
[ "def", "__init__", "(", "self", ",", "args", ",", "env", ",", "scope_name", ",", "image_shape", ",", "action_sizes", ",", "data_format", ")", ":", "self", ".", "args", "=", "args", "scale", "=", "args", ".", "scale", "self", ".", "lstm_size", "=", "arg...
https://github.com/carpedm20/SPIRAL-tensorflow/blob/2cca458f5d0d856c7bb73e877eea24906eda522f/models/policy.py#L12-L173