Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix collections.abc imports for python 3.7.
  • Loading branch information
hwms committed Feb 23, 2020
commit adb491e498796293237f2252a5d8ba14e466b073
8 changes: 6 additions & 2 deletions hyper/common/headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@

Contains hyper's structures for storing and working with HTTP headers.
"""
import collections
try:
from collections.abc import MutableMapping
except ImportError: # pragma: no cover
# Python 2.7 compatibility
from collections import MutableMapping

from hyper.common.util import to_bytestring, to_bytestring_tuple


class HTTPHeaderMap(collections.MutableMapping):
class HTTPHeaderMap(MutableMapping):
"""
A structure that contains HTTP headers.

Expand Down
9 changes: 6 additions & 3 deletions hyper/http11/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
import socket
import base64

from collections import Iterable, Mapping
try:
from collections.abc import Iterable, Mapping
except ImportError: # pragma: no cover
# Python 2.7 compatibility
from collections import Iterable, Mapping

import collections
from hyperframe.frame import SettingsFrame

from .response import HTTP11Response
Expand Down Expand Up @@ -390,7 +393,7 @@ def _send_body(self, body, body_type):
return

# Iterables that set a specific content length.
elif isinstance(body, collections.Iterable):
elif isinstance(body, Iterable):
for item in body:
try:
self._sock.send(item)
Expand Down