本文整理汇总了Python中future.builtins.super方法的典型用法代码示例。如果您正苦于以下问题:Python builtins.super方法的具体用法?Python builtins.super怎么用?Python builtins.super使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类future.builtins
的用法示例。
在下文中一共展示了builtins.super方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: value
# 需要导入模块: from future import builtins [as 别名]
# 或者: from future.builtins import super [as 别名]
def value(self):
quote = False
if self.defects:
quote = True
else:
for x in self:
if x.token_type == 'quoted-string':
quote = True
if quote:
pre = post = ''
if self[0].token_type=='cfws' or self[0][0].token_type=='cfws':
pre = ' '
if self[-1].token_type=='cfws' or self[-1][-1].token_type=='cfws':
post = ' '
return pre+quote_string(self.display_name)+post
else:
return super(DisplayName, self).value
示例2: __init__
# 需要导入模块: from future import builtins [as 别名]
# 或者: from future.builtins import super [as 别名]
def __init__(self, host, port=None, key_file=None, cert_file=None,
strict=_strict_sentinel, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
source_address=None, **_3to2kwargs):
if 'check_hostname' in _3to2kwargs: check_hostname = _3to2kwargs['check_hostname']; del _3to2kwargs['check_hostname']
else: check_hostname = None
if 'context' in _3to2kwargs: context = _3to2kwargs['context']; del _3to2kwargs['context']
else: context = None
super(HTTPSConnection, self).__init__(host, port, strict, timeout,
source_address)
self.key_file = key_file
self.cert_file = cert_file
if context is None:
# Some reasonable defaults
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
context.options |= ssl.OP_NO_SSLv2
will_verify = context.verify_mode != ssl.CERT_NONE
if check_hostname is None:
check_hostname = will_verify
elif check_hostname and not will_verify:
raise ValueError("check_hostname needs a SSL context with "
"either CERT_OPTIONAL or CERT_REQUIRED")
if key_file or cert_file:
context.load_cert_chain(cert_file, key_file)
self._context = context
self._check_hostname = check_hostname
示例3: init
# 需要导入模块: from future import builtins [as 别名]
# 或者: from future.builtins import super [as 别名]
def init(self, *args, **kw):
self._datetime = kw.pop('datetime')
super().init(*args, **kw)
示例4: __init__
# 需要导入模块: from future import builtins [as 别名]
# 或者: from future.builtins import super [as 别名]
def __init__(self, initial_size=0):
self._initial_size = initial_size
super().__init__()
示例5: pop
# 需要导入模块: from future import builtins [as 别名]
# 或者: from future.builtins import super [as 别名]
def pop(self):
if self.part_count()==0:
return ('', '')
return super().pop()
示例6: part_count
# 需要导入模块: from future import builtins [as 别名]
# 或者: from future.builtins import super [as 别名]
def part_count(self):
return super().__len__()
示例7: __init__
# 需要导入模块: from future import builtins [as 别名]
# 或者: from future.builtins import super [as 别名]
def __init__(self, *args, **kw):
super(TokenList, self).__init__(*args, **kw)
self.defects = []
示例8: domain
# 需要导入模块: from future import builtins [as 别名]
# 或者: from future.builtins import super [as 别名]
def domain(self):
return ''.join(super(Domain, self).value.split())
示例9: __new__
# 需要导入模块: from future import builtins [as 别名]
# 或者: from future.builtins import super [as 别名]
def __new__(cls, value, token_type):
self = super(Terminal, cls).__new__(cls, value)
self.token_type = token_type
self.defects = []
return self
示例10: __repr__
# 需要导入模块: from future import builtins [as 别名]
# 或者: from future.builtins import super [as 别名]
def __repr__(self):
return "{}({})".format(self.__class__.__name__, super(Terminal, self).__repr__())
示例11: close
# 需要导入模块: from future import builtins [as 别名]
# 或者: from future.builtins import super [as 别名]
def close(self):
super().close() # set "closed" flag
if self.fp:
self._close_conn()
# These implementations are for the benefit of io.BufferedReader.
# XXX This class should probably be revised to act more like
# the "raw stream" that BufferedReader expects.
示例12: flush
# 需要导入模块: from future import builtins [as 别名]
# 或者: from future.builtins import super [as 别名]
def flush(self):
super().flush()
if self.fp:
self.fp.flush()
示例13: read
# 需要导入模块: from future import builtins [as 别名]
# 或者: from future.builtins import super [as 别名]
def read(self, amt=None):
if self.fp is None:
return bytes(b"")
if self._method == "HEAD":
self._close_conn()
return bytes(b"")
if amt is not None:
# Amount is given, so call base class version
# (which is implemented in terms of self.readinto)
return bytes(super(HTTPResponse, self).read(amt))
else:
# Amount is not given (unbounded read) so we must check self.length
# and self.chunked
if self.chunked:
return self._readall_chunked()
if self.length is None:
s = self.fp.read()
else:
try:
s = self._safe_read(self.length)
except IncompleteRead:
self._close_conn()
raise
self.length = 0
self._close_conn() # we read everything
return bytes(s)
示例14: detach
# 需要导入模块: from future import builtins [as 别名]
# 或者: from future.builtins import super [as 别名]
def detach(self):
"""detach() -> file descriptor
Close the socket object without closing the underlying file descriptor.
The object cannot be used after this call, but the file descriptor
can be reused for other purposes. The file descriptor is returned.
"""
self._closed = True
return super().detach()