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
webcompat/webcompat.com
c3504dffec29b14eaa62ef01aa1ba78f9c2b12ef
webcompat/templates/__init__.py
python
get_description
(body_html)
Get the description of the body by parsing its content. In cases where this fails (in case someone doesn't use the form, and files and issue directly on GitHub and edits the template), return something sensible.
Get the description of the body by parsing its content.
[ "Get", "the", "description", "of", "the", "body", "by", "parsing", "its", "content", "." ]
def get_description(body_html): """Get the description of the body by parsing its content. In cases where this fails (in case someone doesn't use the form, and files and issue directly on GitHub and edits the template), return something sensible. """ stripped_body = Markup.striptags(body_html) description = re.search(r'Description: (.+?) Steps', stripped_body) if description: return description.group(1)[0:74] else: return None
[ "def", "get_description", "(", "body_html", ")", ":", "stripped_body", "=", "Markup", ".", "striptags", "(", "body_html", ")", "description", "=", "re", ".", "search", "(", "r'Description: (.+?) Steps'", ",", "stripped_body", ")", "if", "description", ":", "retu...
https://github.com/webcompat/webcompat.com/blob/c3504dffec29b14eaa62ef01aa1ba78f9c2b12ef/webcompat/templates/__init__.py#L103-L115
cloudlinux/kuberdock-platform
8b3923c19755f3868e4142b62578d9b9857d2704
node_storage_manage/storage.py
python
init_kd_zpool
(devices)
Creates and mounts Kuberdock zpool.
Creates and mounts Kuberdock zpool.
[ "Creates", "and", "mounts", "Kuberdock", "zpool", "." ]
def init_kd_zpool(devices): """Creates and mounts Kuberdock zpool.""" err_code, output = get_subprocess_result( ['zpool', 'create', '-f', KD_ZPOOL_NAME] + devices ) raise_cmd_error(err_code, output) err_code, output = get_subprocess_result( ['zfs', 'set', 'mountpoint={}'.format(LOCAL_STORAGE_MOUNT_POINT), KD_ZPOOL_NAME] ) raise_cmd_error(err_code, output) # Default recordsize is 128k. It is too large for supposed load type. # We want provide best performance for DB engines. Most of the apps use # mysql with Innodb engine which have 16k page size. MyIsam and Postgresql # have 8k page size which is also closer to 16k, than to 128k. # Above DB page sizes (16k, 8k) are default values. # More flexible (but more complicated) way - set recordsize for each PV, # depending of particular application. err_code, output = get_subprocess_result( ['zfs', 'set', 'recordsize=16k', KD_ZPOOL_NAME] ) raise_cmd_error(err_code, output)
[ "def", "init_kd_zpool", "(", "devices", ")", ":", "err_code", ",", "output", "=", "get_subprocess_result", "(", "[", "'zpool'", ",", "'create'", ",", "'-f'", ",", "KD_ZPOOL_NAME", "]", "+", "devices", ")", "raise_cmd_error", "(", "err_code", ",", "output", "...
https://github.com/cloudlinux/kuberdock-platform/blob/8b3923c19755f3868e4142b62578d9b9857d2704/node_storage_manage/storage.py#L62-L83
owtf/owtf
22d6d35fb2a232fcc56bf5ed504ec52fd65f15b6
owtf/managers/target.py
python
get_all_targets
(session, key)
return results
Get all targets by key :param key: Target key :type key: `str` :return: :rtype:
Get all targets by key
[ "Get", "all", "targets", "by", "key" ]
def get_all_targets(session, key): """Get all targets by key :param key: Target key :type key: `str` :return: :rtype: """ results = session.query(getattr(Target, key.lower())).all() results = [result[0] for result in results] return results
[ "def", "get_all_targets", "(", "session", ",", "key", ")", ":", "results", "=", "session", ".", "query", "(", "getattr", "(", "Target", ",", "key", ".", "lower", "(", ")", ")", ")", ".", "all", "(", ")", "results", "=", "[", "result", "[", "0", "...
https://github.com/owtf/owtf/blob/22d6d35fb2a232fcc56bf5ed504ec52fd65f15b6/owtf/managers/target.py#L525-L535
LumaPictures/pymel
fa88a3f4fa18e09bb8aa9bdf4dab53d984bada72
pymel/core/windows.py
python
lsUI
(**kwargs)
return [uitypes.PyUI(x) for x in _lsUI(**kwargs)]
Modified: - long defaults to True - if no type is passed, defaults to all known types
Modified: - long defaults to True - if no type is passed, defaults to all known types
[ "Modified", ":", "-", "long", "defaults", "to", "True", "-", "if", "no", "type", "is", "passed", "defaults", "to", "all", "known", "types" ]
def lsUI(**kwargs): """ Modified: - long defaults to True - if no type is passed, defaults to all known types """ from . import uitypes return [uitypes.PyUI(x) for x in _lsUI(**kwargs)]
[ "def", "lsUI", "(", "*", "*", "kwargs", ")", ":", "from", ".", "import", "uitypes", "return", "[", "uitypes", ".", "PyUI", "(", "x", ")", "for", "x", "in", "_lsUI", "(", "*", "*", "kwargs", ")", "]" ]
https://github.com/LumaPictures/pymel/blob/fa88a3f4fa18e09bb8aa9bdf4dab53d984bada72/pymel/core/windows.py#L94-L101
mitre/multiscanner
86e0145ba3c4a34611f257dc78cd2482ed6358db
multiscanner/common/stix2_generator/__init__.py
python
extract_http_requests_cuckoo
(signature, custom_labels=None)
return indicators
Process Cuckoo http signatures obtained from analysis. Args: signature: A dict from the "signatures" list from the "Cuckoo Sandbox" portion of the report. custom_labels: A list of labels to attach into generated Indicators. Returns: list: Containing ``stix2.Indicator`` with a pattern that matches the file by name or a variety of hashes.
Process Cuckoo http signatures obtained from analysis.
[ "Process", "Cuckoo", "http", "signatures", "obtained", "from", "analysis", "." ]
def extract_http_requests_cuckoo(signature, custom_labels=None): ''' Process Cuckoo http signatures obtained from analysis. Args: signature: A dict from the "signatures" list from the "Cuckoo Sandbox" portion of the report. custom_labels: A list of labels to attach into generated Indicators. Returns: list: Containing ``stix2.Indicator`` with a pattern that matches the file by name or a variety of hashes. ''' indicators = [] labels = ['url-watchlist'] if custom_labels: labels.extend(custom_labels) for ioc_mark in signature.get('marks', []): ioc = ioc_mark.get('ioc', '') if ioc: url_value = ioc.split() if len(url_value) > 1: url_value = url_value[1] else: url_value = url_value[0] ioc_pattern = create_stix2_observation_expression( create_stix2_comparison_expression('url:value', '=', url_value) ) indicators.append(v20.Indicator(**{ 'labels': labels, 'pattern': ioc_pattern })) return indicators
[ "def", "extract_http_requests_cuckoo", "(", "signature", ",", "custom_labels", "=", "None", ")", ":", "indicators", "=", "[", "]", "labels", "=", "[", "'url-watchlist'", "]", "if", "custom_labels", ":", "labels", ".", "extend", "(", "custom_labels", ")", "for"...
https://github.com/mitre/multiscanner/blob/86e0145ba3c4a34611f257dc78cd2482ed6358db/multiscanner/common/stix2_generator/__init__.py#L174-L210
xjsender/haoide
717dd706db1169bfc41e818ac6fc6cd9a0aef12d
requests/packages/urllib3/connectionpool.py
python
HTTPConnectionPool.is_same_host
(self, url)
return (scheme, host, port) == (self.scheme, self.host, self.port)
Check if the given ``url`` is a member of the same host as this connection pool.
Check if the given ``url`` is a member of the same host as this connection pool.
[ "Check", "if", "the", "given", "url", "is", "a", "member", "of", "the", "same", "host", "as", "this", "connection", "pool", "." ]
def is_same_host(self, url): """ Check if the given ``url`` is a member of the same host as this connection pool. """ if url.startswith('/'): return True # TODO: Add optional support for socket.gethostbyname checking. scheme, host, port = get_host(url) # Use explicit default port for comparison when none is given if self.port and not port: port = port_by_scheme.get(scheme) elif not self.port and port == port_by_scheme.get(scheme): port = None return (scheme, host, port) == (self.scheme, self.host, self.port)
[ "def", "is_same_host", "(", "self", ",", "url", ")", ":", "if", "url", ".", "startswith", "(", "'/'", ")", ":", "return", "True", "# TODO: Add optional support for socket.gethostbyname checking.", "scheme", ",", "host", ",", "port", "=", "get_host", "(", "url", ...
https://github.com/xjsender/haoide/blob/717dd706db1169bfc41e818ac6fc6cd9a0aef12d/requests/packages/urllib3/connectionpool.py#L417-L434
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/scipy/odr/odrpack.py
python
Data.set_meta
(self, **kwds)
Update the metadata dictionary with the keywords and data provided by keywords. Examples -------- :: data.set_meta(lab="Ph 7; Lab 26", title="Ag110 + Ag108 Decay")
Update the metadata dictionary with the keywords and data provided by keywords.
[ "Update", "the", "metadata", "dictionary", "with", "the", "keywords", "and", "data", "provided", "by", "keywords", "." ]
def set_meta(self, **kwds): """ Update the metadata dictionary with the keywords and data provided by keywords. Examples -------- :: data.set_meta(lab="Ph 7; Lab 26", title="Ag110 + Ag108 Decay") """ self.meta.update(kwds)
[ "def", "set_meta", "(", "self", ",", "*", "*", "kwds", ")", ":", "self", ".", "meta", ".", "update", "(", "kwds", ")" ]
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/scipy/odr/odrpack.py#L274-L285
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
modules/templates/IFRC/parser.py
python
S3Parser._parse_value
(text, fieldname)
return result
Parse a value from a piece of text
Parse a value from a piece of text
[ "Parse", "a", "value", "from", "a", "piece", "of", "text" ]
def _parse_value(text, fieldname): """ Parse a value from a piece of text """ parts = text.split(":%s:" % fieldname, 1) parts = parts[1].split(":", 1) result = parts[0] return result
[ "def", "_parse_value", "(", "text", ",", "fieldname", ")", ":", "parts", "=", "text", ".", "split", "(", "\":%s:\"", "%", "fieldname", ",", "1", ")", "parts", "=", "parts", "[", "1", "]", ".", "split", "(", "\":\"", ",", "1", ")", "result", "=", ...
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/templates/IFRC/parser.py#L49-L57
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/xiaomi_tv/media_player.py
python
XiaomiTV.volume_up
(self)
Increase volume by one.
Increase volume by one.
[ "Increase", "volume", "by", "one", "." ]
def volume_up(self): """Increase volume by one.""" self._tv.volume_up()
[ "def", "volume_up", "(", "self", ")", ":", "self", ".", "_tv", ".", "volume_up", "(", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/xiaomi_tv/media_player.py#L112-L114
feincms/feincms
be35576fa86083a969ae56aaf848173d1a5a3c5d
feincms/module/page/modeladmins.py
python
PageAdmin.is_visible_admin
(self, page)
return tree_editor.ajax_editable_boolean_cell(page, "active")
Instead of just showing an on/off boolean, also indicate whether this page is not visible because of publishing dates or inherited status.
Instead of just showing an on/off boolean, also indicate whether this page is not visible because of publishing dates or inherited status.
[ "Instead", "of", "just", "showing", "an", "on", "/", "off", "boolean", "also", "indicate", "whether", "this", "page", "is", "not", "visible", "because", "of", "publishing", "dates", "or", "inherited", "status", "." ]
def is_visible_admin(self, page): """ Instead of just showing an on/off boolean, also indicate whether this page is not visible because of publishing dates or inherited status. """ if page.parent_id and page.parent_id not in _local.visible_pages: # parent page's invisibility is inherited if page.id in _local.visible_pages: _local.visible_pages.remove(page.id) return tree_editor.ajax_editable_boolean_cell( page, "active", override=False, text=_("inherited") ) if page.active and page.id not in _local.visible_pages: # is active but should not be shown, so visibility limited by # extension: show a "not active" return tree_editor.ajax_editable_boolean_cell( page, "active", override=False, text=_("extensions") ) return tree_editor.ajax_editable_boolean_cell(page, "active")
[ "def", "is_visible_admin", "(", "self", ",", "page", ")", ":", "if", "page", ".", "parent_id", "and", "page", ".", "parent_id", "not", "in", "_local", ".", "visible_pages", ":", "# parent page's invisibility is inherited", "if", "page", ".", "id", "in", "_loca...
https://github.com/feincms/feincms/blob/be35576fa86083a969ae56aaf848173d1a5a3c5d/feincms/module/page/modeladmins.py#L215-L235
F8LEFT/DecLLVM
d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c
python/idaapi.py
python
ctree_anchor_t.is_citem_anchor
(self, *args)
return _idaapi.ctree_anchor_t_is_citem_anchor(self, *args)
is_citem_anchor(self) -> bool
is_citem_anchor(self) -> bool
[ "is_citem_anchor", "(", "self", ")", "-", ">", "bool" ]
def is_citem_anchor(self, *args): """ is_citem_anchor(self) -> bool """ return _idaapi.ctree_anchor_t_is_citem_anchor(self, *args)
[ "def", "is_citem_anchor", "(", "self", ",", "*", "args", ")", ":", "return", "_idaapi", ".", "ctree_anchor_t_is_citem_anchor", "(", "self", ",", "*", "args", ")" ]
https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L38820-L38824
openstack/glance
502fa0ffc8970c087c5924742231812c0da6a114
glance/api/v2/cached_images.py
python
CacheController.queue_image
(self, req, image_id)
PUT /queued_images/<IMAGE_ID> Queues an image for caching. We do not check to see if the image is in the registry here. That is done by the prefetcher...
PUT /queued_images/<IMAGE_ID>
[ "PUT", "/", "queued_images", "/", "<IMAGE_ID", ">" ]
def queue_image(self, req, image_id): """ PUT /queued_images/<IMAGE_ID> Queues an image for caching. We do not check to see if the image is in the registry here. That is done by the prefetcher... """ self._enforce(req) self.cache.queue_image(image_id)
[ "def", "queue_image", "(", "self", ",", "req", ",", "image_id", ")", ":", "self", ".", "_enforce", "(", "req", ")", "self", ".", "cache", ".", "queue_image", "(", "image_id", ")" ]
https://github.com/openstack/glance/blob/502fa0ffc8970c087c5924742231812c0da6a114/glance/api/v2/cached_images.py#L88-L97
bnpy/bnpy
d5b311e8f58ccd98477f4a0c8a4d4982e3fca424
bnpy/obsmodel/MultObsModel.py
python
MultObsModel.calcLogSoftEvMatrix_FromPost
(self, Data, **kwargs)
Calculate expected log soft ev matrix under Post. Returns ------ L : 2D array, size N x K
Calculate expected log soft ev matrix under Post.
[ "Calculate", "expected", "log", "soft", "ev", "matrix", "under", "Post", "." ]
def calcLogSoftEvMatrix_FromPost(self, Data, **kwargs): ''' Calculate expected log soft ev matrix under Post. Returns ------ L : 2D array, size N x K ''' ElogphiT = self.GetCached('E_logphiT', 'all') # V x K doSparse1 = 'activeonlyLP' in kwargs and kwargs['activeonlyLP'] == 2 doSparse2 = 'nnzPerRowLP' in kwargs and \ kwargs['nnzPerRowLP'] > 0 and kwargs['nnzPerRowLP'] < self.K if doSparse2 and doSparse1: return dict(ElogphiT=ElogphiT) else: E_log_soft_ev = calcLogSoftEvMatrix_FromPost_Static( Data, DataAtomType=self.DataAtomType, ElogphiT=ElogphiT, **kwargs) return dict(E_log_soft_ev=E_log_soft_ev, ElogphiT=ElogphiT)
[ "def", "calcLogSoftEvMatrix_FromPost", "(", "self", ",", "Data", ",", "*", "*", "kwargs", ")", ":", "ElogphiT", "=", "self", ".", "GetCached", "(", "'E_logphiT'", ",", "'all'", ")", "# V x K", "doSparse1", "=", "'activeonlyLP'", "in", "kwargs", "and", "kwarg...
https://github.com/bnpy/bnpy/blob/d5b311e8f58ccd98477f4a0c8a4d4982e3fca424/bnpy/obsmodel/MultObsModel.py#L348-L366
SavinaRoja/PyUserInput
8a93a4e32430fd9da68590897e06e0be9a2ad26e
pykeyboard/windows.py
python
PyKeyboardEvent.toggle_shift_state
(self)
Does toggling for the shift state.
Does toggling for the shift state.
[ "Does", "toggling", "for", "the", "shift", "state", "." ]
def toggle_shift_state(self): # This will be removed later '''Does toggling for the shift state.''' states = [1, 0] self.shift_state = states[self.shift_state]
[ "def", "toggle_shift_state", "(", "self", ")", ":", "# This will be removed later", "states", "=", "[", "1", ",", "0", "]", "self", ".", "shift_state", "=", "states", "[", "self", ".", "shift_state", "]" ]
https://github.com/SavinaRoja/PyUserInput/blob/8a93a4e32430fd9da68590897e06e0be9a2ad26e/pykeyboard/windows.py#L307-L310
1040003585/WebScrapingWithPython
a770fa5b03894076c8c9539b1ffff34424ffc016
portia_examle/lib/python2.7/site-packages/pip/utils/packaging.py
python
check_requires_python
(requires_python)
return python_version in requires_python_specifier
Check if the python version in use match the `requires_python` specifier. Returns `True` if the version of python in use matches the requirement. Returns `False` if the version of python in use does not matches the requirement. Raises an InvalidSpecifier if `requires_python` have an invalid format.
Check if the python version in use match the `requires_python` specifier.
[ "Check", "if", "the", "python", "version", "in", "use", "match", "the", "requires_python", "specifier", "." ]
def check_requires_python(requires_python): """ Check if the python version in use match the `requires_python` specifier. Returns `True` if the version of python in use matches the requirement. Returns `False` if the version of python in use does not matches the requirement. Raises an InvalidSpecifier if `requires_python` have an invalid format. """ if requires_python is None: # The package provides no information return True requires_python_specifier = specifiers.SpecifierSet(requires_python) # We only use major.minor.micro python_version = version.parse('.'.join(map(str, sys.version_info[:3]))) return python_version in requires_python_specifier
[ "def", "check_requires_python", "(", "requires_python", ")", ":", "if", "requires_python", "is", "None", ":", "# The package provides no information", "return", "True", "requires_python_specifier", "=", "specifiers", ".", "SpecifierSet", "(", "requires_python", ")", "# We...
https://github.com/1040003585/WebScrapingWithPython/blob/a770fa5b03894076c8c9539b1ffff34424ffc016/portia_examle/lib/python2.7/site-packages/pip/utils/packaging.py#L17-L34
p2pool/p2pool
53c438bbada06b9d4a9a465bc13f7694a7a322b7
nattraverso/portmapper.py
python
get_port_mapper
(proto="TCP")
return nattraverso.pynupnp.get_port_mapper()
Returns a L{NATMapper} instance, suited to map a port for the given protocol. Defaults to TCP. For the moment, only upnp mapper is available. It accepts both UDP and TCP. @param proto: The protocol: 'TCP' or 'UDP' @type proto: string @return: A deferred called with a L{NATMapper} instance @rtype: L{twisted.internet.defer.Deferred}
Returns a L{NATMapper} instance, suited to map a port for the given protocol. Defaults to TCP. For the moment, only upnp mapper is available. It accepts both UDP and TCP.
[ "Returns", "a", "L", "{", "NATMapper", "}", "instance", "suited", "to", "map", "a", "port", "for", "the", "given", "protocol", ".", "Defaults", "to", "TCP", ".", "For", "the", "moment", "only", "upnp", "mapper", "is", "available", ".", "It", "accepts", ...
def get_port_mapper(proto="TCP"): """ Returns a L{NATMapper} instance, suited to map a port for the given protocol. Defaults to TCP. For the moment, only upnp mapper is available. It accepts both UDP and TCP. @param proto: The protocol: 'TCP' or 'UDP' @type proto: string @return: A deferred called with a L{NATMapper} instance @rtype: L{twisted.internet.defer.Deferred} """ import nattraverso.pynupnp return nattraverso.pynupnp.get_port_mapper()
[ "def", "get_port_mapper", "(", "proto", "=", "\"TCP\"", ")", ":", "import", "nattraverso", ".", "pynupnp", "return", "nattraverso", ".", "pynupnp", ".", "get_port_mapper", "(", ")" ]
https://github.com/p2pool/p2pool/blob/53c438bbada06b9d4a9a465bc13f7694a7a322b7/nattraverso/portmapper.py#L18-L31
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/gdata/src/gdata/youtube/client.py
python
YouTubeClient.delete_track
(self, video_id, track, client_id, developer_key, auth_token=None, **kwargs)
return self.request(http_request=http_request, **kwargs)
Deletes a track.
Deletes a track.
[ "Deletes", "a", "track", "." ]
def delete_track(self, video_id, track, client_id, developer_key, auth_token=None, **kwargs): """Deletes a track.""" if isinstance(track, gdata.youtube.data.TrackEntry): track_id_text_node = track.get_id().split(':') track_id = track_id_text_node[3] else: track_id = track uri = YOUTUBE_CAPTION_URI % (video_id, track_id) http_request = atom.http_core.HttpRequest(uri = uri, method = 'DELETE') dev_key = 'key=' + developer_key authsub = 'AuthSub token="' + str(auth_token) + '"' http_request.headers = { 'Authorization': authsub, 'GData-Version': self.api_version, 'X-GData-Client': client_id, 'X-GData-Key': dev_key } return self.request(http_request=http_request, **kwargs)
[ "def", "delete_track", "(", "self", ",", "video_id", ",", "track", ",", "client_id", ",", "developer_key", ",", "auth_token", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "track", ",", "gdata", ".", "youtube", ".", "data", "...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/gdata/src/gdata/youtube/client.py#L222-L240
F8LEFT/DecLLVM
d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c
python/idaapi.py
python
get_demangled_name
(*args)
return _idaapi.get_demangled_name(*args)
get_demangled_name(frm, ea, inhibitor, demform, strict) -> char *
get_demangled_name(frm, ea, inhibitor, demform, strict) -> char *
[ "get_demangled_name", "(", "frm", "ea", "inhibitor", "demform", "strict", ")", "-", ">", "char", "*" ]
def get_demangled_name(*args): """ get_demangled_name(frm, ea, inhibitor, demform, strict) -> char * """ return _idaapi.get_demangled_name(*args)
[ "def", "get_demangled_name", "(", "*", "args", ")", ":", "return", "_idaapi", ".", "get_demangled_name", "(", "*", "args", ")" ]
https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L47293-L47297
FabriceSalvaire/CodeReview
c48433467ac2a9a14b9c9026734f8c494af4aa95
CodeReview/GUI/DiffViewer/DiffWidget.py
python
DiffViewerCursor.end
(self)
Insert a block and set the y positions.
Insert a block and set the y positions.
[ "Insert", "a", "block", "and", "set", "the", "y", "positions", "." ]
def end(self): """Insert a block and set the y positions.""" self._cursor.insertBlock() self._text_blocks[-1].y_bottom = self.y() for text_block0, text_block1 in pairwise(self._text_blocks): text_block0.y_bottom = text_block1.y_top
[ "def", "end", "(", "self", ")", ":", "self", ".", "_cursor", ".", "insertBlock", "(", ")", "self", ".", "_text_blocks", "[", "-", "1", "]", ".", "y_bottom", "=", "self", ".", "y", "(", ")", "for", "text_block0", ",", "text_block1", "in", "pairwise", ...
https://github.com/FabriceSalvaire/CodeReview/blob/c48433467ac2a9a14b9c9026734f8c494af4aa95/CodeReview/GUI/DiffViewer/DiffWidget.py#L133-L140
canonical/cloud-init
dc1aabfca851e520693c05322f724bd102c76364
cloudinit/analyze/__main__.py
python
configure_io
(args)
return (infh, outfh)
Common parsing and setup of input/output files
Common parsing and setup of input/output files
[ "Common", "parsing", "and", "setup", "of", "input", "/", "output", "files" ]
def configure_io(args): """Common parsing and setup of input/output files""" if args.infile == "-": infh = sys.stdin else: try: infh = open(args.infile, "r") except OSError: sys.stderr.write("Cannot open file %s\n" % args.infile) sys.exit(1) if args.outfile == "-": outfh = sys.stdout else: try: outfh = open(args.outfile, "w") except OSError: sys.stderr.write("Cannot open file %s\n" % args.outfile) sys.exit(1) return (infh, outfh)
[ "def", "configure_io", "(", "args", ")", ":", "if", "args", ".", "infile", "==", "\"-\"", ":", "infh", "=", "sys", ".", "stdin", "else", ":", "try", ":", "infh", "=", "open", "(", "args", ".", "infile", ",", "\"r\"", ")", "except", "OSError", ":", ...
https://github.com/canonical/cloud-init/blob/dc1aabfca851e520693c05322f724bd102c76364/cloudinit/analyze/__main__.py#L273-L293
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/parameters/updater.py
python
ParameterUpdater.compute
(self, current=None, target=None)
return self.target
Update the target parameter(s) based on the current parameter(s). Args: current (int, float, torch.tensor, np.array, torch.nn.Module, None): current parameter(s). If None, it will be set to the current parameter(s) given at the initialization. target (int, float, torch.tensor, np.array, torch.nn.Module, None): target parameter(s) to be modified based on the current parameter(s). If None, it will be set to the current parameters. Returns: int, float, torch.tensor, np.array, torch.nn.Module: updated target parameter(s).
Update the target parameter(s) based on the current parameter(s).
[ "Update", "the", "target", "parameter", "(", "s", ")", "based", "on", "the", "current", "parameter", "(", "s", ")", "." ]
def compute(self, current=None, target=None): """ Update the target parameter(s) based on the current parameter(s). Args: current (int, float, torch.tensor, np.array, torch.nn.Module, None): current parameter(s). If None, it will be set to the current parameter(s) given at the initialization. target (int, float, torch.tensor, np.array, torch.nn.Module, None): target parameter(s) to be modified based on the current parameter(s). If None, it will be set to the current parameters. Returns: int, float, torch.tensor, np.array, torch.nn.Module: updated target parameter(s). """ # if time to update the parameters if (self.counter % self.sleep_count) == 0: # if the current parameters is None, take the ones given at the initialization if current is None: current = self.current if current is None: raise ValueError("Expecting to be given current parameters, instead got None.") # if the target is None, set it to be the current parameters. if target is None: target = current # the target and current needs to be of the same type (except if current is a float or int) if not isinstance(current, (int, float)) and type(target) != type(current): raise TypeError("The given target and current parameters are of different types: " "type(target)={} and type(current)={}".format(type(target), type(current))) # inner computation self.target = self._compute(current, target) # increment counter self.counter += 1 # return the new target parameter(s). return self.target
[ "def", "compute", "(", "self", ",", "current", "=", "None", ",", "target", "=", "None", ")", ":", "# if time to update the parameters", "if", "(", "self", ".", "counter", "%", "self", ".", "sleep_count", ")", "==", "0", ":", "# if the current parameters is Non...
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/parameters/updater.py#L60-L98
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/cron.py
python
_check_instance_uid_match
(user)
return os.geteuid() == __salt__["file.user_to_uid"](user)
Returns true if running instance's UID matches the specified user UID
Returns true if running instance's UID matches the specified user UID
[ "Returns", "true", "if", "running", "instance", "s", "UID", "matches", "the", "specified", "user", "UID" ]
def _check_instance_uid_match(user): """ Returns true if running instance's UID matches the specified user UID """ return os.geteuid() == __salt__["file.user_to_uid"](user)
[ "def", "_check_instance_uid_match", "(", "user", ")", ":", "return", "os", ".", "geteuid", "(", ")", "==", "__salt__", "[", "\"file.user_to_uid\"", "]", "(", "user", ")" ]
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/cron.py#L179-L183
graphcore/examples
46d2b7687b829778369fc6328170a7b14761e5c6
applications/popart/deep_voice/text_utils.py
python
text_to_sequence
(text, replace_prob=0.5)
return sequence
Converts a string of text to a sequence of IDs corresponding to the symbols in the text
Converts a string of text to a sequence of IDs corresponding to the symbols in the text
[ "Converts", "a", "string", "of", "text", "to", "a", "sequence", "of", "IDs", "corresponding", "to", "the", "symbols", "in", "the", "text" ]
def text_to_sequence(text, replace_prob=0.5): """ Converts a string of text to a sequence of IDs corresponding to the symbols in the text """ text = text.upper() if replace_prob > 0.0: text = replace_with_pronunciation(text, replace_prob) sequence = [] while len(text): match_result = _curly_braces_re.match(text) if not match_result: # no curly-brace match sequence += _symbols_to_sequence(text) break sequence += _symbols_to_sequence(match_result.group(1)) # split into list of phonemes before converting to sequence sequence += _symbols_to_sequence(match_result.group(2).split(' ')) text = match_result.group(3) # end with EOS symbol sequence.append(_symbol_to_id[_eos]) return sequence
[ "def", "text_to_sequence", "(", "text", ",", "replace_prob", "=", "0.5", ")", ":", "text", "=", "text", ".", "upper", "(", ")", "if", "replace_prob", ">", "0.0", ":", "text", "=", "replace_with_pronunciation", "(", "text", ",", "replace_prob", ")", "sequen...
https://github.com/graphcore/examples/blob/46d2b7687b829778369fc6328170a7b14761e5c6/applications/popart/deep_voice/text_utils.py#L51-L73
GNS3/gns3-gui
da8adbaa18ab60e053af2a619efd468f4c8950f3
gns3/ports/port.py
python
Port.setLabel
(self, label)
Sets a port label. :param label: NoteItem instance.
Sets a port label.
[ "Sets", "a", "port", "label", "." ]
def setLabel(self, label): """ Sets a port label. :param label: NoteItem instance. """ self._port_label = label if self._link and self._port_label: self._link.addPortLabel(self, self._port_label)
[ "def", "setLabel", "(", "self", ",", "label", ")", ":", "self", ".", "_port_label", "=", "label", "if", "self", ".", "_link", "and", "self", ".", "_port_label", ":", "self", ".", "_link", ".", "addPortLabel", "(", "self", ",", "self", ".", "_port_label...
https://github.com/GNS3/gns3-gui/blob/da8adbaa18ab60e053af2a619efd468f4c8950f3/gns3/ports/port.py#L334-L342
pyvista/pyvista
012dbb95a9aae406c3cd4cd94fc8c477f871e426
pyvista/themes.py
python
DefaultTheme.colorbar_vertical
(self)
return self._colorbar_vertical
Return or set the default parameters of a vertical colorbar. Examples -------- Set the default colorbar width to 0.45. >>> import pyvista >>> pyvista.global_theme.colorbar_vertical.width = 0.45 # doctest:+SKIP Set the default colorbar height to 0.8. >>> import pyvista >>> pyvista.global_theme.colorbar_vertical.height = 0.8 # doctest:+SKIP
Return or set the default parameters of a vertical colorbar.
[ "Return", "or", "set", "the", "default", "parameters", "of", "a", "vertical", "colorbar", "." ]
def colorbar_vertical(self) -> _ColorbarConfig: """Return or set the default parameters of a vertical colorbar. Examples -------- Set the default colorbar width to 0.45. >>> import pyvista >>> pyvista.global_theme.colorbar_vertical.width = 0.45 # doctest:+SKIP Set the default colorbar height to 0.8. >>> import pyvista >>> pyvista.global_theme.colorbar_vertical.height = 0.8 # doctest:+SKIP """ return self._colorbar_vertical
[ "def", "colorbar_vertical", "(", "self", ")", "->", "_ColorbarConfig", ":", "return", "self", ".", "_colorbar_vertical" ]
https://github.com/pyvista/pyvista/blob/012dbb95a9aae406c3cd4cd94fc8c477f871e426/pyvista/themes.py#L1706-L1722
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Mac/Modules/evt/evtscan.py
python
MyScanner.makerepairinstructions
(self)
return [ ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")], [("InBuffer", "*", "*")]), ([("void", "*", "OutMode"), ("long", "*", "InMode"), ("long", "*", "OutMode")], [("VarVarOutBuffer", "*", "InOutMode")]), ([("void", "wStorage", "OutMode")], [("NullStorage", "*", "InMode")]), # GetKeys ([('KeyMap', 'theKeys', 'InMode')], [('*', '*', 'OutMode')]), # GetTicker ([('unsigned long', '*', '*')], [('unsigned_long', '*', '*')]), ]
[]
def makerepairinstructions(self): return [ ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")], [("InBuffer", "*", "*")]), ([("void", "*", "OutMode"), ("long", "*", "InMode"), ("long", "*", "OutMode")], [("VarVarOutBuffer", "*", "InOutMode")]), ([("void", "wStorage", "OutMode")], [("NullStorage", "*", "InMode")]), # GetKeys ([('KeyMap', 'theKeys', 'InMode')], [('*', '*', 'OutMode')]), # GetTicker ([('unsigned long', '*', '*')], [('unsigned_long', '*', '*')]), ]
[ "def", "makerepairinstructions", "(", "self", ")", ":", "return", "[", "(", "[", "(", "\"void_ptr\"", ",", "\"*\"", ",", "\"InMode\"", ")", ",", "(", "\"long\"", ",", "\"*\"", ",", "\"InMode\"", ")", "]", ",", "[", "(", "\"InBuffer\"", ",", "\"*\"", ",...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Mac/Modules/evt/evtscan.py#L58-L77
skylander86/lambda-text-extractor
6da52d077a2fc571e38bfe29c33ae68f6443cd5a
lib-linux_x64/requests/utils.py
python
prepend_scheme_if_needed
(url, new_scheme)
return urlunparse((scheme, netloc, path, params, query, fragment))
Given a URL that may or may not have a scheme, prepend the given scheme. Does not replace a present scheme with the one provided as an argument. :rtype: str
Given a URL that may or may not have a scheme, prepend the given scheme. Does not replace a present scheme with the one provided as an argument.
[ "Given", "a", "URL", "that", "may", "or", "may", "not", "have", "a", "scheme", "prepend", "the", "given", "scheme", ".", "Does", "not", "replace", "a", "present", "scheme", "with", "the", "one", "provided", "as", "an", "argument", "." ]
def prepend_scheme_if_needed(url, new_scheme): """Given a URL that may or may not have a scheme, prepend the given scheme. Does not replace a present scheme with the one provided as an argument. :rtype: str """ scheme, netloc, path, params, query, fragment = urlparse(url, new_scheme) # urlparse is a finicky beast, and sometimes decides that there isn't a # netloc present. Assume that it's being over-cautious, and switch netloc # and path if urlparse decided there was no netloc. if not netloc: netloc, path = path, netloc return urlunparse((scheme, netloc, path, params, query, fragment))
[ "def", "prepend_scheme_if_needed", "(", "url", ",", "new_scheme", ")", ":", "scheme", ",", "netloc", ",", "path", ",", "params", ",", "query", ",", "fragment", "=", "urlparse", "(", "url", ",", "new_scheme", ")", "# urlparse is a finicky beast, and sometimes decid...
https://github.com/skylander86/lambda-text-extractor/blob/6da52d077a2fc571e38bfe29c33ae68f6443cd5a/lib-linux_x64/requests/utils.py#L816-L830
blue-oil/blueoil
0c9160b524b17482d59ae48a0c11384f1d26dccc
blueoil/cmd/init.py
python
prompt
(question)
return answers['value']
Execute prompt answer Args: question (list): list of inquirer question Returns: string of answer
Execute prompt answer
[ "Execute", "prompt", "answer" ]
def prompt(question): """Execute prompt answer Args: question (list): list of inquirer question Returns: string of answer """ answers = inquirer.prompt(question) return answers['value']
[ "def", "prompt", "(", "question", ")", ":", "answers", "=", "inquirer", ".", "prompt", "(", "question", ")", "return", "answers", "[", "'value'", "]" ]
https://github.com/blue-oil/blueoil/blob/0c9160b524b17482d59ae48a0c11384f1d26dccc/blueoil/cmd/init.py#L171-L181
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
frontend/id_kind_def.py
python
IdSpec.LexerPairs
(self, kind)
return result
[]
def LexerPairs(self, kind): # type: (Kind_t) -> List[Tuple[bool, str, Id_t]] result = [] for is_regex, pat, id_ in self.lexer_pairs[kind]: result.append((is_regex, pat, id_)) return result
[ "def", "LexerPairs", "(", "self", ",", "kind", ")", ":", "# type: (Kind_t) -> List[Tuple[bool, str, Id_t]]", "result", "=", "[", "]", "for", "is_regex", ",", "pat", ",", "id_", "in", "self", ".", "lexer_pairs", "[", "kind", "]", ":", "result", ".", "append",...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/frontend/id_kind_def.py#L44-L49
maximecb/gym-minigrid
6116191b15aec9e09e4b48edd16f144e31b412fa
gym_minigrid/minigrid.py
python
MiniGridEnv.render
(self, mode='human', close=False, highlight=True, tile_size=TILE_PIXELS)
return img
Render the whole-grid human view
Render the whole-grid human view
[ "Render", "the", "whole", "-", "grid", "human", "view" ]
def render(self, mode='human', close=False, highlight=True, tile_size=TILE_PIXELS): """ Render the whole-grid human view """ if close: if self.window: self.window.close() return if mode == 'human' and not self.window: import gym_minigrid.window self.window = gym_minigrid.window.Window('gym_minigrid') self.window.show(block=False) # Compute which cells are visible to the agent _, vis_mask = self.gen_obs_grid() # Compute the world coordinates of the bottom-left corner # of the agent's view area f_vec = self.dir_vec r_vec = self.right_vec top_left = self.agent_pos + f_vec * (self.agent_view_size-1) - r_vec * (self.agent_view_size // 2) # Mask of which cells to highlight highlight_mask = np.zeros(shape=(self.width, self.height), dtype=bool) # For each cell in the visibility mask for vis_j in range(0, self.agent_view_size): for vis_i in range(0, self.agent_view_size): # If this cell is not visible, don't highlight it if not vis_mask[vis_i, vis_j]: continue # Compute the world coordinates of this cell abs_i, abs_j = top_left - (f_vec * vis_j) + (r_vec * vis_i) if abs_i < 0 or abs_i >= self.width: continue if abs_j < 0 or abs_j >= self.height: continue # Mark this cell to be highlighted highlight_mask[abs_i, abs_j] = True # Render the whole grid img = self.grid.render( tile_size, self.agent_pos, self.agent_dir, highlight_mask=highlight_mask if highlight else None ) if mode == 'human': self.window.set_caption(self.mission) self.window.show_img(img) return img
[ "def", "render", "(", "self", ",", "mode", "=", "'human'", ",", "close", "=", "False", ",", "highlight", "=", "True", ",", "tile_size", "=", "TILE_PIXELS", ")", ":", "if", "close", ":", "if", "self", ".", "window", ":", "self", ".", "window", ".", ...
https://github.com/maximecb/gym-minigrid/blob/6116191b15aec9e09e4b48edd16f144e31b412fa/gym_minigrid/minigrid.py#L1238-L1295
kyuupichan/electrumx
ab9024f74a034e634a518cfbcdb1fcd911e62f00
electrumx/server/db.py
python
DB.assert_flushed
(self, flush_data)
Asserts state is fully flushed.
Asserts state is fully flushed.
[ "Asserts", "state", "is", "fully", "flushed", "." ]
def assert_flushed(self, flush_data): '''Asserts state is fully flushed.''' assert flush_data.state.tx_count == self.fs_tx_count == self.state.tx_count assert flush_data.state.height == self.fs_height == self.state.height assert flush_data.state.tip == self.state.tip assert not flush_data.headers assert not flush_data.block_tx_hashes assert not flush_data.adds assert not flush_data.deletes assert not flush_data.undo_infos self.history.assert_flushed()
[ "def", "assert_flushed", "(", "self", ",", "flush_data", ")", ":", "assert", "flush_data", ".", "state", ".", "tx_count", "==", "self", ".", "fs_tx_count", "==", "self", ".", "state", ".", "tx_count", "assert", "flush_data", ".", "state", ".", "height", "=...
https://github.com/kyuupichan/electrumx/blob/ab9024f74a034e634a518cfbcdb1fcd911e62f00/electrumx/server/db.py#L180-L190
peterbuga/HASS-sonoff-ewelink
ab8fef3426d0f4821def48f25205e32fe23cc59a
sonoff/__init__.py
python
SonoffDevice.get_device
(self)
return None
[]
def get_device(self): for device in self._hass.data[DOMAIN].get_devices(): if 'deviceid' in device and device['deviceid'] == self._deviceid: return device return None
[ "def", "get_device", "(", "self", ")", ":", "for", "device", "in", "self", ".", "_hass", ".", "data", "[", "DOMAIN", "]", ".", "get_devices", "(", ")", ":", "if", "'deviceid'", "in", "device", "and", "device", "[", "'deviceid'", "]", "==", "self", "....
https://github.com/peterbuga/HASS-sonoff-ewelink/blob/ab8fef3426d0f4821def48f25205e32fe23cc59a/sonoff/__init__.py#L644-L649
bigmlcom/python
35f69d2f3121f1b3dde43495cf145d4992796ad5
bigml/multimodel.py
python
MultiModel._generate_votes
(self, input_data, missing_strategy=LAST_PREDICTION, unused_fields=None)
return votes
Generates a MultiVote object that contains the predictions made by each of the models. Please note that this function calls a _predict method which assumes input data has been properly checked against the model fields. Only casting to the correct type will be applied.
Generates a MultiVote object that contains the predictions made by each of the models. Please note that this function calls a _predict method which assumes input data has been properly checked against the model fields. Only casting to the correct type will be applied.
[ "Generates", "a", "MultiVote", "object", "that", "contains", "the", "predictions", "made", "by", "each", "of", "the", "models", ".", "Please", "note", "that", "this", "function", "calls", "a", "_predict", "method", "which", "assumes", "input", "data", "has", ...
def _generate_votes(self, input_data, missing_strategy=LAST_PREDICTION, unused_fields=None): """ Generates a MultiVote object that contains the predictions made by each of the models. Please note that this function calls a _predict method which assumes input data has been properly checked against the model fields. Only casting to the correct type will be applied. """ votes = MultiVote([]) for order in range(0, len(self.models)): model = self.models[order] prediction_info = model._predict( \ input_data, missing_strategy=missing_strategy, unused_fields=unused_fields) if model.boosting is not None: votes.boosting = True prediction_info.update( \ {"weight": model.boosting.get("weight")}) if model.boosting.get("objective_class") is not None: prediction_info.update( \ {"class": model.boosting.get("objective_class")}) votes.append(prediction_info) return votes
[ "def", "_generate_votes", "(", "self", ",", "input_data", ",", "missing_strategy", "=", "LAST_PREDICTION", ",", "unused_fields", "=", "None", ")", ":", "votes", "=", "MultiVote", "(", "[", "]", ")", "for", "order", "in", "range", "(", "0", ",", "len", "(...
https://github.com/bigmlcom/python/blob/35f69d2f3121f1b3dde43495cf145d4992796ad5/bigml/multimodel.py#L188-L213
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/tke/v20180525/models.py
python
PrometheusNotification.__init__
(self)
r""" :param Enabled: 是否启用 :type Enabled: bool :param RepeatInterval: 收敛时间 :type RepeatInterval: str :param TimeRangeStart: 生效起始时间 :type TimeRangeStart: str :param TimeRangeEnd: 生效结束时间 :type TimeRangeEnd: str :param NotifyWay: 告警通知方式。目前有SMS、EMAIL、CALL、WECHAT方式。 分别代表:短信、邮件、电话、微信 注意:此字段可能返回 null,表示取不到有效值。 :type NotifyWay: list of str :param ReceiverGroups: 告警接收组(用户组) 注意:此字段可能返回 null,表示取不到有效值。 :type ReceiverGroups: list of int non-negative :param PhoneNotifyOrder: 电话告警顺序。 注:NotifyWay选择CALL,采用该参数。 注意:此字段可能返回 null,表示取不到有效值。 :type PhoneNotifyOrder: list of int non-negative :param PhoneCircleTimes: 电话告警次数。 注:NotifyWay选择CALL,采用该参数。 注意:此字段可能返回 null,表示取不到有效值。 :type PhoneCircleTimes: int :param PhoneInnerInterval: 电话告警轮内间隔。单位:秒 注:NotifyWay选择CALL,采用该参数。 注意:此字段可能返回 null,表示取不到有效值。 :type PhoneInnerInterval: int :param PhoneCircleInterval: 电话告警轮外间隔。单位:秒 注:NotifyWay选择CALL,采用该参数。 注意:此字段可能返回 null,表示取不到有效值。 :type PhoneCircleInterval: int :param PhoneArriveNotice: 电话告警触达通知 注:NotifyWay选择CALL,采用该参数。 注意:此字段可能返回 null,表示取不到有效值。 :type PhoneArriveNotice: bool :param Type: 通道类型,默认为amp,支持以下 amp webhook 注意:此字段可能返回 null,表示取不到有效值。 :type Type: str :param WebHook: 如果Type为webhook, 则该字段为必填项 注意:此字段可能返回 null,表示取不到有效值。 :type WebHook: str
r""" :param Enabled: 是否启用 :type Enabled: bool :param RepeatInterval: 收敛时间 :type RepeatInterval: str :param TimeRangeStart: 生效起始时间 :type TimeRangeStart: str :param TimeRangeEnd: 生效结束时间 :type TimeRangeEnd: str :param NotifyWay: 告警通知方式。目前有SMS、EMAIL、CALL、WECHAT方式。 分别代表:短信、邮件、电话、微信 注意:此字段可能返回 null,表示取不到有效值。 :type NotifyWay: list of str :param ReceiverGroups: 告警接收组(用户组) 注意:此字段可能返回 null,表示取不到有效值。 :type ReceiverGroups: list of int non-negative :param PhoneNotifyOrder: 电话告警顺序。 注:NotifyWay选择CALL,采用该参数。 注意:此字段可能返回 null,表示取不到有效值。 :type PhoneNotifyOrder: list of int non-negative :param PhoneCircleTimes: 电话告警次数。 注:NotifyWay选择CALL,采用该参数。 注意:此字段可能返回 null,表示取不到有效值。 :type PhoneCircleTimes: int :param PhoneInnerInterval: 电话告警轮内间隔。单位:秒 注:NotifyWay选择CALL,采用该参数。 注意:此字段可能返回 null,表示取不到有效值。 :type PhoneInnerInterval: int :param PhoneCircleInterval: 电话告警轮外间隔。单位:秒 注:NotifyWay选择CALL,采用该参数。 注意:此字段可能返回 null,表示取不到有效值。 :type PhoneCircleInterval: int :param PhoneArriveNotice: 电话告警触达通知 注:NotifyWay选择CALL,采用该参数。 注意:此字段可能返回 null,表示取不到有效值。 :type PhoneArriveNotice: bool :param Type: 通道类型,默认为amp,支持以下 amp webhook 注意:此字段可能返回 null,表示取不到有效值。 :type Type: str :param WebHook: 如果Type为webhook, 则该字段为必填项 注意:此字段可能返回 null,表示取不到有效值。 :type WebHook: str
[ "r", ":", "param", "Enabled", ":", "是否启用", ":", "type", "Enabled", ":", "bool", ":", "param", "RepeatInterval", ":", "收敛时间", ":", "type", "RepeatInterval", ":", "str", ":", "param", "TimeRangeStart", ":", "生效起始时间", ":", "type", "TimeRangeStart", ":", "str"...
def __init__(self): r""" :param Enabled: 是否启用 :type Enabled: bool :param RepeatInterval: 收敛时间 :type RepeatInterval: str :param TimeRangeStart: 生效起始时间 :type TimeRangeStart: str :param TimeRangeEnd: 生效结束时间 :type TimeRangeEnd: str :param NotifyWay: 告警通知方式。目前有SMS、EMAIL、CALL、WECHAT方式。 分别代表:短信、邮件、电话、微信 注意:此字段可能返回 null,表示取不到有效值。 :type NotifyWay: list of str :param ReceiverGroups: 告警接收组(用户组) 注意:此字段可能返回 null,表示取不到有效值。 :type ReceiverGroups: list of int non-negative :param PhoneNotifyOrder: 电话告警顺序。 注:NotifyWay选择CALL,采用该参数。 注意:此字段可能返回 null,表示取不到有效值。 :type PhoneNotifyOrder: list of int non-negative :param PhoneCircleTimes: 电话告警次数。 注:NotifyWay选择CALL,采用该参数。 注意:此字段可能返回 null,表示取不到有效值。 :type PhoneCircleTimes: int :param PhoneInnerInterval: 电话告警轮内间隔。单位:秒 注:NotifyWay选择CALL,采用该参数。 注意:此字段可能返回 null,表示取不到有效值。 :type PhoneInnerInterval: int :param PhoneCircleInterval: 电话告警轮外间隔。单位:秒 注:NotifyWay选择CALL,采用该参数。 注意:此字段可能返回 null,表示取不到有效值。 :type PhoneCircleInterval: int :param PhoneArriveNotice: 电话告警触达通知 注:NotifyWay选择CALL,采用该参数。 注意:此字段可能返回 null,表示取不到有效值。 :type PhoneArriveNotice: bool :param Type: 通道类型,默认为amp,支持以下 amp webhook 注意:此字段可能返回 null,表示取不到有效值。 :type Type: str :param WebHook: 如果Type为webhook, 则该字段为必填项 注意:此字段可能返回 null,表示取不到有效值。 :type WebHook: str """ self.Enabled = None self.RepeatInterval = None self.TimeRangeStart = None self.TimeRangeEnd = None self.NotifyWay = None self.ReceiverGroups = None self.PhoneNotifyOrder = None self.PhoneCircleTimes = None self.PhoneInnerInterval = None self.PhoneCircleInterval = None self.PhoneArriveNotice = None self.Type = None self.WebHook = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "Enabled", "=", "None", "self", ".", "RepeatInterval", "=", "None", "self", ".", "TimeRangeStart", "=", "None", "self", ".", "TimeRangeEnd", "=", "None", "self", ".", "NotifyWay", "=", "None", "self"...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tke/v20180525/models.py#L8707-L8765
openbmc/openbmc
5f4109adae05f4d6925bfe960007d52f98c61086
poky/meta/lib/oe/license.py
python
list_licenses
(licensestr)
return visitor.licenses
Simply get a list of all licenses mentioned in a license string. Binary operators are not applied or taken into account in any way
Simply get a list of all licenses mentioned in a license string. Binary operators are not applied or taken into account in any way
[ "Simply", "get", "a", "list", "of", "all", "licenses", "mentioned", "in", "a", "license", "string", ".", "Binary", "operators", "are", "not", "applied", "or", "taken", "into", "account", "in", "any", "way" ]
def list_licenses(licensestr): """Simply get a list of all licenses mentioned in a license string. Binary operators are not applied or taken into account in any way""" visitor = ListVisitor() try: visitor.visit_string(licensestr) except SyntaxError as exc: raise LicenseSyntaxError(licensestr, exc) return visitor.licenses
[ "def", "list_licenses", "(", "licensestr", ")", ":", "visitor", "=", "ListVisitor", "(", ")", "try", ":", "visitor", ".", "visit_string", "(", "licensestr", ")", "except", "SyntaxError", "as", "exc", ":", "raise", "LicenseSyntaxError", "(", "licensestr", ",", ...
https://github.com/openbmc/openbmc/blob/5f4109adae05f4d6925bfe960007d52f98c61086/poky/meta/lib/oe/license.py#L230-L238
edfungus/Crouton
ada98b3930192938a48909072b45cb84b945f875
clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/setuptools/archive_util.py
python
default_filter
(src,dst)
return dst
The default progress/filter callback; returns True for all files
The default progress/filter callback; returns True for all files
[ "The", "default", "progress", "/", "filter", "callback", ";", "returns", "True", "for", "all", "files" ]
def default_filter(src,dst): """The default progress/filter callback; returns True for all files""" return dst
[ "def", "default_filter", "(", "src", ",", "dst", ")", ":", "return", "dst" ]
https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/setuptools/archive_util.py#L21-L23
RhinoSecurityLabs/Cloud-Security-Research
b7d14b7eb51b7dea6ea6a8978682bd9671e0e183
AWS/s3_bucket_bruteforcer/buckethead.py
python
check_region_choice
(regions)
Check that the region passed to the script is valid. If all, return all regions. Args: regions (str): Comma separated string of regions. Returns: list: List of AWS regions.
Check that the region passed to the script is valid. If all, return all regions.
[ "Check", "that", "the", "region", "passed", "to", "the", "script", "is", "valid", ".", "If", "all", "return", "all", "regions", "." ]
def check_region_choice(regions): """ Check that the region passed to the script is valid. If all, return all regions. Args: regions (str): Comma separated string of regions. Returns: list: List of AWS regions. """ regions = [x.strip() for x in regions.split(",")] if "all" in regions: return S3_REGIONS elif not all(x in S3_REGIONS for x in regions): # Not all regions passed to program are valid, raise error. print("Invalid option passed for -r (--regions). Regions must be one or more of the following:") print("all, {}".format(", ".join(S3_REGIONS))) exit(1) else: # Every region passed is valid! return regions
[ "def", "check_region_choice", "(", "regions", ")", ":", "regions", "=", "[", "x", ".", "strip", "(", ")", "for", "x", "in", "regions", ".", "split", "(", "\",\"", ")", "]", "if", "\"all\"", "in", "regions", ":", "return", "S3_REGIONS", "elif", "not", ...
https://github.com/RhinoSecurityLabs/Cloud-Security-Research/blob/b7d14b7eb51b7dea6ea6a8978682bd9671e0e183/AWS/s3_bucket_bruteforcer/buckethead.py#L34-L55
UniversalDependencies/tools
74faa47086440d03e06aa26bc7a8247878737c18
compat/argparse.py
python
FileType.__call__
(self, string)
[]
def __call__(self, string): # the special argument "-" means sys.std{in,out} if string == '-': if 'r' in self._mode: return _sys.stdin elif 'w' in self._mode: return _sys.stdout else: msg = _('argument "-" with mode %r' % self._mode) raise ValueError(msg) # all other arguments are used as file names if self._bufsize: return open(string, self._mode, self._bufsize) else: return open(string, self._mode)
[ "def", "__call__", "(", "self", ",", "string", ")", ":", "# the special argument \"-\" means sys.std{in,out}", "if", "string", "==", "'-'", ":", "if", "'r'", "in", "self", ".", "_mode", ":", "return", "_sys", ".", "stdin", "elif", "'w'", "in", "self", ".", ...
https://github.com/UniversalDependencies/tools/blob/74faa47086440d03e06aa26bc7a8247878737c18/compat/argparse.py#L1138-L1153
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
ansible/roles/lib_oa_openshift/library/oc_adm_ca_server_cert.py
python
OpenShiftCLI._evacuate
(self, node=None, selector=None, pod_selector=None, dry_run=False, grace_period=None, force=False)
return self.openshift_cmd(cmd, oadm=True, output=True, output_type='raw')
perform oadm manage-node evacuate
perform oadm manage-node evacuate
[ "perform", "oadm", "manage", "-", "node", "evacuate" ]
def _evacuate(self, node=None, selector=None, pod_selector=None, dry_run=False, grace_period=None, force=False): ''' perform oadm manage-node evacuate ''' cmd = ['manage-node'] if node: cmd.extend(node) else: cmd.append('--selector={}'.format(selector)) if dry_run: cmd.append('--dry-run') if pod_selector: cmd.append('--pod-selector={}'.format(pod_selector)) if grace_period: cmd.append('--grace-period={}'.format(int(grace_period))) if force: cmd.append('--force') cmd.append('--evacuate') return self.openshift_cmd(cmd, oadm=True, output=True, output_type='raw')
[ "def", "_evacuate", "(", "self", ",", "node", "=", "None", ",", "selector", "=", "None", ",", "pod_selector", "=", "None", ",", "dry_run", "=", "False", ",", "grace_period", "=", "None", ",", "force", "=", "False", ")", ":", "cmd", "=", "[", "'manage...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_openshift/library/oc_adm_ca_server_cert.py#L1081-L1103
NVIDIA/DeepLearningExamples
589604d49e016cd9ef4525f7abcc9c7b826cfc5e
PyTorch/LanguageModeling/BART/utils/optimization.py
python
get_linear_schedule_with_warmup
(optimizer, num_warmup_steps, num_training_steps, last_epoch=-1)
return LambdaLR(optimizer, lr_lambda, last_epoch)
Create a schedule with a learning rate that decreases linearly from the initial lr set in the optimizer to 0, after a warmup period during which it increases linearly from 0 to the initial lr set in the optimizer. Args: optimizer (:class:`~torch.optim.Optimizer`): The optimizer for which to schedule the learning rate. num_warmup_steps (:obj:`int`): The number of steps for the warmup phase. num_training_steps (:obj:`int`): The total number of training steps. last_epoch (:obj:`int`, `optional`, defaults to -1): The index of the last epoch when resuming training. Return: :obj:`torch.optim.lr_scheduler.LambdaLR` with the appropriate schedule.
Create a schedule with a learning rate that decreases linearly from the initial lr set in the optimizer to 0, after a warmup period during which it increases linearly from 0 to the initial lr set in the optimizer.
[ "Create", "a", "schedule", "with", "a", "learning", "rate", "that", "decreases", "linearly", "from", "the", "initial", "lr", "set", "in", "the", "optimizer", "to", "0", "after", "a", "warmup", "period", "during", "which", "it", "increases", "linearly", "from...
def get_linear_schedule_with_warmup(optimizer, num_warmup_steps, num_training_steps, last_epoch=-1): """ Create a schedule with a learning rate that decreases linearly from the initial lr set in the optimizer to 0, after a warmup period during which it increases linearly from 0 to the initial lr set in the optimizer. Args: optimizer (:class:`~torch.optim.Optimizer`): The optimizer for which to schedule the learning rate. num_warmup_steps (:obj:`int`): The number of steps for the warmup phase. num_training_steps (:obj:`int`): The total number of training steps. last_epoch (:obj:`int`, `optional`, defaults to -1): The index of the last epoch when resuming training. Return: :obj:`torch.optim.lr_scheduler.LambdaLR` with the appropriate schedule. """ def lr_lambda(current_step: int): if current_step < num_warmup_steps: return float(current_step) / float(max(1, num_warmup_steps)) return max( 0.0, float(num_training_steps - current_step) / float(max(1, num_training_steps - num_warmup_steps)) ) return LambdaLR(optimizer, lr_lambda, last_epoch)
[ "def", "get_linear_schedule_with_warmup", "(", "optimizer", ",", "num_warmup_steps", ",", "num_training_steps", ",", "last_epoch", "=", "-", "1", ")", ":", "def", "lr_lambda", "(", "current_step", ":", "int", ")", ":", "if", "current_step", "<", "num_warmup_steps"...
https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/PyTorch/LanguageModeling/BART/utils/optimization.py#L71-L97
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/Python3/platform.py
python
platform
(aliased=0, terse=0)
return platform
Returns a single string identifying the underlying platform with as much useful information as possible (but no more :). The output is intended to be human readable rather than machine parseable. It may look different on different platforms and this is intended. If "aliased" is true, the function will use aliases for various platforms that report system names which differ from their common names, e.g. SunOS will be reported as Solaris. The system_alias() function is used to implement this. Setting terse to true causes the function to return only the absolute minimum information needed to identify the platform.
Returns a single string identifying the underlying platform with as much useful information as possible (but no more :).
[ "Returns", "a", "single", "string", "identifying", "the", "underlying", "platform", "with", "as", "much", "useful", "information", "as", "possible", "(", "but", "no", "more", ":", ")", "." ]
def platform(aliased=0, terse=0): """ Returns a single string identifying the underlying platform with as much useful information as possible (but no more :). The output is intended to be human readable rather than machine parseable. It may look different on different platforms and this is intended. If "aliased" is true, the function will use aliases for various platforms that report system names which differ from their common names, e.g. SunOS will be reported as Solaris. The system_alias() function is used to implement this. Setting terse to true causes the function to return only the absolute minimum information needed to identify the platform. """ result = _platform_cache.get((aliased, terse), None) if result is not None: return result # Get uname information and then apply platform specific cosmetics # to it... system, node, release, version, machine, processor = uname() if machine == processor: processor = '' if aliased: system, release, version = system_alias(system, release, version) if system == 'Windows': # MS platforms rel, vers, csd, ptype = win32_ver(version) if terse: platform = _platform(system, release) else: platform = _platform(system, release, version, csd) elif system in ('Linux',): # Linux based systems with warnings.catch_warnings(): # see issue #1322 for more information warnings.filterwarnings( 'ignore', r'dist\(\) and linux_distribution\(\) ' 'functions are deprecated .*', PendingDeprecationWarning, ) distname, distversion, distid = dist('') if distname and not terse: platform = _platform(system, release, machine, processor, 'with', distname, distversion, distid) else: # If the distribution name is unknown check for libc vs. glibc libcname, libcversion = libc_ver(sys.executable) platform = _platform(system, release, machine, processor, 'with', libcname+libcversion) elif system == 'Java': # Java platforms r, v, vminfo, (os_name, os_version, os_arch) = java_ver() if terse or not os_name: platform = _platform(system, release, version) else: platform = _platform(system, release, version, 'on', os_name, os_version, os_arch) elif system == 'MacOS': # MacOS platforms if terse: platform = _platform(system, release) else: platform = _platform(system, release, machine) else: # Generic handler if terse: platform = _platform(system, release) else: bits, linkage = architecture(sys.executable) platform = _platform(system, release, machine, processor, bits, linkage) _platform_cache[(aliased, terse)] = platform return platform
[ "def", "platform", "(", "aliased", "=", "0", ",", "terse", "=", "0", ")", ":", "result", "=", "_platform_cache", ".", "get", "(", "(", "aliased", ",", "terse", ")", ",", "None", ")", "if", "result", "is", "not", "None", ":", "return", "result", "# ...
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/platform.py#L1304-L1391
donnemartin/data-science-ipython-notebooks
5b3c00d462c6e9200315afe46d0093948621eb95
deep-learning/keras-tutorial/deep_learning_models/imagenet_utils.py
python
preprocess_input
(x, dim_ordering='default')
return x
[]
def preprocess_input(x, dim_ordering='default'): if dim_ordering == 'default': dim_ordering = K.image_dim_ordering() assert dim_ordering in {'tf', 'th'} if dim_ordering == 'th': x[:, 0, :, :] -= 103.939 x[:, 1, :, :] -= 116.779 x[:, 2, :, :] -= 123.68 # 'RGB'->'BGR' x = x[:, ::-1, :, :] else: x[:, :, :, 0] -= 103.939 x[:, :, :, 1] -= 116.779 x[:, :, :, 2] -= 123.68 # 'RGB'->'BGR' x = x[:, :, :, ::-1] return x
[ "def", "preprocess_input", "(", "x", ",", "dim_ordering", "=", "'default'", ")", ":", "if", "dim_ordering", "==", "'default'", ":", "dim_ordering", "=", "K", ".", "image_dim_ordering", "(", ")", "assert", "dim_ordering", "in", "{", "'tf'", ",", "'th'", "}", ...
https://github.com/donnemartin/data-science-ipython-notebooks/blob/5b3c00d462c6e9200315afe46d0093948621eb95/deep-learning/keras-tutorial/deep_learning_models/imagenet_utils.py#L11-L28
mchristopher/PokemonGo-DesktopMap
ec37575f2776ee7d64456e2a1f6b6b78830b4fe0
app/pywin/Lib/logging/__init__.py
python
Logger._log
(self, level, msg, args, exc_info=None, extra=None)
Low-level logging routine which creates a LogRecord and then calls all the handlers of this logger to handle the record.
Low-level logging routine which creates a LogRecord and then calls all the handlers of this logger to handle the record.
[ "Low", "-", "level", "logging", "routine", "which", "creates", "a", "LogRecord", "and", "then", "calls", "all", "the", "handlers", "of", "this", "logger", "to", "handle", "the", "record", "." ]
def _log(self, level, msg, args, exc_info=None, extra=None): """ Low-level logging routine which creates a LogRecord and then calls all the handlers of this logger to handle the record. """ if _srcfile: #IronPython doesn't track Python frames, so findCaller raises an #exception on some versions of IronPython. We trap it here so that #IronPython can use logging. try: fn, lno, func = self.findCaller() except ValueError: fn, lno, func = "(unknown file)", 0, "(unknown function)" else: fn, lno, func = "(unknown file)", 0, "(unknown function)" if exc_info: if not isinstance(exc_info, tuple): exc_info = sys.exc_info() record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra) self.handle(record)
[ "def", "_log", "(", "self", ",", "level", ",", "msg", ",", "args", ",", "exc_info", "=", "None", ",", "extra", "=", "None", ")", ":", "if", "_srcfile", ":", "#IronPython doesn't track Python frames, so findCaller raises an", "#exception on some versions of IronPython....
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pywin/Lib/logging/__init__.py#L1267-L1286
merenlab/anvio
9b792e2cedc49ecb7c0bed768261595a0d87c012
anvio/sequence.py
python
Kmerizer.get_prefix_kmer_dict
(self, kmer_size, include_full_length=True)
return kmer_dict
Get k-mers of a given size from the beginning of input sequences. Parameters ========== kmer_size : int Length of the k-mers to be extracted include_full_length : bool, True Whether to include or ignore full-length input sequences among the hashed k-mers Returns ======= kmer_dict : dict Keys are unique k-mer strings identified from the input sequences. Values are lists of the names of input sequences containing the k-mer. These lists are sorted in descending order of sequence length and then alphanumerically by ID.
Get k-mers of a given size from the beginning of input sequences.
[ "Get", "k", "-", "mers", "of", "a", "given", "size", "from", "the", "beginning", "of", "input", "sequences", "." ]
def get_prefix_kmer_dict(self, kmer_size, include_full_length=True): """Get k-mers of a given size from the beginning of input sequences. Parameters ========== kmer_size : int Length of the k-mers to be extracted include_full_length : bool, True Whether to include or ignore full-length input sequences among the hashed k-mers Returns ======= kmer_dict : dict Keys are unique k-mer strings identified from the input sequences. Values are lists of the names of input sequences containing the k-mer. These lists are sorted in descending order of sequence length and then alphanumerically by ID. """ kmer_dict = {} for name, seq in zip(self.names, self.seqs): if include_full_length: # Include input seqs as k-mers. if kmer_size > len(seq): continue elif kmer_size >= len(seq): # Do not include input seqs as k-mers. continue hashed_kmer = sha1(seq[: kmer_size].encode('utf-8')).hexdigest() if hashed_kmer in kmer_dict: kmer_dict[hashed_kmer].append((name, len(seq))) else: kmer_dict[hashed_kmer] = [(name, len(seq))] for hashed_kmer, parent_seqs in kmer_dict.items(): kmer_dict[hashed_kmer] = [name for name, seq_length in sorted(parent_seqs, key=lambda t: (-t[1], t[0]))] return kmer_dict
[ "def", "get_prefix_kmer_dict", "(", "self", ",", "kmer_size", ",", "include_full_length", "=", "True", ")", ":", "kmer_dict", "=", "{", "}", "for", "name", ",", "seq", "in", "zip", "(", "self", ".", "names", ",", "self", ".", "seqs", ")", ":", "if", ...
https://github.com/merenlab/anvio/blob/9b792e2cedc49ecb7c0bed768261595a0d87c012/anvio/sequence.py#L248-L285
espnet/espnet
ea411f3f627b8f101c211e107d0ff7053344ac80
egs/vcc20/vc1_task2/local/clean_text_finnish.py
python
g2p
(text)
return " ".join(tokens)
Convert grapheme to phoneme.
Convert grapheme to phoneme.
[ "Convert", "grapheme", "to", "phoneme", "." ]
def g2p(text): """Convert grapheme to phoneme.""" tokens = filter(lambda s: s != " ", f_g2p(text)) return " ".join(tokens)
[ "def", "g2p", "(", "text", ")", ":", "tokens", "=", "filter", "(", "lambda", "s", ":", "s", "!=", "\" \"", ",", "f_g2p", "(", "text", ")", ")", "return", "\" \"", ".", "join", "(", "tokens", ")" ]
https://github.com/espnet/espnet/blob/ea411f3f627b8f101c211e107d0ff7053344ac80/egs/vcc20/vc1_task2/local/clean_text_finnish.py#L44-L47
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/agw/scrolledthumbnail.py
python
ScrolledThumbnail.GetThumbBorder
(self)
return self._tBorder
Returns the thumbnail border.
Returns the thumbnail border.
[ "Returns", "the", "thumbnail", "border", "." ]
def GetThumbBorder(self): """ Returns the thumbnail border. """ return self._tBorder
[ "def", "GetThumbBorder", "(", "self", ")", ":", "return", "self", ".", "_tBorder" ]
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/scrolledthumbnail.py#L1044-L1047
euske/pdfminer
423f851fc20ebd701bc4c8b5b7ba0e7904e18e3b
pdfminer/pdfdocument.py
python
PDFDocument.find_xref
(self, parser)
return int(prev)
Internal function used to locate the first XRef.
Internal function used to locate the first XRef.
[ "Internal", "function", "used", "to", "locate", "the", "first", "XRef", "." ]
def find_xref(self, parser): """Internal function used to locate the first XRef.""" # search the last xref table by scanning the file backwards. prev = None for line in parser.revreadlines(): line = line.strip() if self.debug: logging.debug('find_xref: %r' % line) if line == b'startxref': break if line: prev = line else: raise PDFNoValidXRef('Unexpected EOF') if self.debug: logging.info('xref found: pos=%r' % prev) return int(prev)
[ "def", "find_xref", "(", "self", ",", "parser", ")", ":", "# search the last xref table by scanning the file backwards.", "prev", "=", "None", "for", "line", "in", "parser", ".", "revreadlines", "(", ")", ":", "line", "=", "line", ".", "strip", "(", ")", "if",...
https://github.com/euske/pdfminer/blob/423f851fc20ebd701bc4c8b5b7ba0e7904e18e3b/pdfminer/pdfdocument.py#L755-L771
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/process_group_status_snapshot_dto.py
python
ProcessGroupStatusSnapshotDTO.bytes_in
(self)
return self._bytes_in
Gets the bytes_in of this ProcessGroupStatusSnapshotDTO. The number of bytes that have come into this ProcessGroup in the last 5 minutes :return: The bytes_in of this ProcessGroupStatusSnapshotDTO. :rtype: int
Gets the bytes_in of this ProcessGroupStatusSnapshotDTO. The number of bytes that have come into this ProcessGroup in the last 5 minutes
[ "Gets", "the", "bytes_in", "of", "this", "ProcessGroupStatusSnapshotDTO", ".", "The", "number", "of", "bytes", "that", "have", "come", "into", "this", "ProcessGroup", "in", "the", "last", "5", "minutes" ]
def bytes_in(self): """ Gets the bytes_in of this ProcessGroupStatusSnapshotDTO. The number of bytes that have come into this ProcessGroup in the last 5 minutes :return: The bytes_in of this ProcessGroupStatusSnapshotDTO. :rtype: int """ return self._bytes_in
[ "def", "bytes_in", "(", "self", ")", ":", "return", "self", ".", "_bytes_in" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/process_group_status_snapshot_dto.py#L458-L466
grantjenks/free-python-games
3f27c6555e2c72a9b1c668c4dd8506d7b8378d09
freegames/pong.py
python
rectangle
(x, y, width, height)
Draw rectangle at (x, y) with given width and height.
Draw rectangle at (x, y) with given width and height.
[ "Draw", "rectangle", "at", "(", "x", "y", ")", "with", "given", "width", "and", "height", "." ]
def rectangle(x, y, width, height): """Draw rectangle at (x, y) with given width and height.""" up() goto(x, y) down() begin_fill() for count in range(2): forward(width) left(90) forward(height) left(90) end_fill()
[ "def", "rectangle", "(", "x", ",", "y", ",", "width", ",", "height", ")", ":", "up", "(", ")", "goto", "(", "x", ",", "y", ")", "down", "(", ")", "begin_fill", "(", ")", "for", "count", "in", "range", "(", "2", ")", ":", "forward", "(", "widt...
https://github.com/grantjenks/free-python-games/blob/3f27c6555e2c72a9b1c668c4dd8506d7b8378d09/freegames/pong.py#L35-L46
mlcommons/training
4a4d5a0b7efe99c680306b1940749211d4238a84
reinforcement/tensorflow/minigo/oneoffs/oneoff_utils.py
python
find_and_filter_sgf_files
(base_dir, min_year=None, komi=None)
return filtered_sgf_files
Finds all sgf files in base_dir with year >= min_year and komi
Finds all sgf files in base_dir with year >= min_year and komi
[ "Finds", "all", "sgf", "files", "in", "base_dir", "with", "year", ">", "=", "min_year", "and", "komi" ]
def find_and_filter_sgf_files(base_dir, min_year=None, komi=None): """Finds all sgf files in base_dir with year >= min_year and komi""" sgf_files = [] for dirpath, dirnames, filenames in os.walk(base_dir): for filename in filenames: if filename.endswith('.sgf'): path = os.path.join(dirpath, filename) sgf_files.append(path) if min_year == komi == None: print ("Found {} sgf_files".format(len(sgf_files))) return sgf_files f = filter_year_komi(min_year, komi) filtered_sgf_files = [sgf for sgf in tqdm(sgf_files) if f(sgf)] print("{} of {} .sgf files matched (min_year >= {}, komi = {})".format( len(filtered_sgf_files), len(sgf_files), min_year, komi)) return filtered_sgf_files
[ "def", "find_and_filter_sgf_files", "(", "base_dir", ",", "min_year", "=", "None", ",", "komi", "=", "None", ")", ":", "sgf_files", "=", "[", "]", "for", "dirpath", ",", "dirnames", ",", "filenames", "in", "os", ".", "walk", "(", "base_dir", ")", ":", ...
https://github.com/mlcommons/training/blob/4a4d5a0b7efe99c680306b1940749211d4238a84/reinforcement/tensorflow/minigo/oneoffs/oneoff_utils.py#L77-L95
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/callcenter/indicator_sets.py
python
CallCenterIndicators.date_ranges
(self)
return { WEEK0: (weekago, self.reference_date), WEEK1: (weekago2, weekago), MONTH0: (daysago30, self.reference_date), MONTH1: (daysago60, daysago30), }
[]
def date_ranges(self): weekago = self.reference_date - timedelta(days=7) weekago2 = self.reference_date - timedelta(days=14) daysago30 = self.reference_date - timedelta(days=30) daysago60 = self.reference_date - timedelta(days=60) return { WEEK0: (weekago, self.reference_date), WEEK1: (weekago2, weekago), MONTH0: (daysago30, self.reference_date), MONTH1: (daysago60, daysago30), }
[ "def", "date_ranges", "(", "self", ")", ":", "weekago", "=", "self", ".", "reference_date", "-", "timedelta", "(", "days", "=", "7", ")", "weekago2", "=", "self", ".", "reference_date", "-", "timedelta", "(", "days", "=", "14", ")", "daysago30", "=", "...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/callcenter/indicator_sets.py#L110-L120
Komodo/KomodoEdit
61edab75dce2bdb03943b387b0608ea36f548e8e
src/udl/luddite.py
python
Shell.do_just_compile
(self, subcmd, opts, udl_path)
return commands.compile( udl_path, output_dir=opts.output_dir, include_path=opts.include_dirs, log=log)
${cmd_name}: compile a .udl file into a .lexres file ${cmd_usage} ${cmd_option_list} Note: This is a replacement for the deprecated `luddite compile'. In a subsequent release this will get the name `luddite compile'.
${cmd_name}: compile a .udl file into a .lexres file ${cmd_usage} ${cmd_option_list} Note: This is a replacement for the deprecated `luddite compile'. In a subsequent release this will get the name `luddite compile'.
[ "$", "{", "cmd_name", "}", ":", "compile", "a", ".", "udl", "file", "into", "a", ".", "lexres", "file", "$", "{", "cmd_usage", "}", "$", "{", "cmd_option_list", "}", "Note", ":", "This", "is", "a", "replacement", "for", "the", "deprecated", "luddite", ...
def do_just_compile(self, subcmd, opts, udl_path): """${cmd_name}: compile a .udl file into a .lexres file ${cmd_usage} ${cmd_option_list} Note: This is a replacement for the deprecated `luddite compile'. In a subsequent release this will get the name `luddite compile'. """ return commands.compile( udl_path, output_dir=opts.output_dir, include_path=opts.include_dirs, log=log)
[ "def", "do_just_compile", "(", "self", ",", "subcmd", ",", "opts", ",", "udl_path", ")", ":", "return", "commands", ".", "compile", "(", "udl_path", ",", "output_dir", "=", "opts", ".", "output_dir", ",", "include_path", "=", "opts", ".", "include_dirs", "...
https://github.com/Komodo/KomodoEdit/blob/61edab75dce2bdb03943b387b0608ea36f548e8e/src/udl/luddite.py#L140-L150
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/ipysheet/easy.py
python
current
()
return _last_sheet
Returns the current `Sheet` instance
Returns the current `Sheet` instance
[ "Returns", "the", "current", "Sheet", "instance" ]
def current(): """Returns the current `Sheet` instance""" return _last_sheet
[ "def", "current", "(", ")", ":", "return", "_last_sheet" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/ipysheet/easy.py#L65-L67
OpenMined/PySyft
f181ca02d307d57bfff9477610358df1a12e3ac9
packages/syft/src/syft/core/tensor/smpc/mpc_tensor.py
python
MPCTensor.sanity_checks
(mpc_tensor: MPCTensor, other: Any)
return mpc_tensor, other
Performs sanity checks to share data to whole superset of parites involved. Args: mpc_tensor(MPCTensor): input MPCTensor to perform sanity check on. other (Any): input operand. Returns: Tuple[MPCTensor,Any]: Rehared Tensor values.
Performs sanity checks to share data to whole superset of parites involved. Args: mpc_tensor(MPCTensor): input MPCTensor to perform sanity check on. other (Any): input operand. Returns: Tuple[MPCTensor,Any]: Rehared Tensor values.
[ "Performs", "sanity", "checks", "to", "share", "data", "to", "whole", "superset", "of", "parites", "involved", ".", "Args", ":", "mpc_tensor", "(", "MPCTensor", ")", ":", "input", "MPCTensor", "to", "perform", "sanity", "check", "on", ".", "other", "(", "A...
def sanity_checks(mpc_tensor: MPCTensor, other: Any) -> Tuple[MPCTensor, Any]: """Performs sanity checks to share data to whole superset of parites involved. Args: mpc_tensor(MPCTensor): input MPCTensor to perform sanity check on. other (Any): input operand. Returns: Tuple[MPCTensor,Any]: Rehared Tensor values. """ if utils.ispointer(other): parties = mpc_tensor.parties client = other.client public_shape = other.public_shape if public_shape is None: # TODO: Should be modified after Trask's Synthetic data PR. raise ValueError("The input tensor pointer should have public shape.") if client not in parties: new_parties = [client] new_parties += parties mpc_tensor = MPCTensor.reshare(mpc_tensor, new_parties) other = MPCTensor(secret=other, parties=new_parties, shape=public_shape) elif isinstance(other, MPCTensor): p1 = set(mpc_tensor.parties) # parties in first MPCTensor p2 = set(other.parties) # parties in second MPCTensor. if p1 != p2: parties_union = p1.union(p2) mpc_tensor = ( MPCTensor.reshare(mpc_tensor, parties_union) if p1 != parties_union else mpc_tensor ) other = ( MPCTensor.reshare(other, parties_union) if p2 != parties_union else other ) return mpc_tensor, other
[ "def", "sanity_checks", "(", "mpc_tensor", ":", "MPCTensor", ",", "other", ":", "Any", ")", "->", "Tuple", "[", "MPCTensor", ",", "Any", "]", ":", "if", "utils", ".", "ispointer", "(", "other", ")", ":", "parties", "=", "mpc_tensor", ".", "parties", "c...
https://github.com/OpenMined/PySyft/blob/f181ca02d307d57bfff9477610358df1a12e3ac9/packages/syft/src/syft/core/tensor/smpc/mpc_tensor.py#L544-L582
kedro-org/kedro
e78990c6b606a27830f0d502afa0f639c0830950
kedro/framework/hooks/specs.py
python
DatasetSpecs.after_dataset_loaded
(self, dataset_name: str, data: Any)
Hook to be invoked after a dataset is loaded from the catalog. Args: dataset_name: name of the dataset that was loaded from the catalog. data: the actual data that was loaded from the catalog.
Hook to be invoked after a dataset is loaded from the catalog.
[ "Hook", "to", "be", "invoked", "after", "a", "dataset", "is", "loaded", "from", "the", "catalog", "." ]
def after_dataset_loaded(self, dataset_name: str, data: Any) -> None: """Hook to be invoked after a dataset is loaded from the catalog. Args: dataset_name: name of the dataset that was loaded from the catalog. data: the actual data that was loaded from the catalog. """ pass
[ "def", "after_dataset_loaded", "(", "self", ",", "dataset_name", ":", "str", ",", "data", ":", "Any", ")", "->", "None", ":", "pass" ]
https://github.com/kedro-org/kedro/blob/e78990c6b606a27830f0d502afa0f639c0830950/kedro/framework/hooks/specs.py#L257-L265
enthought/traits
d22ce1f096e2a6f87c78d7f1bb5bf0abab1a18ff
traits/trait_types.py
python
List.create_editor
(self)
return list_editor(self, self)
Returns the default UI editor for the trait.
Returns the default UI editor for the trait.
[ "Returns", "the", "default", "UI", "editor", "for", "the", "trait", "." ]
def create_editor(self): """ Returns the default UI editor for the trait. """ return list_editor(self, self)
[ "def", "create_editor", "(", "self", ")", ":", "return", "list_editor", "(", "self", ",", "self", ")" ]
https://github.com/enthought/traits/blob/d22ce1f096e2a6f87c78d7f1bb5bf0abab1a18ff/traits/trait_types.py#L2684-L2687
pyrocko/pyrocko
b6baefb7540fb7fce6ed9b856ec0c413961a4320
src/dataset/gshhg.py
python
Polygon.__init__
(self, gshhg_file, offset, *attr)
Initialise a GSHHG polygon :param gshhg_file: GSHHG binary file :type gshhg_file: str :param offset: This polygon's offset in binary file :type offset: int :param attr: Polygon attributes ``(pid, npoints, _flag, west, east, south, north, area, area_full, container, ancestor)``. See :file:`gshhg.h` for details. :type attr: tuple
Initialise a GSHHG polygon
[ "Initialise", "a", "GSHHG", "polygon" ]
def __init__(self, gshhg_file, offset, *attr): ''' Initialise a GSHHG polygon :param gshhg_file: GSHHG binary file :type gshhg_file: str :param offset: This polygon's offset in binary file :type offset: int :param attr: Polygon attributes ``(pid, npoints, _flag, west, east, south, north, area, area_full, container, ancestor)``. See :file:`gshhg.h` for details. :type attr: tuple ''' (self.pid, self.npoints, self._flag, self.west, self.east, self.south, self.north, self.area, self.area_full, self.container, self.ancestor) = attr self.west *= micro_deg self.east *= micro_deg self.south *= micro_deg self.north *= micro_deg self.level_no = (self._flag & 255) self.level = self.LEVELS[self.level_no - 1] self.version = (self._flag >> 8) & 255 cross = (self._flag >> 16) & 3 self.greenwhich_crossed = True if cross == 1 or cross == 3 else False self.dateline_crossed = True if cross == 2 or cross == 3 else False self.source = self.SOURCE[(self._flag >> 24) & 1] if self.level_no >= 5: self.source = self.SOURCE[2] self.river = (self._flag >> 25) & 1 scale = 10.**(self._flag >> 26) self.area /= scale self.area_full /= scale self._points = None self._file = gshhg_file self._offset = offset
[ "def", "__init__", "(", "self", ",", "gshhg_file", ",", "offset", ",", "*", "attr", ")", ":", "(", "self", ".", "pid", ",", "self", ".", "npoints", ",", "self", ".", "_flag", ",", "self", ".", "west", ",", "self", ".", "east", ",", "self", ".", ...
https://github.com/pyrocko/pyrocko/blob/b6baefb7540fb7fce6ed9b856ec0c413961a4320/src/dataset/gshhg.py#L202-L245
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials
5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e
tensorflow_dl_models/research/inception/inception/data/build_image_data.py
python
_is_png
(filename)
return filename.endswith('.png')
Determine if a file contains a PNG format image. Args: filename: string, path of the image file. Returns: boolean indicating if the image is a PNG.
Determine if a file contains a PNG format image.
[ "Determine", "if", "a", "file", "contains", "a", "PNG", "format", "image", "." ]
def _is_png(filename): """Determine if a file contains a PNG format image. Args: filename: string, path of the image file. Returns: boolean indicating if the image is a PNG. """ return filename.endswith('.png')
[ "def", "_is_png", "(", "filename", ")", ":", "return", "filename", ".", "endswith", "(", "'.png'", ")" ]
https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/tensorflow_dl_models/research/inception/inception/data/build_image_data.py#L177-L186
tern-tools/tern
723f43dcaae2f2f0a08a63e5e8de3938031a386e
tern/formats/html/generator.py
python
HTML.generate_layer
(self, layer)
return report
Given a layer object, create a html report for the layer
Given a layer object, create a html report for the layer
[ "Given", "a", "layer", "object", "create", "a", "html", "report", "for", "the", "layer" ]
def generate_layer(self, layer): """Given a layer object, create a html report for the layer""" logger.debug("Creating HTML report...") report = "" report = report + '\n' + head_layer % (css, get_tool_version()) report = report + '\n' + report_dict_to_html(layer.to_dict()) report = report + '\n' + js report = report + '\n' + '</body>\n</html>\n' return report
[ "def", "generate_layer", "(", "self", ",", "layer", ")", ":", "logger", ".", "debug", "(", "\"Creating HTML report...\"", ")", "report", "=", "\"\"", "report", "=", "report", "+", "'\\n'", "+", "head_layer", "%", "(", "css", ",", "get_tool_version", "(", "...
https://github.com/tern-tools/tern/blob/723f43dcaae2f2f0a08a63e5e8de3938031a386e/tern/formats/html/generator.py#L331-L339
JimmXinu/FanFicFare
bc149a2deb2636320fe50a3e374af6eef8f61889
included_dependencies/html2text/__init__.py
python
HTML2Text.replaceEntities
(self, s)
[]
def replaceEntities(self, s): s = s.group(1) if s[0] == "#": return self.charref(s[1:]) else: return self.entityref(s)
[ "def", "replaceEntities", "(", "self", ",", "s", ")", ":", "s", "=", "s", ".", "group", "(", "1", ")", "if", "s", "[", "0", "]", "==", "\"#\"", ":", "return", "self", ".", "charref", "(", "s", "[", "1", ":", "]", ")", "else", ":", "return", ...
https://github.com/JimmXinu/FanFicFare/blob/bc149a2deb2636320fe50a3e374af6eef8f61889/included_dependencies/html2text/__init__.py#L861-L866
bikalims/bika.lims
35e4bbdb5a3912cae0b5eb13e51097c8b0486349
bika/lims/exportimport/instruments/resultsimport.py
python
AnalysisResultsImporter.getOverride
(self)
return self._override
If the importer must override previously entered results. [False, False]: The results will not be overriden [True, False]: The results will be overriden only if there's no result entered yet, [True, True]: The results will be always overriden, also if the parsed result is empty.
If the importer must override previously entered results. [False, False]: The results will not be overriden [True, False]: The results will be overriden only if there's no result entered yet, [True, True]: The results will be always overriden, also if the parsed result is empty.
[ "If", "the", "importer", "must", "override", "previously", "entered", "results", ".", "[", "False", "False", "]", ":", "The", "results", "will", "not", "be", "overriden", "[", "True", "False", "]", ":", "The", "results", "will", "be", "overriden", "only", ...
def getOverride(self): """ If the importer must override previously entered results. [False, False]: The results will not be overriden [True, False]: The results will be overriden only if there's no result entered yet, [True, True]: The results will be always overriden, also if the parsed result is empty. """ return self._override
[ "def", "getOverride", "(", "self", ")", ":", "return", "self", ".", "_override" ]
https://github.com/bikalims/bika.lims/blob/35e4bbdb5a3912cae0b5eb13e51097c8b0486349/bika/lims/exportimport/instruments/resultsimport.py#L302-L310
cuthbertLab/music21
bd30d4663e52955ed922c10fdf541419d8c67671
music21/corpus/corpora.py
python
LocalCorpus.cacheFilePath
(self)
return filePath
Get the path to the file path that stores the .json file. returns a pathlib.Path
Get the path to the file path that stores the .json file.
[ "Get", "the", "path", "to", "the", "file", "path", "that", "stores", "the", ".", "json", "file", "." ]
def cacheFilePath(self): ''' Get the path to the file path that stores the .json file. returns a pathlib.Path ''' localCorpusSettings = self._getSettings() if localCorpusSettings is not None and localCorpusSettings.cacheFilePath is not None: return localCorpusSettings.cacheFilePath localName = self.name if localName == 'local': localName = '' else: localName = '-' + self.name filePath = environLocal.getRootTempDir() / ('local' + localName + '.p.gz') return filePath
[ "def", "cacheFilePath", "(", "self", ")", ":", "localCorpusSettings", "=", "self", ".", "_getSettings", "(", ")", "if", "localCorpusSettings", "is", "not", "None", "and", "localCorpusSettings", ".", "cacheFilePath", "is", "not", "None", ":", "return", "localCorp...
https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/corpus/corpora.py#L726-L742
saghul/evergreen
22f22f45892f397c23c3e09e6ea1ad4c00b3add8
evergreen/tasks.py
python
Task.kill
(self, typ=TaskExit, value=None, tb=None)
Terminates the current task by raising an exception into it. Whatever that task might be doing; be it waiting for I/O or another primitive, it sees an exception as soon as it yields control. By default, this exception is TaskExit, but a specific exception may be specified.
Terminates the current task by raising an exception into it. Whatever that task might be doing; be it waiting for I/O or another primitive, it sees an exception as soon as it yields control.
[ "Terminates", "the", "current", "task", "by", "raising", "an", "exception", "into", "it", ".", "Whatever", "that", "task", "might", "be", "doing", ";", "be", "it", "waiting", "for", "I", "/", "O", "or", "another", "primitive", "it", "sees", "an", "except...
def kill(self, typ=TaskExit, value=None, tb=None): """Terminates the current task by raising an exception into it. Whatever that task might be doing; be it waiting for I/O or another primitive, it sees an exception as soon as it yields control. By default, this exception is TaskExit, but a specific exception may be specified. """ if not self.is_alive(): return if not value: value = typ() if not self._running: # task hasn't started yet and therefore throw won't work def just_raise(): six.reraise(typ, value, tb) self.run = just_raise return evergreen.current.loop.call_soon(self.throw, typ, value, tb)
[ "def", "kill", "(", "self", ",", "typ", "=", "TaskExit", ",", "value", "=", "None", ",", "tb", "=", "None", ")", ":", "if", "not", "self", ".", "is_alive", "(", ")", ":", "return", "if", "not", "value", ":", "value", "=", "typ", "(", ")", "if",...
https://github.com/saghul/evergreen/blob/22f22f45892f397c23c3e09e6ea1ad4c00b3add8/evergreen/tasks.py#L96-L114
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_pvc.py
python
PersistentVolumeClaim.access_modes
(self)
return self._access_modes
access_modes property
access_modes property
[ "access_modes", "property" ]
def access_modes(self): ''' access_modes property ''' if self._access_modes is None: self._access_modes = self.get_access_modes() if not isinstance(self._access_modes, list): self._access_modes = list(self._access_modes) return self._access_modes
[ "def", "access_modes", "(", "self", ")", ":", "if", "self", ".", "_access_modes", "is", "None", ":", "self", ".", "_access_modes", "=", "self", ".", "get_access_modes", "(", ")", "if", "not", "isinstance", "(", "self", ".", "_access_modes", ",", "list", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_pvc.py#L1594-L1601
chapmanb/bcbb
dbfb52711f0bfcc1d26c5a5b53c9ff4f50dc0027
biosql_ontologies/sparta.py
python
Thing.__delattr__
(self, attr)
attr - either: a) str starting with _ (normal attribute deletion) b) str that is a URI c) str in the form prefix_localname
attr - either: a) str starting with _ (normal attribute deletion) b) str that is a URI c) str in the form prefix_localname
[ "attr", "-", "either", ":", "a", ")", "str", "starting", "with", "_", "(", "normal", "attribute", "deletion", ")", "b", ")", "str", "that", "is", "a", "URI", "c", ")", "str", "in", "the", "form", "prefix_localname" ]
def __delattr__(self, attr): """ attr - either: a) str starting with _ (normal attribute deletion) b) str that is a URI c) str in the form prefix_localname """ if attr[0] == '_': del self.__dict__[attr] else: if ":" in attr: self._store.remove((self._id, URI(attr), None)) else: try: self._store.remove((self._id, self._AttrToURI(attr), None)) except ValueError: raise AttributeError
[ "def", "__delattr__", "(", "self", ",", "attr", ")", ":", "if", "attr", "[", "0", "]", "==", "'_'", ":", "del", "self", ".", "__dict__", "[", "attr", "]", "else", ":", "if", "\":\"", "in", "attr", ":", "self", ".", "_store", ".", "remove", "(", ...
https://github.com/chapmanb/bcbb/blob/dbfb52711f0bfcc1d26c5a5b53c9ff4f50dc0027/biosql_ontologies/sparta.py#L208-L224
django-import-export/django-import-export
0d4340f02582e86d4515159becb045cad1d53ee0
import_export/resources.py
python
Resource.before_import_row
(self, row, row_number=None, **kwargs)
Override to add additional logic. Does nothing by default.
Override to add additional logic. Does nothing by default.
[ "Override", "to", "add", "additional", "logic", ".", "Does", "nothing", "by", "default", "." ]
def before_import_row(self, row, row_number=None, **kwargs): """ Override to add additional logic. Does nothing by default. """ pass
[ "def", "before_import_row", "(", "self", ",", "row", ",", "row_number", "=", "None", ",", "*", "*", "kwargs", ")", ":", "pass" ]
https://github.com/django-import-export/django-import-export/blob/0d4340f02582e86d4515159becb045cad1d53ee0/import_export/resources.py#L629-L633
HymanLiuTS/flaskTs
286648286976e85d9b9a5873632331efcafe0b21
flasky/lib/python2.7/site-packages/sqlalchemy/sql/elements.py
python
Null._instance
(cls)
return Null()
Return a constant :class:`.Null` construct.
Return a constant :class:`.Null` construct.
[ "Return", "a", "constant", ":", "class", ":", ".", "Null", "construct", "." ]
def _instance(cls): """Return a constant :class:`.Null` construct.""" return Null()
[ "def", "_instance", "(", "cls", ")", ":", "return", "Null", "(", ")" ]
https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/sqlalchemy/sql/elements.py#L1633-L1636
python/cpython
e13cdca0f5224ec4e23bdd04bb3120506964bc8b
Lib/ssl.py
python
get_server_certificate
(addr, ssl_version=PROTOCOL_TLS_CLIENT, ca_certs=None, timeout=_GLOBAL_DEFAULT_TIMEOUT)
return DER_cert_to_PEM_cert(dercert)
Retrieve the certificate from the server at the specified address, and return it as a PEM-encoded string. If 'ca_certs' is specified, validate the server cert against it. If 'ssl_version' is specified, use it in the connection attempt. If 'timeout' is specified, use it in the connection attempt.
Retrieve the certificate from the server at the specified address, and return it as a PEM-encoded string. If 'ca_certs' is specified, validate the server cert against it. If 'ssl_version' is specified, use it in the connection attempt. If 'timeout' is specified, use it in the connection attempt.
[ "Retrieve", "the", "certificate", "from", "the", "server", "at", "the", "specified", "address", "and", "return", "it", "as", "a", "PEM", "-", "encoded", "string", ".", "If", "ca_certs", "is", "specified", "validate", "the", "server", "cert", "against", "it",...
def get_server_certificate(addr, ssl_version=PROTOCOL_TLS_CLIENT, ca_certs=None, timeout=_GLOBAL_DEFAULT_TIMEOUT): """Retrieve the certificate from the server at the specified address, and return it as a PEM-encoded string. If 'ca_certs' is specified, validate the server cert against it. If 'ssl_version' is specified, use it in the connection attempt. If 'timeout' is specified, use it in the connection attempt. """ host, port = addr if ca_certs is not None: cert_reqs = CERT_REQUIRED else: cert_reqs = CERT_NONE context = _create_stdlib_context(ssl_version, cert_reqs=cert_reqs, cafile=ca_certs) with create_connection(addr, timeout=timeout) as sock: with context.wrap_socket(sock, server_hostname=host) as sslsock: dercert = sslsock.getpeercert(True) return DER_cert_to_PEM_cert(dercert)
[ "def", "get_server_certificate", "(", "addr", ",", "ssl_version", "=", "PROTOCOL_TLS_CLIENT", ",", "ca_certs", "=", "None", ",", "timeout", "=", "_GLOBAL_DEFAULT_TIMEOUT", ")", ":", "host", ",", "port", "=", "addr", "if", "ca_certs", "is", "not", "None", ":", ...
https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/ssl.py#L1510-L1530
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/distutils/command/bdist_msi.py
python
PyDialog.__init__
(self, *args, **kw)
Dialog(database, name, x, y, w, h, attributes, title, first, default, cancel, bitmap=true)
Dialog(database, name, x, y, w, h, attributes, title, first, default, cancel, bitmap=true)
[ "Dialog", "(", "database", "name", "x", "y", "w", "h", "attributes", "title", "first", "default", "cancel", "bitmap", "=", "true", ")" ]
def __init__(self, *args, **kw): """Dialog(database, name, x, y, w, h, attributes, title, first, default, cancel, bitmap=true)""" Dialog.__init__(self, *args) ruler = self.h - 36 bmwidth = 152*ruler/328 #if kw.get("bitmap", True): # self.bitmap("Bitmap", 0, 0, bmwidth, ruler, "PythonWin") self.line("BottomLine", 0, ruler, self.w, 0)
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "Dialog", ".", "__init__", "(", "self", ",", "*", "args", ")", "ruler", "=", "self", ".", "h", "-", "36", "bmwidth", "=", "152", "*", "ruler", "/", "328", "#if kw....
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/distutils/command/bdist_msi.py#L25-L33
tanghaibao/jcvi
5e720870c0928996f8b77a38208106ff0447ccb6
jcvi/assembly/hic.py
python
prepare_synteny
(tourfile, lastfile, odir, p, opts)
return anchorsfile, qbedfile, contig_to_beds
Prepare synteny plots for movie().
Prepare synteny plots for movie().
[ "Prepare", "synteny", "plots", "for", "movie", "()", "." ]
def prepare_synteny(tourfile, lastfile, odir, p, opts): """ Prepare synteny plots for movie(). """ qbedfile, sbedfile = get_bed_filenames(lastfile, p, opts) qbedfile = op.abspath(qbedfile) sbedfile = op.abspath(sbedfile) qbed = Bed(qbedfile, sorted=False) contig_to_beds = dict(qbed.sub_beds()) # Create a separate directory for the subplots and movie mkdir(odir, overwrite=True) os.chdir(odir) logging.debug("Change into subdir `{}`".format(odir)) # Make anchorsfile anchorsfile = ".".join(op.basename(lastfile).split(".", 2)[:2]) + ".anchors" fw = open(anchorsfile, "w") for b in Blast(lastfile): print( "\t".join((gene_name(b.query), gene_name(b.subject), str(int(b.score)))), file=fw, ) fw.close() # Symlink sbed symlink(sbedfile, op.basename(sbedfile)) return anchorsfile, qbedfile, contig_to_beds
[ "def", "prepare_synteny", "(", "tourfile", ",", "lastfile", ",", "odir", ",", "p", ",", "opts", ")", ":", "qbedfile", ",", "sbedfile", "=", "get_bed_filenames", "(", "lastfile", ",", "p", ",", "opts", ")", "qbedfile", "=", "op", ".", "abspath", "(", "q...
https://github.com/tanghaibao/jcvi/blob/5e720870c0928996f8b77a38208106ff0447ccb6/jcvi/assembly/hic.py#L1322-L1351
fooying/3102
0faee38c30b2e24154f41e68457cfd8f7a61c040
thirdparty/dns/zone.py
python
Zone.to_text
(self, sorted=True, relativize=True, nl=None)
return return_value
Return a zone's text as though it were written to a file. @param sorted: if True, the file will be written with the names sorted in DNSSEC order from least to greatest. Otherwise the names will be written in whatever order they happen to have in the zone's dictionary. @param relativize: if True, domain names in the output will be relativized to the zone's origin (if possible). @type relativize: bool @param nl: The end of line string. If not specified, the output will use the platform's native end-of-line marker (i.e. LF on POSIX, CRLF on Windows, CR on Macintosh). @type nl: string or None
Return a zone's text as though it were written to a file.
[ "Return", "a", "zone", "s", "text", "as", "though", "it", "were", "written", "to", "a", "file", "." ]
def to_text(self, sorted=True, relativize=True, nl=None): """Return a zone's text as though it were written to a file. @param sorted: if True, the file will be written with the names sorted in DNSSEC order from least to greatest. Otherwise the names will be written in whatever order they happen to have in the zone's dictionary. @param relativize: if True, domain names in the output will be relativized to the zone's origin (if possible). @type relativize: bool @param nl: The end of line string. If not specified, the output will use the platform's native end-of-line marker (i.e. LF on POSIX, CRLF on Windows, CR on Macintosh). @type nl: string or None """ temp_buffer = StringIO() self.to_file(temp_buffer, sorted, relativize, nl) return_value = temp_buffer.getvalue() temp_buffer.close() return return_value
[ "def", "to_text", "(", "self", ",", "sorted", "=", "True", ",", "relativize", "=", "True", ",", "nl", "=", "None", ")", ":", "temp_buffer", "=", "StringIO", "(", ")", "self", ".", "to_file", "(", "temp_buffer", ",", "sorted", ",", "relativize", ",", ...
https://github.com/fooying/3102/blob/0faee38c30b2e24154f41e68457cfd8f7a61c040/thirdparty/dns/zone.py#L513-L532
cronyo/cronyo
cd5abab0871b68bf31b18aac934303928130a441
cronyo/vendor/yaml/constructor.py
python
FullConstructor.construct_python_str
(self, node)
return self.construct_scalar(node)
[]
def construct_python_str(self, node): return self.construct_scalar(node)
[ "def", "construct_python_str", "(", "self", ",", "node", ")", ":", "return", "self", ".", "construct_scalar", "(", "node", ")" ]
https://github.com/cronyo/cronyo/blob/cd5abab0871b68bf31b18aac934303928130a441/cronyo/vendor/yaml/constructor.py#L475-L476
salabim/salabim
e0de846b042daf2dc71aaf43d8adc6486b57f376
salabim_exp.py
python
test31
()
[]
def test31(): class X(sim.Component): def process(self): yield self.hold(1) s1.set() yield self.hold(2) s1.reset() yield self.hold(2) y.print_info() s1.trigger() class Y(sim.Component): def process(self): while True: yield self.wait(s1, (s2, "red"), (s2, "green"), s3) yield self.hold(1.5) env = sim.Environment(trace=True) env.print_info() s1 = sim.State(name="s.") s2 = sim.State(name="s.") s3 = sim.State(name="s.") q = sim.Queue("q.") x = X() y = Y() env.run(10) print("value at ", env.now(), s1.get()) print(s1.value.xduration()) print(s1.value.tx()) print(env) print(y) print(q) print(s1) s1.print_info() s2.print_info()
[ "def", "test31", "(", ")", ":", "class", "X", "(", "sim", ".", "Component", ")", ":", "def", "process", "(", "self", ")", ":", "yield", "self", ".", "hold", "(", "1", ")", "s1", ".", "set", "(", ")", "yield", "self", ".", "hold", "(", "2", ")...
https://github.com/salabim/salabim/blob/e0de846b042daf2dc71aaf43d8adc6486b57f376/salabim_exp.py#L3254-L3289
fluentpython/example-code-2e
80f7f84274a47579e59c29a4657691525152c9d5
24-class-metaprog/bulkfood/model_v7.py
python
EntityMeta.__init__
(cls, name, bases, attr_dict)
[]
def __init__(cls, name, bases, attr_dict): super().__init__(name, bases, attr_dict) # <1> for key, attr in attr_dict.items(): # <2> if isinstance(attr, Validated): type_name = type(attr).__name__ attr.storage_name = '_{}#{}'.format(type_name, key)
[ "def", "__init__", "(", "cls", ",", "name", ",", "bases", ",", "attr_dict", ")", ":", "super", "(", ")", ".", "__init__", "(", "name", ",", "bases", ",", "attr_dict", ")", "# <1>", "for", "key", ",", "attr", "in", "attr_dict", ".", "items", "(", ")...
https://github.com/fluentpython/example-code-2e/blob/80f7f84274a47579e59c29a4657691525152c9d5/24-class-metaprog/bulkfood/model_v7.py#L57-L62
trevp/tlslite
cd82fadb6bb958522b7457c5ed95890283437a4f
tlslite/tlsrecordlayer.py
python
TLSRecordLayer.send
(self, s)
return len(s)
Send data to the TLS connection (socket emulation). @raise socket.error: If a socket error occurs.
Send data to the TLS connection (socket emulation).
[ "Send", "data", "to", "the", "TLS", "connection", "(", "socket", "emulation", ")", "." ]
def send(self, s): """Send data to the TLS connection (socket emulation). @raise socket.error: If a socket error occurs. """ self.write(s) return len(s)
[ "def", "send", "(", "self", ",", "s", ")", ":", "self", ".", "write", "(", "s", ")", "return", "len", "(", "s", ")" ]
https://github.com/trevp/tlslite/blob/cd82fadb6bb958522b7457c5ed95890283437a4f/tlslite/tlsrecordlayer.py#L420-L426
perone/Pyevolve
589b6a9b92ed1fd9ef00987bf4bfe807c4a7b7e0
pyevolve/Statistics.py
python
Statistics.asTuple
(self)
return tuple(self.internalDict.values())
Returns the stats as a python tuple
Returns the stats as a python tuple
[ "Returns", "the", "stats", "as", "a", "python", "tuple" ]
def asTuple(self): """ Returns the stats as a python tuple """ return tuple(self.internalDict.values())
[ "def", "asTuple", "(", "self", ")", ":", "return", "tuple", "(", "self", ".", "internalDict", ".", "values", "(", ")", ")" ]
https://github.com/perone/Pyevolve/blob/589b6a9b92ed1fd9ef00987bf4bfe807c4a7b7e0/pyevolve/Statistics.py#L80-L82
loli/medpy
39131b94f0ab5328ab14a874229320efc2f74d98
medpy/graphcut/graph.py
python
Graph.get_nodes
(self)
return list(range(1, self.__nodes + 1))
r""" Get the nodes. Returns ------- nodes : list All nodes as an ordered list.
r""" Get the nodes. Returns ------- nodes : list All nodes as an ordered list.
[ "r", "Get", "the", "nodes", ".", "Returns", "-------", "nodes", ":", "list", "All", "nodes", "as", "an", "ordered", "list", "." ]
def get_nodes(self): r""" Get the nodes. Returns ------- nodes : list All nodes as an ordered list. """ return list(range(1, self.__nodes + 1))
[ "def", "get_nodes", "(", "self", ")", ":", "return", "list", "(", "range", "(", "1", ",", "self", ".", "__nodes", "+", "1", ")", ")" ]
https://github.com/loli/medpy/blob/39131b94f0ab5328ab14a874229320efc2f74d98/medpy/graphcut/graph.py#L156-L165
guildai/guildai
1665985a3d4d788efc1a3180ca51cc417f71ca78
guild/external/pip/_vendor/urllib3/packages/six.py
python
_SixMetaPathImporter.get_code
(self, fullname)
return None
Return None Required, if is_package is implemented
Return None
[ "Return", "None" ]
def get_code(self, fullname): """Return None Required, if is_package is implemented""" self.__get_module(fullname) # eventually raises ImportError return None
[ "def", "get_code", "(", "self", ",", "fullname", ")", ":", "self", ".", "__get_module", "(", "fullname", ")", "# eventually raises ImportError", "return", "None" ]
https://github.com/guildai/guildai/blob/1665985a3d4d788efc1a3180ca51cc417f71ca78/guild/external/pip/_vendor/urllib3/packages/six.py#L218-L223
avrae/avrae
6ebe46a1ec3d4dfaa2f9b18fac948325f39f87de
cogs5e/models/initiative/combatant.py
python
Combatant.on_remove
(self)
Called when the combatant is removed from combat, either through !i remove or the combat ending.
Called when the combatant is removed from combat, either through !i remove or the combat ending.
[ "Called", "when", "the", "combatant", "is", "removed", "from", "combat", "either", "through", "!i", "remove", "or", "the", "combat", "ending", "." ]
def on_remove(self): """ Called when the combatant is removed from combat, either through !i remove or the combat ending. """ pass
[ "def", "on_remove", "(", "self", ")", ":", "pass" ]
https://github.com/avrae/avrae/blob/6ebe46a1ec3d4dfaa2f9b18fac948325f39f87de/cogs5e/models/initiative/combatant.py#L376-L380
MrH0wl/Cloudmare
65e5bc9888f9d362ab2abfb103ea6c1e869d67aa
thirdparty/requests/models.py
python
Response.is_permanent_redirect
(self)
return ('location' in self.headers and self.status_code in (codes.moved_permanently, codes.permanent_redirect))
True if this Response one of the permanent versions of redirect.
True if this Response one of the permanent versions of redirect.
[ "True", "if", "this", "Response", "one", "of", "the", "permanent", "versions", "of", "redirect", "." ]
def is_permanent_redirect(self): """True if this Response one of the permanent versions of redirect.""" return ('location' in self.headers and self.status_code in (codes.moved_permanently, codes.permanent_redirect))
[ "def", "is_permanent_redirect", "(", "self", ")", ":", "return", "(", "'location'", "in", "self", ".", "headers", "and", "self", ".", "status_code", "in", "(", "codes", ".", "moved_permanently", ",", "codes", ".", "permanent_redirect", ")", ")" ]
https://github.com/MrH0wl/Cloudmare/blob/65e5bc9888f9d362ab2abfb103ea6c1e869d67aa/thirdparty/requests/models.py#L716-L718
blackye/webdirdig
11eb3df84d228127dde1dd4afcb922f5075903a2
thirdparty_libs/requests/cookies.py
python
MockRequest.origin_req_host
(self)
return self.get_origin_req_host()
[]
def origin_req_host(self): return self.get_origin_req_host()
[ "def", "origin_req_host", "(", "self", ")", ":", "return", "self", ".", "get_origin_req_host", "(", ")" ]
https://github.com/blackye/webdirdig/blob/11eb3df84d228127dde1dd4afcb922f5075903a2/thirdparty_libs/requests/cookies.py#L74-L75
hydroshare/hydroshare
7ba563b55412f283047fb3ef6da367d41dec58c6
hs_tracking/management/commands/stats.py
python
Command.monthly_orgs_counts
(self, start_date, end_date)
[]
def monthly_orgs_counts(self, start_date, end_date): profiles = UserProfile.objects.filter(user__date_joined__lte=end_date) org_count = profiles.values('organization').distinct().count() self.print_var("monthly_orgs_counts", org_count, (start_date, end_date))
[ "def", "monthly_orgs_counts", "(", "self", ",", "start_date", ",", "end_date", ")", ":", "profiles", "=", "UserProfile", ".", "objects", ".", "filter", "(", "user__date_joined__lte", "=", "end_date", ")", "org_count", "=", "profiles", ".", "values", "(", "'org...
https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/hs_tracking/management/commands/stats.py#L98-L101
PaddlePaddle/PaddleX
2bab73f81ab54e328204e7871e6ae4a82e719f5d
paddlex/ppcls/arch/backbone/legendary_models/hrnet.py
python
HighResolutionModule.__init__
(self, num_filters, has_se=False)
[]
def __init__(self, num_filters, has_se=False): super().__init__() self.basic_block_list = nn.LayerList() for i in range(len(num_filters)): self.basic_block_list.append( nn.Sequential(*[ BasicBlock( num_channels=num_filters[i], num_filters=num_filters[i], has_se=has_se) for j in range(4) ])) self.fuse_func = FuseLayers( in_channels=num_filters, out_channels=num_filters)
[ "def", "__init__", "(", "self", ",", "num_filters", ",", "has_se", "=", "False", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "basic_block_list", "=", "nn", ".", "LayerList", "(", ")", "for", "i", "in", "range", "(", "len", ...
https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/paddlex/ppcls/arch/backbone/legendary_models/hrnet.py#L240-L255
pybuilder/pybuilder
12ea2f54e04f97daada375dc3309a3f525f1b5e1
src/main/python/pybuilder/_vendor/pkg_resources/_vendor/pyparsing.py
python
ParserElement.runTests
(self, tests, parseAll=True, comment='#', fullDump=True, printResults=True, failureTests=False)
return success, allResults
Execute the parse expression on a series of test strings, showing each test, the parsed results or where the parse failed. Quick and easy way to run a parse expression against a list of sample strings. Parameters: - tests - a list of separate test strings, or a multiline string of test strings - parseAll - (default=C{True}) - flag to pass to C{L{parseString}} when running tests - comment - (default=C{'#'}) - expression for indicating embedded comments in the test string; pass None to disable comment filtering - fullDump - (default=C{True}) - dump results as list followed by results names in nested outline; if False, only dump nested list - printResults - (default=C{True}) prints test output to stdout - failureTests - (default=C{False}) indicates if these tests are expected to fail parsing Returns: a (success, results) tuple, where success indicates that all tests succeeded (or failed if C{failureTests} is True), and the results contain a list of lines of each test's output Example:: number_expr = pyparsing_common.number.copy() result = number_expr.runTests(''' # unsigned integer 100 # negative integer -100 # float with scientific notation 6.02e23 # integer with scientific notation 1e-12 ''') print("Success" if result[0] else "Failed!") result = number_expr.runTests(''' # stray character 100Z # missing leading digit before '.' -.100 # too many '.' 3.14.159 ''', failureTests=True) print("Success" if result[0] else "Failed!") prints:: # unsigned integer 100 [100] # negative integer -100 [-100] # float with scientific notation 6.02e23 [6.02e+23] # integer with scientific notation 1e-12 [1e-12] Success # stray character 100Z ^ FAIL: Expected end of text (at char 3), (line:1, col:4) # missing leading digit before '.' -.100 ^ FAIL: Expected {real number with scientific notation | real number | signed integer} (at char 0), (line:1, col:1) # too many '.' 3.14.159 ^ FAIL: Expected end of text (at char 4), (line:1, col:5) Success Each test string must be on a single line. If you want to test a string that spans multiple lines, create a test like this:: expr.runTest(r"this is a test\\n of strings that spans \\n 3 lines") (Note that this is a raw string literal, you must include the leading 'r'.)
Execute the parse expression on a series of test strings, showing each test, the parsed results or where the parse failed. Quick and easy way to run a parse expression against a list of sample strings. Parameters: - tests - a list of separate test strings, or a multiline string of test strings - parseAll - (default=C{True}) - flag to pass to C{L{parseString}} when running tests - comment - (default=C{'#'}) - expression for indicating embedded comments in the test string; pass None to disable comment filtering - fullDump - (default=C{True}) - dump results as list followed by results names in nested outline; if False, only dump nested list - printResults - (default=C{True}) prints test output to stdout - failureTests - (default=C{False}) indicates if these tests are expected to fail parsing
[ "Execute", "the", "parse", "expression", "on", "a", "series", "of", "test", "strings", "showing", "each", "test", "the", "parsed", "results", "or", "where", "the", "parse", "failed", ".", "Quick", "and", "easy", "way", "to", "run", "a", "parse", "expressio...
def runTests(self, tests, parseAll=True, comment='#', fullDump=True, printResults=True, failureTests=False): """ Execute the parse expression on a series of test strings, showing each test, the parsed results or where the parse failed. Quick and easy way to run a parse expression against a list of sample strings. Parameters: - tests - a list of separate test strings, or a multiline string of test strings - parseAll - (default=C{True}) - flag to pass to C{L{parseString}} when running tests - comment - (default=C{'#'}) - expression for indicating embedded comments in the test string; pass None to disable comment filtering - fullDump - (default=C{True}) - dump results as list followed by results names in nested outline; if False, only dump nested list - printResults - (default=C{True}) prints test output to stdout - failureTests - (default=C{False}) indicates if these tests are expected to fail parsing Returns: a (success, results) tuple, where success indicates that all tests succeeded (or failed if C{failureTests} is True), and the results contain a list of lines of each test's output Example:: number_expr = pyparsing_common.number.copy() result = number_expr.runTests(''' # unsigned integer 100 # negative integer -100 # float with scientific notation 6.02e23 # integer with scientific notation 1e-12 ''') print("Success" if result[0] else "Failed!") result = number_expr.runTests(''' # stray character 100Z # missing leading digit before '.' -.100 # too many '.' 3.14.159 ''', failureTests=True) print("Success" if result[0] else "Failed!") prints:: # unsigned integer 100 [100] # negative integer -100 [-100] # float with scientific notation 6.02e23 [6.02e+23] # integer with scientific notation 1e-12 [1e-12] Success # stray character 100Z ^ FAIL: Expected end of text (at char 3), (line:1, col:4) # missing leading digit before '.' -.100 ^ FAIL: Expected {real number with scientific notation | real number | signed integer} (at char 0), (line:1, col:1) # too many '.' 3.14.159 ^ FAIL: Expected end of text (at char 4), (line:1, col:5) Success Each test string must be on a single line. If you want to test a string that spans multiple lines, create a test like this:: expr.runTest(r"this is a test\\n of strings that spans \\n 3 lines") (Note that this is a raw string literal, you must include the leading 'r'.) """ if isinstance(tests, basestring): tests = list(map(str.strip, tests.rstrip().splitlines())) if isinstance(comment, basestring): comment = Literal(comment) allResults = [] comments = [] success = True for t in tests: if comment is not None and comment.matches(t, False) or comments and not t: comments.append(t) continue if not t: continue out = ['\n'.join(comments), t] comments = [] try: t = t.replace(r'\n','\n') result = self.parseString(t, parseAll=parseAll) out.append(result.dump(full=fullDump)) success = success and not failureTests except ParseBaseException as pe: fatal = "(FATAL)" if isinstance(pe, ParseFatalException) else "" if '\n' in t: out.append(line(pe.loc, t)) out.append(' '*(col(pe.loc,t)-1) + '^' + fatal) else: out.append(' '*pe.loc + '^' + fatal) out.append("FAIL: " + str(pe)) success = success and failureTests result = pe except Exception as exc: out.append("FAIL-EXCEPTION: " + str(exc)) success = success and failureTests result = exc if printResults: if fullDump: out.append('') print('\n'.join(out)) allResults.append((t, result)) return success, allResults
[ "def", "runTests", "(", "self", ",", "tests", ",", "parseAll", "=", "True", ",", "comment", "=", "'#'", ",", "fullDump", "=", "True", ",", "printResults", "=", "True", ",", "failureTests", "=", "False", ")", ":", "if", "isinstance", "(", "tests", ",", ...
https://github.com/pybuilder/pybuilder/blob/12ea2f54e04f97daada375dc3309a3f525f1b5e1/src/main/python/pybuilder/_vendor/pkg_resources/_vendor/pyparsing.py#L2232-L2361
CGATOxford/cgat
326aad4694bdfae8ddc194171bb5d73911243947
CGAT/TreeTools.py
python
TreeDFS
(tree, node_id, pre_function=Nop, descend_condition=Nop, post_function=Nop)
BFS tree tree traversal starting at node_id. Apply functions pre_function at first and post_function at last visit of a node.
BFS tree tree traversal starting at node_id.
[ "BFS", "tree", "tree", "traversal", "starting", "at", "node_id", "." ]
def TreeDFS(tree, node_id, pre_function=Nop, descend_condition=Nop, post_function=Nop): """BFS tree tree traversal starting at node_id. Apply functions pre_function at first and post_function at last visit of a node. """ pre_function(node_id) for n in tree.node(node_id).succ: if descend_condition(node_id): TreeDFS(tree, n, pre_function, descend_condition, post_function) post_function(node_id)
[ "def", "TreeDFS", "(", "tree", ",", "node_id", ",", "pre_function", "=", "Nop", ",", "descend_condition", "=", "Nop", ",", "post_function", "=", "Nop", ")", ":", "pre_function", "(", "node_id", ")", "for", "n", "in", "tree", ".", "node", "(", "node_id", ...
https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/CGAT/TreeTools.py#L525-L538
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1beta1_certificate_signing_request.py
python
V1beta1CertificateSigningRequest.__ne__
(self, other)
return self.to_dict() != other.to_dict()
Returns true if both objects are not equal
Returns true if both objects are not equal
[ "Returns", "true", "if", "both", "objects", "are", "not", "equal" ]
def __ne__(self, other): """Returns true if both objects are not equal""" if not isinstance(other, V1beta1CertificateSigningRequest): return True return self.to_dict() != other.to_dict()
[ "def", "__ne__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "V1beta1CertificateSigningRequest", ")", ":", "return", "True", "return", "self", ".", "to_dict", "(", ")", "!=", "other", ".", "to_dict", "(", ")" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1beta1_certificate_signing_request.py#L223-L228
phantomcyber/playbooks
9e850ecc44cb98c5dde53784744213a1ed5799bd
excessive_account_lockouts_enrichment_and_response.py
python
query_endpoint_rights
(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None, **kwargs)
return
[]
def query_endpoint_rights(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None, **kwargs): phantom.debug('query_endpoint_rights() called') # collect data for 'query_endpoint_rights' call formatted_data_1 = phantom.get_format_data(name='endpoint_rights_mod') parameters = [] # build parameters list for 'query_endpoint_rights' call parameters.append({ 'query': formatted_data_1, 'command': "", 'display': "", 'parse_only': "", }) phantom.act(action="run query", parameters=parameters, assets=['splunk'], callback=join_add_comment_2, name="query_endpoint_rights") return
[ "def", "query_endpoint_rights", "(", "action", "=", "None", ",", "success", "=", "None", ",", "container", "=", "None", ",", "results", "=", "None", ",", "handle", "=", "None", ",", "filtered_artifacts", "=", "None", ",", "filtered_results", "=", "None", "...
https://github.com/phantomcyber/playbooks/blob/9e850ecc44cb98c5dde53784744213a1ed5799bd/excessive_account_lockouts_enrichment_and_response.py#L304-L322
menpo/menpofit
5f2f45bab26df206d43292fd32d19cd8f62f0443
menpofit/math/regression.py
python
OptimalLinearRegression.predict
(self, x)
return np.dot(x, self.R)
r""" Makes a prediction using the trained regression model. Parameters ---------- x : ``(n_features,)`` `ndarray` The input feature vector. Returns ------- prediction : ``(n_dims,)`` `ndarray` The prediction vector.
r""" Makes a prediction using the trained regression model.
[ "r", "Makes", "a", "prediction", "using", "the", "trained", "regression", "model", "." ]
def predict(self, x): r""" Makes a prediction using the trained regression model. Parameters ---------- x : ``(n_features,)`` `ndarray` The input feature vector. Returns ------- prediction : ``(n_dims,)`` `ndarray` The prediction vector. """ if self.bias: if len(x.shape) == 1: x = np.hstack((x, np.ones(1))) else: x = np.hstack((x, np.ones((x.shape[0], 1)))) return np.dot(x, self.R)
[ "def", "predict", "(", "self", ",", "x", ")", ":", "if", "self", ".", "bias", ":", "if", "len", "(", "x", ".", "shape", ")", "==", "1", ":", "x", "=", "np", ".", "hstack", "(", "(", "x", ",", "np", ".", "ones", "(", "1", ")", ")", ")", ...
https://github.com/menpo/menpofit/blob/5f2f45bab26df206d43292fd32d19cd8f62f0443/menpofit/math/regression.py#L348-L367
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/tools/bridges/mouse_keyboard/bridge_mousekeyboard_wheeled.py
python
BridgeMouseKeyboardWheeledRobot.simulator
(self)
return self._robot.simulator
Return the simulator instance.
Return the simulator instance.
[ "Return", "the", "simulator", "instance", "." ]
def simulator(self): """Return the simulator instance.""" return self._robot.simulator
[ "def", "simulator", "(", "self", ")", ":", "return", "self", ".", "_robot", ".", "simulator" ]
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/tools/bridges/mouse_keyboard/bridge_mousekeyboard_wheeled.py#L113-L115
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Lib/tkinter/__init__.py
python
Misc.winfo_reqwidth
(self)
return getint( self.tk.call('winfo', 'reqwidth', self._w))
Return requested width of this widget.
Return requested width of this widget.
[ "Return", "requested", "width", "of", "this", "widget", "." ]
def winfo_reqwidth(self): """Return requested width of this widget.""" return getint( self.tk.call('winfo', 'reqwidth', self._w))
[ "def", "winfo_reqwidth", "(", "self", ")", ":", "return", "getint", "(", "self", ".", "tk", ".", "call", "(", "'winfo'", ",", "'reqwidth'", ",", "self", ".", "_w", ")", ")" ]
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/tkinter/__init__.py#L832-L835
a312863063/seeprettyface-generator-yellow
c75b95b56c40036d00b35f3e140cc4a45598e077
dnnlib/tflib/optimizer.py
python
Optimizer.apply_updates
(self)
Construct training op to update the registered variables based on their gradients.
Construct training op to update the registered variables based on their gradients.
[ "Construct", "training", "op", "to", "update", "the", "registered", "variables", "based", "on", "their", "gradients", "." ]
def apply_updates(self) -> tf.Operation: """Construct training op to update the registered variables based on their gradients.""" tfutil.assert_tf_initialized() assert not self._updates_applied self._updates_applied = True devices = list(self._dev_grads.keys()) total_grads = sum(len(grads) for grads in self._dev_grads.values()) assert len(devices) >= 1 and total_grads >= 1 ops = [] with tfutil.absolute_name_scope(self.scope): # Cast gradients to FP32 and calculate partial sum within each device. dev_grads = OrderedDict() # device => [(grad, var), ...] for dev_idx, dev in enumerate(devices): with tf.name_scope("ProcessGrads%d" % dev_idx), tf.device(dev): sums = [] for gv in zip(*self._dev_grads[dev]): assert all(v is gv[0][1] for g, v in gv) g = [tf.cast(g, tf.float32) for g, v in gv] g = g[0] if len(g) == 1 else tf.add_n(g) sums.append((g, gv[0][1])) dev_grads[dev] = sums # Sum gradients across devices. if len(devices) > 1: with tf.name_scope("SumAcrossGPUs"), tf.device(None): for var_idx, grad_shape in enumerate(self._grad_shapes): g = [dev_grads[dev][var_idx][0] for dev in devices] if np.prod(grad_shape): # nccl does not support zero-sized tensors g = nccl_ops.all_sum(g) for dev, gg in zip(devices, g): dev_grads[dev][var_idx] = (gg, dev_grads[dev][var_idx][1]) # Apply updates separately on each device. for dev_idx, (dev, grads) in enumerate(dev_grads.items()): with tf.name_scope("ApplyGrads%d" % dev_idx), tf.device(dev): # Scale gradients as needed. if self.use_loss_scaling or total_grads > 1: with tf.name_scope("Scale"): coef = tf.constant(np.float32(1.0 / total_grads), name="coef") coef = self.undo_loss_scaling(coef) grads = [(g * coef, v) for g, v in grads] # Check for overflows. with tf.name_scope("CheckOverflow"): grad_ok = tf.reduce_all(tf.stack([tf.reduce_all(tf.is_finite(g)) for g, v in grads])) # Update weights and adjust loss scaling. with tf.name_scope("UpdateWeights"): # pylint: disable=cell-var-from-loop opt = self._dev_opt[dev] ls_var = self.get_loss_scaling_var(dev) if not self.use_loss_scaling: ops.append(tf.cond(grad_ok, lambda: opt.apply_gradients(grads), tf.no_op)) else: ops.append(tf.cond(grad_ok, lambda: tf.group(tf.assign_add(ls_var, self.loss_scaling_inc), opt.apply_gradients(grads)), lambda: tf.group(tf.assign_sub(ls_var, self.loss_scaling_dec)))) # Report statistics on the last device. if dev == devices[-1]: with tf.name_scope("Statistics"): ops.append(autosummary.autosummary(self.id + "/learning_rate", self.learning_rate)) ops.append(autosummary.autosummary(self.id + "/overflow_frequency", tf.where(grad_ok, 0, 1))) if self.use_loss_scaling: ops.append(autosummary.autosummary(self.id + "/loss_scaling_log2", ls_var)) # Initialize variables and group everything into a single op. self.reset_optimizer_state() tfutil.init_uninitialized_vars(list(self._dev_ls_var.values())) return tf.group(*ops, name="TrainingOp")
[ "def", "apply_updates", "(", "self", ")", "->", "tf", ".", "Operation", ":", "tfutil", ".", "assert_tf_initialized", "(", ")", "assert", "not", "self", ".", "_updates_applied", "self", ".", "_updates_applied", "=", "True", "devices", "=", "list", "(", "self"...
https://github.com/a312863063/seeprettyface-generator-yellow/blob/c75b95b56c40036d00b35f3e140cc4a45598e077/dnnlib/tflib/optimizer.py#L102-L180
007gzs/dingtalk-sdk
7979da2e259fdbc571728cae2425a04dbc65850a
dingtalk/client/api/taobao.py
python
TbALiJianKangZhuiSuMa.alibaba_alihealth_drug_code_common_list_codeinfo
( self, ref_ent_id, search_source, code_list, auth_ref_ent_id, cert_isv_no='', invocation='', terminal_type='', terminal_name='', bureau_name='', error_message='' )
return self._top_request( "alibaba.alihealth.drug.code.common.list.codeinfo", { "ref_ent_id": ref_ent_id, "search_source": search_source, "code_list": code_list, "auth_ref_ent_id": auth_ref_ent_id, "cert_isv_no": cert_isv_no, "invocation": invocation, "terminal_type": terminal_type, "terminal_name": terminal_name, "bureau_name": bureau_name, "error_message": error_message } )
通用查询码接口 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=41299 :param ref_ent_id: 企业refEntId :param search_source: 标示医院业务 :param code_list: 追溯码 :param auth_ref_ent_id: 验证权限企业id :param cert_isv_no: 证件编号 :param invocation: 调用方式:formal-正式、test-测试 :param terminal_type: 终端类型 1:零售 :param terminal_name: 调用零售药店名称 :param bureau_name: 城市名称 :param error_message: 错误信息
通用查询码接口 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=41299
[ "通用查询码接口", "文档地址:https", ":", "//", "open", "-", "doc", ".", "dingtalk", ".", "com", "/", "docs", "/", "api", ".", "htm?apiId", "=", "41299" ]
def alibaba_alihealth_drug_code_common_list_codeinfo( self, ref_ent_id, search_source, code_list, auth_ref_ent_id, cert_isv_no='', invocation='', terminal_type='', terminal_name='', bureau_name='', error_message='' ): """ 通用查询码接口 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=41299 :param ref_ent_id: 企业refEntId :param search_source: 标示医院业务 :param code_list: 追溯码 :param auth_ref_ent_id: 验证权限企业id :param cert_isv_no: 证件编号 :param invocation: 调用方式:formal-正式、test-测试 :param terminal_type: 终端类型 1:零售 :param terminal_name: 调用零售药店名称 :param bureau_name: 城市名称 :param error_message: 错误信息 """ return self._top_request( "alibaba.alihealth.drug.code.common.list.codeinfo", { "ref_ent_id": ref_ent_id, "search_source": search_source, "code_list": code_list, "auth_ref_ent_id": auth_ref_ent_id, "cert_isv_no": cert_isv_no, "invocation": invocation, "terminal_type": terminal_type, "terminal_name": terminal_name, "bureau_name": bureau_name, "error_message": error_message } )
[ "def", "alibaba_alihealth_drug_code_common_list_codeinfo", "(", "self", ",", "ref_ent_id", ",", "search_source", ",", "code_list", ",", "auth_ref_ent_id", ",", "cert_isv_no", "=", "''", ",", "invocation", "=", "''", ",", "terminal_type", "=", "''", ",", "terminal_na...
https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L89954-L89996
linuxmint/mintupdate
476059f9f977cd1d0d7a451c64931a7a9ffd4bbf
usr/lib/linuxmint/mintUpdate/mintUpdate.py
python
MintUpdate.close_preferences
(self, widget, window)
[]
def close_preferences(self, widget, window): self.window.set_sensitive(True) self.preferences_window_showing = False window.destroy() self.refresh()
[ "def", "close_preferences", "(", "self", ",", "widget", ",", "window", ")", ":", "self", ".", "window", ".", "set_sensitive", "(", "True", ")", "self", ".", "preferences_window_showing", "=", "False", "window", ".", "destroy", "(", ")", "self", ".", "refre...
https://github.com/linuxmint/mintupdate/blob/476059f9f977cd1d0d7a451c64931a7a9ffd4bbf/usr/lib/linuxmint/mintUpdate/mintUpdate.py#L2466-L2470
cea-hpc/clustershell
c421133ed4baa69e35ff76c476d4097201485344
lib/ClusterShell/RangeSet.py
python
RangeSetND.intersection_update
(self, other)
``s.intersection_update(t)`` returns nodeset s keeping only elements also found in t.
``s.intersection_update(t)`` returns nodeset s keeping only elements also found in t.
[ "s", ".", "intersection_update", "(", "t", ")", "returns", "nodeset", "s", "keeping", "only", "elements", "also", "found", "in", "t", "." ]
def intersection_update(self, other): """ ``s.intersection_update(t)`` returns nodeset s keeping only elements also found in t. """ if other is self: return tmp_rnd = RangeSetND() empty_rset = RangeSet() for rgvec in self._veclist: for ergvec in other._veclist: irgvec = [rg.intersection(erg) \ for rg, erg in zip(rgvec, ergvec)] if not empty_rset in irgvec: tmp_rnd.update([irgvec]) # substitute self.veclist = tmp_rnd.veclist
[ "def", "intersection_update", "(", "self", ",", "other", ")", ":", "if", "other", "is", "self", ":", "return", "tmp_rnd", "=", "RangeSetND", "(", ")", "empty_rset", "=", "RangeSet", "(", ")", "for", "rgvec", "in", "self", ".", "_veclist", ":", "for", "...
https://github.com/cea-hpc/clustershell/blob/c421133ed4baa69e35ff76c476d4097201485344/lib/ClusterShell/RangeSet.py#L1358-L1377
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/simulators/mujoco.py
python
Mujoco.get_joint_names
(self, body_id, joint_ids)
return names
Return the name of the given joint(s). Args: body_id (int): unique body id. joint_ids (int, list[int]): a joint id, or list of joint ids. Returns: if 1 joint: str: name of the joint if multiple joints: str[N]: name of each joint
Return the name of the given joint(s).
[ "Return", "the", "name", "of", "the", "given", "joint", "(", "s", ")", "." ]
def get_joint_names(self, body_id, joint_ids): """ Return the name of the given joint(s). Args: body_id (int): unique body id. joint_ids (int, list[int]): a joint id, or list of joint ids. Returns: if 1 joint: str: name of the joint if multiple joints: str[N]: name of each joint """ body = self._bodies[body_id] one_joint = isinstance(joint_ids, int) if one_joint: joint_ids = [joint_ids] names = [] for joint_id in joint_ids: name = body.joints[joint_id].name if name.startswith('prl_'): name = '_'.join(name.split('_')[1:-1]) names.append(name) if one_joint and len(names) > 1: return names[0] return names
[ "def", "get_joint_names", "(", "self", ",", "body_id", ",", "joint_ids", ")", ":", "body", "=", "self", ".", "_bodies", "[", "body_id", "]", "one_joint", "=", "isinstance", "(", "joint_ids", ",", "int", ")", "if", "one_joint", ":", "joint_ids", "=", "[",...
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/simulators/mujoco.py#L2604-L2630
nicola-decao/s-vae-pytorch
671c46c0772a2c92a602252311864c48c816bc44
examples/mnist.py
python
ModelVAE.__init__
(self, h_dim, z_dim, activation=F.relu, distribution='normal')
ModelVAE initializer :param h_dim: dimension of the hidden layers :param z_dim: dimension of the latent representation :param activation: callable activation function :param distribution: string either `normal` or `vmf`, indicates which distribution to use
ModelVAE initializer :param h_dim: dimension of the hidden layers :param z_dim: dimension of the latent representation :param activation: callable activation function :param distribution: string either `normal` or `vmf`, indicates which distribution to use
[ "ModelVAE", "initializer", ":", "param", "h_dim", ":", "dimension", "of", "the", "hidden", "layers", ":", "param", "z_dim", ":", "dimension", "of", "the", "latent", "representation", ":", "param", "activation", ":", "callable", "activation", "function", ":", "...
def __init__(self, h_dim, z_dim, activation=F.relu, distribution='normal'): """ ModelVAE initializer :param h_dim: dimension of the hidden layers :param z_dim: dimension of the latent representation :param activation: callable activation function :param distribution: string either `normal` or `vmf`, indicates which distribution to use """ super(ModelVAE, self).__init__() self.z_dim, self.activation, self.distribution = z_dim, activation, distribution # 2 hidden layers encoder self.fc_e0 = nn.Linear(784, h_dim * 2) self.fc_e1 = nn.Linear(h_dim * 2, h_dim) if self.distribution == 'normal': # compute mean and std of the normal distribution self.fc_mean = nn.Linear(h_dim, z_dim) self.fc_var = nn.Linear(h_dim, z_dim) elif self.distribution == 'vmf': # compute mean and concentration of the von Mises-Fisher self.fc_mean = nn.Linear(h_dim, z_dim) self.fc_var = nn.Linear(h_dim, 1) else: raise NotImplemented # 2 hidden layers decoder self.fc_d0 = nn.Linear(z_dim, h_dim) self.fc_d1 = nn.Linear(h_dim, h_dim * 2) self.fc_logits = nn.Linear(h_dim * 2, 784)
[ "def", "__init__", "(", "self", ",", "h_dim", ",", "z_dim", ",", "activation", "=", "F", ".", "relu", ",", "distribution", "=", "'normal'", ")", ":", "super", "(", "ModelVAE", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "z_dim", ",", ...
https://github.com/nicola-decao/s-vae-pytorch/blob/671c46c0772a2c92a602252311864c48c816bc44/examples/mnist.py#L23-L53
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/scatter3d/_marker.py
python
Marker.sizemin
(self)
return self["sizemin"]
Has an effect only if `marker.size` is set to a numerical array. Sets the minimum size (in px) of the rendered marker points. The 'sizemin' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float
Has an effect only if `marker.size` is set to a numerical array. Sets the minimum size (in px) of the rendered marker points. The 'sizemin' property is a number and may be specified as: - An int or float in the interval [0, inf]
[ "Has", "an", "effect", "only", "if", "marker", ".", "size", "is", "set", "to", "a", "numerical", "array", ".", "Sets", "the", "minimum", "size", "(", "in", "px", ")", "of", "the", "rendered", "marker", "points", ".", "The", "sizemin", "property", "is",...
def sizemin(self): """ Has an effect only if `marker.size` is set to a numerical array. Sets the minimum size (in px) of the rendered marker points. The 'sizemin' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float """ return self["sizemin"]
[ "def", "sizemin", "(", "self", ")", ":", "return", "self", "[", "\"sizemin\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/scatter3d/_marker.py#L784-L797
basho/riak-python-client
91de13a16607cdf553d1a194e762734e3bec4231
riak/content.py
python
RiakContent.add_link
(self, obj, tag=None)
return self._robject
add_link(obj, tag=None) Add a link to a RiakObject. :param obj: Either a RiakObject or 3 item link tuple consisting of (bucket, key, tag). :type obj: mixed :param tag: Optional link tag. Defaults to bucket name. It is ignored if ``obj`` is a 3 item link tuple. :type tag: string :rtype: :class:`RiakObject <riak.riak_object.RiakObject>`
add_link(obj, tag=None)
[ "add_link", "(", "obj", "tag", "=", "None", ")" ]
def add_link(self, obj, tag=None): """ add_link(obj, tag=None) Add a link to a RiakObject. :param obj: Either a RiakObject or 3 item link tuple consisting of (bucket, key, tag). :type obj: mixed :param tag: Optional link tag. Defaults to bucket name. It is ignored if ``obj`` is a 3 item link tuple. :type tag: string :rtype: :class:`RiakObject <riak.riak_object.RiakObject>` """ if isinstance(obj, tuple): newlink = obj else: newlink = (obj.bucket.name, obj.key, tag) self.links.append(newlink) return self._robject
[ "def", "add_link", "(", "self", ",", "obj", ",", "tag", "=", "None", ")", ":", "if", "isinstance", "(", "obj", ",", "tuple", ")", ":", "newlink", "=", "obj", "else", ":", "newlink", "=", "(", "obj", ".", "bucket", ".", "name", ",", "obj", ".", ...
https://github.com/basho/riak-python-client/blob/91de13a16607cdf553d1a194e762734e3bec4231/riak/content.py#L166-L186
yukitsuji/3D_CNN_tensorflow
5104ecf3f75a4e51a2170b72244e3f2a8993ce25
input_velodyne.py
python
filter_camera_angle
(places)
return places[bool_in]
Filter camera angles for KiTTI Datasets
Filter camera angles for KiTTI Datasets
[ "Filter", "camera", "angles", "for", "KiTTI", "Datasets" ]
def filter_camera_angle(places): """Filter camera angles for KiTTI Datasets""" bool_in = np.logical_and((places[:, 1] < places[:, 0] - 0.27), (-places[:, 1] < places[:, 0] - 0.27)) # bool_in = np.logical_and((places[:, 1] < places[:, 0]), (-places[:, 1] < places[:, 0])) return places[bool_in]
[ "def", "filter_camera_angle", "(", "places", ")", ":", "bool_in", "=", "np", ".", "logical_and", "(", "(", "places", "[", ":", ",", "1", "]", "<", "places", "[", ":", ",", "0", "]", "-", "0.27", ")", ",", "(", "-", "places", "[", ":", ",", "1",...
https://github.com/yukitsuji/3D_CNN_tensorflow/blob/5104ecf3f75a4e51a2170b72244e3f2a8993ce25/input_velodyne.py#L97-L101
hyperledger/fabric-sdk-py
8ee33a8981887e37950dc0f36a7ec63b3a5ba5c3
hfc/fabric/channel/channel.py
python
Channel._build_channel_header
(type, tx_id, channel_id, timestamp, epoch=0, extension=None)
return channel_header
Build channel. :param extension: extension (Default value = None) :param timestamp: timestamp :param channel_id: channel id :param tx_id: transaction id :param type: type :param epoch: epoch :return: common_proto.Header instance (Default value = 0)
Build channel.
[ "Build", "channel", "." ]
def _build_channel_header(type, tx_id, channel_id, timestamp, epoch=0, extension=None): """Build channel. :param extension: extension (Default value = None) :param timestamp: timestamp :param channel_id: channel id :param tx_id: transaction id :param type: type :param epoch: epoch :return: common_proto.Header instance (Default value = 0) """ channel_header = common_pb2.ChannelHeader() channel_header.type = type channel_header.version = 1 channel_header.channel_id = proto_str(channel_id) channel_header.tx_id = proto_str(tx_id) channel_header.epoch = epoch channel_header.timestamp = timestamp if extension: channel_header.extension = extension return channel_header
[ "def", "_build_channel_header", "(", "type", ",", "tx_id", ",", "channel_id", ",", "timestamp", ",", "epoch", "=", "0", ",", "extension", "=", "None", ")", ":", "channel_header", "=", "common_pb2", ".", "ChannelHeader", "(", ")", "channel_header", ".", "type...
https://github.com/hyperledger/fabric-sdk-py/blob/8ee33a8981887e37950dc0f36a7ec63b3a5ba5c3/hfc/fabric/channel/channel.py#L245-L267