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
Jenyay/outwiker
50530cf7b3f71480bb075b2829bc0669773b835b
buildtools/src/buildtools/builders/linux/debsource.py
python
BuilderBaseDebSource._source
(self, distname)
Create a sources folder for building the deb package
Create a sources folder for building the deb package
[ "Create", "a", "sources", "folder", "for", "building", "the", "deb", "package" ]
def _source(self, distname): """ Create a sources folder for building the deb package """ self._debclean() dirname = os.path.join(self.build_dir, self._getDebName()) os.makedirs(dirname) temp_images_dir = os.path.join(self.facts.temp_dir, u'images') if o...
[ "def", "_source", "(", "self", ",", "distname", ")", ":", "self", ".", "_debclean", "(", ")", "dirname", "=", "os", ".", "path", ".", "join", "(", "self", ".", "build_dir", ",", "self", ".", "_getDebName", "(", ")", ")", "os", ".", "makedirs", "(",...
https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/buildtools/src/buildtools/builders/linux/debsource.py#L81-L161
jython/jython3
def4f8ec47cb7a9c799ea4c745f12badf92c5769
lib-python/3.5.1/multiprocessing/context.py
python
BaseContext.Manager
(self)
return m
Returns a manager associated with a running server process The managers methods such as `Lock()`, `Condition()` and `Queue()` can be used to create shared objects.
Returns a manager associated with a running server process
[ "Returns", "a", "manager", "associated", "with", "a", "running", "server", "process" ]
def Manager(self): '''Returns a manager associated with a running server process The managers methods such as `Lock()`, `Condition()` and `Queue()` can be used to create shared objects. ''' from .managers import SyncManager m = SyncManager(ctx=self.get_context()) ...
[ "def", "Manager", "(", "self", ")", ":", "from", ".", "managers", "import", "SyncManager", "m", "=", "SyncManager", "(", "ctx", "=", "self", ".", "get_context", "(", ")", ")", "m", ".", "start", "(", ")", "return", "m" ]
https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/multiprocessing/context.py#L47-L56
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/urllib3/connectionpool.py
python
HTTPConnectionPool._make_request
(self, conn, method, url, timeout=_Default, chunked=False, **httplib_request_kw)
return httplib_response
Perform a request on a given urllib connection object taken from our pool. :param conn: a connection from one of our connection pools :param timeout: Socket timeout in seconds for the request. This can be a float or integer, which will set the same timeout v...
Perform a request on a given urllib connection object taken from our pool.
[ "Perform", "a", "request", "on", "a", "given", "urllib", "connection", "object", "taken", "from", "our", "pool", "." ]
def _make_request(self, conn, method, url, timeout=_Default, chunked=False, **httplib_request_kw): """ Perform a request on a given urllib connection object taken from our pool. :param conn: a connection from one of our connection pools :param ...
[ "def", "_make_request", "(", "self", ",", "conn", ",", "method", ",", "url", ",", "timeout", "=", "_Default", ",", "chunked", "=", "False", ",", "*", "*", "httplib_request_kw", ")", ":", "self", ".", "num_requests", "+=", "1", "timeout_obj", "=", "self",...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/urllib3/connectionpool.py#L322-L405
cisco-sas/kitty
cb0760989dcdfe079e43ac574d872d0b18953a32
kitty/data/report.py
python
Report.get_name
(self)
return self.get('name')
:return: the name of the report
:return: the name of the report
[ ":", "return", ":", "the", "name", "of", "the", "report" ]
def get_name(self): ''' :return: the name of the report ''' return self.get('name')
[ "def", "get_name", "(", "self", ")", ":", "return", "self", ".", "get", "(", "'name'", ")" ]
https://github.com/cisco-sas/kitty/blob/cb0760989dcdfe079e43ac574d872d0b18953a32/kitty/data/report.py#L78-L82
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/cgi.py
python
MiniFieldStorage.__repr__
(self)
return "MiniFieldStorage(%r, %r)" % (self.name, self.value)
Return printable representation.
Return printable representation.
[ "Return", "printable", "representation", "." ]
def __repr__(self): """Return printable representation.""" return "MiniFieldStorage(%r, %r)" % (self.name, self.value)
[ "def", "__repr__", "(", "self", ")", ":", "return", "\"MiniFieldStorage(%r, %r)\"", "%", "(", "self", ".", "name", ",", "self", ".", "value", ")" ]
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/cgi.py#L346-L348
selimsef/dfdc_deepfake_challenge
89c6290490bac96b29193a4061b3db9dd3933e36
preprocessing/face_detector.py
python
VideoFaceDetector.__init__
(self, **kwargs)
[]
def __init__(self, **kwargs) -> None: super().__init__()
[ "def", "__init__", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", ")" ]
https://github.com/selimsef/dfdc_deepfake_challenge/blob/89c6290490bac96b29193a4061b3db9dd3933e36/preprocessing/face_detector.py#L21-L22
cloudera/impyla
0c736af4cad2bade9b8e313badc08ec50e81c948
impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py
python
Iface.list_privileges
(self, principal_name, principal_type, hiveObject)
Parameters: - principal_name - principal_type - hiveObject
Parameters: - principal_name - principal_type - hiveObject
[ "Parameters", ":", "-", "principal_name", "-", "principal_type", "-", "hiveObject" ]
def list_privileges(self, principal_name, principal_type, hiveObject): """ Parameters: - principal_name - principal_type - hiveObject """ pass
[ "def", "list_privileges", "(", "self", ",", "principal_name", ",", "principal_type", ",", "hiveObject", ")", ":", "pass" ]
https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L940-L947
wwqgtxx/wwqLyParse
33136508e52821babd9294fdecffbdf02d73a6fc
wwqLyParse/lib/fallback_lib_py352/asyncio/transports.py
python
BaseTransport.get_extra_info
(self, name, default=None)
return self._extra.get(name, default)
Get optional transport information.
Get optional transport information.
[ "Get", "optional", "transport", "information", "." ]
def get_extra_info(self, name, default=None): """Get optional transport information.""" return self._extra.get(name, default)
[ "def", "get_extra_info", "(", "self", ",", "name", ",", "default", "=", "None", ")", ":", "return", "self", ".", "_extra", ".", "get", "(", "name", ",", "default", ")" ]
https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/fallback_lib_py352/asyncio/transports.py#L17-L19
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Lib/ntpath.py
python
splitunc
(p)
return '', p
Split a pathname into UNC mount point and relative path specifiers. Return a 2-tuple (unc, rest); either part may be empty. If unc is not empty, it has the form '//host/mount' (or similar using backslashes). unc+rest is always the input path. Paths containing drive letters never have a UNC part.
Split a pathname into UNC mount point and relative path specifiers.
[ "Split", "a", "pathname", "into", "UNC", "mount", "point", "and", "relative", "path", "specifiers", "." ]
def splitunc(p): """Split a pathname into UNC mount point and relative path specifiers. Return a 2-tuple (unc, rest); either part may be empty. If unc is not empty, it has the form '//host/mount' (or similar using backslashes). unc+rest is always the input path. Paths containing drive letters neve...
[ "def", "splitunc", "(", "p", ")", ":", "if", "p", "[", "1", ":", "2", "]", "==", "':'", ":", "return", "''", ",", "p", "# Drive letter present", "firstTwo", "=", "p", "[", "0", ":", "2", "]", "if", "firstTwo", "==", "'//'", "or", "firstTwo", "=="...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/ntpath.py#L138-L166
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/IPython/nbformat/v2/rwbase.py
python
NotebookReader.read
(self, fp, **kwargs)
return self.read(fp.read(), **kwargs)
Read a notebook from a file like object
Read a notebook from a file like object
[ "Read", "a", "notebook", "from", "a", "file", "like", "object" ]
def read(self, fp, **kwargs): """Read a notebook from a file like object""" return self.read(fp.read(), **kwargs)
[ "def", "read", "(", "self", ",", "fp", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "read", "(", "fp", ".", "read", "(", ")", ",", "*", "*", "kwargs", ")" ]
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/IPython/nbformat/v2/rwbase.py#L148-L150
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/xiaomi_miio/switch.py
python
async_setup_entry
( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback, )
Set up the switch from a config entry.
Set up the switch from a config entry.
[ "Set", "up", "the", "switch", "from", "a", "config", "entry", "." ]
async def async_setup_entry( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback, ) -> None: """Set up the switch from a config entry.""" model = config_entry.data[CONF_MODEL] if model in (*MODELS_HUMIDIFIER, *MODELS_FAN): await async_setup_coordinated...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "config_entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "AddEntitiesCallback", ",", ")", "->", "None", ":", "model", "=", "config_entry", ".", "data", "[", "CONF_MODEL", "]"...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/xiaomi_miio/switch.py#L279-L289
Kozea/pygal
8267b03535ff55789a30bf66b798302adad88623
pygal/style.py
python
Style.to_dict
(self)
return config
Convert instance to a serializable mapping.
Convert instance to a serializable mapping.
[ "Convert", "instance", "to", "a", "serializable", "mapping", "." ]
def to_dict(self): """Convert instance to a serializable mapping.""" config = {} for attr in dir(self): if not attr.startswith('_'): value = getattr(self, attr) if not hasattr(value, '__call__'): config[attr] = value return ...
[ "def", "to_dict", "(", "self", ")", ":", "config", "=", "{", "}", "for", "attr", "in", "dir", "(", "self", ")", ":", "if", "not", "attr", ".", "startswith", "(", "'_'", ")", ":", "value", "=", "getattr", "(", "self", ",", "attr", ")", "if", "no...
https://github.com/Kozea/pygal/blob/8267b03535ff55789a30bf66b798302adad88623/pygal/style.py#L181-L189
rackerlabs/mimic
efd34108b6aa3eb7ecd26e22f1aa155c14a7885e
mimic/util/helper.py
python
json_dump
(o)
Serialize an object to JSON, unless it is :obj:`EMPTY_RESPONSE`, in which case the empty string will be returned.
Serialize an object to JSON, unless it is :obj:`EMPTY_RESPONSE`, in which case the empty string will be returned.
[ "Serialize", "an", "object", "to", "JSON", "unless", "it", "is", ":", "obj", ":", "EMPTY_RESPONSE", "in", "which", "case", "the", "empty", "string", "will", "be", "returned", "." ]
def json_dump(o): """ Serialize an object to JSON, unless it is :obj:`EMPTY_RESPONSE`, in which case the empty string will be returned. """ if o is EMPTY_RESPONSE: return b'' else: return json.dumps(o)
[ "def", "json_dump", "(", "o", ")", ":", "if", "o", "is", "EMPTY_RESPONSE", ":", "return", "b''", "else", ":", "return", "json", ".", "dumps", "(", "o", ")" ]
https://github.com/rackerlabs/mimic/blob/efd34108b6aa3eb7ecd26e22f1aa155c14a7885e/mimic/util/helper.py#L37-L45
flow-project/flow
a511c41c48e6b928bb2060de8ad1ef3c3e3d9554
flow/core/kernel/vehicle/base.py
python
KernelVehicle.get_max_speed
(self, veh_id, error)
Return the max speed of the specified vehicle. Parameters ---------- veh_id : str or list of str vehicle id, or list of vehicle ids error : any, optional value that is returned if the vehicle is not found Returns ------- float
Return the max speed of the specified vehicle.
[ "Return", "the", "max", "speed", "of", "the", "specified", "vehicle", "." ]
def get_max_speed(self, veh_id, error): """Return the max speed of the specified vehicle. Parameters ---------- veh_id : str or list of str vehicle id, or list of vehicle ids error : any, optional value that is returned if the vehicle is not found ...
[ "def", "get_max_speed", "(", "self", ",", "veh_id", ",", "error", ")", ":", "pass" ]
https://github.com/flow-project/flow/blob/a511c41c48e6b928bb2060de8ad1ef3c3e3d9554/flow/core/kernel/vehicle/base.py#L733-L747
conan-io/conan
28ec09f6cbf1d7e27ec27393fd7bbc74891e74a8
conans/server/service/v1/service.py
python
ConanService.get_conanfile_download_urls
(self, ref, files_subset=None)
return urls
Gets a dict with filepaths and the urls: {filename: url}
Gets a dict with filepaths and the urls: {filename: url}
[ "Gets", "a", "dict", "with", "filepaths", "and", "the", "urls", ":", "{", "filename", ":", "url", "}" ]
def get_conanfile_download_urls(self, ref, files_subset=None): """Gets a dict with filepaths and the urls: {filename: url} """ self._authorizer.check_read_conan(self._auth_user, ref) latest_ref = self._get_latest_ref(ref) urls = self._server_store.get_download_conanfi...
[ "def", "get_conanfile_download_urls", "(", "self", ",", "ref", ",", "files_subset", "=", "None", ")", ":", "self", ".", "_authorizer", ".", "check_read_conan", "(", "self", ".", "_auth_user", ",", "ref", ")", "latest_ref", "=", "self", ".", "_get_latest_ref", ...
https://github.com/conan-io/conan/blob/28ec09f6cbf1d7e27ec27393fd7bbc74891e74a8/conans/server/service/v1/service.py#L26-L36
hacktoolspack/hack-tools
c2b1e324f4b24a2c5b4f111e7ef84e9c547159c2
wifite2-master/wifite/model/handshake.py
python
Handshake.aircrack_handshakes
(self)
Returns tuple (BSSID,None) if aircrack thinks self.capfile contains a handshake / can be cracked
Returns tuple (BSSID,None) if aircrack thinks self.capfile contains a handshake / can be cracked
[ "Returns", "tuple", "(", "BSSID", "None", ")", "if", "aircrack", "thinks", "self", ".", "capfile", "contains", "a", "handshake", "/", "can", "be", "cracked" ]
def aircrack_handshakes(self): '''Returns tuple (BSSID,None) if aircrack thinks self.capfile contains a handshake / can be cracked''' if not self.bssid: return [] # Aircrack requires BSSID command = 'echo "" | aircrack-ng -a 2 -w - -b %s "%s"' % (self.bssid, self.capfile) (...
[ "def", "aircrack_handshakes", "(", "self", ")", ":", "if", "not", "self", ".", "bssid", ":", "return", "[", "]", "# Aircrack requires BSSID", "command", "=", "'echo \"\" | aircrack-ng -a 2 -w - -b %s \"%s\"'", "%", "(", "self", ".", "bssid", ",", "self", ".", "c...
https://github.com/hacktoolspack/hack-tools/blob/c2b1e324f4b24a2c5b4f111e7ef84e9c547159c2/wifite2-master/wifite/model/handshake.py#L116-L127
nithinmurali/pygsheets
09e985ccfe0585e8aa0633af8d0c0f038e3b3e1a
pygsheets/cell.py
python
Cell.set_number_format
(self, format_type, pattern='')
return self
Set number format of this cell. Reference: `api docs <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#NumberFormat>`__ :param format_type: The type of the number format. Should be of type :class:`FormatType <FormatType>`. :param pattern: Pattern string used for formatti...
Set number format of this cell.
[ "Set", "number", "format", "of", "this", "cell", "." ]
def set_number_format(self, format_type, pattern=''): """ Set number format of this cell. Reference: `api docs <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#NumberFormat>`__ :param format_type: The type of the number format. Should be of type :class:`FormatTy...
[ "def", "set_number_format", "(", "self", ",", "format_type", ",", "pattern", "=", "''", ")", ":", "if", "not", "isinstance", "(", "format_type", ",", "FormatType", ")", ":", "raise", "InvalidArgumentValue", "(", "\"format_type should be of type pygsheets.FormatType\""...
https://github.com/nithinmurali/pygsheets/blob/09e985ccfe0585e8aa0633af8d0c0f038e3b3e1a/pygsheets/cell.py#L268-L286
p-christ/Deep-Reinforcement-Learning-Algorithms-with-PyTorch
135d3e2e06bbde2868047d738e3fc2d73fd8cc93
agents/hierarchical_agents/HIRO.py
python
HIRO.goal_transition
(state, goal, next_state)
return state + goal - next_state
Provides updated goal according to the goal transition function in the HIRO paper
Provides updated goal according to the goal transition function in the HIRO paper
[ "Provides", "updated", "goal", "according", "to", "the", "goal", "transition", "function", "in", "the", "HIRO", "paper" ]
def goal_transition(state, goal, next_state): """Provides updated goal according to the goal transition function in the HIRO paper""" return state + goal - next_state
[ "def", "goal_transition", "(", "state", ",", "goal", ",", "next_state", ")", ":", "return", "state", "+", "goal", "-", "next_state" ]
https://github.com/p-christ/Deep-Reinforcement-Learning-Algorithms-with-PyTorch/blob/135d3e2e06bbde2868047d738e3fc2d73fd8cc93/agents/hierarchical_agents/HIRO.py#L54-L56
Scalsol/mega.pytorch
a6aa6e0537b82d70da94228100a51e6a53d98f82
mega_core/data/datasets/voc.py
python
PascalVOCDataset.map_class_id_to_class_name
(self, class_id)
return PascalVOCDataset.CLASSES[class_id]
[]
def map_class_id_to_class_name(self, class_id): return PascalVOCDataset.CLASSES[class_id]
[ "def", "map_class_id_to_class_name", "(", "self", ",", "class_id", ")", ":", "return", "PascalVOCDataset", ".", "CLASSES", "[", "class_id", "]" ]
https://github.com/Scalsol/mega.pytorch/blob/a6aa6e0537b82d70da94228100a51e6a53d98f82/mega_core/data/datasets/voc.py#L134-L135
chadmv/cmt
1b1a9a4fb154d1d10e73373cf899e4d83c95a6a1
scripts/pyparsing/core.py
python
ParserElement.__str__
(self)
return self.name
[]
def __str__(self): return self.name
[ "def", "__str__", "(", "self", ")", ":", "return", "self", ".", "name" ]
https://github.com/chadmv/cmt/blob/1b1a9a4fb154d1d10e73373cf899e4d83c95a6a1/scripts/pyparsing/core.py#L1463-L1464
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/csv.py
python
Sniffer._guess_delimiter
(self, data, delimiters)
return (delim, skipinitialspace)
The delimiter /should/ occur the same number of times on each row. However, due to malformed data, it may not. We don't want an all or nothing approach, so we allow for small variations in this number. 1) build a table of the frequency of each character on every line. 2) buil...
The delimiter /should/ occur the same number of times on each row. However, due to malformed data, it may not. We don't want an all or nothing approach, so we allow for small variations in this number. 1) build a table of the frequency of each character on every line. 2) buil...
[ "The", "delimiter", "/", "should", "/", "occur", "the", "same", "number", "of", "times", "on", "each", "row", ".", "However", "due", "to", "malformed", "data", "it", "may", "not", ".", "We", "don", "t", "want", "an", "all", "or", "nothing", "approach",...
def _guess_delimiter(self, data, delimiters): """ The delimiter /should/ occur the same number of times on each row. However, due to malformed data, it may not. We don't want an all or nothing approach, so we allow for small variations in this number. 1) build a table o...
[ "def", "_guess_delimiter", "(", "self", ",", "data", ",", "delimiters", ")", ":", "data", "=", "list", "(", "filter", "(", "None", ",", "data", ".", "split", "(", "'\\n'", ")", ")", ")", "ascii", "=", "[", "chr", "(", "c", ")", "for", "c", "in", ...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/csv.py#L280-L380
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/flask_debugtoolbar/panels/timer.py
python
TimerDebugPanel.content
(self)
return self.render('panels/timer.html', context)
[]
def content(self): utime = 1000 * self._elapsed_ru('ru_utime') stime = 1000 * self._elapsed_ru('ru_stime') vcsw = self._elapsed_ru('ru_nvcsw') ivcsw = self._elapsed_ru('ru_nivcsw') # minflt = self._elapsed_ru('ru_minflt') # majflt = self._elapsed_ru('ru_majflt') # these...
[ "def", "content", "(", "self", ")", ":", "utime", "=", "1000", "*", "self", ".", "_elapsed_ru", "(", "'ru_utime'", ")", "stime", "=", "1000", "*", "self", ".", "_elapsed_ru", "(", "'ru_stime'", ")", "vcsw", "=", "self", ".", "_elapsed_ru", "(", "'ru_nv...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/flask_debugtoolbar/panels/timer.py#L58-L96
snapcore/snapcraft
b81550376df7f2d0dfe65f7bfb006a3107252450
snapcraft/plugins/v1/_plugin.py
python
PluginV1.env
(self, root)
return []
Return a list with the execution environment for building. Plugins often need special environment variables exported to the system for some builds to take place. This is a list of strings of the form key=value. The parameter root is the path to this part. :param str root: The root for ...
Return a list with the execution environment for building.
[ "Return", "a", "list", "with", "the", "execution", "environment", "for", "building", "." ]
def env(self, root): """Return a list with the execution environment for building. Plugins often need special environment variables exported to the system for some builds to take place. This is a list of strings of the form key=value. The parameter root is the path to this part. ...
[ "def", "env", "(", "self", ",", "root", ")", ":", "return", "[", "]" ]
https://github.com/snapcore/snapcraft/blob/b81550376df7f2d0dfe65f7bfb006a3107252450/snapcraft/plugins/v1/_plugin.py#L159-L168
nerdvegas/rez
d392c65bf63b4bca8106f938cec49144ba54e770
src/rez/vendor/pyparsing/pyparsing.py
python
ungroup
(expr)
return TokenConverter(expr).addParseAction(lambda t:t[0])
Helper to undo pyparsing's default grouping of And expressions, even if all but one are non-empty.
Helper to undo pyparsing's default grouping of And expressions, even if all but one are non-empty.
[ "Helper", "to", "undo", "pyparsing", "s", "default", "grouping", "of", "And", "expressions", "even", "if", "all", "but", "one", "are", "non", "-", "empty", "." ]
def ungroup(expr): """Helper to undo pyparsing's default grouping of And expressions, even if all but one are non-empty. """ return TokenConverter(expr).addParseAction(lambda t:t[0])
[ "def", "ungroup", "(", "expr", ")", ":", "return", "TokenConverter", "(", "expr", ")", ".", "addParseAction", "(", "lambda", "t", ":", "t", "[", "0", "]", ")" ]
https://github.com/nerdvegas/rez/blob/d392c65bf63b4bca8106f938cec49144ba54e770/src/rez/vendor/pyparsing/pyparsing.py#L5215-L5219
diyjac/SDC-P5
818a2de532c37f16761e2913ca3ff18d2de9f828
vehicleLab/chogtrainingYUV2.py
python
drawPlots
(imagefile, sampleTitle, orient, pix_per_cell, cell_per_block, trainScore, testScore, carimage, carhog, notcarimage, notcarhog, deltaTime)
[]
def drawPlots(imagefile, sampleTitle, orient, pix_per_cell, cell_per_block, trainScore, testScore, carimage, carhog, notcarimage, notcarhog, deltaTime): print("saving sample image and hogs to ", imagefile) # Setup plot fig = plt.figure(figsize=(10, 3)) w_ratios = [1 for n in range(5)] h_ratios = [1 ...
[ "def", "drawPlots", "(", "imagefile", ",", "sampleTitle", ",", "orient", ",", "pix_per_cell", ",", "cell_per_block", ",", "trainScore", ",", "testScore", ",", "carimage", ",", "carhog", ",", "notcarimage", ",", "notcarhog", ",", "deltaTime", ")", ":", "print",...
https://github.com/diyjac/SDC-P5/blob/818a2de532c37f16761e2913ca3ff18d2de9f828/vehicleLab/chogtrainingYUV2.py#L103-L161
lfz/Guided-Denoise
8881ab768d16eaf87342da4ff7dc8271e183e205
Attackset/Iter4_ensv3_resv2_inresv2_random/nets/inception_v4.py
python
block_inception_b
(inputs, scope=None, reuse=None)
Builds Inception-B block for Inception v4 network.
Builds Inception-B block for Inception v4 network.
[ "Builds", "Inception", "-", "B", "block", "for", "Inception", "v4", "network", "." ]
def block_inception_b(inputs, scope=None, reuse=None): """Builds Inception-B block for Inception v4 network.""" # By default use stride=1 and SAME padding with slim.arg_scope([slim.conv2d, slim.avg_pool2d, slim.max_pool2d], stride=1, padding='SAME'): with tf.variable_scope(scope, 'BlockI...
[ "def", "block_inception_b", "(", "inputs", ",", "scope", "=", "None", ",", "reuse", "=", "None", ")", ":", "# By default use stride=1 and SAME padding", "with", "slim", ".", "arg_scope", "(", "[", "slim", ".", "conv2d", ",", "slim", ".", "avg_pool2d", ",", "...
https://github.com/lfz/Guided-Denoise/blob/8881ab768d16eaf87342da4ff7dc8271e183e205/Attackset/Iter4_ensv3_resv2_inresv2_random/nets/inception_v4.py#L75-L96
google/TensorNetwork
e12580f1749493dbe05f474d2fecdec4eaba73c5
tensornetwork/matrixproductstates/base_mps.py
python
BaseMPS.bond_dimensions
(self)
return [self.tensors[0].shape[0]] + [t.shape[2] for t in self.tensors]
A list of bond dimensions of `BaseMPS`
A list of bond dimensions of `BaseMPS`
[ "A", "list", "of", "bond", "dimensions", "of", "BaseMPS" ]
def bond_dimensions(self) -> List: """A list of bond dimensions of `BaseMPS`""" return [self.tensors[0].shape[0]] + [t.shape[2] for t in self.tensors]
[ "def", "bond_dimensions", "(", "self", ")", "->", "List", ":", "return", "[", "self", ".", "tensors", "[", "0", "]", ".", "shape", "[", "0", "]", "]", "+", "[", "t", ".", "shape", "[", "2", "]", "for", "t", "in", "self", ".", "tensors", "]" ]
https://github.com/google/TensorNetwork/blob/e12580f1749493dbe05f474d2fecdec4eaba73c5/tensornetwork/matrixproductstates/base_mps.py#L248-L250
paramiko/paramiko
88f35a537428e430f7f26eee8026715e357b55d6
paramiko/channel.py
python
Channel.shutdown
(self, how)
Shut down one or both halves of the connection. If ``how`` is 0, further receives are disallowed. If ``how`` is 1, further sends are disallowed. If ``how`` is 2, further sends and receives are disallowed. This closes the stream in one or both directions. :param int how: ...
Shut down one or both halves of the connection. If ``how`` is 0, further receives are disallowed. If ``how`` is 1, further sends are disallowed. If ``how`` is 2, further sends and receives are disallowed. This closes the stream in one or both directions.
[ "Shut", "down", "one", "or", "both", "halves", "of", "the", "connection", ".", "If", "how", "is", "0", "further", "receives", "are", "disallowed", ".", "If", "how", "is", "1", "further", "sends", "are", "disallowed", ".", "If", "how", "is", "2", "furth...
def shutdown(self, how): """ Shut down one or both halves of the connection. If ``how`` is 0, further receives are disallowed. If ``how`` is 1, further sends are disallowed. If ``how`` is 2, further sends and receives are disallowed. This closes the stream in one or both dire...
[ "def", "shutdown", "(", "self", ",", "how", ")", ":", "if", "(", "how", "==", "0", ")", "or", "(", "how", "==", "2", ")", ":", "# feign \"read\" shutdown", "self", ".", "eof_received", "=", "1", "if", "(", "how", "==", "1", ")", "or", "(", "how",...
https://github.com/paramiko/paramiko/blob/88f35a537428e430f7f26eee8026715e357b55d6/paramiko/channel.py#L946-L967
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/packages/site-packages/sqlalchemy/dialects/oracle/base.py
python
OracleIdentifierPreparer._bindparam_requires_quotes
(self, value)
return (lc_value in self.reserved_words or value[0] in self.illegal_initial_characters or not self.legal_characters.match(util.text_type(value)) )
Return True if the given identifier requires quoting.
Return True if the given identifier requires quoting.
[ "Return", "True", "if", "the", "given", "identifier", "requires", "quoting", "." ]
def _bindparam_requires_quotes(self, value): """Return True if the given identifier requires quoting.""" lc_value = value.lower() return (lc_value in self.reserved_words or value[0] in self.illegal_initial_characters or not self.legal_characters.match(util.text_ty...
[ "def", "_bindparam_requires_quotes", "(", "self", ",", "value", ")", ":", "lc_value", "=", "value", ".", "lower", "(", ")", "return", "(", "lc_value", "in", "self", ".", "reserved_words", "or", "value", "[", "0", "]", "in", "self", ".", "illegal_initial_ch...
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/site-packages/sqlalchemy/dialects/oracle/base.py#L911-L917
sfu-db/dataprep
6dfb9c659e8bf73f07978ae195d0372495c6f118
dataprep/clean/clean_address.py
python
_clean_prefix
(result_dict: Dict[str, str], prefix: str)
Adds a cleaned full prefix and cleaned abbreviated prefix to result_dict, based on the value of street prefix
Adds a cleaned full prefix and cleaned abbreviated prefix to result_dict, based on the value of street prefix
[ "Adds", "a", "cleaned", "full", "prefix", "and", "cleaned", "abbreviated", "prefix", "to", "result_dict", "based", "on", "the", "value", "of", "street", "prefix" ]
def _clean_prefix(result_dict: Dict[str, str], prefix: str) -> None: """ Adds a cleaned full prefix and cleaned abbreviated prefix to result_dict, based on the value of street prefix """ prefix_abbr = PREFIXES.get(prefix.lower()) if prefix_abbr: result_dict["street_prefix_abbr"] = prefix...
[ "def", "_clean_prefix", "(", "result_dict", ":", "Dict", "[", "str", ",", "str", "]", ",", "prefix", ":", "str", ")", "->", "None", ":", "prefix_abbr", "=", "PREFIXES", ".", "get", "(", "prefix", ".", "lower", "(", ")", ")", "if", "prefix_abbr", ":",...
https://github.com/sfu-db/dataprep/blob/6dfb9c659e8bf73f07978ae195d0372495c6f118/dataprep/clean/clean_address.py#L377-L385
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/SocketServer.py
python
ForkingMixIn.handle_timeout
(self)
Wait for zombies after self.timeout seconds of inactivity. May be extended, do not override.
Wait for zombies after self.timeout seconds of inactivity.
[ "Wait", "for", "zombies", "after", "self", ".", "timeout", "seconds", "of", "inactivity", "." ]
def handle_timeout(self): """Wait for zombies after self.timeout seconds of inactivity. May be extended, do not override. """ self.collect_children()
[ "def", "handle_timeout", "(", "self", ")", ":", "self", ".", "collect_children", "(", ")" ]
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/SocketServer.py#L546-L551
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py
python
_verify_callback
(cnx, x509, err_no, err_depth, return_code)
return err_no == 0
[]
def _verify_callback(cnx, x509, err_no, err_depth, return_code): return err_no == 0
[ "def", "_verify_callback", "(", "cnx", ",", "x509", ",", "err_no", ",", "err_depth", ",", "return_code", ")", ":", "return", "err_no", "==", "0" ]
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py#L311-L312
tosher/Mediawiker
81bf97cace59bedcb1668e7830b85c36e014428e
lib/Crypto.osx.x64/Crypto/Protocol/KDF.py
python
_S2V.update
(self, item)
Pass the next component of the vector. The maximum number of components you can pass is equal to the block length of the cipher (in bits) minus 1. :Parameters: item : byte string The next component of the vector. :Raise TypeError: when the limit on the number of c...
Pass the next component of the vector.
[ "Pass", "the", "next", "component", "of", "the", "vector", "." ]
def update(self, item): """Pass the next component of the vector. The maximum number of components you can pass is equal to the block length of the cipher (in bits) minus 1. :Parameters: item : byte string The next component of the vector. :Raise TypeError...
[ "def", "update", "(", "self", ",", "item", ")", ":", "if", "self", ".", "_n_updates", "==", "0", ":", "raise", "TypeError", "(", "\"Too many components passed to S2V\"", ")", "self", ".", "_n_updates", "-=", "1", "mac", "=", "CMAC", ".", "new", "(", "sel...
https://github.com/tosher/Mediawiker/blob/81bf97cace59bedcb1668e7830b85c36e014428e/lib/Crypto.osx.x64/Crypto/Protocol/KDF.py#L221-L242
foxbook/atap
3e17489f57e1e17c4fba84fe68ad6c7f44fa05ad
snippets/ch12/preprocess.py
python
ParallelPreprocessor.__init__
(self, *args, **kwargs)
Get parallel-specific arguments and then call super.
Get parallel-specific arguments and then call super.
[ "Get", "parallel", "-", "specific", "arguments", "and", "then", "call", "super", "." ]
def __init__(self, *args, **kwargs): """ Get parallel-specific arguments and then call super. """ self.tasks = mp.cpu_count() super(ParallelPreprocessor, self).__init__(*args, **kwargs)
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "tasks", "=", "mp", ".", "cpu_count", "(", ")", "super", "(", "ParallelPreprocessor", ",", "self", ")", ".", "__init__", "(", "*", "args", ",", "*", ...
https://github.com/foxbook/atap/blob/3e17489f57e1e17c4fba84fe68ad6c7f44fa05ad/snippets/ch12/preprocess.py#L134-L139
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Templates/Integrations/Authentication/Authentication.py
python
Client.lock_account
(self, account_id: AnyStr)
return self._http_request('POST', suffix, params=params)
Locks an account by the account ID. Args: account_id: Account ID to lock. Returns: Response JSON
Locks an account by the account ID.
[ "Locks", "an", "account", "by", "the", "account", "ID", "." ]
def lock_account(self, account_id: AnyStr) -> Dict: """Locks an account by the account ID. Args: account_id: Account ID to lock. Returns: Response JSON """ # The service endpoint to request from suffix = 'account/lock' # Dictionary of par...
[ "def", "lock_account", "(", "self", ",", "account_id", ":", "AnyStr", ")", "->", "Dict", ":", "# The service endpoint to request from", "suffix", "=", "'account/lock'", "# Dictionary of params for the request", "params", "=", "{", "'account'", ":", "account_id", "}", ...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Templates/Integrations/Authentication/Authentication.py#L60-L73
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/_heatmap.py
python
Heatmap.metasrc
(self)
return self["metasrc"]
Sets the source reference on Chart Studio Cloud for `meta`. The 'metasrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str
Sets the source reference on Chart Studio Cloud for `meta`. The 'metasrc' property must be specified as a string or as a plotly.grid_objs.Column object
[ "Sets", "the", "source", "reference", "on", "Chart", "Studio", "Cloud", "for", "meta", ".", "The", "metasrc", "property", "must", "be", "specified", "as", "a", "string", "or", "as", "a", "plotly", ".", "grid_objs", ".", "Column", "object" ]
def metasrc(self): """ Sets the source reference on Chart Studio Cloud for `meta`. The 'metasrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str """ return self["metasrc"]
[ "def", "metasrc", "(", "self", ")", ":", "return", "self", "[", "\"metasrc\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_heatmap.py#L936-L947
mkusner/grammarVAE
ffffe272a8cf1772578dfc92254c55c224cddc02
Theano-master/theano/gof/link.py
python
map_storage
(fgraph, order, input_storage, output_storage, storage_map=None)
return input_storage, output_storage, storage_map
Ensure there is storage (a length-1 list) for inputs, outputs, and interior nodes. :param fgraph: The current fgraph. This function uses the inputs and outputs attributes. :param order: an iterable over Apply instances (in program running order) :param input_storage: None or existing input storage (see be...
Ensure there is storage (a length-1 list) for inputs, outputs, and interior nodes.
[ "Ensure", "there", "is", "storage", "(", "a", "length", "-", "1", "list", ")", "for", "inputs", "outputs", "and", "interior", "nodes", "." ]
def map_storage(fgraph, order, input_storage, output_storage, storage_map=None): """Ensure there is storage (a length-1 list) for inputs, outputs, and interior nodes. :param fgraph: The current fgraph. This function uses the inputs and outputs attributes. :param order: an iterable over Apply instances (in...
[ "def", "map_storage", "(", "fgraph", ",", "order", ",", "input_storage", ",", "output_storage", ",", "storage_map", "=", "None", ")", ":", "# each Apply argument's data is stored in a list of length 1 (these lists act like pointers)", "if", "storage_map", "is", "None", ":",...
https://github.com/mkusner/grammarVAE/blob/ffffe272a8cf1772578dfc92254c55c224cddc02/Theano-master/theano/gof/link.py#L506-L603
ycremar/ArkPlanner
f3916d24ab2f52322cbe074382db5e9a51c0eaaf
MaterialPlanning.py
python
MaterialPlanning._pre_processing
(self, material_probs)
Compute costs, convertion rules and items probabilities from requested dictionaries. Args: material_probs: List of dictionaries recording the dropping info per stage per item. Keys of instances: ["itemID", "times", "itemName", "quantity", "apCost", "stageCode", "stageID"]. ...
Compute costs, convertion rules and items probabilities from requested dictionaries. Args: material_probs: List of dictionaries recording the dropping info per stage per item. Keys of instances: ["itemID", "times", "itemName", "quantity", "apCost", "stageCode", "stageID"]. ...
[ "Compute", "costs", "convertion", "rules", "and", "items", "probabilities", "from", "requested", "dictionaries", ".", "Args", ":", "material_probs", ":", "List", "of", "dictionaries", "recording", "the", "dropping", "info", "per", "stage", "per", "item", ".", "K...
def _pre_processing(self, material_probs): """ Compute costs, convertion rules and items probabilities from requested dictionaries. Args: material_probs: List of dictionaries recording the dropping info per stage per item. Keys of instances: ["itemID", "times", "itemN...
[ "def", "_pre_processing", "(", "self", ",", "material_probs", ")", ":", "# construct item id projections.", "# construct stage id projections.", "stage_array", "=", "[", "]", "for", "drop", "in", "material_probs", "[", "'matrix'", "]", ":", "if", "drop", "[", "'stag...
https://github.com/ycremar/ArkPlanner/blob/f3916d24ab2f52322cbe074382db5e9a51c0eaaf/MaterialPlanning.py#L79-L183
alexander-akhmetov/python-shortcuts
41e8ea87a0058606052714b9755a4b4f47d3a276
shortcuts/loader.py
python
PListLoader._action_from_dict
(cls, action_dict: Dict)
return action_class(data=params)
Returns action instance from the dictionary with all necessary parameters
Returns action instance from the dictionary with all necessary parameters
[ "Returns", "action", "instance", "from", "the", "dictionary", "with", "all", "necessary", "parameters" ]
def _action_from_dict(cls, action_dict: Dict) -> 'BaseAction': '''Returns action instance from the dictionary with all necessary parameters''' identifier = action_dict['WFWorkflowActionIdentifier'] action_class = actions_registry.get_by_itype( itype=identifier, action_params=action_d...
[ "def", "_action_from_dict", "(", "cls", ",", "action_dict", ":", "Dict", ")", "->", "'BaseAction'", ":", "identifier", "=", "action_dict", "[", "'WFWorkflowActionIdentifier'", "]", "action_class", "=", "actions_registry", ".", "get_by_itype", "(", "itype", "=", "i...
https://github.com/alexander-akhmetov/python-shortcuts/blob/41e8ea87a0058606052714b9755a4b4f47d3a276/shortcuts/loader.py#L78-L91
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/Python3/operator.py
python
isub
(a, b)
return a
Same as a -= b.
Same as a -= b.
[ "Same", "as", "a", "-", "=", "b", "." ]
def isub(a, b): "Same as a -= b." a -= b return a
[ "def", "isub", "(", "a", ",", "b", ")", ":", "a", "-=", "b", "return", "a" ]
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/operator.py#L395-L398
datawire/forge
d501be4571dcef5691804c7db7008ee877933c8d
forge/schema.py
python
Schema.load
(self, name)
Load data from a json or yaml file.
Load data from a json or yaml file.
[ "Load", "data", "from", "a", "json", "or", "yaml", "file", "." ]
def load(self, name): "Load data from a json or yaml file." with open(name) as fd: return self.load(name, fd.read())
[ "def", "load", "(", "self", ",", "name", ")", ":", "with", "open", "(", "name", ")", "as", "fd", ":", "return", "self", ".", "load", "(", "name", ",", "fd", ".", "read", "(", ")", ")" ]
https://github.com/datawire/forge/blob/d501be4571dcef5691804c7db7008ee877933c8d/forge/schema.py#L192-L195
respeaker/get_started_with_respeaker
ec859759fcec7e683a5e09328a8ea307046f353d
files/usr/lib/python2.7/site-packages/serial/serialcli.py
python
IronSerial.close
(self)
Close port
Close port
[ "Close", "port" ]
def close(self): """Close port""" if self._isOpen: if self._port_handle: try: self._port_handle.Close() except System.IO.Ports.InvalidOperationException: # ignore errors. can happen for unplugged USB serial devices ...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_isOpen", ":", "if", "self", ".", "_port_handle", ":", "try", ":", "self", ".", "_port_handle", ".", "Close", "(", ")", "except", "System", ".", "IO", ".", "Ports", ".", "InvalidOperationExcept...
https://github.com/respeaker/get_started_with_respeaker/blob/ec859759fcec7e683a5e09328a8ea307046f353d/files/usr/lib/python2.7/site-packages/serial/serialcli.py#L127-L137
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
thirdparty_libs/nltk/parse/rd.py
python
SteppingRecursiveDescentParser.backtrack
(self)
return 1
Return the parser to its state before the most recent match or expand operation. Calling ``undo`` repeatedly return the parser to successively earlier states. If no match or expand operations have been performed, ``undo`` will make no changes. :return: true if an operation was...
Return the parser to its state before the most recent match or expand operation. Calling ``undo`` repeatedly return the parser to successively earlier states. If no match or expand operations have been performed, ``undo`` will make no changes.
[ "Return", "the", "parser", "to", "its", "state", "before", "the", "most", "recent", "match", "or", "expand", "operation", ".", "Calling", "undo", "repeatedly", "return", "the", "parser", "to", "successively", "earlier", "states", ".", "If", "no", "match", "o...
def backtrack(self): """ Return the parser to its state before the most recent match or expand operation. Calling ``undo`` repeatedly return the parser to successively earlier states. If no match or expand operations have been performed, ``undo`` will make no changes. ...
[ "def", "backtrack", "(", "self", ")", ":", "if", "len", "(", "self", ".", "_history", ")", "==", "0", ":", "return", "0", "(", "self", ".", "_rtext", ",", "self", ".", "_tree", ",", "self", ".", "_frontier", ")", "=", "self", ".", "_history", "."...
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/nltk/parse/rd.py#L520-L533
kivy/kivy
fbf561f73ddba9941b1b7e771f86264c6e6eef36
kivy/uix/vkeyboard.py
python
VKeyboard.refresh
(self, force=False)
(internal) Recreate the entire widget and graphics according to the selected layout.
(internal) Recreate the entire widget and graphics according to the selected layout.
[ "(", "internal", ")", "Recreate", "the", "entire", "widget", "and", "graphics", "according", "to", "the", "selected", "layout", "." ]
def refresh(self, force=False): '''(internal) Recreate the entire widget and graphics according to the selected layout. ''' self.clear_widgets() if force: self.refresh_keys_hint() self.refresh_keys() self.refresh_active_keys_layer()
[ "def", "refresh", "(", "self", ",", "force", "=", "False", ")", ":", "self", ".", "clear_widgets", "(", ")", "if", "force", ":", "self", ".", "refresh_keys_hint", "(", ")", "self", ".", "refresh_keys", "(", ")", "self", ".", "refresh_active_keys_layer", ...
https://github.com/kivy/kivy/blob/fbf561f73ddba9941b1b7e771f86264c6e6eef36/kivy/uix/vkeyboard.py#L554-L562
spesmilo/electrum
bdbd59300fbd35b01605e66145458e5f396108e8
electrum/plugins/digitalbitbox/digitalbitbox.py
python
DigitalBitboxPlugin.show_address
(self, wallet, address, keystore=None)
[]
def show_address(self, wallet, address, keystore=None): if keystore is None: keystore = wallet.get_keystore() if not self.show_address_helper(wallet, address, keystore): return if type(wallet) is not Standard_Wallet: keystore.handler.show_error(_('This functio...
[ "def", "show_address", "(", "self", ",", "wallet", ",", "address", ",", "keystore", "=", "None", ")", ":", "if", "keystore", "is", "None", ":", "keystore", "=", "wallet", ".", "get_keystore", "(", ")", "if", "not", "self", ".", "show_address_helper", "("...
https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/plugins/digitalbitbox/digitalbitbox.py#L746-L767
frenetic-lang/pyretic
30462692f3e9675158862755955b44f3a37ea21c
pyretic/lib/re.py
python
re_base.equals_meta_by_id
(self, other)
return self == other and id(self.metadata) == id(other.metadata)
Return True if the other re equals self including metadata (by id), else False.
Return True if the other re equals self including metadata (by id), else False.
[ "Return", "True", "if", "the", "other", "re", "equals", "self", "including", "metadata", "(", "by", "id", ")", "else", "False", "." ]
def equals_meta_by_id(self, other): """ Return True if the other re equals self including metadata (by id), else False. """ return self == other and id(self.metadata) == id(other.metadata)
[ "def", "equals_meta_by_id", "(", "self", ",", "other", ")", ":", "return", "self", "==", "other", "and", "id", "(", "self", ".", "metadata", ")", "==", "id", "(", "other", ".", "metadata", ")" ]
https://github.com/frenetic-lang/pyretic/blob/30462692f3e9675158862755955b44f3a37ea21c/pyretic/lib/re.py#L131-L135
Exodus-Privacy/exodus
0be3a255fda29218227ed3a214b5ef1f6c65631a
gpapi/googleplay.py
python
GooglePlayAPI.delivery
(self, packageName, versionCode=None, offerType=1, downloadToken=None, expansion_files=False)
Download an already purchased app. Args: packageName (str): app unique ID (usually starting with 'com.') versionCode (int): version to download offerType (int): different type of downloads (mostly unused for apks) downloadToken (str): download token returned by '...
Download an already purchased app.
[ "Download", "an", "already", "purchased", "app", "." ]
def delivery(self, packageName, versionCode=None, offerType=1, downloadToken=None, expansion_files=False): """Download an already purchased app. Args: packageName (str): app unique ID (usually starting with 'com.') versionCode (int): version to download ...
[ "def", "delivery", "(", "self", ",", "packageName", ",", "versionCode", "=", "None", ",", "offerType", "=", "1", ",", "downloadToken", "=", "None", ",", "expansion_files", "=", "False", ")", ":", "if", "versionCode", "is", "None", ":", "# pick up latest vers...
https://github.com/Exodus-Privacy/exodus/blob/0be3a255fda29218227ed3a214b5ef1f6c65631a/gpapi/googleplay.py#L539-L614
speedinghzl/CCNet
1fae6c67229c3863232494762b0afd9a8d7ff309
evaluate.py
python
pad_image
(img, target_size)
return padded_img
Pad an image up to the target size.
Pad an image up to the target size.
[ "Pad", "an", "image", "up", "to", "the", "target", "size", "." ]
def pad_image(img, target_size): """Pad an image up to the target size.""" rows_missing = target_size[0] - img.shape[2] cols_missing = target_size[1] - img.shape[3] padded_img = np.pad(img, ((0, 0), (0, 0), (0, rows_missing), (0, cols_missing)), 'constant') return padded_img
[ "def", "pad_image", "(", "img", ",", "target_size", ")", ":", "rows_missing", "=", "target_size", "[", "0", "]", "-", "img", ".", "shape", "[", "2", "]", "cols_missing", "=", "target_size", "[", "1", "]", "-", "img", ".", "shape", "[", "3", "]", "p...
https://github.com/speedinghzl/CCNet/blob/1fae6c67229c3863232494762b0afd9a8d7ff309/evaluate.py#L95-L100
praw-dev/praw
d1280b132f509ad115f3941fb55f13f979068377
praw/models/reddit/mixins/editable.py
python
EditableMixin.delete
(self)
Delete the object. Example usage: .. code-block:: python comment = reddit.comment("dkk4qjd") comment.delete() submission = reddit.submission("8dmv8z") submission.delete()
Delete the object.
[ "Delete", "the", "object", "." ]
def delete(self): """Delete the object. Example usage: .. code-block:: python comment = reddit.comment("dkk4qjd") comment.delete() submission = reddit.submission("8dmv8z") submission.delete() """ self._reddit.post(API_PATH["del...
[ "def", "delete", "(", "self", ")", ":", "self", ".", "_reddit", ".", "post", "(", "API_PATH", "[", "\"del\"", "]", ",", "{", "\"id\"", ":", "self", ".", "fullname", "}", ")" ]
https://github.com/praw-dev/praw/blob/d1280b132f509ad115f3941fb55f13f979068377/praw/models/reddit/mixins/editable.py#L13-L27
grantjenks/python-sortedcontainers
dff7ef79a21b3f3ceb6a19868f302f0a680aa243
sortedcontainers/sortedlist.py
python
SortedList.discard
(self, value)
Remove `value` from sorted list if it is a member. If `value` is not a member, do nothing. Runtime complexity: `O(log(n))` -- approximate. >>> sl = SortedList([1, 2, 3, 4, 5]) >>> sl.discard(5) >>> sl.discard(0) >>> sl == [1, 2, 3, 4] True :param value...
Remove `value` from sorted list if it is a member.
[ "Remove", "value", "from", "sorted", "list", "if", "it", "is", "a", "member", "." ]
def discard(self, value): """Remove `value` from sorted list if it is a member. If `value` is not a member, do nothing. Runtime complexity: `O(log(n))` -- approximate. >>> sl = SortedList([1, 2, 3, 4, 5]) >>> sl.discard(5) >>> sl.discard(0) >>> sl == [1, 2, 3, ...
[ "def", "discard", "(", "self", ",", "value", ")", ":", "_maxes", "=", "self", ".", "_maxes", "if", "not", "_maxes", ":", "return", "pos", "=", "bisect_left", "(", "_maxes", ",", "value", ")", "if", "pos", "==", "len", "(", "_maxes", ")", ":", "retu...
https://github.com/grantjenks/python-sortedcontainers/blob/dff7ef79a21b3f3ceb6a19868f302f0a680aa243/sortedcontainers/sortedlist.py#L393-L423
skylander86/lambda-text-extractor
6da52d077a2fc571e38bfe29c33ae68f6443cd5a
lib-linux_x64/pptx/shapes/placeholder.py
python
PicturePlaceholder.insert_picture
(self, image_file)
return PlaceholderPicture(pic, self._parent)
Return a |PlaceholderPicture| object depicting the image in *image_file*, which may be either a path (string) or a file-like object. The image is cropped to fill the entire space of the placeholder. A |PlaceholderPicture| object has all the properties and methods of a |Picture| shape exc...
Return a |PlaceholderPicture| object depicting the image in *image_file*, which may be either a path (string) or a file-like object. The image is cropped to fill the entire space of the placeholder. A |PlaceholderPicture| object has all the properties and methods of a |Picture| shape exc...
[ "Return", "a", "|PlaceholderPicture|", "object", "depicting", "the", "image", "in", "*", "image_file", "*", "which", "may", "be", "either", "a", "path", "(", "string", ")", "or", "a", "file", "-", "like", "object", ".", "The", "image", "is", "cropped", "...
def insert_picture(self, image_file): """ Return a |PlaceholderPicture| object depicting the image in *image_file*, which may be either a path (string) or a file-like object. The image is cropped to fill the entire space of the placeholder. A |PlaceholderPicture| object has all t...
[ "def", "insert_picture", "(", "self", ",", "image_file", ")", ":", "pic", "=", "self", ".", "_new_placeholder_pic", "(", "image_file", ")", "self", ".", "_replace_placeholder_with", "(", "pic", ")", "return", "PlaceholderPicture", "(", "pic", ",", "self", ".",...
https://github.com/skylander86/lambda-text-extractor/blob/6da52d077a2fc571e38bfe29c33ae68f6443cd5a/lib-linux_x64/pptx/shapes/placeholder.py#L313-L325
sfzhang15/ATSS
79dfb28bd18c931dd75a3ca2c63d32f5e4b1626a
atss_core/modeling/rpn/anchor_generator.py
python
_generate_anchors
(base_size, scales, aspect_ratios)
return torch.from_numpy(anchors)
Generate anchor (reference) windows by enumerating aspect ratios X scales wrt a reference (0, 0, base_size - 1, base_size - 1) window.
Generate anchor (reference) windows by enumerating aspect ratios X scales wrt a reference (0, 0, base_size - 1, base_size - 1) window.
[ "Generate", "anchor", "(", "reference", ")", "windows", "by", "enumerating", "aspect", "ratios", "X", "scales", "wrt", "a", "reference", "(", "0", "0", "base_size", "-", "1", "base_size", "-", "1", ")", "window", "." ]
def _generate_anchors(base_size, scales, aspect_ratios): """Generate anchor (reference) windows by enumerating aspect ratios X scales wrt a reference (0, 0, base_size - 1, base_size - 1) window. """ anchor = np.array([1, 1, base_size, base_size], dtype=np.float) - 0.5 anchors = _ratio_enum(anchor, a...
[ "def", "_generate_anchors", "(", "base_size", ",", "scales", ",", "aspect_ratios", ")", ":", "anchor", "=", "np", ".", "array", "(", "[", "1", ",", "1", ",", "base_size", ",", "base_size", "]", ",", "dtype", "=", "np", ".", "float", ")", "-", "0.5", ...
https://github.com/sfzhang15/ATSS/blob/79dfb28bd18c931dd75a3ca2c63d32f5e4b1626a/atss_core/modeling/rpn/anchor_generator.py#L257-L266
jesse-ai/jesse
28759547138fbc76dff12741204833e39c93b083
jesse/indicators/srwma.py
python
srwma
(candles: np.ndarray, period: int = 14, source_type: str = "close", sequential: bool = False)
return res if sequential else res[-1]
Square Root Weighted Moving Average :param candles: np.ndarray :param period: int - default: 14 :param source_type: str - default: "close" :param sequential: bool - default: False :return: float | np.ndarray
Square Root Weighted Moving Average
[ "Square", "Root", "Weighted", "Moving", "Average" ]
def srwma(candles: np.ndarray, period: int = 14, source_type: str = "close", sequential: bool = False) -> Union[ float, np.ndarray]: """ Square Root Weighted Moving Average :param candles: np.ndarray :param period: int - default: 14 :param source_type: str - default: "close" :param sequenti...
[ "def", "srwma", "(", "candles", ":", "np", ".", "ndarray", ",", "period", ":", "int", "=", "14", ",", "source_type", ":", "str", "=", "\"close\"", ",", "sequential", ":", "bool", "=", "False", ")", "->", "Union", "[", "float", ",", "np", ".", "ndar...
https://github.com/jesse-ai/jesse/blob/28759547138fbc76dff12741204833e39c93b083/jesse/indicators/srwma.py#L13-L35
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Lib/tkinter/__init__.py
python
Misc.winfo_visual
(self)
return self.tk.call('winfo', 'visual', self._w)
Return one of the strings directcolor, grayscale, pseudocolor, staticcolor, staticgray, or truecolor for the colormodel of this widget.
Return one of the strings directcolor, grayscale, pseudocolor, staticcolor, staticgray, or truecolor for the colormodel of this widget.
[ "Return", "one", "of", "the", "strings", "directcolor", "grayscale", "pseudocolor", "staticcolor", "staticgray", "or", "truecolor", "for", "the", "colormodel", "of", "this", "widget", "." ]
def winfo_visual(self): """Return one of the strings directcolor, grayscale, pseudocolor, staticcolor, staticgray, or truecolor for the colormodel of this widget.""" return self.tk.call('winfo', 'visual', self._w)
[ "def", "winfo_visual", "(", "self", ")", ":", "return", "self", ".", "tk", ".", "call", "(", "'winfo'", ",", "'visual'", ",", "self", ".", "_w", ")" ]
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/tkinter/__init__.py#L901-L905
universalcore/elastic-git
a44a58b646630ccfa890eb92a1e23fd4cef65712
elasticgit/istorage.py
python
IStorageManager.write_config
(section, data)
Write a config block for a git repository. :param str section: The section to write the data for. :param dict data: The keys & values of data to write
Write a config block for a git repository.
[ "Write", "a", "config", "block", "for", "a", "git", "repository", "." ]
def write_config(section, data): """ Write a config block for a git repository. :param str section: The section to write the data for. :param dict data: The keys & values of data to write """
[ "def", "write_config", "(", "section", ",", "data", ")", ":" ]
https://github.com/universalcore/elastic-git/blob/a44a58b646630ccfa890eb92a1e23fd4cef65712/elasticgit/istorage.py#L11-L20
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
tensorflow2/tf2cv/models/pyramidnet_cifar.py
python
pyramidnet236_a220_bn_svhn
(classes=10, **kwargs)
return get_pyramidnet_cifar( classes=classes, blocks=236, alpha=220, bottleneck=True, model_name="pyramidnet236_a220_bn_svhn", **kwargs)
PyramidNet-236 (a=220, bn) model for SVHN from 'Deep Pyramidal Residual Networks,' https://arxiv.org/abs/1610.02915. Parameters: ---------- classes : int, default 10 Number of classification classes. pretrained : bool, default False Whether to load the pretrained weights for model. ...
PyramidNet-236 (a=220, bn) model for SVHN from 'Deep Pyramidal Residual Networks,' https://arxiv.org/abs/1610.02915.
[ "PyramidNet", "-", "236", "(", "a", "=", "220", "bn", ")", "model", "for", "SVHN", "from", "Deep", "Pyramidal", "Residual", "Networks", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1610", ".", "02915", "." ]
def pyramidnet236_a220_bn_svhn(classes=10, **kwargs): """ PyramidNet-236 (a=220, bn) model for SVHN from 'Deep Pyramidal Residual Networks,' https://arxiv.org/abs/1610.02915. Parameters: ---------- classes : int, default 10 Number of classification classes. pretrained : bool, defaul...
[ "def", "pyramidnet236_a220_bn_svhn", "(", "classes", "=", "10", ",", "*", "*", "kwargs", ")", ":", "return", "get_pyramidnet_cifar", "(", "classes", "=", "classes", ",", "blocks", "=", "236", ",", "alpha", "=", "220", ",", "bottleneck", "=", "True", ",", ...
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/tensorflow2/tf2cv/models/pyramidnet_cifar.py#L555-L575
sympy/sympy
d822fcba181155b85ff2b29fe525adbafb22b448
sympy/stats/rv_interface.py
python
variance
(X, condition=None, **kwargs)
return cmoment(X, 2, condition, **kwargs)
Variance of a random expression. .. math:: variance(X) = E((X-E(X))^{2}) Examples ======== >>> from sympy.stats import Die, Bernoulli, variance >>> from sympy import simplify, Symbol >>> X = Die('X', 6) >>> p = Symbol('p') >>> B = Bernoulli('B', p, 1, 0) >>> variance(2*X...
Variance of a random expression.
[ "Variance", "of", "a", "random", "expression", "." ]
def variance(X, condition=None, **kwargs): """ Variance of a random expression. .. math:: variance(X) = E((X-E(X))^{2}) Examples ======== >>> from sympy.stats import Die, Bernoulli, variance >>> from sympy import simplify, Symbol >>> X = Die('X', 6) >>> p = Symbol('p') ...
[ "def", "variance", "(", "X", ",", "condition", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "is_random", "(", "X", ")", "and", "pspace", "(", "X", ")", "==", "PSpace", "(", ")", ":", "from", "sympy", ".", "stats", ".", "symbolic_probabilit...
https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/stats/rv_interface.py#L53-L80
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/babel/core.py
python
Locale.periods
(self)
Locale display names for day periods (AM/PM). >>> Locale('en', 'US').periods['am'] u'AM'
Locale display names for day periods (AM/PM).
[ "Locale", "display", "names", "for", "day", "periods", "(", "AM", "/", "PM", ")", "." ]
def periods(self): """Locale display names for day periods (AM/PM). >>> Locale('en', 'US').periods['am'] u'AM' """ try: return self._data['day_periods']['stand-alone']['wide'] except KeyError: return {}
[ "def", "periods", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_data", "[", "'day_periods'", "]", "[", "'stand-alone'", "]", "[", "'wide'", "]", "except", "KeyError", ":", "return", "{", "}" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/babel/core.py#L609-L618
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/distlib/index.py
python
PackageIndex.get_sign_command
(self, filename, signer, sign_password, keystore=None)
return cmd, sf
Return a suitable command for signing a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_password: The passphrase for the signer's private key used for signing. :param keystor...
Return a suitable command for signing a file.
[ "Return", "a", "suitable", "command", "for", "signing", "a", "file", "." ]
def get_sign_command(self, filename, signer, sign_password, keystore=None): """ Return a suitable command for signing a file. :param filename: The pathname to the file to be signed. :param signer: The identifier of the signer of the file. :param sign_pas...
[ "def", "get_sign_command", "(", "self", ",", "filename", ",", "signer", ",", "sign_password", ",", "keystore", "=", "None", ")", ":", "cmd", "=", "[", "self", ".", "gpg", ",", "'--status-fd'", ",", "'2'", ",", "'--no-tty'", "]", "if", "keystore", "is", ...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/distlib/index.py#L151-L178
tobami/littlechef
272b5e605fe66e28752ff23605094b267bccf0fe
littlechef/lib.py
python
print_recipe
(recipe)
Pretty prints the given recipe
Pretty prints the given recipe
[ "Pretty", "prints", "the", "given", "recipe" ]
def print_recipe(recipe): """Pretty prints the given recipe""" print(colors.yellow("\n{0}".format(recipe['name']))) print " description: {0}".format(recipe['description']) print " version: {0}".format(recipe['version']) print " dependencies: {0}".format(", ".join(recipe['dependencies'])) ...
[ "def", "print_recipe", "(", "recipe", ")", ":", "print", "(", "colors", ".", "yellow", "(", "\"\\n{0}\"", ".", "format", "(", "recipe", "[", "'name'", "]", ")", ")", ")", "print", "\" description: {0}\"", ".", "format", "(", "recipe", "[", "'description'...
https://github.com/tobami/littlechef/blob/272b5e605fe66e28752ff23605094b267bccf0fe/littlechef/lib.py#L379-L385
tecladocode/rest-apis-flask-python
d2d40872012dcf1b63ffde4bbd2dd447fec98eca
section2/9_inheritance.py
python
Student.__init__
(self, name, school)
[]
def __init__(self, name, school): self.name = name self.school = school self.marks = []
[ "def", "__init__", "(", "self", ",", "name", ",", "school", ")", ":", "self", ".", "name", "=", "name", "self", ".", "school", "=", "school", "self", ".", "marks", "=", "[", "]" ]
https://github.com/tecladocode/rest-apis-flask-python/blob/d2d40872012dcf1b63ffde4bbd2dd447fec98eca/section2/9_inheritance.py#L2-L5
IntelLabs/nlp-architect
60afd0dd1bfd74f01b4ac8f613cb484777b80284
nlp_architect/utils/metrics.py
python
get_conll_scores
(predictions, y, y_lex, unk="O")
return classification_report(y_true, y_pred, digits=3)
Get Conll style scores (precision, recall, f1)
Get Conll style scores (precision, recall, f1)
[ "Get", "Conll", "style", "scores", "(", "precision", "recall", "f1", ")" ]
def get_conll_scores(predictions, y, y_lex, unk="O"): """Get Conll style scores (precision, recall, f1)""" if isinstance(predictions, list): predictions = predictions[-1] test_p = predictions if len(test_p.shape) > 2: test_p = test_p.argmax(2) test_y = y if len(test_y.shape) > 2:...
[ "def", "get_conll_scores", "(", "predictions", ",", "y", ",", "y_lex", ",", "unk", "=", "\"O\"", ")", ":", "if", "isinstance", "(", "predictions", ",", "list", ")", ":", "predictions", "=", "predictions", "[", "-", "1", "]", "test_p", "=", "predictions",...
https://github.com/IntelLabs/nlp-architect/blob/60afd0dd1bfd74f01b4ac8f613cb484777b80284/nlp_architect/utils/metrics.py#L52-L79
shiweibsw/Translation-Tools
2fbbf902364e557fa7017f9a74a8797b7440c077
venv/Lib/site-packages/xlrd/sheet.py
python
Sheet.handle_obj
(self, data)
return o
[]
def handle_obj(self, data): if self.biff_version < 80: return None o = MSObj() data_len = len(data) pos = 0 if OBJ_MSO_DEBUG: fprintf(self.logfile, "... OBJ record len=%d...\n", data_len) while pos < data_len: ft, cb = unpack('<HH', dat...
[ "def", "handle_obj", "(", "self", ",", "data", ")", ":", "if", "self", ".", "biff_version", "<", "80", ":", "return", "None", "o", "=", "MSObj", "(", ")", "data_len", "=", "len", "(", "data", ")", "pos", "=", "0", "if", "OBJ_MSO_DEBUG", ":", "fprin...
https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/xlrd/sheet.py#L1877-L1931
nschloe/quadpy
c4c076d8ddfa968486a2443a95e2fb3780dcde0f
src/quadpy/t2/_dunavant/__init__.py
python
dunavant_05
()
return _read(this_dir / "dunavant_05.json", source)
[]
def dunavant_05(): return _read(this_dir / "dunavant_05.json", source)
[ "def", "dunavant_05", "(", ")", ":", "return", "_read", "(", "this_dir", "/", "\"dunavant_05.json\"", ",", "source", ")" ]
https://github.com/nschloe/quadpy/blob/c4c076d8ddfa968486a2443a95e2fb3780dcde0f/src/quadpy/t2/_dunavant/__init__.py#L42-L43
transferwise/pipelinewise
6934b3851512dbdd4280790bf253a0a13ab65684
pipelinewise/fastsync/mysql_to_postgres.py
python
sync_table
(table: str, args: Namespace)
Sync one table
Sync one table
[ "Sync", "one", "table" ]
def sync_table(table: str, args: Namespace) -> Union[bool, str]: """Sync one table""" mysql = FastSyncTapMySql(args.tap, tap_type_to_target_type) postgres = FastSyncTargetPostgres(args.target, args.transform) try: filename = utils.gen_export_filename( tap_id=args.target.get('tap_id'...
[ "def", "sync_table", "(", "table", ":", "str", ",", "args", ":", "Namespace", ")", "->", "Union", "[", "bool", ",", "str", "]", ":", "mysql", "=", "FastSyncTapMySql", "(", "args", ".", "tap", ",", "tap_type_to_target_type", ")", "postgres", "=", "FastSyn...
https://github.com/transferwise/pipelinewise/blob/6934b3851512dbdd4280790bf253a0a13ab65684/pipelinewise/fastsync/mysql_to_postgres.py#L73-L134
cloudtools/troposphere
62a90a5e88c6e2df8c3f0a5d56284df212438dc1
troposphere/codebuild.py
python
Artifacts.validate
(self)
[]
def validate(self): valid_types = [ "CODEPIPELINE", "NO_ARTIFACTS", "S3", ] artifact_type = self.properties.get("Type") if artifact_type not in valid_types: raise ValueError( "Artifacts Type: must be one of %s" % ",".join(va...
[ "def", "validate", "(", "self", ")", ":", "valid_types", "=", "[", "\"CODEPIPELINE\"", ",", "\"NO_ARTIFACTS\"", ",", "\"S3\"", ",", "]", "artifact_type", "=", "self", ".", "properties", ".", "get", "(", "\"Type\"", ")", "if", "artifact_type", "not", "in", ...
https://github.com/cloudtools/troposphere/blob/62a90a5e88c6e2df8c3f0a5d56284df212438dc1/troposphere/codebuild.py#L95-L112
EricssonResearch/calvin-base
bc4645c2061c30ca305a660e48dc86e3317f5b6f
calvin/utilities/calvinconfig.py
python
CalvinConfig.set_wildcards
(self)
Allow environment variables on the form CALVIN_<SECTION>_<OPTION> to override options read from defaults or config files. <SECTION> must be one of GLOBAL, TESTING, or DEVELOPER.
Allow environment variables on the form CALVIN_<SECTION>_<OPTION> to override options read from defaults or config files. <SECTION> must be one of GLOBAL, TESTING, or DEVELOPER.
[ "Allow", "environment", "variables", "on", "the", "form", "CALVIN_<SECTION", ">", "_<OPTION", ">", "to", "override", "options", "read", "from", "defaults", "or", "config", "files", ".", "<SECTION", ">", "must", "be", "one", "of", "GLOBAL", "TESTING", "or", "...
def set_wildcards(self): """ Allow environment variables on the form CALVIN_<SECTION>_<OPTION> to override options read from defaults or config files. <SECTION> must be one of GLOBAL, TESTING, or DEVELOPER. """ wildcards = [e for e in os.environ if e.startswith('CALVIN_') and not...
[ "def", "set_wildcards", "(", "self", ")", ":", "wildcards", "=", "[", "e", "for", "e", "in", "os", ".", "environ", "if", "e", ".", "startswith", "(", "'CALVIN_'", ")", "and", "not", "e", ".", "startswith", "(", "'CALVIN_CONFIG'", ")", "]", "for", "wi...
https://github.com/EricssonResearch/calvin-base/blob/bc4645c2061c30ca305a660e48dc86e3317f5b6f/calvin/utilities/calvinconfig.py#L421-L438
davidmcclure/open-syllabus-project
078cfd4c5a257fbfb0901d43bfbc6350824eed4e
osp/common/mixins/elasticsearch.py
python
Elasticsearch.es_insert
(cls, mock=False)
Insert documents. Args: mock (bool): If true, generate mock data.
Insert documents.
[ "Insert", "documents", "." ]
def es_insert(cls, mock=False): """ Insert documents. Args: mock (bool): If true, generate mock data. """ if not mock: actions = cls.es_stream_docs() else: actions = cls.es_stream_mock_docs() # Clear the index. cls....
[ "def", "es_insert", "(", "cls", ",", "mock", "=", "False", ")", ":", "if", "not", "mock", ":", "actions", "=", "cls", ".", "es_stream_docs", "(", ")", "else", ":", "actions", "=", "cls", ".", "es_stream_mock_docs", "(", ")", "# Clear the index.", "cls", ...
https://github.com/davidmcclure/open-syllabus-project/blob/078cfd4c5a257fbfb0901d43bfbc6350824eed4e/osp/common/mixins/elasticsearch.py#L55-L84
PINTO0309/PINTO_model_zoo
2924acda7a7d541d8712efd7cc4fd1c61ef5bddd
041_DBFace/main_openvino.py
python
detect
(exec_net, input_blob, image, threshold=0.4, nms_iou=0.5)
return nms(objs, iou=nms_iou)
[]
def detect(exec_net, input_blob, image, threshold=0.4, nms_iou=0.5): outputs = exec_net.infer(inputs={input_blob: image}) # print('outputs:', outputs) # print('outputs[\'Sigmoid_526\'].shape:', outputs['Sigmoid_526'].shape) # print('outputs[\'Exp_527\'].shape:', outputs['Exp_527'].shape) # print('o...
[ "def", "detect", "(", "exec_net", ",", "input_blob", ",", "image", ",", "threshold", "=", "0.4", ",", "nms_iou", "=", "0.5", ")", ":", "outputs", "=", "exec_net", ".", "infer", "(", "inputs", "=", "{", "input_blob", ":", "image", "}", ")", "# print('ou...
https://github.com/PINTO0309/PINTO_model_zoo/blob/2924acda7a7d541d8712efd7cc4fd1c61ef5bddd/041_DBFace/main_openvino.py#L42-L87
misterch0c/shadowbroker
e3a069bea47a2c1009697941ac214adc6f90aa8d
windows/Resources/Python/Core/Lib/mailbox.py
python
Maildir.add_folder
(self, folder)
return result
Create a folder and return a Maildir instance representing it.
Create a folder and return a Maildir instance representing it.
[ "Create", "a", "folder", "and", "return", "a", "Maildir", "instance", "representing", "it", "." ]
def add_folder(self, folder): """Create a folder and return a Maildir instance representing it.""" path = os.path.join(self._path, '.' + folder) result = Maildir(path, factory=self._factory) maildirfolder_path = os.path.join(path, 'maildirfolder') if not os.path.exists(maildirfol...
[ "def", "add_folder", "(", "self", ",", "folder", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_path", ",", "'.'", "+", "folder", ")", "result", "=", "Maildir", "(", "path", ",", "factory", "=", "self", ".", "_factory", ...
https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/mailbox.py#L409-L416
itailang/SampleNet
442459abc54f9e14f0966a169a094a98febd32eb
registration/main.py
python
options
(argv=None, parser=None)
return args
[]
def options(argv=None, parser=None): if parser is None: parser = argparse.ArgumentParser() parser.add_argument('-o', '--outfile', required=True, type=str, metavar='BASENAME', help='output filename (prefix)') # the result: ${BASENAME}_model_best.pth parser.add_argument('--da...
[ "def", "options", "(", "argv", "=", "None", ",", "parser", "=", "None", ")", ":", "if", "parser", "is", "None", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "'-o'", ",", "'--outfile'", ",", "requi...
https://github.com/itailang/SampleNet/blob/442459abc54f9e14f0966a169a094a98febd32eb/registration/main.py#L40-L92
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/events/v1/subscription/subscribed_event.py
python
SubscribedEventInstance.fetch
(self)
return self._proxy.fetch()
Fetch the SubscribedEventInstance :returns: The fetched SubscribedEventInstance :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventInstance
Fetch the SubscribedEventInstance
[ "Fetch", "the", "SubscribedEventInstance" ]
def fetch(self): """ Fetch the SubscribedEventInstance :returns: The fetched SubscribedEventInstance :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventInstance """ return self._proxy.fetch()
[ "def", "fetch", "(", "self", ")", ":", "return", "self", ".", "_proxy", ".", "fetch", "(", ")" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/events/v1/subscription/subscribed_event.py#L379-L386
bpython/curtsies
56a0ad1199d346a059635982aa87ca07be17e14a
docs/terminal_output.py
python
ANSIHTMLParser._format_it
(self, block)
[]
def _format_it(self, block): source = block.rawsource content = htmlize(source) formatted = "<pre>%s</pre>" % (content,) raw_node = nodes.raw(formatted, formatted, format="html") block.replace_self(raw_node)
[ "def", "_format_it", "(", "self", ",", "block", ")", ":", "source", "=", "block", ".", "rawsource", "content", "=", "htmlize", "(", "source", ")", "formatted", "=", "\"<pre>%s</pre>\"", "%", "(", "content", ",", ")", "raw_node", "=", "nodes", ".", "raw",...
https://github.com/bpython/curtsies/blob/56a0ad1199d346a059635982aa87ca07be17e14a/docs/terminal_output.py#L46-L51
noamraph/dreampie
b09ee546ec099ee6549c649692ceb129e05fb229
dreampielib/gui/autocomplete_window.py
python
AutocompleteWindow.on_changed_after_hide
(self, sb, expected_text, public, private, is_case_insen, start_len)
This is called on the first 'changed' signal after the completion list was hidden because a "wrong" character was typed. If it is deleted, this method opens the list again.
This is called on the first 'changed' signal after the completion list was hidden because a "wrong" character was typed. If it is deleted, this method opens the list again.
[ "This", "is", "called", "on", "the", "first", "changed", "signal", "after", "the", "completion", "list", "was", "hidden", "because", "a", "wrong", "character", "was", "typed", ".", "If", "it", "is", "deleted", "this", "method", "opens", "the", "list", "aga...
def on_changed_after_hide(self, sb, expected_text, public, private, is_case_insen, start_len): """ This is called on the first 'changed' signal after the completion list was hidden because a "wrong" character was typed. If it is deleted, this method opens th...
[ "def", "on_changed_after_hide", "(", "self", ",", "sb", ",", "expected_text", ",", "public", ",", "private", ",", "is_case_insen", ",", "start_len", ")", ":", "# Stop handler", "sb", ".", "disconnect", "(", "self", ".", "changed_after_hide_handler", ")", "self",...
https://github.com/noamraph/dreampie/blob/b09ee546ec099ee6549c649692ceb129e05fb229/dreampielib/gui/autocomplete_window.py#L394-L406
cloudera/impyla
0c736af4cad2bade9b8e313badc08ec50e81c948
impala/_thrift_gen/hive_metastore/ttypes.py
python
ColumnStatisticsDesc.validate
(self)
return
[]
def validate(self): if self.isTblLevel is None: raise TProtocolException(message='Required field isTblLevel is unset!') if self.dbName is None: raise TProtocolException(message='Required field dbName is unset!') if self.tableName is None: raise TProtocolExcept...
[ "def", "validate", "(", "self", ")", ":", "if", "self", ".", "isTblLevel", "is", "None", ":", "raise", "TProtocolException", "(", "message", "=", "'Required field isTblLevel is unset!'", ")", "if", "self", ".", "dbName", "is", "None", ":", "raise", "TProtocolE...
https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ttypes.py#L4837-L4844
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/site-packages/gdata/apps/organization/data.py
python
CustomerIdEntry.GetCustomerId
(self)
return self._GetProperty(CUSTOMER_ID)
Get the customer ID of the customerId object. Returns: The customer ID of this customerId object as a string or None.
Get the customer ID of the customerId object.
[ "Get", "the", "customer", "ID", "of", "the", "customerId", "object", "." ]
def GetCustomerId(self): """Get the customer ID of the customerId object. Returns: The customer ID of this customerId object as a string or None. """ return self._GetProperty(CUSTOMER_ID)
[ "def", "GetCustomerId", "(", "self", ")", ":", "return", "self", ".", "_GetProperty", "(", "CUSTOMER_ID", ")" ]
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/gdata/apps/organization/data.py#L63-L69
theotherp/nzbhydra
4b03d7f769384b97dfc60dade4806c0fc987514e
libs/cherrypy/process/plugins.py
python
PerpetualTimer.__init__
(self, *args, **kwargs)
Override parent constructor to allow 'bus' to be provided.
Override parent constructor to allow 'bus' to be provided.
[ "Override", "parent", "constructor", "to", "allow", "bus", "to", "be", "provided", "." ]
def __init__(self, *args, **kwargs): "Override parent constructor to allow 'bus' to be provided." self.bus = kwargs.pop('bus', None) super(PerpetualTimer, self).__init__(*args, **kwargs)
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "bus", "=", "kwargs", ".", "pop", "(", "'bus'", ",", "None", ")", "super", "(", "PerpetualTimer", ",", "self", ")", ".", "__init__", "(", "*", "args...
https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/cherrypy/process/plugins.py#L446-L449
nilearn/nilearn
9edba4471747efacf21260bf470a346307f52706
nilearn/glm/regression.py
python
RegressionResults.__init__
(self, theta, Y, model, whitened_Y, whitened_residuals, cov=None, dispersion=1., nuisance=None)
See LikelihoodModelResults constructor. The only difference is that the whitened Y and residual values are stored for a regression model.
See LikelihoodModelResults constructor.
[ "See", "LikelihoodModelResults", "constructor", "." ]
def __init__(self, theta, Y, model, whitened_Y, whitened_residuals, cov=None, dispersion=1., nuisance=None): """See LikelihoodModelResults constructor. The only difference is that the whitened Y and residual values are stored for a regression model. """ Likelih...
[ "def", "__init__", "(", "self", ",", "theta", ",", "Y", ",", "model", ",", "whitened_Y", ",", "whitened_residuals", ",", "cov", "=", "None", ",", "dispersion", "=", "1.", ",", "nuisance", "=", "None", ")", ":", "LikelihoodModelResults", ".", "__init__", ...
https://github.com/nilearn/nilearn/blob/9edba4471747efacf21260bf470a346307f52706/nilearn/glm/regression.py#L340-L352
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/ipaddress.py
python
_BaseNetwork.is_loopback
(self)
return (self.network_address.is_loopback and self.broadcast_address.is_loopback)
Test if the address is a loopback address. Returns: A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3.
Test if the address is a loopback address.
[ "Test", "if", "the", "address", "is", "a", "loopback", "address", "." ]
def is_loopback(self): """Test if the address is a loopback address. Returns: A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3. """ return (self.network_address.is_loopback and self.broadcast_address.is_loopback)
[ "def", "is_loopback", "(", "self", ")", ":", "return", "(", "self", ".", "network_address", ".", "is_loopback", "and", "self", ".", "broadcast_address", ".", "is_loopback", ")" ]
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/ipaddress.py#L1180-L1189
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-darwin/x64/PIL/PngImagePlugin.py
python
PngStream.chunk_gAMA
(self, pos, length)
return s
[]
def chunk_gAMA(self, pos, length): # gamma setting s = ImageFile._safe_read(self.fp, length) self.im_info["gamma"] = i32(s) / 100000.0 return s
[ "def", "chunk_gAMA", "(", "self", ",", "pos", ",", "length", ")", ":", "# gamma setting", "s", "=", "ImageFile", ".", "_safe_read", "(", "self", ".", "fp", ",", "length", ")", "self", ".", "im_info", "[", "\"gamma\"", "]", "=", "i32", "(", "s", ")", ...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/PIL/PngImagePlugin.py#L391-L395
pythonarcade/arcade
1ee3eb1900683213e8e8df93943327c2ea784564
arcade/physics_engines.py
python
PhysicsEngineSimple.update
(self)
return _move_sprite(self.player_sprite, self.walls, ramp_up=False)
Move everything and resolve collisions. :Returns: SpriteList with all sprites contacted. Empty list if no sprites.
Move everything and resolve collisions.
[ "Move", "everything", "and", "resolve", "collisions", "." ]
def update(self): """ Move everything and resolve collisions. :Returns: SpriteList with all sprites contacted. Empty list if no sprites. """ return _move_sprite(self.player_sprite, self.walls, ramp_up=False)
[ "def", "update", "(", "self", ")", ":", "return", "_move_sprite", "(", "self", ".", "player_sprite", ",", "self", ".", "walls", ",", "ramp_up", "=", "False", ")" ]
https://github.com/pythonarcade/arcade/blob/1ee3eb1900683213e8e8df93943327c2ea784564/arcade/physics_engines.py#L236-L243
CleanCut/green
55625649869d44f8c9577f5f10626b1cbdcc48ad
green/result.py
python
GreenTestResult.stopTestRun
(self)
Called once after all tests have run
Called once after all tests have run
[ "Called", "once", "after", "all", "tests", "have", "run" ]
def stopTestRun(self): """ Called once after all tests have run """ self.stopTime = time.time() self.timeTaken = self.stopTime - self.startTime self.printErrors() if self.args.run_coverage or self.args.quiet_coverage: from coverage.misc import Coverage...
[ "def", "stopTestRun", "(", "self", ")", ":", "self", ".", "stopTime", "=", "time", ".", "time", "(", ")", "self", ".", "timeTaken", "=", "self", ".", "stopTime", "-", "self", ".", "startTime", "self", ".", "printErrors", "(", ")", "if", "self", ".", ...
https://github.com/CleanCut/green/blob/55625649869d44f8c9577f5f10626b1cbdcc48ad/green/result.py#L479-L549
fxsjy/jiebademo
ba3e5a34cd84b612e13f4dfb9f3ec037928c4339
jiebademo/bottle.py
python
cookie_decode
(data, key)
return None
Verify and decode an encoded string. Return an object or None.
Verify and decode an encoded string. Return an object or None.
[ "Verify", "and", "decode", "an", "encoded", "string", ".", "Return", "an", "object", "or", "None", "." ]
def cookie_decode(data, key): ''' Verify and decode an encoded string. Return an object or None.''' data = tob(data) if cookie_is_encoded(data): sig, msg = data.split(tob('?'), 1) if _lscmp(sig[1:], base64.b64encode(hmac.new(tob(key), msg).digest())): return pickle.loads(base64.b...
[ "def", "cookie_decode", "(", "data", ",", "key", ")", ":", "data", "=", "tob", "(", "data", ")", "if", "cookie_is_encoded", "(", "data", ")", ":", "sig", ",", "msg", "=", "data", ".", "split", "(", "tob", "(", "'?'", ")", ",", "1", ")", "if", "...
https://github.com/fxsjy/jiebademo/blob/ba3e5a34cd84b612e13f4dfb9f3ec037928c4339/jiebademo/bottle.py#L1946-L1953
nutonomy/nuscenes-devkit
05d05b3c994fb3c17b6643016d9f622a001c7275
python-sdk/nuscenes/nuscenes.py
python
NuScenesExplorer.list_sample
(self, sample_token: str)
Prints sample_data tokens and sample_annotation tokens related to the sample_token.
Prints sample_data tokens and sample_annotation tokens related to the sample_token.
[ "Prints", "sample_data", "tokens", "and", "sample_annotation", "tokens", "related", "to", "the", "sample_token", "." ]
def list_sample(self, sample_token: str) -> None: """ Prints sample_data tokens and sample_annotation tokens related to the sample_token. """ sample_record = self.nusc.get('sample', sample_token) print('Sample: {}\n'.format(sample_record['token'])) for sd_token in sample_record['data']....
[ "def", "list_sample", "(", "self", ",", "sample_token", ":", "str", ")", "->", "None", ":", "sample_record", "=", "self", ".", "nusc", ".", "get", "(", "'sample'", ",", "sample_token", ")", "print", "(", "'Sample: {}\\n'", ".", "format", "(", "sample_recor...
https://github.com/nutonomy/nuscenes-devkit/blob/05d05b3c994fb3c17b6643016d9f622a001c7275/python-sdk/nuscenes/nuscenes.py#L820-L832
blockcypher/blockcypher-python
337f9e7b8fd05a4fbb646a1e6599fe30acca47cb
blockcypher/api.py
python
get_num_confirmations
(tx_hash, coin_symbol='btc', api_key=None)
return get_transaction_details(tx_hash=tx_hash, coin_symbol=coin_symbol, limit=1, api_key=api_key).get('confirmations')
Given a tx_hash, return the number of confirmations that transactions has. Answer is going to be from 0 - current_block_height.
Given a tx_hash, return the number of confirmations that transactions has.
[ "Given", "a", "tx_hash", "return", "the", "number", "of", "confirmations", "that", "transactions", "has", "." ]
def get_num_confirmations(tx_hash, coin_symbol='btc', api_key=None): ''' Given a tx_hash, return the number of confirmations that transactions has. Answer is going to be from 0 - current_block_height. ''' return get_transaction_details(tx_hash=tx_hash, coin_symbol=coin_symbol, limit=1, ...
[ "def", "get_num_confirmations", "(", "tx_hash", ",", "coin_symbol", "=", "'btc'", ",", "api_key", "=", "None", ")", ":", "return", "get_transaction_details", "(", "tx_hash", "=", "tx_hash", ",", "coin_symbol", "=", "coin_symbol", ",", "limit", "=", "1", ",", ...
https://github.com/blockcypher/blockcypher-python/blob/337f9e7b8fd05a4fbb646a1e6599fe30acca47cb/blockcypher/api.py#L520-L527
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/dexcom/config_flow.py
python
DexcomConfigFlow.async_get_options_flow
(config_entry)
return DexcomOptionsFlowHandler(config_entry)
Get the options flow for this handler.
Get the options flow for this handler.
[ "Get", "the", "options", "flow", "for", "this", "handler", "." ]
def async_get_options_flow(config_entry): """Get the options flow for this handler.""" return DexcomOptionsFlowHandler(config_entry)
[ "def", "async_get_options_flow", "(", "config_entry", ")", ":", "return", "DexcomOptionsFlowHandler", "(", "config_entry", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/dexcom/config_flow.py#L56-L58
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v2beta2_object_metric_source.py
python
V2beta2ObjectMetricSource.__eq__
(self, other)
return self.to_dict() == other.to_dict()
Returns true if both objects are equal
Returns true if both objects are equal
[ "Returns", "true", "if", "both", "objects", "are", "equal" ]
def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, V2beta2ObjectMetricSource): return False return self.to_dict() == other.to_dict()
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "V2beta2ObjectMetricSource", ")", ":", "return", "False", "return", "self", ".", "to_dict", "(", ")", "==", "other", ".", "to_dict", "(", ")" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v2beta2_object_metric_source.py#L163-L168
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/tkinter/__init__.py
python
Misc.after_idle
(self, func, *args)
return self.after('idle', func, *args)
Call FUNC once if the Tcl main loop has no event to process. Return an identifier to cancel the scheduling with after_cancel.
Call FUNC once if the Tcl main loop has no event to process.
[ "Call", "FUNC", "once", "if", "the", "Tcl", "main", "loop", "has", "no", "event", "to", "process", "." ]
def after_idle(self, func, *args): """Call FUNC once if the Tcl main loop has no event to process. Return an identifier to cancel the scheduling with after_cancel.""" return self.after('idle', func, *args)
[ "def", "after_idle", "(", "self", ",", "func", ",", "*", "args", ")", ":", "return", "self", ".", "after", "(", "'idle'", ",", "func", ",", "*", "args", ")" ]
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/tkinter/__init__.py#L542-L548
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/src/desktop/models.py
python
Document2.get_permissions
(self, perm='read')
return Document2Permission.objects.filter(Q(doc=self) & perms)
Return the sub permissions that make one of the two top privileges. e.g. 'read' and 'link_read' perms give the global 'read' privilege.
Return the sub permissions that make one of the two top privileges. e.g. 'read' and 'link_read' perms give the global 'read' privilege.
[ "Return", "the", "sub", "permissions", "that", "make", "one", "of", "the", "two", "top", "privileges", ".", "e", ".", "g", ".", "read", "and", "link_read", "perms", "give", "the", "global", "read", "privilege", "." ]
def get_permissions(self, perm='read'): ''' Return the sub permissions that make one of the two top privileges. e.g. 'read' and 'link_read' perms give the global 'read' privilege. ''' if perm == 'read': perms = Q(perms=Document2Permission.READ_PERM) | (Q(perms=Document2Permission.LINK_READ_PER...
[ "def", "get_permissions", "(", "self", ",", "perm", "=", "'read'", ")", ":", "if", "perm", "==", "'read'", ":", "perms", "=", "Q", "(", "perms", "=", "Document2Permission", ".", "READ_PERM", ")", "|", "(", "Q", "(", "perms", "=", "Document2Permission", ...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/src/desktop/models.py#L1461-L1473
srusskih/SublimeJEDI
8a5054f0a053c8a8170c06c56216245240551d54
dependencies/jedi/inference/syntax_tree.py
python
_apply_decorators
(context, node)
return values
Returns the function, that should to be executed in the end. This is also the places where the decorators are processed.
Returns the function, that should to be executed in the end. This is also the places where the decorators are processed.
[ "Returns", "the", "function", "that", "should", "to", "be", "executed", "in", "the", "end", ".", "This", "is", "also", "the", "places", "where", "the", "decorators", "are", "processed", "." ]
def _apply_decorators(context, node): """ Returns the function, that should to be executed in the end. This is also the places where the decorators are processed. """ if node.type == 'classdef': decoratee_value = ClassValue( context.inference_state, parent_context=con...
[ "def", "_apply_decorators", "(", "context", ",", "node", ")", ":", "if", "node", ".", "type", "==", "'classdef'", ":", "decoratee_value", "=", "ClassValue", "(", "context", ".", "inference_state", ",", "parent_context", "=", "context", ",", "tree_node", "=", ...
https://github.com/srusskih/SublimeJEDI/blob/8a5054f0a053c8a8170c06c56216245240551d54/dependencies/jedi/inference/syntax_tree.py#L736-L782
josephwilk/semanticpy
60af3f190fd44e5c76717c3a126cdc9201624cb5
semanticpy/porter_stemmer.py
python
PorterStemmer.vowelinstem
(self)
return 0
vowelinstem() is TRUE <=> k0,...j contains a vowel
vowelinstem() is TRUE <=> k0,...j contains a vowel
[ "vowelinstem", "()", "is", "TRUE", "<", "=", ">", "k0", "...", "j", "contains", "a", "vowel" ]
def vowelinstem(self): """vowelinstem() is TRUE <=> k0,...j contains a vowel""" for i in range(self.k0, self.j + 1): if not self.cons(i): return 1 return 0
[ "def", "vowelinstem", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "k0", ",", "self", ".", "j", "+", "1", ")", ":", "if", "not", "self", ".", "cons", "(", "i", ")", ":", "return", "1", "return", "0" ]
https://github.com/josephwilk/semanticpy/blob/60af3f190fd44e5c76717c3a126cdc9201624cb5/semanticpy/porter_stemmer.py#L100-L105
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/lib/npyio.py
python
genfromtxt
(fname, dtype=float, comments='#', delimiter=None, skiprows=0, skip_header=0, skip_footer=0, converters=None, missing='', missing_values=None, filling_values=None, usecols=None, names=None, excludelist=None, deletechars=None, replace_space='_', ...
return output.squeeze()
Load data from a text file, with missing values handled as specified. Each line past the first `skip_header` lines is split at the `delimiter` character, and characters following the `comments` character are discarded. Parameters ---------- fname : file or str File, filename, or generator ...
Load data from a text file, with missing values handled as specified.
[ "Load", "data", "from", "a", "text", "file", "with", "missing", "values", "handled", "as", "specified", "." ]
def genfromtxt(fname, dtype=float, comments='#', delimiter=None, skiprows=0, skip_header=0, skip_footer=0, converters=None, missing='', missing_values=None, filling_values=None, usecols=None, names=None, excludelist=None, deletechars=None, replace_space='_', ...
[ "def", "genfromtxt", "(", "fname", ",", "dtype", "=", "float", ",", "comments", "=", "'#'", ",", "delimiter", "=", "None", ",", "skiprows", "=", "0", ",", "skip_header", "=", "0", ",", "skip_footer", "=", "0", ",", "converters", "=", "None", ",", "mi...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/lib/npyio.py#L1162-L1784
JDAI-CV/fast-reid
31d99b793fe0937461b9c9bc8a8a11f88bf5642c
fastreid/engine/hooks.py
python
PeriodicWriter.after_step
(self)
[]
def after_step(self): if (self.trainer.iter + 1) % self._period == 0 or ( self.trainer.iter == self.trainer.max_iter - 1 ): for writer in self._writers: writer.write()
[ "def", "after_step", "(", "self", ")", ":", "if", "(", "self", ".", "trainer", ".", "iter", "+", "1", ")", "%", "self", ".", "_period", "==", "0", "or", "(", "self", ".", "trainer", ".", "iter", "==", "self", ".", "trainer", ".", "max_iter", "-",...
https://github.com/JDAI-CV/fast-reid/blob/31d99b793fe0937461b9c9bc8a8a11f88bf5642c/fastreid/engine/hooks.py#L174-L179
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
chap19/monitor/monitor/build/lib.linux-x86_64-2.7/monitor/utils.py
python
total_seconds
(td)
Local total_seconds implementation for compatibility with python 2.6
Local total_seconds implementation for compatibility with python 2.6
[ "Local", "total_seconds", "implementation", "for", "compatibility", "with", "python", "2", ".", "6" ]
def total_seconds(td): """Local total_seconds implementation for compatibility with python 2.6""" if hasattr(td, 'total_seconds'): return td.total_seconds() else: return ((td.days * 86400 + td.seconds) * 10 ** 6 + td.microseconds) / 10.0 ** 6
[ "def", "total_seconds", "(", "td", ")", ":", "if", "hasattr", "(", "td", ",", "'total_seconds'", ")", ":", "return", "td", ".", "total_seconds", "(", ")", "else", ":", "return", "(", "(", "td", ".", "days", "*", "86400", "+", "td", ".", "seconds", ...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/chap19/monitor/monitor/build/lib.linux-x86_64-2.7/monitor/utils.py#L949-L955
readbeyond/aeneas
4d200a050690903b30b3d885b44714fecb23f18a
aeneas/ttswrappers/basettswrapper.py
python
TTSCache.get
(self, fragment_info)
return self.cache[fragment_info]
Get the value associated with the given key. :param fragment_info: the text key :type fragment_info: tuple of str ``(language, text)`` :raises: KeyError if the key is not present in the cache
Get the value associated with the given key.
[ "Get", "the", "value", "associated", "with", "the", "given", "key", "." ]
def get(self, fragment_info): """ Get the value associated with the given key. :param fragment_info: the text key :type fragment_info: tuple of str ``(language, text)`` :raises: KeyError if the key is not present in the cache """ if not self.is_cached(fragment_i...
[ "def", "get", "(", "self", ",", "fragment_info", ")", ":", "if", "not", "self", ".", "is_cached", "(", "fragment_info", ")", ":", "raise", "KeyError", "(", "u\"Attempt to get text not cached\"", ")", "return", "self", ".", "cache", "[", "fragment_info", "]" ]
https://github.com/readbeyond/aeneas/blob/4d200a050690903b30b3d885b44714fecb23f18a/aeneas/ttswrappers/basettswrapper.py#L116-L126
peterbrittain/asciimatics
9a490faddf484ee5b9b845316f921f5888b23b18
samples/terminal.py
python
Terminal.required_height
(self, offset, width)
return self._required_height
Required height for the terminal.
Required height for the terminal.
[ "Required", "height", "for", "the", "terminal", "." ]
def required_height(self, offset, width): """ Required height for the terminal. """ return self._required_height
[ "def", "required_height", "(", "self", ",", "offset", ",", "width", ")", ":", "return", "self", ".", "_required_height" ]
https://github.com/peterbrittain/asciimatics/blob/9a490faddf484ee5b9b845316f921f5888b23b18/samples/terminal.py#L225-L229
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/apis/process_groups_api.py
python
ProcessGroupsApi.create_output_port_with_http_info
(self, id, body, **kwargs)
return self.api_client.call_api('/process-groups/{id}/output-ports', 'POST', path_params, query_params, header_params, body=body_params, ...
Creates an output port This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> ...
Creates an output port
[ "Creates", "an", "output", "port" ]
def create_output_port_with_http_info(self, id, body, **kwargs): """ Creates an output port This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> d...
[ "def", "create_output_port_with_http_info", "(", "self", ",", "id", ",", "body", ",", "*", "*", "kwargs", ")", ":", "all_params", "=", "[", "'id'", ",", "'body'", "]", "all_params", ".", "append", "(", "'callback'", ")", "all_params", ".", "append", "(", ...
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/apis/process_groups_api.py#L854-L938
gmate/gmate
83312e64e0c115a9842500e4eb8617d3f5f4025b
plugins/gedit2/classbrowser/classbrowser/parser_html.py
python
geditHTMLParser.get_tag_position
(self, model, path)
return
Return the position of a tag in a file. This is used by the browser to jump to a symbol's position. Returns a tuple with the full file uri of the source file and the line number of the tag or None if the tag has no correspondance in a file. model -- a gtk.TreeModel (pre...
Return the position of a tag in a file. This is used by the browser to jump to a symbol's position. Returns a tuple with the full file uri of the source file and the line number of the tag or None if the tag has no correspondance in a file. model -- a gtk.TreeModel (pre...
[ "Return", "the", "position", "of", "a", "tag", "in", "a", "file", ".", "This", "is", "used", "by", "the", "browser", "to", "jump", "to", "a", "symbol", "s", "position", ".", "Returns", "a", "tuple", "with", "the", "full", "file", "uri", "of", "the", ...
def get_tag_position(self, model, path): """ Return the position of a tag in a file. This is used by the browser to jump to a symbol's position. Returns a tuple with the full file uri of the source file and the line number of the tag or None if the tag has no correspondance in a...
[ "def", "get_tag_position", "(", "self", ",", "model", ",", "path", ")", ":", "return" ]
https://github.com/gmate/gmate/blob/83312e64e0c115a9842500e4eb8617d3f5f4025b/plugins/gedit2/classbrowser/classbrowser/parser_html.py#L69-L80
jazzband/tablib
94ffe67e50eb5bfd99d73a4f010e463478a98928
src/tablib/packages/dbfpy/fields.py
python
lookupFor
(typeCode)
return _fieldsRegistry[chr(typeCode)]
Return field definition class for the given type code. ``typeCode`` must be a single character. That type should be previously registered. Use `registerField` to register new field class. Return: Return value is a subclass of the `DbfFieldDef`.
Return field definition class for the given type code.
[ "Return", "field", "definition", "class", "for", "the", "given", "type", "code", "." ]
def lookupFor(typeCode): """Return field definition class for the given type code. ``typeCode`` must be a single character. That type should be previously registered. Use `registerField` to register new field class. Return: Return value is a subclass of the `DbfFieldDef`. """ # X...
[ "def", "lookupFor", "(", "typeCode", ")", ":", "# XXX: use typeCode.upper()? in case of any decign don't", "# forget to look to the same comment in ``registerField``", "return", "_fieldsRegistry", "[", "chr", "(", "typeCode", ")", "]" ]
https://github.com/jazzband/tablib/blob/94ffe67e50eb5bfd99d73a4f010e463478a98928/src/tablib/packages/dbfpy/fields.py#L449-L463
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/com.oracle.graal.python.benchmarks/python/meso/chaos.py
python
Spline.__init__
(self, points, degree = 3, knots = None)
Creates a Spline. points is a list of GVector, degree is the degree of the Spline.
Creates a Spline. points is a list of GVector, degree is the degree of the Spline.
[ "Creates", "a", "Spline", ".", "points", "is", "a", "list", "of", "GVector", "degree", "is", "the", "degree", "of", "the", "Spline", "." ]
def __init__(self, points, degree = 3, knots = None): """Creates a Spline. points is a list of GVector, degree is the degree of the Spline.""" if knots == None: self.knots = GetKnots(points, degree) else: if len(points) > len(knots) - degree + 1: raise Val...
[ "def", "__init__", "(", "self", ",", "points", ",", "degree", "=", "3", ",", "knots", "=", "None", ")", ":", "if", "knots", "==", "None", ":", "self", ".", "knots", "=", "GetKnots", "(", "points", ",", "degree", ")", "else", ":", "if", "len", "("...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/com.oracle.graal.python.benchmarks/python/meso/chaos.py#L88-L105