Skip to content

Commit

Permalink
Merge pull request #154 from pipermerriam/piper/code-reorganization
Browse files Browse the repository at this point in the history
split out six module
  • Loading branch information
pipermerriam committed Feb 5, 2017
2 parents 9e72075 + 07a4fe2 commit 459dc1e
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 35 deletions.
4 changes: 3 additions & 1 deletion web3/providers/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

from .base import JSONBaseProvider # noqa: E402

from web3.utils.compat import (
from web3.utils.six import (
urlunparse,
)
from web3.utils.compat import (
make_post_request,
)
from web3.utils.http import construct_user_agent
Expand Down
2 changes: 1 addition & 1 deletion web3/utils/caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .string import (
force_bytes,
)
from .compat import (
from .six import (
Generator,
)

Expand Down
15 changes: 0 additions & 15 deletions web3/utils/compat/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
import sys
import os


if sys.version_info.major == 2:
from .compat_py2 import (
urlparse,
urlunparse,
Generator,
)
else:
from .compat_py3 import ( # noqa: #401
urlparse,
urlunparse,
Generator,
)


def get_threading_backend():
if 'WEB3_THREADING_BACKEND' in os.environ:
return os.environ['WEB3_THREADING_BACKEND']
Expand Down
2 changes: 1 addition & 1 deletion web3/utils/compat/compat_gevent.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from geventhttpclient import HTTPClient

from web3.utils.compat import urlparse
from web3.utils.six import urlparse


_client_cache = pylru.lrucache(8)
Expand Down
5 changes: 0 additions & 5 deletions web3/utils/compat/compat_py2.py
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@
from urlparse import ( # noqa: F401
urlparse,
urlunparse,
)
Generator = type(_ for _ in tuple())
12 changes: 0 additions & 12 deletions web3/utils/compat/compat_py3.py
Original file line number Diff line number Diff line change
@@ -1,12 +0,0 @@
import collections

from urllib.parse import ( # noqa: F401
urlparse,
urlunparse,
)

try:
Generator = collections.Generator
except AttributeError:
# py34
Generator = type(_ for _ in tuple())
15 changes: 15 additions & 0 deletions web3/utils/six/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import sys


if sys.version_info.major == 2:
from .six_py2 import (
urlparse,
urlunparse,
Generator,
)
else:
from .six_py3 import ( # noqa: #401
urlparse,
urlunparse,
Generator,
)
5 changes: 5 additions & 0 deletions web3/utils/six/six_py2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from urlparse import ( # noqa: F401
urlparse,
urlunparse,
)
Generator = type(_ for _ in tuple())
12 changes: 12 additions & 0 deletions web3/utils/six/six_py3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import collections

from urllib.parse import ( # noqa: F401
urlparse,
urlunparse,
)

try:
Generator = collections.Generator
except AttributeError:
# py34
Generator = type(_ for _ in tuple())

0 comments on commit 459dc1e

Please sign in to comment.