run isort

This commit is contained in:
Amber Brown 2018-07-09 16:09:20 +10:00
parent 2ee9f1bd1a
commit 49af402019
334 changed files with 1749 additions and 1668 deletions

View file

@ -17,6 +17,7 @@ import logging
from itertools import islice
import attr
from twisted.internet import defer, task
from synapse.util.logcontext import PreserveLoggingContext

View file

@ -13,20 +13,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
from contextlib import contextmanager
from six.moves import range
from twisted.internet import defer
from twisted.internet.defer import CancelledError
from twisted.python import failure
from synapse.util import Clock, logcontext, unwrapFirstError
from .logcontext import (
PreserveLoggingContext, make_deferred_yieldable, run_in_background
PreserveLoggingContext,
make_deferred_yieldable,
run_in_background,
)
from synapse.util import logcontext, unwrapFirstError, Clock
from contextlib import contextmanager
import logging
from six.moves import range
logger = logging.getLogger(__name__)

View file

@ -13,12 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from prometheus_client.core import Gauge, REGISTRY, GaugeMetricFamily
import os
from six.moves import intern
import six
from six.moves import intern
from prometheus_client.core import REGISTRY, Gauge, GaugeMetricFamily
CACHE_SIZE_FACTOR = float(os.environ.get("SYNAPSE_CACHE_FACTOR", 0.5))

View file

@ -13,10 +13,19 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import functools
import inspect
import logging
import threading
from collections import namedtuple
import six
from six import itervalues, string_types
from twisted.internet import defer
from synapse.util import logcontext, unwrapFirstError
from synapse.util.async import ObservableDeferred
from synapse.util import unwrapFirstError, logcontext
from synapse.util.caches import get_cache_factor_for
from synapse.util.caches.lrucache import LruCache
from synapse.util.caches.treecache import TreeCache, iterate_tree_cache_entry
@ -24,17 +33,6 @@ from synapse.util.stringutils import to_ascii
from . import register_cache
from twisted.internet import defer
from collections import namedtuple
import functools
import inspect
import threading
from six import string_types, itervalues
import six
logger = logging.getLogger(__name__)

View file

@ -13,12 +13,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from synapse.util.caches.lrucache import LruCache
from collections import namedtuple
from . import register_cache
import threading
import logging
import threading
from collections import namedtuple
from synapse.util.caches.lrucache import LruCache
from . import register_cache
logger = logging.getLogger(__name__)

View file

@ -13,11 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from synapse.util.caches import register_cache
from collections import OrderedDict
import logging
from collections import OrderedDict
from synapse.util.caches import register_cache
logger = logging.getLogger(__name__)

View file

@ -14,8 +14,8 @@
# limitations under the License.
from functools import wraps
import threading
from functools import wraps
from synapse.util.caches.treecache import TreeCache

View file

@ -13,12 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from synapse.util import caches
from sortedcontainers import SortedDict
import logging
from sortedcontainers import SortedDict
from synapse.util import caches
logger = logging.getLogger(__name__)

View file

@ -13,12 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from six.moves import queue
from twisted.internet import threads
from synapse.util.logcontext import make_deferred_yieldable, run_in_background
from six.moves import queue
class BackgroundFileConsumer(object):
"""A consumer that writes to a file like object. Supports both push

View file

@ -13,11 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from frozendict import frozendict
from canonicaljson import json
from six import string_types
from canonicaljson import json
from frozendict import frozendict
def freeze(o):
if isinstance(o, dict):

View file

@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from twisted.web.resource import NoResource
import logging
from twisted.web.resource import NoResource
logger = logging.getLogger(__name__)

View file

@ -22,10 +22,10 @@ them.
See doc/log_contexts.rst for details on how this works.
"""
from twisted.internet import defer
import threading
import logging
import threading
from twisted.internet import defer
logger = logging.getLogger(__name__)

View file

@ -14,10 +14,11 @@
# limitations under the License.
from six import StringIO
import logging
import traceback
from six import StringIO
class LogFormatter(logging.Formatter):
"""Log formatter which gives more detail for exceptions

View file

@ -14,13 +14,11 @@
# limitations under the License.
from inspect import getcallargs
from functools import wraps
import logging
import inspect
import logging
import time
from functools import wraps
from inspect import getcallargs
_TIME_FUNC_ID = 0

View file

@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from twisted.conch.manhole import ColoredManhole
from twisted.conch.insults import insults
from twisted.conch import manhole_ssh
from twisted.cred import checkers, portal
from twisted.conch.insults import insults
from twisted.conch.manhole import ColoredManhole
from twisted.conch.ssh.keys import Key
from twisted.cred import checkers, portal
PUBLIC_KEY = (
"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAGEArzJx8OYOnJmzf4tfBEvLi8DVPrJ3/c9k2I/Az"

View file

@ -13,15 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from twisted.internet import defer
import logging
from functools import wraps
from prometheus_client import Counter
from twisted.internet import defer
from synapse.util.logcontext import LoggingContext
from functools import wraps
import logging
logger = logging.getLogger(__name__)
block_counter = Counter("synapse_util_metrics_block_count", "", ["block_name"])

View file

@ -14,6 +14,7 @@
# limitations under the License.
import phonenumbers
from synapse.api.errors import SynapseError

View file

@ -13,19 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from twisted.internet import defer
from synapse.api.errors import LimitExceededError
from synapse.util.logcontext import (
run_in_background, make_deferred_yieldable,
PreserveLoggingContext,
)
import collections
import contextlib
import logging
from twisted.internet import defer
from synapse.api.errors import LimitExceededError
from synapse.util.logcontext import (
PreserveLoggingContext,
make_deferred_yieldable,
run_in_background,
)
logger = logging.getLogger(__name__)

View file

@ -12,14 +12,13 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import synapse.util.logcontext
from twisted.internet import defer
from synapse.api.errors import CodeMessageException
import logging
import random
from twisted.internet import defer
import synapse.util.logcontext
from synapse.api.errors import CodeMessageException
logger = logging.getLogger(__name__)

View file

@ -13,9 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import resource
import logging
import resource
logger = logging.getLogger("synapse.app.homeserver")

View file

@ -15,6 +15,7 @@
import random
import string
from six.moves import range
_string_with_symbols = (

View file

@ -14,9 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import subprocess
import os
import logging
import os
import subprocess
logger = logging.getLogger(__name__)