Python future.builtins.super() Examples

The following are 30 code examples of future.builtins.super(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module future.builtins , or try the search function .
Example #1
Source File: client.py    From verge3d-blender-addon with GNU General Public License v3.0 7 votes vote down vote up
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 
Example #2
Source File: _header_value_parser.py    From misp42splunk with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 
Example #3
Source File: client.py    From misp42splunk with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 
Example #4
Source File: _header_value_parser.py    From deepWordBug with Apache License 2.0 6 votes vote down vote up
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 
Example #5
Source File: client.py    From misp42splunk with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 
Example #6
Source File: _header_value_parser.py    From misp42splunk with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 
Example #7
Source File: _header_value_parser.py    From verge3d-blender-addon with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #8
Source File: _header_value_parser.py    From deepWordBug with Apache License 2.0 5 votes vote down vote up
def domain(self):
        return ''.join(super(DomainLiteral, self).value.split()) 
Example #9
Source File: _header_value_parser.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __new__(cls, value, token_type):
        self = super(Terminal, cls).__new__(cls, value)
        self.token_type = token_type
        self.defects = []
        return self 
Example #10
Source File: _header_value_parser.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def _pp(self, indent=''):
        return ["{}{}/{}({}){}".format(
            indent,
            self.__class__.__name__,
            self.token_type,
            super(Terminal, self).__repr__(),
            '' if not self.defects else ' {}'.format(self.defects),
            )] 
Example #11
Source File: client.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
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. 
Example #12
Source File: _header_value_parser.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def domain(self):
        return ''.join(super(Domain, self).value.split()) 
Example #13
Source File: header.py    From deepWordBug with Apache License 2.0 5 votes vote down vote up
def pop(self):
        if self.part_count()==0:
            return ('', '')
        return super().pop() 
Example #14
Source File: header.py    From deepWordBug with Apache License 2.0 5 votes vote down vote up
def part_count(self):
        return super().__len__() 
Example #15
Source File: _header_value_parser.py    From deepWordBug with Apache License 2.0 5 votes vote down vote up
def __init__(self, *args, **kw):
        super(TokenList, self).__init__(*args, **kw)
        self.defects = [] 
Example #16
Source File: _header_value_parser.py    From deepWordBug with Apache License 2.0 5 votes vote down vote up
def domain(self):
        return ''.join(super(Domain, self).value.split()) 
Example #17
Source File: _header_value_parser.py    From deepWordBug with Apache License 2.0 5 votes vote down vote up
def __repr__(self):
        return "{}({})".format(self.__class__.__name__, super(Terminal, self).__repr__()) 
Example #18
Source File: client.py    From deepWordBug with Apache License 2.0 5 votes vote down vote up
def flush(self):
        super().flush()
        if self.fp:
            self.fp.flush() 
Example #19
Source File: _header_value_parser.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def domain(self):
        return ''.join(super(DomainLiteral, self).value.split()) 
Example #20
Source File: headerregistry.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def init(self, *args, **kw):
        self._datetime = kw.pop('datetime')
        super().init(*args, **kw) 
Example #21
Source File: _header_value_parser.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __repr__(self):
        return '{}({})'.format(self.__class__.__name__,
                               super(TokenList, self).__repr__()) 
Example #22
Source File: header.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def part_count(self):
        return super().__len__() 
Example #23
Source File: header.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def pop(self):
        if self.part_count()==0:
            return ('', '')
        return super().pop() 
Example #24
Source File: header.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, initial_size=0):
        self._initial_size = initial_size
        super().__init__() 
Example #25
Source File: headerregistry.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def init(self, *args, **kw):
        super().init(*args, **kw)
        self._cte = utils._sanitize(self._parse_tree.cte) 
Example #26
Source File: headerregistry.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def init(self, *args, **kw):
        super().init(*args, **kw)
        cd = self._parse_tree.content_disposition
        self._content_disposition = cd if cd is None else utils._sanitize(cd) 
Example #27
Source File: headerregistry.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def init(self, *args, **kw):
        self._params = kw.pop('params')
        super().init(*args, **kw) 
Example #28
Source File: headerregistry.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def init(self, *args, **kw):
        self._version = kw.pop('version')
        self._major = kw.pop('major')
        self._minor = kw.pop('minor')
        super().init(*args, **kw) 
Example #29
Source File: headerregistry.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def init(self, *args, **kw):
        self._groups = tuple(kw.pop('groups'))
        self._addresses = None
        super().init(*args, **kw) 
Example #30
Source File: socket.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
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()