Skip to content

Commit

Permalink
sort the import order
Browse files Browse the repository at this point in the history
  • Loading branch information
cocolato committed Mar 18, 2024
1 parent 7b82cab commit 4832fc0
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 40 deletions.
2 changes: 1 addition & 1 deletion thriftpy2/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

import platform
import sys
from urllib.request import urlopen
from urllib.parse import urlparse
from urllib.request import urlopen

PY3 = sys.version_info[0] == 3
PY35 = sys.version_info >= (3, 5)
Expand Down
8 changes: 4 additions & 4 deletions thriftpy2/contrib/aio/rpc.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
import warnings
import urllib
import warnings

from .processor import TAsyncProcessor
from .client import TAsyncClient
from .processor import TAsyncProcessor
from .protocol.binary import TAsyncBinaryProtocolFactory
from .transport.buffered import TAsyncBufferedTransportFactory
from .socket import TAsyncSocket, TAsyncServerSocket
from .server import TAsyncServer
from .socket import TAsyncServerSocket, TAsyncSocket
from .transport.buffered import TAsyncBufferedTransportFactory


async def make_client(service, host='localhost', port=9090, unix_socket=None,
Expand Down
17 changes: 7 additions & 10 deletions thriftpy2/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,20 @@

from __future__ import absolute_import

import http.client as http_client
import http.server as http_server
import os
import socket
import sys
import urllib
from contextlib import contextmanager
from io import BytesIO

import http.client as http_client
import http.server as http_server
import urllib

from thriftpy2.thrift import TProcessor, TClient
from thriftpy2.server import TServer
from thriftpy2.transport import TTransportBase, TMemoryBuffer

from thriftpy2.protocol import TBinaryProtocolFactory
from thriftpy2.transport import TBufferedTransportFactory

from thriftpy2.server import TServer
from thriftpy2.thrift import TClient, TProcessor
from thriftpy2.transport import (TBufferedTransportFactory, TMemoryBuffer,
TTransportBase)

HTTP_URI = '{scheme}://{host}:{port}{path}'
DEFAULT_HTTP_CLIENT_TIMEOUT_MS = 30000 # 30 seconds
Expand Down
21 changes: 7 additions & 14 deletions thriftpy2/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,15 @@

import contextlib
import socket
import urllib
import warnings

from thriftpy2._compat import PY35
import urllib

from thriftpy2.protocol import TBinaryProtocolFactory
from thriftpy2.server import TThreadedServer
from thriftpy2.thrift import TProcessor, TClient
from thriftpy2.transport import (
TBufferedTransportFactory,
TServerSocket,
TSSLServerSocket,
TSocket,
TSSLSocket,
)
from thriftpy2.thrift import TClient, TProcessor
from thriftpy2.transport import (TBufferedTransportFactory, TServerSocket,
TSocket, TSSLServerSocket, TSSLSocket)


def make_client(service, host="localhost", port=9090, unix_socket=None,
Expand Down Expand Up @@ -131,7 +125,6 @@ def client_context(service, host="localhost", port=9090, unix_socket=None,


if PY35:
from thriftpy2.contrib.aio.rpc import ( # noqa
make_server as make_aio_server,
make_client as make_aio_client
)
from thriftpy2.contrib.aio.rpc import make_client as make_aio_client
from thriftpy2.contrib.aio.rpc import \
make_server as make_aio_server # noqa
21 changes: 10 additions & 11 deletions thriftpy2/tornado.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,22 @@

from __future__ import absolute_import

import logging
import socket
import struct
import urllib
from contextlib import contextmanager
from tornado import tcpserver, iostream, gen
from tornado import version as tornado_version
from io import BytesIO
from datetime import timedelta
from io import BytesIO

from .transport import TTransportException, TTransportBase
from .transport.memory import TMemoryBuffer
from .thrift import TApplicationException, TProcessor, TClient
from tornado import gen, iostream, tcpserver
from tornado import version as tornado_version

# TODO need TCyTornadoStreamTransport to work with cython binary protocol
from .protocol.binary import TBinaryProtocolFactory

import urllib
import logging
import socket
import struct
from .thrift import TApplicationException, TClient, TProcessor
from .transport import TTransportBase, TTransportException
from .transport.memory import TMemoryBuffer

try:
from tornado.locks import Lock
Expand Down

0 comments on commit 4832fc0

Please sign in to comment.