Merge pull request #154 from pipermerriam/piper/code-reorganization

split out six module
This commit is contained in:
Piper Merriam 2017-02-04 21:16:33 -07:00 committed by GitHub
commit 459dc1e2ea
9 changed files with 37 additions and 35 deletions

View File

@ -2,8 +2,10 @@ import logging
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

View File

@ -12,7 +12,7 @@ from .types import (
from .string import (
force_bytes,
)
from .compat import (
from .six import (
Generator,
)

View File

@ -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']

View File

@ -14,7 +14,7 @@ import pylru
from geventhttpclient import HTTPClient
from web3.utils.compat import urlparse
from web3.utils.six import urlparse
_client_cache = pylru.lrucache(8)

View File

@ -1,5 +0,0 @@
from urlparse import ( # noqa: F401
urlparse,
urlunparse,
)
Generator = type(_ for _ in tuple())

View File

@ -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())

View File

@ -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,
)

View File

@ -0,0 +1,5 @@
from urlparse import ( # noqa: F401
urlparse,
urlunparse,
)
Generator = type(_ for _ in tuple())

12
web3/utils/six/six_py3.py Normal file
View File

@ -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())