mirror of
https://github.com/FlipsideCrypto/web3.py.git
synced 2026-02-06 19:06:52 +00:00
Merge pull request #154 from pipermerriam/piper/code-reorganization
split out six module
This commit is contained in:
commit
459dc1e2ea
@ -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
|
||||
|
||||
@ -12,7 +12,7 @@ from .types import (
|
||||
from .string import (
|
||||
force_bytes,
|
||||
)
|
||||
from .compat import (
|
||||
from .six import (
|
||||
Generator,
|
||||
)
|
||||
|
||||
|
||||
@ -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']
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
from urlparse import ( # noqa: F401
|
||||
urlparse,
|
||||
urlunparse,
|
||||
)
|
||||
Generator = type(_ for _ in tuple())
|
||||
@ -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
web3/utils/six/__init__.py
Normal file
15
web3/utils/six/__init__.py
Normal 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,
|
||||
)
|
||||
5
web3/utils/six/six_py2.py
Normal file
5
web3/utils/six/six_py2.py
Normal 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
12
web3/utils/six/six_py3.py
Normal 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())
|
||||
Loading…
Reference in New Issue
Block a user