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
mitogen-hq/mitogen
5b505f524a7ae170fe68613841ab92b299613d3f
ansible_mitogen/connection.py
python
_connect_ssh
(spec)
return { 'method': 'ssh', 'kwargs': { 'check_host_keys': check_host_keys, 'hostname': spec.remote_addr(), 'username': spec.remote_user(), 'compression': convert_bool( default(spec.mitogen_ssh_compression(), True) ), ...
Return ContextService arguments for an SSH connection.
Return ContextService arguments for an SSH connection.
[ "Return", "ContextService", "arguments", "for", "an", "SSH", "connection", "." ]
def _connect_ssh(spec): """ Return ContextService arguments for an SSH connection. """ if C.HOST_KEY_CHECKING: check_host_keys = 'enforce' else: check_host_keys = 'ignore' # #334: tilde-expand private_key_file to avoid implementation difference # between Python and OpenSSH. ...
[ "def", "_connect_ssh", "(", "spec", ")", ":", "if", "C", ".", "HOST_KEY_CHECKING", ":", "check_host_keys", "=", "'enforce'", "else", ":", "check_host_keys", "=", "'ignore'", "# #334: tilde-expand private_key_file to avoid implementation difference", "# between Python and Open...
https://github.com/mitogen-hq/mitogen/blob/5b505f524a7ae170fe68613841ab92b299613d3f/ansible_mitogen/connection.py#L119-L160
jina-ai/jina
c77a492fcd5adba0fc3de5347bea83dd4e7d8087
jina/helloworld/fashion/helper.py
python
index_generator
(num_docs: int, target: dict)
Generate the index data. :param num_docs: Number of documents to be indexed. :param target: Dictionary which stores the data paths :yields: index data
Generate the index data.
[ "Generate", "the", "index", "data", "." ]
def index_generator(num_docs: int, target: dict): """ Generate the index data. :param num_docs: Number of documents to be indexed. :param target: Dictionary which stores the data paths :yields: index data """ for internal_doc_id in range(num_docs): # x_blackwhite.shape is (28,28) ...
[ "def", "index_generator", "(", "num_docs", ":", "int", ",", "target", ":", "dict", ")", ":", "for", "internal_doc_id", "in", "range", "(", "num_docs", ")", ":", "# x_blackwhite.shape is (28,28)", "x_blackwhite", "=", "255", "-", "target", "[", "'index'", "]", ...
https://github.com/jina-ai/jina/blob/c77a492fcd5adba0fc3de5347bea83dd4e7d8087/jina/helloworld/fashion/helper.py#L46-L61
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
modules/s3cfg.py
python
S3Config.customise_controller
(self, tablename, **attr)
Customise a Controller - runs before resource customisation - but prep runs after resource customisation
Customise a Controller - runs before resource customisation - but prep runs after resource customisation
[ "Customise", "a", "Controller", "-", "runs", "before", "resource", "customisation", "-", "but", "prep", "runs", "after", "resource", "customisation" ]
def customise_controller(self, tablename, **attr): """ Customise a Controller - runs before resource customisation - but prep runs after resource customisation """ customise = self.get("customise_%s_controller" % tablename) if customise: re...
[ "def", "customise_controller", "(", "self", ",", "tablename", ",", "*", "*", "attr", ")", ":", "customise", "=", "self", ".", "get", "(", "\"customise_%s_controller\"", "%", "tablename", ")", "if", "customise", ":", "return", "customise", "(", "*", "*", "a...
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3cfg.py#L481-L491
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/chocolatey.py
python
_clear_context
()
Clear variables stored in __context__. Run this function when a new version of chocolatey is installed.
Clear variables stored in __context__. Run this function when a new version of chocolatey is installed.
[ "Clear", "variables", "stored", "in", "__context__", ".", "Run", "this", "function", "when", "a", "new", "version", "of", "chocolatey", "is", "installed", "." ]
def _clear_context(): """ Clear variables stored in __context__. Run this function when a new version of chocolatey is installed. """ choco_items = [x for x in __context__ if x.startswith("chocolatey.")] for var in choco_items: __context__.pop(var)
[ "def", "_clear_context", "(", ")", ":", "choco_items", "=", "[", "x", "for", "x", "in", "__context__", "if", "x", ".", "startswith", "(", "\"chocolatey.\"", ")", "]", "for", "var", "in", "choco_items", ":", "__context__", ".", "pop", "(", "var", ")" ]
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/chocolatey.py#L53-L60
gnemoug/distribute_crawler
fb74ad853126b3a6358f987d763d492d8f3eec12
woaidu_crawler/woaidu_crawler/pipelines/file.py
python
FilePipeline.get_file_name
(self,request,response)
return filename
Get the raw file name that the sever transfer to. It examine two places:Content-Disposition,url.
Get the raw file name that the sever transfer to. It examine two places:Content-Disposition,url.
[ "Get", "the", "raw", "file", "name", "that", "the", "sever", "transfer", "to", ".", "It", "examine", "two", "places", ":", "Content", "-", "Disposition", "url", "." ]
def get_file_name(self,request,response): """ Get the raw file name that the sever transfer to. It examine two places:Content-Disposition,url. """ content_dispo = response.headers.get('Content-Disposition','') filename = "" #print res...
[ "def", "get_file_name", "(", "self", ",", "request", ",", "response", ")", ":", "content_dispo", "=", "response", ".", "headers", ".", "get", "(", "'Content-Disposition'", ",", "''", ")", "filename", "=", "\"\"", "#print response.headers", "if", "content_dispo",...
https://github.com/gnemoug/distribute_crawler/blob/fb74ad853126b3a6358f987d763d492d8f3eec12/woaidu_crawler/woaidu_crawler/pipelines/file.py#L245-L282
lululxvi/deepxde
730c97282636e86c845ce2ba3253482f2178469e
deepxde/backend/__init__.py
python
get_preferred_backend
()
return "tensorflow.compat.v1"
[]
def get_preferred_backend(): backend_name = None config_path = os.path.join(os.path.expanduser("~"), ".deepxde", "config.json") if "DDEBACKEND" in os.environ: backend_name = os.getenv("DDEBACKEND") elif os.path.exists(config_path): with open(config_path, "r") as config_file: ...
[ "def", "get_preferred_backend", "(", ")", ":", "backend_name", "=", "None", "config_path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "expanduser", "(", "\"~\"", ")", ",", "\".deepxde\"", ",", "\"config.json\"", ")", "if", "\"DDEBACK...
https://github.com/lululxvi/deepxde/blob/730c97282636e86c845ce2ba3253482f2178469e/deepxde/backend/__init__.py#L65-L82
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/models/v1beta1_certificate_signing_request_list.py
python
V1beta1CertificateSigningRequestList.__ne__
(self, other)
return not self == other
Returns true if both objects are not equal
Returns true if both objects are not equal
[ "Returns", "true", "if", "both", "objects", "are", "not", "equal" ]
def __ne__(self, other): """ Returns true if both objects are not equal """ return not self == other
[ "def", "__ne__", "(", "self", ",", "other", ")", ":", "return", "not", "self", "==", "other" ]
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1beta1_certificate_signing_request_list.py#L189-L193
meraki/dashboard-api-python
aef5e6fe5d23a40d435d5c64ff30580a28af07f1
meraki/api/batch/switch.py
python
ActionBatchSwitch.updateNetworkSwitchQosRulesOrder
(self, networkId: str, ruleIds: list)
return action
**Update the order in which the rules should be processed by the switch** https://developer.cisco.com/meraki/api-v1/#!update-network-switch-qos-rules-order - networkId (string): (required) - ruleIds (array): A list of quality of service rule IDs arranged in order in which they should be process...
**Update the order in which the rules should be processed by the switch** https://developer.cisco.com/meraki/api-v1/#!update-network-switch-qos-rules-order
[ "**", "Update", "the", "order", "in", "which", "the", "rules", "should", "be", "processed", "by", "the", "switch", "**", "https", ":", "//", "developer", ".", "cisco", ".", "com", "/", "meraki", "/", "api", "-", "v1", "/", "#!update", "-", "network", ...
def updateNetworkSwitchQosRulesOrder(self, networkId: str, ruleIds: list): """ **Update the order in which the rules should be processed by the switch** https://developer.cisco.com/meraki/api-v1/#!update-network-switch-qos-rules-order - networkId (string): (required) - ruleIds (...
[ "def", "updateNetworkSwitchQosRulesOrder", "(", "self", ",", "networkId", ":", "str", ",", "ruleIds", ":", "list", ")", ":", "kwargs", "=", "locals", "(", ")", "metadata", "=", "{", "'tags'", ":", "[", "'switch'", ",", "'configure'", ",", "'qosRules'", ","...
https://github.com/meraki/dashboard-api-python/blob/aef5e6fe5d23a40d435d5c64ff30580a28af07f1/meraki/api/batch/switch.py#L829-L853
gee-community/gee_tools
d7b35174933739f3aeee439d622e5fab57b6dd2d
geetools/tools/computedobject.py
python
isGeometry
(ComputedObject)
return _isType(ComputedObject, GEOMETRY)
[]
def isGeometry(ComputedObject): return _isType(ComputedObject, GEOMETRY)
[ "def", "isGeometry", "(", "ComputedObject", ")", ":", "return", "_isType", "(", "ComputedObject", ",", "GEOMETRY", ")" ]
https://github.com/gee-community/gee_tools/blob/d7b35174933739f3aeee439d622e5fab57b6dd2d/geetools/tools/computedobject.py#L47-L48
PacktPublishing/Advanced-Deep-Learning-with-Keras
099980731ba4f4e1a847506adf693247e41ef0cb
chapter13-mi-unsupervised/mine-13.8.1.py
python
MINE.load_weights
(self)
Reload model weights for evaluation
Reload model weights for evaluation
[ "Reload", "model", "weights", "for", "evaluation" ]
def load_weights(self): """Reload model weights for evaluation """ if self.args.restore_weights is None: error_msg = "Must load model weights for evaluation" raise ValueError(error_msg) if self.args.restore_weights: folder = "weights" os.m...
[ "def", "load_weights", "(", "self", ")", ":", "if", "self", ".", "args", ".", "restore_weights", "is", "None", ":", "error_msg", "=", "\"Must load model weights for evaluation\"", "raise", "ValueError", "(", "error_msg", ")", "if", "self", ".", "args", ".", "r...
https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras/blob/099980731ba4f4e1a847506adf693247e41ef0cb/chapter13-mi-unsupervised/mine-13.8.1.py#L404-L416
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
pypy/module/_csv/app_csv.py
python
list_dialects
()
return list(_dialects)
Return a list of all know dialect names.
Return a list of all know dialect names.
[ "Return", "a", "list", "of", "all", "know", "dialect", "names", "." ]
def list_dialects(): """Return a list of all know dialect names.""" return list(_dialects)
[ "def", "list_dialects", "(", ")", ":", "return", "list", "(", "_dialects", ")" ]
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/pypy/module/_csv/app_csv.py#L31-L33
seanbell/opensurfaces
7f3e987560faa62cd37f821760683ccd1e053c7c
server/shapes/utils.py
python
complex_polygon_area
(vertices, triangles)
return 0.5 * area_sum
Returns the area of a complex polygon. :param vertices: List ``[[x1, y1], [x2, y2]]`` or string ``"x1,y1,x2,y2,...,xn,yn"`` :param triangles: List ``[[v1, v2, v3], [v1, v2, v3]]`` or string ``"v1,v2,v3,v1,v2,v3,..."``, where ``vx`` is an index into the vertices list. :return: area...
Returns the area of a complex polygon.
[ "Returns", "the", "area", "of", "a", "complex", "polygon", "." ]
def complex_polygon_area(vertices, triangles): """ Returns the area of a complex polygon. :param vertices: List ``[[x1, y1], [x2, y2]]`` or string ``"x1,y1,x2,y2,...,xn,yn"`` :param triangles: List ``[[v1, v2, v3], [v1, v2, v3]]`` or string ``"v1,v2,v3,v1,v2,v3,..."``, where ``vx`` is ...
[ "def", "complex_polygon_area", "(", "vertices", ",", "triangles", ")", ":", "if", "isinstance", "(", "vertices", ",", "basestring", ")", ":", "vertices", "=", "parse_vertices", "(", "vertices", ")", "if", "isinstance", "(", "triangles", ",", "basestring", ")",...
https://github.com/seanbell/opensurfaces/blob/7f3e987560faa62cd37f821760683ccd1e053c7c/server/shapes/utils.py#L120-L147
pyqt/examples
843bb982917cecb2350b5f6d7f42c9b7fb142ec1
src/pyqt-official/animation/easing/easing.py
python
PixmapItem.__init__
(self, pix)
[]
def __init__(self, pix): super(PixmapItem, self).__init__() self.pixmap_item = QGraphicsPixmapItem(pix)
[ "def", "__init__", "(", "self", ",", "pix", ")", ":", "super", "(", "PixmapItem", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "pixmap_item", "=", "QGraphicsPixmapItem", "(", "pix", ")" ]
https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/animation/easing/easing.py#L98-L101
DataBiosphere/toil
2e148eee2114ece8dcc3ec8a83f36333266ece0d
src/toil/lib/docker.py
python
containerIsRunning
(container_name: str, timeout: int = 365 * 24 * 60 * 60)
Checks whether the container is running or not. :param container_name: Name of the container being checked. :param int timeout: Use the given timeout in seconds for interactions with the Docker daemon. Note that the underlying docker module is not always able to ...
Checks whether the container is running or not.
[ "Checks", "whether", "the", "container", "is", "running", "or", "not", "." ]
def containerIsRunning(container_name: str, timeout: int = 365 * 24 * 60 * 60): """ Checks whether the container is running or not. :param container_name: Name of the container being checked. :param int timeout: Use the given timeout in seconds for interactions with the Docker d...
[ "def", "containerIsRunning", "(", "container_name", ":", "str", ",", "timeout", ":", "int", "=", "365", "*", "24", "*", "60", "*", "60", ")", ":", "client", "=", "docker", ".", "from_env", "(", "version", "=", "'auto'", ",", "timeout", "=", "timeout", ...
https://github.com/DataBiosphere/toil/blob/2e148eee2114ece8dcc3ec8a83f36333266ece0d/src/toil/lib/docker.py#L378-L404
microsoft/ptvsd
99c8513921021d2cc7cd82e132b65c644c256768
src/ptvsd/_vendored/pydevd/_pydev_runfiles/pydev_runfiles.py
python
PydevTestRunner.__adjust_path
(self)
add the current file or directory to the python path
add the current file or directory to the python path
[ "add", "the", "current", "file", "or", "directory", "to", "the", "python", "path" ]
def __adjust_path(self): """ add the current file or directory to the python path """ path_to_append = None for n in xrange(len(self.files_or_dirs)): dir_name = self.__unixify(self.files_or_dirs[n]) if os.path.isdir(dir_name): if not dir_name.endswith("/")...
[ "def", "__adjust_path", "(", "self", ")", ":", "path_to_append", "=", "None", "for", "n", "in", "xrange", "(", "len", "(", "self", ".", "files_or_dirs", ")", ")", ":", "dir_name", "=", "self", ".", "__unixify", "(", "self", ".", "files_or_dirs", "[", "...
https://github.com/microsoft/ptvsd/blob/99c8513921021d2cc7cd82e132b65c644c256768/src/ptvsd/_vendored/pydevd/_pydev_runfiles/pydev_runfiles.py#L320-L341
mahmoud/boltons
270e974975984f662f998c8f6eb0ebebd964de82
boltons/cacheutils.py
python
ThresholdCounter.keys
(self)
return list(self.iterkeys())
[]
def keys(self): return list(self.iterkeys())
[ "def", "keys", "(", "self", ")", ":", "return", "list", "(", "self", ".", "iterkeys", "(", ")", ")" ]
https://github.com/mahmoud/boltons/blob/270e974975984f662f998c8f6eb0ebebd964de82/boltons/cacheutils.py#L779-L780
bspaans/python-mingus
6558cacffeaab4f084a3eedda12b0e86fd24c430
mingus/containers/composition.py
python
Composition.reset
(self)
Reset the information in this class. Remove the track and composer information.
Reset the information in this class.
[ "Reset", "the", "information", "in", "this", "class", "." ]
def reset(self): """Reset the information in this class. Remove the track and composer information. """ self.empty() self.set_title() self.set_author()
[ "def", "reset", "(", "self", ")", ":", "self", ".", "empty", "(", ")", "self", ".", "set_title", "(", ")", "self", ".", "set_author", "(", ")" ]
https://github.com/bspaans/python-mingus/blob/6558cacffeaab4f084a3eedda12b0e86fd24c430/mingus/containers/composition.py#L48-L55
WerWolv/EdiZon_CheatsConfigsAndScripts
d16d36c7509c01dca770f402babd83ff2e9ae6e7
Scripts/lib/python3.5/turtle.py
python
TurtleScreen.onclick
(self, fun, btn=1, add=None)
Bind fun to mouse-click event on canvas. Arguments: fun -- a function with two arguments, the coordinates of the clicked point on the canvas. num -- the number of the mouse-button, defaults to 1 Example (for a TurtleScreen instance named screen) >>> screen.oncli...
Bind fun to mouse-click event on canvas.
[ "Bind", "fun", "to", "mouse", "-", "click", "event", "on", "canvas", "." ]
def onclick(self, fun, btn=1, add=None): """Bind fun to mouse-click event on canvas. Arguments: fun -- a function with two arguments, the coordinates of the clicked point on the canvas. num -- the number of the mouse-button, defaults to 1 Example (for a TurtleScr...
[ "def", "onclick", "(", "self", ",", "fun", ",", "btn", "=", "1", ",", "add", "=", "None", ")", ":", "self", ".", "_onscreenclick", "(", "fun", ",", "btn", ",", "add", ")" ]
https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/turtle.py#L1349-L1364
google/coursebuilder-core
08f809db3226d9269e30d5edd0edd33bd22041f4
coursebuilder/modules/courses/availability.py
python
_authorize_put
(handler)
return course, settings, payload, response_payload
Common function for handlers. Verifies user, gets common settings.
Common function for handlers. Verifies user, gets common settings.
[ "Common", "function", "for", "handlers", ".", "Verifies", "user", "gets", "common", "settings", "." ]
def _authorize_put(handler): """Common function for handlers. Verifies user, gets common settings.""" request = transforms.loads(handler.request.get('request')) response_payload = { 'key': handler.app_context.get_namespace_name(), } if not handler.assert_xsrf_token_or_fail(request, handler...
[ "def", "_authorize_put", "(", "handler", ")", ":", "request", "=", "transforms", ".", "loads", "(", "handler", ".", "request", ".", "get", "(", "'request'", ")", ")", "response_payload", "=", "{", "'key'", ":", "handler", ".", "app_context", ".", "get_name...
https://github.com/google/coursebuilder-core/blob/08f809db3226d9269e30d5edd0edd33bd22041f4/coursebuilder/modules/courses/availability.py#L42-L62
RiotGames/cloud-inquisitor
29a26c705381fdba3538b4efedb25b9e09b387ed
backend/cloud_inquisitor/plugins/types/enforcements.py
python
Enforcement.action
(self)
return self.enforcement.action
The Action taken for the enforcement Returns: `str` : Values: (SHUTDOWN, TERMINATED)
The Action taken for the enforcement
[ "The", "Action", "taken", "for", "the", "enforcement" ]
def action(self): """ The Action taken for the enforcement Returns: `str` : Values: (SHUTDOWN, TERMINATED) """ return self.enforcement.action
[ "def", "action", "(", "self", ")", ":", "return", "self", ".", "enforcement", ".", "action" ]
https://github.com/RiotGames/cloud-inquisitor/blob/29a26c705381fdba3538b4efedb25b9e09b387ed/backend/cloud_inquisitor/plugins/types/enforcements.py#L105-L111
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/_backport/tarfile.py
python
TarFile.__init__
(self, name=None, mode="r", fileobj=None, format=None, tarinfo=None, dereference=None, ignore_zeros=None, encoding=None, errors="surrogateescape", pax_headers=None, debug=None, errorlevel=None)
Open an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an existing archive, 'a' to append data to an existing file or 'w' to create a new file overwriting an existing one. `mode' defaults to 'r'. If `fileobj' is given, it is used for reading or writing d...
Open an (uncompressed) tar archive `name'. `mode' is either 'r' to read from an existing archive, 'a' to append data to an existing file or 'w' to create a new file overwriting an existing one. `mode' defaults to 'r'. If `fileobj' is given, it is used for reading or writing d...
[ "Open", "an", "(", "uncompressed", ")", "tar", "archive", "name", ".", "mode", "is", "either", "r", "to", "read", "from", "an", "existing", "archive", "a", "to", "append", "data", "to", "an", "existing", "file", "or", "w", "to", "create", "a", "new", ...
def __init__(self, name=None, mode="r", fileobj=None, format=None, tarinfo=None, dereference=None, ignore_zeros=None, encoding=None, errors="surrogateescape", pax_headers=None, debug=None, errorlevel=None): """Open an (uncompressed) tar archive `name'. `mode' is either 'r' to ...
[ "def", "__init__", "(", "self", ",", "name", "=", "None", ",", "mode", "=", "\"r\"", ",", "fileobj", "=", "None", ",", "format", "=", "None", ",", "tarinfo", "=", "None", ",", "dereference", "=", "None", ",", "ignore_zeros", "=", "None", ",", "encodi...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/_backport/tarfile.py#L1606-L1700
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
lib-python/2.7/distutils/emxccompiler.py
python
check_config_h
()
Check if the current Python installation (specifically, pyconfig.h) appears amenable to building extensions with GCC. Returns a tuple (status, details), where 'status' is one of the following constants: CONFIG_H_OK all is well, go ahead and compile CONFIG_H_NOTOK doesn't look good ...
Check if the current Python installation (specifically, pyconfig.h) appears amenable to building extensions with GCC. Returns a tuple (status, details), where 'status' is one of the following constants: CONFIG_H_OK all is well, go ahead and compile CONFIG_H_NOTOK doesn't look good ...
[ "Check", "if", "the", "current", "Python", "installation", "(", "specifically", "pyconfig", ".", "h", ")", "appears", "amenable", "to", "building", "extensions", "with", "GCC", ".", "Returns", "a", "tuple", "(", "status", "details", ")", "where", "status", "...
def check_config_h(): """Check if the current Python installation (specifically, pyconfig.h) appears amenable to building extensions with GCC. Returns a tuple (status, details), where 'status' is one of the following constants: CONFIG_H_OK all is well, go ahead and compile CONFIG_H_NOT...
[ "def", "check_config_h", "(", ")", ":", "# XXX since this function also checks sys.version, it's not strictly a", "# \"pyconfig.h\" check -- should probably be renamed...", "from", "distutils", "import", "sysconfig", "import", "string", "# if sys.version contains GCC then python was compil...
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/distutils/emxccompiler.py#L242-L291
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/ps4/media_player.py
python
PS4Device.async_turn_off
(self)
Turn off media player.
Turn off media player.
[ "Turn", "off", "media", "player", "." ]
async def async_turn_off(self): """Turn off media player.""" await self._ps4.standby()
[ "async", "def", "async_turn_off", "(", "self", ")", ":", "await", "self", ".", "_ps4", ".", "standby", "(", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/ps4/media_player.py#L448-L450
bikalims/bika.lims
35e4bbdb5a3912cae0b5eb13e51097c8b0486349
bika/lims/browser/widgets/datetimewidget.py
python
DateTimeWidget.ulocalized_time
(self, time, context, request)
return val
[]
def ulocalized_time(self, time, context, request): val = ut(time, long_format=self._properties['show_time'], time_only=False, context=context, request=request) return val
[ "def", "ulocalized_time", "(", "self", ",", "time", ",", "context", ",", "request", ")", ":", "val", "=", "ut", "(", "time", ",", "long_format", "=", "self", ".", "_properties", "[", "'show_time'", "]", ",", "time_only", "=", "False", ",", "context", "...
https://github.com/bikalims/bika.lims/blob/35e4bbdb5a3912cae0b5eb13e51097c8b0486349/bika/lims/browser/widgets/datetimewidget.py#L26-L32
mdiazcl/fuzzbunch-debian
2b76c2249ade83a389ae3badb12a1bd09901fd2c
windows/Resources/Python/Core/Lib/lib-tk/Tkinter.py
python
Misc.focus_set
(self)
Direct input focus to this widget. If the application currently does not have the focus this widget will get the focus if the application gets the focus through the window manager.
Direct input focus to this widget. If the application currently does not have the focus this widget will get the focus if the application gets the focus through the window manager.
[ "Direct", "input", "focus", "to", "this", "widget", ".", "If", "the", "application", "currently", "does", "not", "have", "the", "focus", "this", "widget", "will", "get", "the", "focus", "if", "the", "application", "gets", "the", "focus", "through", "the", ...
def focus_set(self): """Direct input focus to this widget. If the application currently does not have the focus this widget will get the focus if the application gets the focus through the window manager.""" self.tk.call('focus', self._w)
[ "def", "focus_set", "(", "self", ")", ":", "self", ".", "tk", ".", "call", "(", "'focus'", ",", "self", ".", "_w", ")" ]
https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/lib-tk/Tkinter.py#L470-L476
annoviko/pyclustering
bf4f51a472622292627ec8c294eb205585e50f52
pyclustering/cluster/ttsas.py
python
ttsas.__init__
(self, data, threshold1, threshold2, ccore=True, **kwargs)
! @brief Creates TTSAS algorithm. @param[in] data (list): Input data that is presented as list of points (objects), each point should be represented by list or tuple. @param[in] threshold1: Dissimilarity level (distance) between point and its closest cluster, if the distance is ...
! @brief Creates TTSAS algorithm.
[ "!", "@brief", "Creates", "TTSAS", "algorithm", "." ]
def __init__(self, data, threshold1, threshold2, ccore=True, **kwargs): """! @brief Creates TTSAS algorithm. @param[in] data (list): Input data that is presented as list of points (objects), each point should be represented by list or tuple. @param[in] threshold1: Dissimilarity level (d...
[ "def", "__init__", "(", "self", ",", "data", ",", "threshold1", ",", "threshold2", ",", "ccore", "=", "True", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_threshold2", "=", "threshold2", "self", ".", "_amount_skipped_objects", "=", "len", "(", "data...
https://github.com/annoviko/pyclustering/blob/bf4f51a472622292627ec8c294eb205585e50f52/pyclustering/cluster/ttsas.py#L58-L79
PIQuIL/QuCumber
25a8cbfaf6b8d009a6f9877770760b525c3f91a8
qucumber/observables/pauli.py
python
SigmaY.apply
(self, nn_state, samples)
r"""Computes the average magnetization along Y of each sample in the given batch of samples. Assumes that the computational basis that the NeuralState was trained on was the Z basis. :param nn_state: The NeuralState that drew the samples. :type nn_state: qucumber.nn_states.NeuralStateB...
r"""Computes the average magnetization along Y of each sample in the given batch of samples.
[ "r", "Computes", "the", "average", "magnetization", "along", "Y", "of", "each", "sample", "in", "the", "given", "batch", "of", "samples", "." ]
def apply(self, nn_state, samples): r"""Computes the average magnetization along Y of each sample in the given batch of samples. Assumes that the computational basis that the NeuralState was trained on was the Z basis. :param nn_state: The NeuralState that drew the samples. :ty...
[ "def", "apply", "(", "self", ",", "nn_state", ",", "samples", ")", ":", "samples", "=", "samples", ".", "to", "(", "device", "=", "nn_state", ".", "device", ")", "# vectors of shape: (2, num_samples,)", "denom", "=", "nn_state", ".", "importance_sampling_denomin...
https://github.com/PIQuIL/QuCumber/blob/25a8cbfaf6b8d009a6f9877770760b525c3f91a8/qucumber/observables/pauli.py#L100-L136
pyansys/pymapdl
c07291fc062b359abf0e92b95a92d753a95ef3d7
ansys/mapdl/core/_commands/solution/multi_field_solver_convergence_controls.py
python
MultiFieldConvergenceControls.mfconv
(self, lab="", toler="", minref="", **kwargs)
return self.run(f"MFCONV,{lab},{toler},,{minref}", **kwargs)
Sets convergence values for an ANSYS Multi-field solver analysis. APDL Command: MFCONV Parameters ---------- lab Valid labels: toler Convergence tolerance about program calculated reference value (the L2 norm of the new load in a multi-field...
Sets convergence values for an ANSYS Multi-field solver analysis.
[ "Sets", "convergence", "values", "for", "an", "ANSYS", "Multi", "-", "field", "solver", "analysis", "." ]
def mfconv(self, lab="", toler="", minref="", **kwargs): """Sets convergence values for an ANSYS Multi-field solver analysis. APDL Command: MFCONV Parameters ---------- lab Valid labels: toler Convergence tolerance about program calculated refer...
[ "def", "mfconv", "(", "self", ",", "lab", "=", "\"\"", ",", "toler", "=", "\"\"", ",", "minref", "=", "\"\"", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "run", "(", "f\"MFCONV,{lab},{toler},,{minref}\"", ",", "*", "*", "kwargs", ")" ]
https://github.com/pyansys/pymapdl/blob/c07291fc062b359abf0e92b95a92d753a95ef3d7/ansys/mapdl/core/_commands/solution/multi_field_solver_convergence_controls.py#L2-L38
scikit-multilearn/scikit-multilearn
4733443b9cbb30f7f1ee7352caf38ce38cfc6163
skmultilearn/ext/meka.py
python
Meka._parse_output
(self)
Internal function for parsing MEKA output.
Internal function for parsing MEKA output.
[ "Internal", "function", "for", "parsing", "MEKA", "output", "." ]
def _parse_output(self): """Internal function for parsing MEKA output.""" if self.output_ is None: self._results = None self._statistics = None return None predictions_split_head = '==== PREDICTIONS' predictions_split_foot = '|===========' if...
[ "def", "_parse_output", "(", "self", ")", ":", "if", "self", ".", "output_", "is", "None", ":", "self", ".", "_results", "=", "None", "self", ".", "_statistics", "=", "None", "return", "None", "predictions_split_head", "=", "'==== PREDICTIONS'", "predictions_s...
https://github.com/scikit-multilearn/scikit-multilearn/blob/4733443b9cbb30f7f1ee7352caf38ce38cfc6163/skmultilearn/ext/meka.py#L357-L418
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/lib2to3/fixes/fix_input.py
python
FixInput.transform
(self, node, results)
return Call(Name("eval"), [new], prefix=node.prefix)
[]
def transform(self, node, results): # If we're already wrapped in a eval() call, we're done. if context.match(node.parent.parent): return new = node.clone() new.prefix = "" return Call(Name("eval"), [new], prefix=node.prefix)
[ "def", "transform", "(", "self", ",", "node", ",", "results", ")", ":", "# If we're already wrapped in a eval() call, we're done.", "if", "context", ".", "match", "(", "node", ".", "parent", ".", "parent", ")", ":", "return", "new", "=", "node", ".", "clone", ...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/lib2to3/fixes/fix_input.py#L19-L26
ansible-collections/community.general
3faffe8f47968a2400ba3c896c8901c03001a194
plugins/action/system/iptables_state.py
python
ActionModule._async_result
(self, async_status_args, task_vars, timeout)
return async_result
Retrieve results of the asynchonous task, and display them in place of the async wrapper results (those with the ansible_job_id key).
Retrieve results of the asynchonous task, and display them in place of the async wrapper results (those with the ansible_job_id key).
[ "Retrieve", "results", "of", "the", "asynchonous", "task", "and", "display", "them", "in", "place", "of", "the", "async", "wrapper", "results", "(", "those", "with", "the", "ansible_job_id", "key", ")", "." ]
def _async_result(self, async_status_args, task_vars, timeout): ''' Retrieve results of the asynchonous task, and display them in place of the async wrapper results (those with the ansible_job_id key). ''' async_status = self._task.copy() async_status.args = async_status_...
[ "def", "_async_result", "(", "self", ",", "async_status_args", ",", "task_vars", ",", "timeout", ")", ":", "async_status", "=", "self", ".", "_task", ".", "copy", "(", ")", "async_status", ".", "args", "=", "async_status_args", "async_status", ".", "action", ...
https://github.com/ansible-collections/community.general/blob/3faffe8f47968a2400ba3c896c8901c03001a194/plugins/action/system/iptables_state.py#L44-L68
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/pickletools.py
python
read_float8
(f)
r""" >>> import StringIO, struct >>> raw = struct.pack(">d", -1.25) >>> raw '\xbf\xf4\x00\x00\x00\x00\x00\x00' >>> read_float8(StringIO.StringIO(raw + "\n")) -1.25
r""" >>> import StringIO, struct >>> raw = struct.pack(">d", -1.25) >>> raw '\xbf\xf4\x00\x00\x00\x00\x00\x00' >>> read_float8(StringIO.StringIO(raw + "\n")) -1.25
[ "r", ">>>", "import", "StringIO", "struct", ">>>", "raw", "=", "struct", ".", "pack", "(", ">", "d", "-", "1", ".", "25", ")", ">>>", "raw", "\\", "xbf", "\\", "xf4", "\\", "x00", "\\", "x00", "\\", "x00", "\\", "x00", "\\", "x00", "\\", "x00",...
def read_float8(f): r""" >>> import StringIO, struct >>> raw = struct.pack(">d", -1.25) >>> raw '\xbf\xf4\x00\x00\x00\x00\x00\x00' >>> read_float8(StringIO.StringIO(raw + "\n")) -1.25 """ data = f.read(8) if len(data) == 8: return _unpack(">d", data)[0] raise ValueEr...
[ "def", "read_float8", "(", "f", ")", ":", "data", "=", "f", ".", "read", "(", "8", ")", "if", "len", "(", "data", ")", "==", "8", ":", "return", "_unpack", "(", "\">d\"", ",", "data", ")", "[", "0", "]", "raise", "ValueError", "(", "\"not enough ...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/pickletools.py#L584-L597
learningequality/ka-lite
571918ea668013dcf022286ea85eff1c5333fb8b
kalite/packages/bundled/django/contrib/formtools/preview.py
python
FormPreview.parse_params
(self, *args, **kwargs)
Given captured args and kwargs from the URLconf, saves something in self.state and/or raises Http404 if necessary. For example, this URLconf captures a user_id variable: (r'^contact/(?P<user_id>\d{1,6})/$', MyFormPreview(MyForm)), In this case, the kwargs variable in parse_params ...
Given captured args and kwargs from the URLconf, saves something in self.state and/or raises Http404 if necessary.
[ "Given", "captured", "args", "and", "kwargs", "from", "the", "URLconf", "saves", "something", "in", "self", ".", "state", "and", "/", "or", "raises", "Http404", "if", "necessary", "." ]
def parse_params(self, *args, **kwargs): """ Given captured args and kwargs from the URLconf, saves something in self.state and/or raises Http404 if necessary. For example, this URLconf captures a user_id variable: (r'^contact/(?P<user_id>\d{1,6})/$', MyFormPreview(MyForm))...
[ "def", "parse_params", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "pass" ]
https://github.com/learningequality/ka-lite/blob/571918ea668013dcf022286ea85eff1c5333fb8b/kalite/packages/bundled/django/contrib/formtools/preview.py#L105-L119
wiseman/mavelous
eef41c096cc282bb3acd33a747146a88d2bd1eee
modules/sensors.py
python
cmd_speed
(args)
enable/disable speed report
enable/disable speed report
[ "enable", "/", "disable", "speed", "report" ]
def cmd_speed(args): '''enable/disable speed report''' mpstate.sensors_state.speed_report = not mpstate.sensors_state.speed_report if mpstate.sensors_state.speed_report: mpstate.console.writeln("Speed reporting enabled", bg='yellow') else: mpstate.console.writeln("Speed reporting disable...
[ "def", "cmd_speed", "(", "args", ")", ":", "mpstate", ".", "sensors_state", ".", "speed_report", "=", "not", "mpstate", ".", "sensors_state", ".", "speed_report", "if", "mpstate", ".", "sensors_state", ".", "speed_report", ":", "mpstate", ".", "console", ".", ...
https://github.com/wiseman/mavelous/blob/eef41c096cc282bb3acd33a747146a88d2bd1eee/modules/sensors.py#L53-L59
spesmilo/electrum
bdbd59300fbd35b01605e66145458e5f396108e8
electrum/gui/kivy/main_window.py
python
ElectrumWindow.build
(self)
return Builder.load_file(KIVY_GUI_PATH + '/main.kv')
[]
def build(self): return Builder.load_file(KIVY_GUI_PATH + '/main.kv')
[ "def", "build", "(", "self", ")", ":", "return", "Builder", ".", "load_file", "(", "KIVY_GUI_PATH", "+", "'/main.kv'", ")" ]
https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/gui/kivy/main_window.py#L591-L592
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v7/services/services/distance_view_service/client.py
python
DistanceViewServiceClient.common_billing_account_path
(billing_account: str,)
return "billingAccounts/{billing_account}".format( billing_account=billing_account, )
Return a fully-qualified billing_account string.
Return a fully-qualified billing_account string.
[ "Return", "a", "fully", "-", "qualified", "billing_account", "string", "." ]
def common_billing_account_path(billing_account: str,) -> str: """Return a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, )
[ "def", "common_billing_account_path", "(", "billing_account", ":", "str", ",", ")", "->", "str", ":", "return", "\"billingAccounts/{billing_account}\"", ".", "format", "(", "billing_account", "=", "billing_account", ",", ")" ]
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/distance_view_service/client.py#L179-L183
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
pypy/objspace/std/longobject.py
python
newlong
(space, bigint)
return W_LongObject(bigint)
Turn the bigint into a W_LongObject. If withsmalllong is enabled, check if the bigint would fit in a smalllong, and return a W_SmallLongObject instead if it does.
Turn the bigint into a W_LongObject. If withsmalllong is enabled, check if the bigint would fit in a smalllong, and return a W_SmallLongObject instead if it does.
[ "Turn", "the", "bigint", "into", "a", "W_LongObject", ".", "If", "withsmalllong", "is", "enabled", "check", "if", "the", "bigint", "would", "fit", "in", "a", "smalllong", "and", "return", "a", "W_SmallLongObject", "instead", "if", "it", "does", "." ]
def newlong(space, bigint): """Turn the bigint into a W_LongObject. If withsmalllong is enabled, check if the bigint would fit in a smalllong, and return a W_SmallLongObject instead if it does. """ if space.config.objspace.std.withsmalllong: try: z = bigint.tolonglong() ...
[ "def", "newlong", "(", "space", ",", "bigint", ")", ":", "if", "space", ".", "config", ".", "objspace", ".", "std", ".", "withsmalllong", ":", "try", ":", "z", "=", "bigint", ".", "tolonglong", "(", ")", "except", "OverflowError", ":", "pass", "else", ...
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/pypy/objspace/std/longobject.py#L551-L564
pyannote/pyannote-audio
a448164b4abe56a2c0da11e143648d4fed5967f8
pyannote/audio/labeling/tasks/speech_activity_detection.py
python
SpeechActivityDetectionGenerator.specifications
(self)
return specs
[]
def specifications(self): specs = { "task": self.task, "X": {"dimension": self.feature_extraction.dimension}, "y": {"classes": ["non_speech", "speech"]}, } for key, classes in self.file_labels_.items(): # TODO. add an option to handle this list ...
[ "def", "specifications", "(", "self", ")", ":", "specs", "=", "{", "\"task\"", ":", "self", ".", "task", ",", "\"X\"", ":", "{", "\"dimension\"", ":", "self", ".", "feature_extraction", ".", "dimension", "}", ",", "\"y\"", ":", "{", "\"classes\"", ":", ...
https://github.com/pyannote/pyannote-audio/blob/a448164b4abe56a2c0da11e143648d4fed5967f8/pyannote/audio/labeling/tasks/speech_activity_detection.py#L141-L156
tothi/pwn-hisilicon-dvr
42d8325e68fdb075fe27df8a269932f9fa9601a6
pwn_hisilicon_dvr.py
python
guessregion
(smaps)
return (-1)
[]
def guessregion(smaps): for t in range(len(smaps)-7, 1, -1): if (smaps[t][1][0], smaps[t+1][1][0], smaps[t+2][1][0], smaps[t+3][1][0], smaps[t+4][1][0], smaps[t+5][1][0], smaps[t+6][1][0]) == (8188, 8188, 8188, 8188, 8188, 8188, 8188) and smaps[t][1][1] == 4 and smaps[t+1][1][1] == 4 and smaps[t+2][1][1] ==...
[ "def", "guessregion", "(", "smaps", ")", ":", "for", "t", "in", "range", "(", "len", "(", "smaps", ")", "-", "7", ",", "1", ",", "-", "1", ")", ":", "if", "(", "smaps", "[", "t", "]", "[", "1", "]", "[", "0", "]", ",", "smaps", "[", "t", ...
https://github.com/tothi/pwn-hisilicon-dvr/blob/42d8325e68fdb075fe27df8a269932f9fa9601a6/pwn_hisilicon_dvr.py#L143-L147
tensorlayer/tensorlayer
cb4eb896dd063e650ef22533ed6fa6056a71cad5
tensorlayer/prepro.py
python
shift_multi
( x, wrg=0.1, hrg=0.1, is_random=False, row_index=0, col_index=1, channel_index=2, fill_mode='nearest', cval=0., order=1 )
return np.asarray(results)
Shift images with the same arguments, randomly or non-randomly. Usually be used for image segmentation which x=[X, Y], X and Y should be matched. Parameters ----------- x : list of numpy.array List of images with dimension of [n_images, row, col, channel] (default). others : args Se...
Shift images with the same arguments, randomly or non-randomly. Usually be used for image segmentation which x=[X, Y], X and Y should be matched.
[ "Shift", "images", "with", "the", "same", "arguments", "randomly", "or", "non", "-", "randomly", ".", "Usually", "be", "used", "for", "image", "segmentation", "which", "x", "=", "[", "X", "Y", "]", "X", "and", "Y", "should", "be", "matched", "." ]
def shift_multi( x, wrg=0.1, hrg=0.1, is_random=False, row_index=0, col_index=1, channel_index=2, fill_mode='nearest', cval=0., order=1 ): """Shift images with the same arguments, randomly or non-randomly. Usually be used for image segmentation which x=[X, Y], X and Y should be matched. Parameters ...
[ "def", "shift_multi", "(", "x", ",", "wrg", "=", "0.1", ",", "hrg", "=", "0.1", ",", "is_random", "=", "False", ",", "row_index", "=", "0", ",", "col_index", "=", "1", ",", "channel_index", "=", "2", ",", "fill_mode", "=", "'nearest'", ",", "cval", ...
https://github.com/tensorlayer/tensorlayer/blob/cb4eb896dd063e650ef22533ed6fa6056a71cad5/tensorlayer/prepro.py#L1001-L1033
rytilahti/python-miio
b6e53dd16fac77915426e7592e2528b78ef65190
miio/integrations/vacuum/roborock/vacuumcontainers.py
python
ConsumableStatus.main_brush
(self)
return pretty_seconds(self.data["main_brush_work_time"])
Main brush usage time.
Main brush usage time.
[ "Main", "brush", "usage", "time", "." ]
def main_brush(self) -> timedelta: """Main brush usage time.""" return pretty_seconds(self.data["main_brush_work_time"])
[ "def", "main_brush", "(", "self", ")", "->", "timedelta", ":", "return", "pretty_seconds", "(", "self", ".", "data", "[", "\"main_brush_work_time\"", "]", ")" ]
https://github.com/rytilahti/python-miio/blob/b6e53dd16fac77915426e7592e2528b78ef65190/miio/integrations/vacuum/roborock/vacuumcontainers.py#L352-L354
jina-ai/jina
c77a492fcd5adba0fc3de5347bea83dd4e7d8087
jina/parsers/client.py
python
mixin_comm_protocol_parser
(parser)
Add the arguments for the protocol to the parser :param parser: the parser configure
Add the arguments for the protocol to the parser
[ "Add", "the", "arguments", "for", "the", "protocol", "to", "the", "parser" ]
def mixin_comm_protocol_parser(parser): """Add the arguments for the protocol to the parser :param parser: the parser configure """ from ..enums import GatewayProtocolType parser.add_argument( '--protocol', type=GatewayProtocolType.from_string, choices=list(GatewayProtocol...
[ "def", "mixin_comm_protocol_parser", "(", "parser", ")", ":", "from", ".", ".", "enums", "import", "GatewayProtocolType", "parser", ".", "add_argument", "(", "'--protocol'", ",", "type", "=", "GatewayProtocolType", ".", "from_string", ",", "choices", "=", "list", ...
https://github.com/jina-ai/jina/blob/c77a492fcd5adba0fc3de5347bea83dd4e7d8087/jina/parsers/client.py#L4-L18
awslabs/aws-glue-libs
a498b92cf437e566b51060131d9446a4abd014c9
awsglue/context.py
python
GlueContext.purge_table
(self, database, table_name, options={}, transformation_ctx="", catalog_id=None)
Delete files from s3 for the given catalog's database and table. If all files in a partition are deleted, that partition is deleted from the catalog too :param database: database name in catalog :param table_name: table name in catalog :param options: Options to filter files to be delete...
Delete files from s3 for the given catalog's database and table. If all files in a partition are deleted, that partition is deleted from the catalog too :param database: database name in catalog :param table_name: table name in catalog :param options: Options to filter files to be delete...
[ "Delete", "files", "from", "s3", "for", "the", "given", "catalog", "s", "database", "and", "table", ".", "If", "all", "files", "in", "a", "partition", "are", "deleted", "that", "partition", "is", "deleted", "from", "the", "catalog", "too", ":", "param", ...
def purge_table(self, database, table_name, options={}, transformation_ctx="", catalog_id=None): """ Delete files from s3 for the given catalog's database and table. If all files in a partition are deleted, that partition is deleted from the catalog too :param database: database name in ...
[ "def", "purge_table", "(", "self", ",", "database", ",", "table_name", ",", "options", "=", "{", "}", ",", "transformation_ctx", "=", "\"\"", ",", "catalog_id", "=", "None", ")", ":", "self", ".", "_ssql_ctx", ".", "purgeTable", "(", "database", ",", "ta...
https://github.com/awslabs/aws-glue-libs/blob/a498b92cf437e566b51060131d9446a4abd014c9/awsglue/context.py#L389-L410
trailofbits/manticore
b050fdf0939f6c63f503cdf87ec0ab159dd41159
manticore/platforms/linux.py
python
Linux.sys_fsync
(self, fd: int)
Synchronize a file's in-core state with that on disk.
Synchronize a file's in-core state with that on disk.
[ "Synchronize", "a", "file", "s", "in", "-", "core", "state", "with", "that", "on", "disk", "." ]
def sys_fsync(self, fd: int) -> int: """ Synchronize a file's in-core state with that on disk. """ try: self._get_fdlike(fd).sync() return 0 except FdError as e: return -e.err
[ "def", "sys_fsync", "(", "self", ",", "fd", ":", "int", ")", "->", "int", ":", "try", ":", "self", ".", "_get_fdlike", "(", "fd", ")", ".", "sync", "(", ")", "return", "0", "except", "FdError", "as", "e", ":", "return", "-", "e", ".", "err" ]
https://github.com/trailofbits/manticore/blob/b050fdf0939f6c63f503cdf87ec0ab159dd41159/manticore/platforms/linux.py#L2034-L2043
PaddlePaddle/PaddleX
2bab73f81ab54e328204e7871e6ae4a82e719f5d
paddlex/ppdet/modeling/backbones/vgg.py
python
L2NormScale.forward
(self, inputs)
return out
[]
def forward(self, inputs): out = F.normalize(inputs, axis=1, epsilon=1e-10) # out = self.scale.unsqueeze(0).unsqueeze(2).unsqueeze(3).expand_as( # out) * out out = self.scale.unsqueeze(0).unsqueeze(2).unsqueeze(3) * out return out
[ "def", "forward", "(", "self", ",", "inputs", ")", ":", "out", "=", "F", ".", "normalize", "(", "inputs", ",", "axis", "=", "1", ",", "epsilon", "=", "1e-10", ")", "# out = self.scale.unsqueeze(0).unsqueeze(2).unsqueeze(3).expand_as(", "# out) * out", "out", ...
https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/paddlex/ppdet/modeling/backbones/vgg.py#L101-L106
mbraak/django-mptt-admin
2c827b4575afada5afdce94345833289f2a898c0
django_mptt_admin/util.py
python
get_tree_from_queryset
( queryset, on_create_node=None, max_level=None, item_label_field_name=None )
return tree
Return tree data that is suitable for jqTree. The queryset must be sorted by 'tree_id' and 'left' fields.
Return tree data that is suitable for jqTree. The queryset must be sorted by 'tree_id' and 'left' fields.
[ "Return", "tree", "data", "that", "is", "suitable", "for", "jqTree", ".", "The", "queryset", "must", "be", "sorted", "by", "tree_id", "and", "left", "fields", "." ]
def get_tree_from_queryset( queryset, on_create_node=None, max_level=None, item_label_field_name=None ): """ Return tree data that is suitable for jqTree. The queryset must be sorted by 'tree_id' and 'left' fields. """ pk_attname = queryset.model._meta.pk.attname # Result tree tree = []...
[ "def", "get_tree_from_queryset", "(", "queryset", ",", "on_create_node", "=", "None", ",", "max_level", "=", "None", ",", "item_label_field_name", "=", "None", ")", ":", "pk_attname", "=", "queryset", ".", "model", ".", "_meta", ".", "pk", ".", "attname", "#...
https://github.com/mbraak/django-mptt-admin/blob/2c827b4575afada5afdce94345833289f2a898c0/django_mptt_admin/util.py#L12-L81
exodrifter/unity-python
bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d
Lib/distutils/command/sdist.py
python
sdist.read_template
(self)
Read and parse manifest template file named by self.template. (usually "MANIFEST.in") The parsing and processing is done by 'self.filelist', which updates itself accordingly.
Read and parse manifest template file named by self.template.
[ "Read", "and", "parse", "manifest", "template", "file", "named", "by", "self", ".", "template", "." ]
def read_template(self): """Read and parse manifest template file named by self.template. (usually "MANIFEST.in") The parsing and processing is done by 'self.filelist', which updates itself accordingly. """ log.info("reading manifest template '%s'", self.template) templa...
[ "def", "read_template", "(", "self", ")", ":", "log", ".", "info", "(", "\"reading manifest template '%s'\"", ",", "self", ".", "template", ")", "template", "=", "TextFile", "(", "self", ".", "template", ",", "strip_comments", "=", "1", ",", "skip_blanks", "...
https://github.com/exodrifter/unity-python/blob/bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d/Lib/distutils/command/sdist.py#L300-L331
frerich/clcache
cae73d8255d78db8ba11e23c51fd2c9a89e7475b
clcache/__main__.py
python
Cache.statistics
(self)
return self.strategy.statistics
[]
def statistics(self): return self.strategy.statistics
[ "def", "statistics", "(", "self", ")", ":", "return", "self", ".", "strategy", ".", "statistics" ]
https://github.com/frerich/clcache/blob/cae73d8255d78db8ba11e23c51fd2c9a89e7475b/clcache/__main__.py#L617-L618
fake-name/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
WebMirror/management/rss_parser_funcs/feed_parse_extractUmbrawebserialWordpressCom.py
python
extractUmbrawebserialWordpressCom
(item)
return False
Parser for 'umbrawebserial.wordpress.com'
Parser for 'umbrawebserial.wordpress.com'
[ "Parser", "for", "umbrawebserial", ".", "wordpress", ".", "com" ]
def extractUmbrawebserialWordpressCom(item): ''' Parser for 'umbrawebserial.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('PRC', 'PRC', 'translated'), ...
[ "def", "extractUmbrawebserialWordpressCom", "(", "item", ")", ":", "vol", ",", "chp", ",", "frag", ",", "postfix", "=", "extractVolChapterFragmentPostfix", "(", "item", "[", "'title'", "]", ")", "if", "not", "(", "chp", "or", "vol", ")", "or", "\"preview\"",...
https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractUmbrawebserialWordpressCom.py#L2-L21
matrix-org/synapse
8e57584a5859a9002759963eb546d523d2498a01
synapse/storage/databases/main/roommember.py
python
RoomMemberStore.forget
(self, user_id: str, room_id: str)
Indicate that user_id wishes to discard history for room_id.
Indicate that user_id wishes to discard history for room_id.
[ "Indicate", "that", "user_id", "wishes", "to", "discard", "history", "for", "room_id", "." ]
async def forget(self, user_id: str, room_id: str) -> None: """Indicate that user_id wishes to discard history for room_id.""" def f(txn): sql = ( "UPDATE" " room_memberships" " SET" " forgotten = 1" " WHERE" ...
[ "async", "def", "forget", "(", "self", ",", "user_id", ":", "str", ",", "room_id", ":", "str", ")", "->", "None", ":", "def", "f", "(", "txn", ")", ":", "sql", "=", "(", "\"UPDATE\"", "\" room_memberships\"", "\" SET\"", "\" forgotten = 1\"", "\" WHERE\"...
https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/storage/databases/main/roommember.py#L1156-L1177
ansible/ansible-modules-core
00911a75ad6635834b6d28eef41f197b2f73c381
cloud/amazon/rds_param_group.py
python
modify_group
(group, params, immediate=False)
return changed, new_params
Set all of the params in a group to the provided new params. Raises NotModifiableError if any of the params to be changed are read only.
Set all of the params in a group to the provided new params. Raises NotModifiableError if any of the params to be changed are read only.
[ "Set", "all", "of", "the", "params", "in", "a", "group", "to", "the", "provided", "new", "params", ".", "Raises", "NotModifiableError", "if", "any", "of", "the", "params", "to", "be", "changed", "are", "read", "only", "." ]
def modify_group(group, params, immediate=False): """ Set all of the params in a group to the provided new params. Raises NotModifiableError if any of the params to be changed are read only. """ changed = {} new_params = dict(params) for key in new_params.keys(): if key in group: ...
[ "def", "modify_group", "(", "group", ",", "params", ",", "immediate", "=", "False", ")", ":", "changed", "=", "{", "}", "new_params", "=", "dict", "(", "params", ")", "for", "key", "in", "new_params", ".", "keys", "(", ")", ":", "if", "key", "in", ...
https://github.com/ansible/ansible-modules-core/blob/00911a75ad6635834b6d28eef41f197b2f73c381/cloud/amazon/rds_param_group.py#L182-L214
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
apps/impala/gen-py/TCLIService/TCLIService.py
python
Iface.GetColumns
(self, req)
Parameters: - req
Parameters: - req
[ "Parameters", ":", "-", "req" ]
def GetColumns(self, req): """ Parameters: - req """ pass
[ "def", "GetColumns", "(", "self", ",", "req", ")", ":", "pass" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/apps/impala/gen-py/TCLIService/TCLIService.py#L94-L100
etetoolkit/ete
2b207357dc2a40ccad7bfd8f54964472c72e4726
ete3/nexml/_nexml.py
python
AAMapping.exportLiteral
(self, outfile, level, name_='AAMapping')
[]
def exportLiteral(self, outfile, level, name_='AAMapping'): level += 1 self.exportLiteralAttributes(outfile, level, [], name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_)
[ "def", "exportLiteral", "(", "self", ",", "outfile", ",", "level", ",", "name_", "=", "'AAMapping'", ")", ":", "level", "+=", "1", "self", ".", "exportLiteralAttributes", "(", "outfile", ",", "level", ",", "[", "]", ",", "name_", ")", "if", "self", "."...
https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/nexml/_nexml.py#L1025-L1029
haiwen/seahub
e92fcd44e3e46260597d8faa9347cb8222b8b10d
seahub/api2/endpoints/dir_shared_items.py
python
DirSharedItemsEndpoint.list_group_shared_items
(self, request, repo_id, path)
return ret
[]
def list_group_shared_items(self, request, repo_id, path): if is_org_context(request): # when calling seafile API to share authority related functions, change the uesrname to repo owner. repo_owner = seafile_api.get_org_repo_owner(repo_id) org_id = request.user.org.org_id ...
[ "def", "list_group_shared_items", "(", "self", ",", "request", ",", "repo_id", ",", "path", ")", ":", "if", "is_org_context", "(", "request", ")", ":", "# when calling seafile API to share authority related functions, change the uesrname to repo owner.", "repo_owner", "=", ...
https://github.com/haiwen/seahub/blob/e92fcd44e3e46260597d8faa9347cb8222b8b10d/seahub/api2/endpoints/dir_shared_items.py#L93-L147
haiwen/seafile-docker
2d2461d4c8cab3458ec9832611c419d47506c300
scripts_9.0/utils.py
python
get_seafile_version
()
return os.environ['SEAFILE_VERSION']
[]
def get_seafile_version(): return os.environ['SEAFILE_VERSION']
[ "def", "get_seafile_version", "(", ")", ":", "return", "os", ".", "environ", "[", "'SEAFILE_VERSION'", "]" ]
https://github.com/haiwen/seafile-docker/blob/2d2461d4c8cab3458ec9832611c419d47506c300/scripts_9.0/utils.py#L210-L211
plkmo/BERT-Relation-Extraction
06075620fccb044785f5fd319e8d06df9af15b50
src/model/ALBERT/tokenization_utils.py
python
PreTrainedTokenizer.tokenize
(self, text, **kwargs)
return tokenized_text
Converts a string in a sequence of tokens (string), using the tokenizer. Split in words for word-based vocabulary or sub-words for sub-word-based vocabularies (BPE/SentencePieces/WordPieces). Take care of added tokens. text: The sequence to be encoded. **kwa...
Converts a string in a sequence of tokens (string), using the tokenizer. Split in words for word-based vocabulary or sub-words for sub-word-based vocabularies (BPE/SentencePieces/WordPieces).
[ "Converts", "a", "string", "in", "a", "sequence", "of", "tokens", "(", "string", ")", "using", "the", "tokenizer", ".", "Split", "in", "words", "for", "word", "-", "based", "vocabulary", "or", "sub", "-", "words", "for", "sub", "-", "word", "-", "based...
def tokenize(self, text, **kwargs): """ Converts a string in a sequence of tokens (string), using the tokenizer. Split in words for word-based vocabulary or sub-words for sub-word-based vocabularies (BPE/SentencePieces/WordPieces). Take care of added tokens. tex...
[ "def", "tokenize", "(", "self", ",", "text", ",", "*", "*", "kwargs", ")", ":", "all_special_tokens", "=", "self", ".", "all_special_tokens", "def", "lowercase_text", "(", "t", ")", ":", "# convert non-special tokens to lowercase", "escaped_special_toks", "=", "["...
https://github.com/plkmo/BERT-Relation-Extraction/blob/06075620fccb044785f5fd319e8d06df9af15b50/src/model/ALBERT/tokenization_utils.py#L657-L724
ruiminshen/yolo-tf
eae65c8071fe5069f5e3bb1e26f19a761b1b68bc
parse_darknet_yolo2.py
python
transpose_biases
(biases, num_anchors)
return np.concatenate([iou, coords, classes], -1).reshape([-1])
[]
def transpose_biases(biases, num_anchors): biases = biases.reshape([num_anchors, -1]) coords = biases[:, 0:4] iou = np.expand_dims(biases[:, 4], -1) classes = biases[:, 5:] return np.concatenate([iou, coords, classes], -1).reshape([-1])
[ "def", "transpose_biases", "(", "biases", ",", "num_anchors", ")", ":", "biases", "=", "biases", ".", "reshape", "(", "[", "num_anchors", ",", "-", "1", "]", ")", "coords", "=", "biases", "[", ":", ",", "0", ":", "4", "]", "iou", "=", "np", ".", ...
https://github.com/ruiminshen/yolo-tf/blob/eae65c8071fe5069f5e3bb1e26f19a761b1b68bc/parse_darknet_yolo2.py#L43-L48
morganstanley/treadmill
f18267c665baf6def4374d21170198f63ff1cde4
lib/python/treadmill/dnsctx.py
python
_state_api
(ctx, scope=None)
return _api(ctx, srvlookup.format(scope=scope, cell=ctx.cell), 'http')
Resolve state api given context and scope. Default srv lookup - _http._tcp.stateapi.<cell>.cell Override - environment var: TREADMILL_STATEAPI_LOOKUP_<cell> all upper case.
Resolve state api given context and scope.
[ "Resolve", "state", "api", "given", "context", "and", "scope", "." ]
def _state_api(ctx, scope=None): """Resolve state api given context and scope. Default srv lookup - _http._tcp.stateapi.<cell>.cell Override - environment var: TREADMILL_STATEAPI_LOOKUP_<cell> all upper case. """ if scope is None: if not ctx.cell: raise context.ContextError...
[ "def", "_state_api", "(", "ctx", ",", "scope", "=", "None", ")", ":", "if", "scope", "is", "None", ":", "if", "not", "ctx", ".", "cell", ":", "raise", "context", ".", "ContextError", "(", "'Cell not specified.'", ")", "scope", "=", "cell_scope", "(", "...
https://github.com/morganstanley/treadmill/blob/f18267c665baf6def4374d21170198f63ff1cde4/lib/python/treadmill/dnsctx.py#L74-L92
googleads/googleads-python-lib
b3b42a6deedbe6eaa1c9b30183a9eae3f9e9a7ee
examples/ad_manager/v202105/proposal_line_item_service/get_proposal_line_items_for_proposal.py
python
main
(client, proposal_id)
[]
def main(client, proposal_id): # Initialize appropriate service. proposal_line_item_service = client.GetService( 'ProposalLineItemService', version='v202105') # Create a statement to select proposal line items. statement = (ad_manager.StatementBuilder(version='v202105') .Where('proposalId =...
[ "def", "main", "(", "client", ",", "proposal_id", ")", ":", "# Initialize appropriate service.", "proposal_line_item_service", "=", "client", ".", "GetService", "(", "'ProposalLineItemService'", ",", "version", "=", "'v202105'", ")", "# Create a statement to select proposal...
https://github.com/googleads/googleads-python-lib/blob/b3b42a6deedbe6eaa1c9b30183a9eae3f9e9a7ee/examples/ad_manager/v202105/proposal_line_item_service/get_proposal_line_items_for_proposal.py#L25-L48
roytseng-tw/Detectron.pytorch
1b1c4ba58428b7277a45b0dce6cc1bce3744b86a
lib/utils/fpn.py
python
remove_negative_area_roi_blobs
(blobs, blob_prefix, rois, target_lvls)
return target_lvls
Delete roi entries that have negative area (Uncompleted)
Delete roi entries that have negative area (Uncompleted)
[ "Delete", "roi", "entries", "that", "have", "negative", "area", "(", "Uncompleted", ")" ]
def remove_negative_area_roi_blobs(blobs, blob_prefix, rois, target_lvls): """ Delete roi entries that have negative area (Uncompleted) """ idx_neg = np.where(target_lvls == -1)[0] rois = np.delete(rois, idx_neg, axis=0) blobs[blob_prefix] = rois target_lvls = np.delete(target_lvls, idx_neg, axis=0)...
[ "def", "remove_negative_area_roi_blobs", "(", "blobs", ",", "blob_prefix", ",", "rois", ",", "target_lvls", ")", ":", "idx_neg", "=", "np", ".", "where", "(", "target_lvls", "==", "-", "1", ")", "[", "0", "]", "rois", "=", "np", ".", "delete", "(", "ro...
https://github.com/roytseng-tw/Detectron.pytorch/blob/1b1c4ba58428b7277a45b0dce6cc1bce3744b86a/lib/utils/fpn.py#L61-L68
TengXiaoDai/DistributedCrawling
f5c2439e6ce68dd9b49bde084d76473ff9ed4963
Lib/importlib/_bootstrap_external.py
python
FileLoader.get_filename
(self, fullname)
return self.path
Return the path to the source file as found by the finder.
Return the path to the source file as found by the finder.
[ "Return", "the", "path", "to", "the", "source", "file", "as", "found", "by", "the", "finder", "." ]
def get_filename(self, fullname): """Return the path to the source file as found by the finder.""" return self.path
[ "def", "get_filename", "(", "self", ",", "fullname", ")", ":", "return", "self", ".", "path" ]
https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/importlib/_bootstrap_external.py#L820-L822
PyLops/pylops
33eb807c6f429dd2efe697627c0d3955328af81f
pylops/utils/wavelets.py
python
ricker
(t, f0=10)
return w, t, wcenter
r"""Ricker wavelet Create a Ricker wavelet given time axis ``t`` and central frequency ``f_0`` Parameters ---------- t : :obj:`numpy.ndarray` Time axis (positive part including zero sample) f0 : :obj:`float`, optional Central frequency Returns ------- w : :obj:`numpy.n...
r"""Ricker wavelet
[ "r", "Ricker", "wavelet" ]
def ricker(t, f0=10): r"""Ricker wavelet Create a Ricker wavelet given time axis ``t`` and central frequency ``f_0`` Parameters ---------- t : :obj:`numpy.ndarray` Time axis (positive part including zero sample) f0 : :obj:`float`, optional Central frequency Returns ---...
[ "def", "ricker", "(", "t", ",", "f0", "=", "10", ")", ":", "if", "len", "(", "t", ")", "%", "2", "==", "0", ":", "t", "=", "t", "[", ":", "-", "1", "]", "warnings", ".", "warn", "(", "\"one sample removed from time axis...\"", ")", "w", "=", "(...
https://github.com/PyLops/pylops/blob/33eb807c6f429dd2efe697627c0d3955328af81f/pylops/utils/wavelets.py#L7-L39
BlackLight/platypush
a6b552504e2ac327c94f3a28b607061b6b60cf36
platypush/plugins/mobile/join/__init__.py
python
MobileJoinPlugin.find
(self, device)
return self._send_request(self._push_url, device=device, params={'find': True})
Make a device ring loudly :param device: Device ID or name, or list of device IDs/names, or group name(s)
Make a device ring loudly :param device: Device ID or name, or list of device IDs/names, or group name(s)
[ "Make", "a", "device", "ring", "loudly", ":", "param", "device", ":", "Device", "ID", "or", "name", "or", "list", "of", "device", "IDs", "/", "names", "or", "group", "name", "(", "s", ")" ]
def find(self, device): """ Make a device ring loudly :param device: Device ID or name, or list of device IDs/names, or group name(s) """ return self._send_request(self._push_url, device=device, params={'find': True})
[ "def", "find", "(", "self", ",", "device", ")", ":", "return", "self", ".", "_send_request", "(", "self", ".", "_push_url", ",", "device", "=", "device", ",", "params", "=", "{", "'find'", ":", "True", "}", ")" ]
https://github.com/BlackLight/platypush/blob/a6b552504e2ac327c94f3a28b607061b6b60cf36/platypush/plugins/mobile/join/__init__.py#L238-L243
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/DeprecatedContent/Integrations/AzureSecurityCenter/AzureSecurityCenter.py
python
initiate_jit
( resource_group_name, asc_location, policy_name, vm_id, port, source_address, duration, )
return response
Starting new Just-in-time machine Args: resource_group_name: Resource group name asc_location: Machine location policy_name: Policy name vm_id: Virtual Machine ID port: ports to be used source_address: Source address duration: Time in Returns: di...
Starting new Just-in-time machine
[ "Starting", "new", "Just", "-", "in", "-", "time", "machine" ]
def initiate_jit( resource_group_name, asc_location, policy_name, vm_id, port, source_address, duration, ): """Starting new Just-in-time machine Args: resource_group_name: Resource group name asc_location: Machine location policy_name: Policy name vm_...
[ "def", "initiate_jit", "(", "resource_group_name", ",", "asc_location", ",", "policy_name", ",", "vm_id", ",", "port", ",", "source_address", ",", "duration", ",", ")", ":", "cmd_url", "=", "(", "\"/resourceGroups/{}/providers/Microsoft.Security/\"", "\"locations/{}/jit...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/DeprecatedContent/Integrations/AzureSecurityCenter/AzureSecurityCenter.py#L1374-L1419
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/models/dmp/dmpytorch/forcing_terms.py
python
DiscreteForcingTerm.__init__
(self, cs, num_basis)
Initialize the discrete forcing term. Args: cs (CS): discrete canonical system num_basis (int): number of basis functions
Initialize the discrete forcing term.
[ "Initialize", "the", "discrete", "forcing", "term", "." ]
def __init__(self, cs, num_basis): """Initialize the discrete forcing term. Args: cs (CS): discrete canonical system num_basis (int): number of basis functions """ # set canonical system if not isinstance(cs, DiscreteCS): raise TypeError("Expe...
[ "def", "__init__", "(", "self", ",", "cs", ",", "num_basis", ")", ":", "# set canonical system", "if", "not", "isinstance", "(", "cs", ",", "DiscreteCS", ")", ":", "raise", "TypeError", "(", "\"Expecting 'cs' to be an instance of DiscreteCS\"", ")", "self", ".", ...
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/models/dmp/dmpytorch/forcing_terms.py#L141-L167
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/rings/polynomial/infinite_polynomial_ring.py
python
InfinitePolynomialGen.__getitem__
(self, i)
return self._output[i]
Return the variable ``x[i]`` where ``x`` is this :class:`sage.rings.polynomial.infinite_polynomial_ring.InfinitePolynomialGen`, and i is a non-negative integer. EXAMPLES:: sage: X.<alpha> = InfinitePolynomialRing(QQ) sage: alpha[1] alpha_1
Return the variable ``x[i]`` where ``x`` is this :class:`sage.rings.polynomial.infinite_polynomial_ring.InfinitePolynomialGen`, and i is a non-negative integer.
[ "Return", "the", "variable", "x", "[", "i", "]", "where", "x", "is", "this", ":", "class", ":", "sage", ".", "rings", ".", "polynomial", ".", "infinite_polynomial_ring", ".", "InfinitePolynomialGen", "and", "i", "is", "a", "non", "-", "negative", "integer"...
def __getitem__(self, i): """ Return the variable ``x[i]`` where ``x`` is this :class:`sage.rings.polynomial.infinite_polynomial_ring.InfinitePolynomialGen`, and i is a non-negative integer. EXAMPLES:: sage: X.<alpha> = InfinitePolynomialRing(QQ) sage: a...
[ "def", "__getitem__", "(", "self", ",", "i", ")", ":", "if", "int", "(", "i", ")", "!=", "i", ":", "raise", "ValueError", "(", "\"The index (= %s) must be an integer\"", "%", "i", ")", "i", "=", "int", "(", "i", ")", "if", "i", "<", "0", ":", "rais...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/polynomial/infinite_polynomial_ring.py#L1439-L1494
HDI-Project/ATM
dde454a95e963a460843a61bbb44d18982984b17
atm/worker.py
python
Worker.select_hyperpartition
(self)
return self.db.get_hyperpartition(hyperpartition_id)
Use the hyperpartition selection method specified by our datarun to choose a hyperpartition of hyperparameters from the ModelHub. Only consider partitions for which gridding is not complete.
Use the hyperpartition selection method specified by our datarun to choose a hyperpartition of hyperparameters from the ModelHub. Only consider partitions for which gridding is not complete.
[ "Use", "the", "hyperpartition", "selection", "method", "specified", "by", "our", "datarun", "to", "choose", "a", "hyperpartition", "of", "hyperparameters", "from", "the", "ModelHub", ".", "Only", "consider", "partitions", "for", "which", "gridding", "is", "not", ...
def select_hyperpartition(self): """ Use the hyperpartition selection method specified by our datarun to choose a hyperpartition of hyperparameters from the ModelHub. Only consider partitions for which gridding is not complete. """ hyperpartitions = self.db.get_hyperparti...
[ "def", "select_hyperpartition", "(", "self", ")", ":", "hyperpartitions", "=", "self", ".", "db", ".", "get_hyperpartitions", "(", "datarun_id", "=", "self", ".", "datarun", ".", "id", ")", "# load classifiers and build scores lists", "# make sure all hyperpartitions ar...
https://github.com/HDI-Project/ATM/blob/dde454a95e963a460843a61bbb44d18982984b17/atm/worker.py#L119-L145
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
py2manager/gluon/html.py
python
DIV.elements
(self, *args, **kargs)
return matches
Find all components that match the supplied attribute dictionary, or None if nothing could be found All components of the components are searched. Examples: >>> a = DIV(DIV(SPAN('x'),3,DIV(SPAN('y')))) >>> for c in a.elements('span', first_only=True): c[0]='z' >>> prin...
Find all components that match the supplied attribute dictionary, or None if nothing could be found
[ "Find", "all", "components", "that", "match", "the", "supplied", "attribute", "dictionary", "or", "None", "if", "nothing", "could", "be", "found" ]
def elements(self, *args, **kargs): """ Find all components that match the supplied attribute dictionary, or None if nothing could be found All components of the components are searched. Examples: >>> a = DIV(DIV(SPAN('x'),3,DIV(SPAN('y')))) >>> for c in a.elem...
[ "def", "elements", "(", "self", ",", "*", "args", ",", "*", "*", "kargs", ")", ":", "if", "len", "(", "args", ")", "==", "1", ":", "args", "=", "[", "a", ".", "strip", "(", ")", "for", "a", "in", "args", "[", "0", "]", ".", "split", "(", ...
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/py2manager/gluon/html.py#L1017-L1190
jelmer/xandikos
3149a633c388a6f1dffbc6686763fca00f72e3bc
xandikos/store/git.py
python
GitStore.get_description
(self)
Get extended description. :return: repository description as string
Get extended description.
[ "Get", "extended", "description", "." ]
def get_description(self): """Get extended description. :return: repository description as string """ try: return self.config.get_description() except KeyError: return None
[ "def", "get_description", "(", "self", ")", ":", "try", ":", "return", "self", ".", "config", ".", "get_description", "(", ")", "except", "KeyError", ":", "return", "None" ]
https://github.com/jelmer/xandikos/blob/3149a633c388a6f1dffbc6686763fca00f72e3bc/xandikos/store/git.py#L412-L420
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
pypy/objspace/std/bytesobject.py
python
W_AbstractBytesObject.descr_rmod
(self, space, w_values)
x.__rmod__(y) <==> y%x
x.__rmod__(y) <==> y%x
[ "x", ".", "__rmod__", "(", "y", ")", "<", "==", ">", "y%x" ]
def descr_rmod(self, space, w_values): """x.__rmod__(y) <==> y%x"""
[ "def", "descr_rmod", "(", "self", ",", "space", ",", "w_values", ")", ":" ]
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/pypy/objspace/std/bytesobject.py#L119-L120
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/models/v1_object_meta.py
python
V1ObjectMeta.name
(self, name)
Sets the name of this V1ObjectMeta. Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be ...
Sets the name of this V1ObjectMeta. Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be ...
[ "Sets", "the", "name", "of", "this", "V1ObjectMeta", ".", "Name", "must", "be", "unique", "within", "a", "namespace", ".", "Is", "required", "when", "creating", "resources", "although", "some", "resources", "may", "allow", "a", "client", "to", "request", "th...
def name(self, name): """ Sets the name of this V1ObjectMeta. Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotenc...
[ "def", "name", "(", "self", ",", "name", ")", ":", "self", ".", "_name", "=", "name" ]
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_object_meta.py#L330-L339
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/tcaplusdb/v20190823/models.py
python
ModifyCensorshipResponse.__init__
(self)
r""" :param ClusterId: 集群id :type ClusterId: str :param Uins: 已加入审批人的uin 注意:此字段可能返回 null,表示取不到有效值。 :type Uins: list of str :param Censorship: 集群是否开启审核 0-关闭 1-开启 :type Censorship: int :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type Reques...
r""" :param ClusterId: 集群id :type ClusterId: str :param Uins: 已加入审批人的uin 注意:此字段可能返回 null,表示取不到有效值。 :type Uins: list of str :param Censorship: 集群是否开启审核 0-关闭 1-开启 :type Censorship: int :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type Reques...
[ "r", ":", "param", "ClusterId", ":", "集群id", ":", "type", "ClusterId", ":", "str", ":", "param", "Uins", ":", "已加入审批人的uin", "注意:此字段可能返回", "null,表示取不到有效值。", ":", "type", "Uins", ":", "list", "of", "str", ":", "param", "Censorship", ":", "集群是否开启审核", "0", "...
def __init__(self): r""" :param ClusterId: 集群id :type ClusterId: str :param Uins: 已加入审批人的uin 注意:此字段可能返回 null,表示取不到有效值。 :type Uins: list of str :param Censorship: 集群是否开启审核 0-关闭 1-开启 :type Censorship: int :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 Req...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "ClusterId", "=", "None", "self", ".", "Uins", "=", "None", "self", ".", "Censorship", "=", "None", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tcaplusdb/v20190823/models.py#L2866-L2881
MushroomRL/mushroom-rl
a0eaa2cf8001e433419234a9fc48b64170e3f61c
mushroom_rl/approximators/parametric/linear.py
python
LinearApproximator.__init__
(self, weights=None, input_shape=None, output_shape=(1,), **kwargs)
Constructor. Args: weights (np.ndarray): array of weights to initialize the weights of the approximator; input_shape (np.ndarray, None): the shape of the input of the model; output_shape (np.ndarray, (1,)): the shape of the output of the ...
Constructor.
[ "Constructor", "." ]
def __init__(self, weights=None, input_shape=None, output_shape=(1,), **kwargs): """ Constructor. Args: weights (np.ndarray): array of weights to initialize the weights of the approximator; input_shape (np.ndarray, None): the shape of t...
[ "def", "__init__", "(", "self", ",", "weights", "=", "None", ",", "input_shape", "=", "None", ",", "output_shape", "=", "(", "1", ",", ")", ",", "*", "*", "kwargs", ")", ":", "assert", "len", "(", "input_shape", ")", "==", "1", "and", "len", "(", ...
https://github.com/MushroomRL/mushroom-rl/blob/a0eaa2cf8001e433419234a9fc48b64170e3f61c/mushroom_rl/approximators/parametric/linear.py#L11-L39
sendgrid/sendgrid-python
df13b78b0cdcb410b4516f6761c4d3138edd4b2d
sendgrid/helpers/mail/validators.py
python
ValidateApiKey.validate_message_text
(self, message_string)
With a message string, check to see if it contains a SendGrid API Key If a key is found, throw an exception :param message_string: message that will be sent :type message_string: string :raises ApiKeyIncludedException: If message_string matches a regex ...
With a message string, check to see if it contains a SendGrid API Key If a key is found, throw an exception
[ "With", "a", "message", "string", "check", "to", "see", "if", "it", "contains", "a", "SendGrid", "API", "Key", "If", "a", "key", "is", "found", "throw", "an", "exception" ]
def validate_message_text(self, message_string): """With a message string, check to see if it contains a SendGrid API Key If a key is found, throw an exception :param message_string: message that will be sent :type message_string: string :raises ApiKeyIncludedExcept...
[ "def", "validate_message_text", "(", "self", ",", "message_string", ")", ":", "if", "isinstance", "(", "message_string", ",", "str", ")", ":", "for", "regex", "in", "self", ".", "regexes", ":", "if", "regex", ".", "match", "(", "message_string", ")", "is",...
https://github.com/sendgrid/sendgrid-python/blob/df13b78b0cdcb410b4516f6761c4d3138edd4b2d/sendgrid/helpers/mail/validators.py#L57-L69
sqall01/alertR
e1d1a83e54f876cc4cd7bd87387e05cb75d4dc13
sensorClientTemplate/lib/client/communication.py
python
Communication._request_sender
(self)
Request sender loop that processes the message queue. :return:
Request sender loop that processes the message queue.
[ "Request", "sender", "loop", "that", "processes", "the", "message", "queue", "." ]
def _request_sender(self): """ Request sender loop that processes the message queue. :return: """ logging.info("[%s] Starting Request Sender thread." % self._log_tag) while True: # If we still have messages in the queue, wait a short time before starting a ...
[ "def", "_request_sender", "(", "self", ")", ":", "logging", ".", "info", "(", "\"[%s] Starting Request Sender thread.\"", "%", "self", ".", "_log_tag", ")", "while", "True", ":", "# If we still have messages in the queue, wait a short time before starting a new sending round.",...
https://github.com/sqall01/alertR/blob/e1d1a83e54f876cc4cd7bd87387e05cb75d4dc13/sensorClientTemplate/lib/client/communication.py#L246-L408
svenkreiss/pysparkling
f0e8e8d039f3313c2693b7c7576cb1b7ba5a6d78
pysparkling/sql/types.py
python
_infer_type
(obj)
Infer the DataType from obj
Infer the DataType from obj
[ "Infer", "the", "DataType", "from", "obj" ]
def _infer_type(obj): """Infer the DataType from obj """ if obj is None: return NullType() if hasattr(obj, '__UDT__'): return obj.__UDT__ dataType = _type_mappings.get(type(obj)) if dataType is DecimalType: # the precision and scale of `obj` may be different from row to...
[ "def", "_infer_type", "(", "obj", ")", ":", "if", "obj", "is", "None", ":", "return", "NullType", "(", ")", "if", "hasattr", "(", "obj", ",", "'__UDT__'", ")", ":", "return", "obj", ".", "__UDT__", "dataType", "=", "_type_mappings", ".", "get", "(", ...
https://github.com/svenkreiss/pysparkling/blob/f0e8e8d039f3313c2693b7c7576cb1b7ba5a6d78/pysparkling/sql/types.py#L993-L1016
VikParuchuri/scribe
48428d42871677910eb6e56ad5892a366922af26
recognizer.py
python
save_audio
(wav_file)
Stream audio from an input device and save it.
Stream audio from an input device and save it.
[ "Stream", "audio", "from", "an", "input", "device", "and", "save", "it", "." ]
def save_audio(wav_file): """ Stream audio from an input device and save it. """ p = pyaudio.PyAudio() device = find_device(p, ["input", "mic", "audio"]) device_info = p.get_device_info_by_index(device) channels = int(device_info['maxInputChannels']) stream = p.open( format=FOR...
[ "def", "save_audio", "(", "wav_file", ")", ":", "p", "=", "pyaudio", ".", "PyAudio", "(", ")", "device", "=", "find_device", "(", "p", ",", "[", "\"input\"", ",", "\"mic\"", ",", "\"audio\"", "]", ")", "device_info", "=", "p", ".", "get_device_info_by_in...
https://github.com/VikParuchuri/scribe/blob/48428d42871677910eb6e56ad5892a366922af26/recognizer.py#L45-L84
noxrepo/pox
5f82461e01f8822bd7336603b361bff4ffbd2380
pox/lib/ioworker/__init__.py
python
IOWorker.close_handler
(self, callback)
Handler to call when closing
Handler to call when closing
[ "Handler", "to", "call", "when", "closing" ]
def close_handler (self, callback): """ Handler to call when closing """ # Not sure if this is a good idea, but it might be... if self.close_handler is not None or callback is not None: log.debug("Resetting close_handler on %s?", self) if callback is None: callback = _dummy_handler sel...
[ "def", "close_handler", "(", "self", ",", "callback", ")", ":", "# Not sure if this is a good idea, but it might be...", "if", "self", ".", "close_handler", "is", "not", "None", "or", "callback", "is", "not", "None", ":", "log", ".", "debug", "(", "\"Resetting clo...
https://github.com/noxrepo/pox/blob/5f82461e01f8822bd7336603b361bff4ffbd2380/pox/lib/ioworker/__init__.py#L174-L182
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
datadog_checks_base/datadog_checks/base/utils/time.py
python
ensure_aware_datetime
(dt, default_tz=UTC)
return dt
Ensures that the returned datetime object is not naive.
Ensures that the returned datetime object is not naive.
[ "Ensures", "that", "the", "returned", "datetime", "object", "is", "not", "naive", "." ]
def ensure_aware_datetime(dt, default_tz=UTC): """ Ensures that the returned datetime object is not naive. """ if dt.tzinfo is None: dt = dt.replace(tzinfo=default_tz) return dt
[ "def", "ensure_aware_datetime", "(", "dt", ",", "default_tz", "=", "UTC", ")", ":", "if", "dt", ".", "tzinfo", "is", "None", ":", "dt", "=", "dt", ".", "replace", "(", "tzinfo", "=", "default_tz", ")", "return", "dt" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/datadog_checks_base/datadog_checks/base/utils/time.py#L59-L66
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/sslstrip/setup.py
python
capture
(cmd)
return os.popen(cmd).read().strip()
[]
def capture(cmd): return os.popen(cmd).read().strip()
[ "def", "capture", "(", "cmd", ")", ":", "return", "os", ".", "popen", "(", "cmd", ")", ".", "read", "(", ")", ".", "strip", "(", ")" ]
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/sslstrip/setup.py#L32-L33
evilhero/mylar
dbee01d7e48e8c717afa01b2de1946c5d0b956cb
lib/mako/lookup.py
python
TemplateCollection.get_template
(self, uri, relativeto=None)
Return a :class:`.Template` object corresponding to the given ``uri``. The default implementation raises :class:`.NotImplementedError`. Implementations should raise :class:`.TemplateLookupException` if the given ``uri`` cannot be resolved. :param uri: String URI of the ...
Return a :class:`.Template` object corresponding to the given ``uri``.
[ "Return", "a", ":", "class", ":", ".", "Template", "object", "corresponding", "to", "the", "given", "uri", "." ]
def get_template(self, uri, relativeto=None): """Return a :class:`.Template` object corresponding to the given ``uri``. The default implementation raises :class:`.NotImplementedError`. Implementations should raise :class:`.TemplateLookupException` if the given ``uri`` ca...
[ "def", "get_template", "(", "self", ",", "uri", ",", "relativeto", "=", "None", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/evilhero/mylar/blob/dbee01d7e48e8c717afa01b2de1946c5d0b956cb/lib/mako/lookup.py#L51-L65
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/setuptools/command/bdist_rpm.py
python
bdist_rpm._make_spec_file
(self)
return spec
[]
def _make_spec_file(self): version = self.distribution.get_version() rpmversion = version.replace('-', '_') spec = orig.bdist_rpm._make_spec_file(self) line23 = '%define version ' + version line24 = '%define version ' + rpmversion spec = [ line.replace( ...
[ "def", "_make_spec_file", "(", "self", ")", ":", "version", "=", "self", ".", "distribution", ".", "get_version", "(", ")", "rpmversion", "=", "version", ".", "replace", "(", "'-'", ",", "'_'", ")", "spec", "=", "orig", ".", "bdist_rpm", ".", "_make_spec...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/setuptools/command/bdist_rpm.py#L21-L43
sourmash-bio/sourmash
73aeb155befd7c94042ddb8ca277a69986f25a55
src/sourmash/fig.py
python
load_matrix_and_labels
(basefile)
return (D, labeltext)
Load the comparison matrix and associated labels. Returns a square numpy matrix & list of labels.
Load the comparison matrix and associated labels.
[ "Load", "the", "comparison", "matrix", "and", "associated", "labels", "." ]
def load_matrix_and_labels(basefile): """Load the comparison matrix and associated labels. Returns a square numpy matrix & list of labels. """ D = numpy.load(open(basefile, 'rb')) labeltext = [x.strip() for x in open(basefile + '.labels.txt')] return (D, labeltext)
[ "def", "load_matrix_and_labels", "(", "basefile", ")", ":", "D", "=", "numpy", ".", "load", "(", "open", "(", "basefile", ",", "'rb'", ")", ")", "labeltext", "=", "[", "x", ".", "strip", "(", ")", "for", "x", "in", "open", "(", "basefile", "+", "'....
https://github.com/sourmash-bio/sourmash/blob/73aeb155befd7c94042ddb8ca277a69986f25a55/src/sourmash/fig.py#L13-L20
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Lib/site-packages/win32/lib/win32timezone.py
python
TimeZoneInfo._get_indexed_time_zone_keys
(index_key='Index')
return zip(values, key_names)
Get the names of the registry keys indexed by a value in that key.
Get the names of the registry keys indexed by a value in that key.
[ "Get", "the", "names", "of", "the", "registry", "keys", "indexed", "by", "a", "value", "in", "that", "key", "." ]
def _get_indexed_time_zone_keys(index_key='Index'): """ Get the names of the registry keys indexed by a value in that key. """ key_names = list(TimeZoneInfo._get_time_zone_key_names()) def get_index_value(key_name): key = TimeZoneInfo._get_time_zone_key(key_name) return key[index_key] values = map(get...
[ "def", "_get_indexed_time_zone_keys", "(", "index_key", "=", "'Index'", ")", ":", "key_names", "=", "list", "(", "TimeZoneInfo", ".", "_get_time_zone_key_names", "(", ")", ")", "def", "get_index_value", "(", "key_name", ")", ":", "key", "=", "TimeZoneInfo", ".",...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/site-packages/win32/lib/win32timezone.py#L574-L583
pluralsight/guides-cms
9e73a6bbc0f0747a66c08346d94b380892a49012
pskb_website/views.py
python
sync_listing
(publish_status)
return redirect(url_for('index'))
Sync listing page
Sync listing page
[ "Sync", "listing", "page" ]
def sync_listing(publish_status): """Sync listing page""" user = models.find_user() if user is None: app.logger.error('Cannot sync listing unless logged in') return render_template('index.html'), 500 if publish_status not in STATUSES: flash('Invalid publish status, must be one ...
[ "def", "sync_listing", "(", "publish_status", ")", ":", "user", "=", "models", ".", "find_user", "(", ")", "if", "user", "is", "None", ":", "app", ".", "logger", ".", "error", "(", "'Cannot sync listing unless logged in'", ")", "return", "render_template", "("...
https://github.com/pluralsight/guides-cms/blob/9e73a6bbc0f0747a66c08346d94b380892a49012/pskb_website/views.py#L710-L727
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/messaging/v1/service/__init__.py
python
ServiceInstance.us_app_to_person
(self)
return self._proxy.us_app_to_person
Access the us_app_to_person :returns: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonList :rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonList
Access the us_app_to_person
[ "Access", "the", "us_app_to_person" ]
def us_app_to_person(self): """ Access the us_app_to_person :returns: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonList :rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonList """ return self._proxy.us_app_to_person
[ "def", "us_app_to_person", "(", "self", ")", ":", "return", "self", ".", "_proxy", ".", "us_app_to_person" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/messaging/v1/service/__init__.py#L767-L774
securityclippy/elasticintel
aa08d3e9f5ab1c000128e95161139ce97ff0e334
ingest_feed_lambda/numpy/distutils/misc_util.py
python
general_source_directories_files
(top_path)
Return a directory name relative to top_path and files contained.
Return a directory name relative to top_path and files contained.
[ "Return", "a", "directory", "name", "relative", "to", "top_path", "and", "files", "contained", "." ]
def general_source_directories_files(top_path): """Return a directory name relative to top_path and files contained. """ pruned_directories = ['CVS', '.svn', 'build'] prune_file_pat = re.compile(r'(?:[~#]|\.py[co]|\.o)$') for dirpath, dirnames, filenames in os.walk(top_path, topdown=True): ...
[ "def", "general_source_directories_files", "(", "top_path", ")", ":", "pruned_directories", "=", "[", "'CVS'", ",", "'.svn'", ",", "'build'", "]", "prune_file_pat", "=", "re", ".", "compile", "(", "r'(?:[~#]|\\.py[co]|\\.o)$'", ")", "for", "dirpath", ",", "dirname...
https://github.com/securityclippy/elasticintel/blob/aa08d3e9f5ab1c000128e95161139ce97ff0e334/ingest_feed_lambda/numpy/distutils/misc_util.py#L585-L608
CPqD/RouteFlow
3f406b9c1a0796f40a86eb1194990cdd2c955f4d
pox/pox/openflow/discovery.py
python
Discovery._expire_links
(self)
Remove apparently dead links
Remove apparently dead links
[ "Remove", "apparently", "dead", "links" ]
def _expire_links (self): """ Remove apparently dead links """ now = time.time() expired = [link for link,timestamp in self.adjacency.iteritems() if timestamp + self._link_timeout < now] if expired: for link in expired: log.info('link timeout: %s.%i -> %s.%i' % ...
[ "def", "_expire_links", "(", "self", ")", ":", "now", "=", "time", ".", "time", "(", ")", "expired", "=", "[", "link", "for", "link", ",", "timestamp", "in", "self", ".", "adjacency", ".", "iteritems", "(", ")", "if", "timestamp", "+", "self", ".", ...
https://github.com/CPqD/RouteFlow/blob/3f406b9c1a0796f40a86eb1194990cdd2c955f4d/pox/pox/openflow/discovery.py#L252-L266
CouchPotato/CouchPotatoServer
7260c12f72447ddb6f062367c6dfbda03ecd4e9c
libs/requests/packages/urllib3/util/connection.py
python
is_connection_dropped
(conn)
Returns True if the connection is dropped and should be closed. :param conn: :class:`httplib.HTTPConnection` object. Note: For platforms like AppEngine, this will always return ``False`` to let the platform handle connection recycling transparently for us.
Returns True if the connection is dropped and should be closed.
[ "Returns", "True", "if", "the", "connection", "is", "dropped", "and", "should", "be", "closed", "." ]
def is_connection_dropped(conn): # Platform-specific """ Returns True if the connection is dropped and should be closed. :param conn: :class:`httplib.HTTPConnection` object. Note: For platforms like AppEngine, this will always return ``False`` to let the platform handle connection recycli...
[ "def", "is_connection_dropped", "(", "conn", ")", ":", "# Platform-specific", "sock", "=", "getattr", "(", "conn", ",", "'sock'", ",", "False", ")", "if", "sock", "is", "False", ":", "# Platform-specific: AppEngine", "return", "False", "if", "sock", "is", "Non...
https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/requests/packages/urllib3/util/connection.py#L12-L43
mcfletch/pyopengl
02d11dad9ff18e50db10e975c4756e17bf198464
OpenGL/GL/NV/viewport_swizzle.py
python
glInitViewportSwizzleNV
()
return extensions.hasGLExtension( _EXTENSION_NAME )
Return boolean indicating whether this extension is available
Return boolean indicating whether this extension is available
[ "Return", "boolean", "indicating", "whether", "this", "extension", "is", "available" ]
def glInitViewportSwizzleNV(): '''Return boolean indicating whether this extension is available''' from OpenGL import extensions return extensions.hasGLExtension( _EXTENSION_NAME )
[ "def", "glInitViewportSwizzleNV", "(", ")", ":", "from", "OpenGL", "import", "extensions", "return", "extensions", ".", "hasGLExtension", "(", "_EXTENSION_NAME", ")" ]
https://github.com/mcfletch/pyopengl/blob/02d11dad9ff18e50db10e975c4756e17bf198464/OpenGL/GL/NV/viewport_swizzle.py#L35-L38
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Lib/multiprocessing/managers.py
python
BaseProxy._getvalue
(self)
return self._callmethod('#GETVALUE')
Get a copy of the value of the referent
Get a copy of the value of the referent
[ "Get", "a", "copy", "of", "the", "value", "of", "the", "referent" ]
def _getvalue(self): ''' Get a copy of the value of the referent ''' return self._callmethod('#GETVALUE')
[ "def", "_getvalue", "(", "self", ")", ":", "return", "self", ".", "_callmethod", "(", "'#GETVALUE'", ")" ]
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/multiprocessing/managers.py#L746-L750
openbmc/openbmc
5f4109adae05f4d6925bfe960007d52f98c61086
poky/scripts/pybootchartgui/pybootchartgui/process_tree.py
python
ProcessTree.prune
(self, process_subtree, parent)
return num_removed
Prunes the process tree by removing idle processes and processes that only live for the duration of a single top sample. Sibling processes with the same command line (i.e. threads) are merged together. This filters out sleepy background processes, short-lived processes and b...
Prunes the process tree by removing idle processes and processes that only live for the duration of a single top sample. Sibling processes with the same command line (i.e. threads) are merged together. This filters out sleepy background processes, short-lived processes and b...
[ "Prunes", "the", "process", "tree", "by", "removing", "idle", "processes", "and", "processes", "that", "only", "live", "for", "the", "duration", "of", "a", "single", "top", "sample", ".", "Sibling", "processes", "with", "the", "same", "command", "line", "(",...
def prune(self, process_subtree, parent): """Prunes the process tree by removing idle processes and processes that only live for the duration of a single top sample. Sibling processes with the same command line (i.e. threads) are merged together. This filters out sleepy backgro...
[ "def", "prune", "(", "self", ",", "process_subtree", ",", "parent", ")", ":", "def", "is_idle_background_process_without_children", "(", "p", ")", ":", "process_end", "=", "p", ".", "start_time", "+", "p", ".", "duration", "return", "not", "p", ".", "active"...
https://github.com/openbmc/openbmc/blob/5f4109adae05f4d6925bfe960007d52f98c61086/poky/scripts/pybootchartgui/pybootchartgui/process_tree.py#L155-L195
OSInside/kiwi
9618cf33f510ddf302ad1d4e0df35f75b00eb152
kiwi/defaults.py
python
Defaults.get_obs_api_server_url
()
return 'https://api.opensuse.org'
Provides the default API server url to access the public open buildservice API :return: url path :rtype: str
Provides the default API server url to access the public open buildservice API
[ "Provides", "the", "default", "API", "server", "url", "to", "access", "the", "public", "open", "buildservice", "API" ]
def get_obs_api_server_url(): """ Provides the default API server url to access the public open buildservice API :return: url path :rtype: str """ return 'https://api.opensuse.org'
[ "def", "get_obs_api_server_url", "(", ")", ":", "return", "'https://api.opensuse.org'" ]
https://github.com/OSInside/kiwi/blob/9618cf33f510ddf302ad1d4e0df35f75b00eb152/kiwi/defaults.py#L219-L228
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
thirdparty_libs/django/utils/timezone.py
python
get_default_timezone
()
return _localtime
Returns the default time zone as a tzinfo instance. This is the time zone defined by settings.TIME_ZONE. See also :func:`get_current_timezone`.
Returns the default time zone as a tzinfo instance.
[ "Returns", "the", "default", "time", "zone", "as", "a", "tzinfo", "instance", "." ]
def get_default_timezone(): """ Returns the default time zone as a tzinfo instance. This is the time zone defined by settings.TIME_ZONE. See also :func:`get_current_timezone`. """ global _localtime if _localtime is None: if isinstance(settings.TIME_ZONE, six.string_types) and pytz ...
[ "def", "get_default_timezone", "(", ")", ":", "global", "_localtime", "if", "_localtime", "is", "None", ":", "if", "isinstance", "(", "settings", ".", "TIME_ZONE", ",", "six", ".", "string_types", ")", "and", "pytz", "is", "not", "None", ":", "_localtime", ...
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/django/utils/timezone.py#L101-L116
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/python-openid/openid/yadis/discover.py
python
DiscoveryResult.usedYadisLocation
(self)
return self.normalized_uri != self.xrds_uri
Was the Yadis protocol's indirection used?
Was the Yadis protocol's indirection used?
[ "Was", "the", "Yadis", "protocol", "s", "indirection", "used?" ]
def usedYadisLocation(self): """Was the Yadis protocol's indirection used?""" return self.normalized_uri != self.xrds_uri
[ "def", "usedYadisLocation", "(", "self", ")", ":", "return", "self", ".", "normalized_uri", "!=", "self", ".", "xrds_uri" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/python-openid/openid/yadis/discover.py#L46-L48
angr/claripy
4c961b4dc664706be8142fe4868f27655bc8da77
claripy/ast/bool.py
python
Bool.is_true
(self)
return is_true(self)
Returns True if 'self' can be easily determined to be True. Otherwise, return False. Note that the AST *might* still be True (i.e., if it were simplified via Z3), but it's hard to quickly tell that.
Returns True if 'self' can be easily determined to be True. Otherwise, return False. Note that the AST *might* still be True (i.e., if it were simplified via Z3), but it's hard to quickly tell that.
[ "Returns", "True", "if", "self", "can", "be", "easily", "determined", "to", "be", "True", ".", "Otherwise", "return", "False", ".", "Note", "that", "the", "AST", "*", "might", "*", "still", "be", "True", "(", "i", ".", "e", ".", "if", "it", "were", ...
def is_true(self): """ Returns True if 'self' can be easily determined to be True. Otherwise, return False. Note that the AST *might* still be True (i.e., if it were simplified via Z3), but it's hard to quickly tell that. """ return is_true(self)
[ "def", "is_true", "(", "self", ")", ":", "return", "is_true", "(", "self", ")" ]
https://github.com/angr/claripy/blob/4c961b4dc664706be8142fe4868f27655bc8da77/claripy/ast/bool.py#L24-L29
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/linked_domain/views.py
python
DomainLinkHistoryReport._make_user_cell
(self, record)
return pretty_doc_info(doc_info)
[]
def _make_user_cell(self, record): doc_info = get_doc_info_by_id(self.domain, record.user_id) user = WebUser.get_by_user_id(record.user_id) if self.domain not in user.get_domains() and 'link' in doc_info: doc_info['link'] = None return pretty_doc_info(doc_info)
[ "def", "_make_user_cell", "(", "self", ",", "record", ")", ":", "doc_info", "=", "get_doc_info_by_id", "(", "self", ".", "domain", ",", "record", ".", "user_id", ")", "user", "=", "WebUser", ".", "get_by_user_id", "(", "record", ".", "user_id", ")", "if", ...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/linked_domain/views.py#L541-L547
python-openxml/python-docx
36cac78de080d412e9e50d56c2784e33655cad59
docx/oxml/coreprops.py
python
CT_CoreProperties.author_text
(self)
return self._text_of_element('creator')
The text in the `dc:creator` child element.
The text in the `dc:creator` child element.
[ "The", "text", "in", "the", "dc", ":", "creator", "child", "element", "." ]
def author_text(self): """ The text in the `dc:creator` child element. """ return self._text_of_element('creator')
[ "def", "author_text", "(", "self", ")", ":", "return", "self", ".", "_text_of_element", "(", "'creator'", ")" ]
https://github.com/python-openxml/python-docx/blob/36cac78de080d412e9e50d56c2784e33655cad59/docx/oxml/coreprops.py#L57-L61
WPO-Foundation/wptagent
94470f007294213f900dcd9a207678b5b9fce5d3
internal/traffic_shaping.py
python
NoShaper.apply
(self, target_id)
return
Stub for applying Chrome traffic-shaping
Stub for applying Chrome traffic-shaping
[ "Stub", "for", "applying", "Chrome", "traffic", "-", "shaping" ]
def apply(self, target_id): """Stub for applying Chrome traffic-shaping""" return
[ "def", "apply", "(", "self", ",", "target_id", ")", ":", "return" ]
https://github.com/WPO-Foundation/wptagent/blob/94470f007294213f900dcd9a207678b5b9fce5d3/internal/traffic_shaping.py#L161-L163
scikit-hep/pyhf
ba8fb4c9879db491ccba021c669adc98b7d7f5a9
src/pyhf/patchset.py
python
Patch.metadata
(self)
return self._metadata
The metadata of the patch
The metadata of the patch
[ "The", "metadata", "of", "the", "patch" ]
def metadata(self): """The metadata of the patch""" return self._metadata
[ "def", "metadata", "(", "self", ")", ":", "return", "self", ".", "_metadata" ]
https://github.com/scikit-hep/pyhf/blob/ba8fb4c9879db491ccba021c669adc98b7d7f5a9/src/pyhf/patchset.py#L46-L48