diff options
Diffstat (limited to 'netlib')
-rw-r--r-- | netlib/http/headers.py | 2 | ||||
-rw-r--r-- | netlib/http/request.py | 2 | ||||
-rw-r--r-- | netlib/http/response.py | 2 | ||||
-rw-r--r-- | netlib/multidict.py | 8 | ||||
-rw-r--r-- | netlib/tcp.py | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/netlib/http/headers.py b/netlib/http/headers.py index 2caf8d51..6067ff5e 100644 --- a/netlib/http/headers.py +++ b/netlib/http/headers.py @@ -76,7 +76,7 @@ class Headers(MultiDict): For use with the "Set-Cookie" header, see :py:meth:`get_all`. """ - def __init__(self, fields=None, **headers): + def __init__(self, fields=(), **headers): """ Args: fields: (optional) list of ``(name, value)`` header byte tuples, diff --git a/netlib/http/request.py b/netlib/http/request.py index 5a528bf2..a6e2a5ef 100644 --- a/netlib/http/request.py +++ b/netlib/http/request.py @@ -19,7 +19,7 @@ host_header_re = re.compile(r"^(?P<host>[^:]+|\[.+\])(?::(?P<port>\d+))?$") class RequestData(MessageData): - def __init__(self, first_line_format, method, scheme, host, port, path, http_version, headers=None, content=None, + def __init__(self, first_line_format, method, scheme, host, port, path, http_version, headers=(), content=None, timestamp_start=None, timestamp_end=None): if not isinstance(headers, Headers): headers = Headers(headers) diff --git a/netlib/http/response.py b/netlib/http/response.py index 7d272e10..a6a5bf47 100644 --- a/netlib/http/response.py +++ b/netlib/http/response.py @@ -11,7 +11,7 @@ from .. import utils class ResponseData(MessageData): - def __init__(self, http_version, status_code, reason=None, headers=None, content=None, + def __init__(self, http_version, status_code, reason=None, headers=(), content=None, timestamp_start=None, timestamp_end=None): if not isinstance(headers, Headers): headers = Headers(headers) diff --git a/netlib/multidict.py b/netlib/multidict.py index da482620..98fde7e3 100644 --- a/netlib/multidict.py +++ b/netlib/multidict.py @@ -16,7 +16,7 @@ from .utils import Serializable @six.add_metaclass(ABCMeta) class _MultiDict(MutableMapping, Serializable): def __repr__(self): - fields = tuple( + fields = ( repr(field) for field in self.fields ) @@ -206,14 +206,14 @@ class _MultiDict(MutableMapping, Serializable): @classmethod def from_state(cls, state): - return cls(tuple(x) for x in state) + return cls(state) class MultiDict(_MultiDict): - def __init__(self, fields=None): + def __init__(self, fields=()): super(MultiDict, self).__init__() self.fields = tuple( - [tuple(i) for i in fields or ()] + tuple(i) for i in fields ) diff --git a/netlib/tcp.py b/netlib/tcp.py index ad75cff8..c7231dbb 100644 --- a/netlib/tcp.py +++ b/netlib/tcp.py @@ -901,7 +901,7 @@ class TCPServer(object): """ # If a thread has persisted after interpreter exit, the module might be # none. - if traceback: + if traceback and six: exc = six.text_type(traceback.format_exc()) print(u'-' * 40, file=fp) print( |