diff options
| author | Chris McDonough <chrism@plope.com> | 2011-11-28 05:02:14 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-11-28 05:02:14 -0500 |
| commit | 0c1c39b02f1e0348d8e317972601e2db514db103 (patch) | |
| tree | 2d07a4dab9dbc8b1518d4f2252902cd912755e82 | |
| parent | ee117e73834318049cc743eb11c9dd766ea1982d (diff) | |
| download | pyramid-0c1c39b02f1e0348d8e317972601e2db514db103.tar.gz pyramid-0c1c39b02f1e0348d8e317972601e2db514db103.tar.bz2 pyramid-0c1c39b02f1e0348d8e317972601e2db514db103.zip | |
use multiline imports
| -rw-r--r-- | pyramid/asset.py | 6 | ||||
| -rw-r--r-- | pyramid/authentication.py | 32 | ||||
| -rw-r--r-- | pyramid/authorization.py | 13 | ||||
| -rw-r--r-- | pyramid/encode.py | 12 | ||||
| -rw-r--r-- | pyramid/events.py | 12 | ||||
| -rw-r--r-- | pyramid/exceptions.py | 6 | ||||
| -rw-r--r-- | pyramid/httpexceptions.py | 11 | ||||
| -rw-r--r-- | pyramid/i18n.py | 19 | ||||
| -rw-r--r-- | pyramid/interfaces.py | 6 | ||||
| -rw-r--r-- | pyramid/mako_templating.py | 20 | ||||
| -rw-r--r-- | pyramid/renderers.py | 33 | ||||
| -rw-r--r-- | pyramid/request.py | 25 | ||||
| -rw-r--r-- | pyramid/router.py | 51 | ||||
| -rw-r--r-- | pyramid/scripting.py | 8 | ||||
| -rw-r--r-- | pyramid/security.py | 10 | ||||
| -rw-r--r-- | pyramid/session.py | 13 | ||||
| -rw-r--r-- | pyramid/static.py | 35 | ||||
| -rw-r--r-- | pyramid/testing.py | 59 | ||||
| -rw-r--r-- | pyramid/traversal.py | 33 | ||||
| -rw-r--r-- | pyramid/tweens.py | 7 | ||||
| -rw-r--r-- | pyramid/url.py | 23 | ||||
| -rw-r--r-- | pyramid/urldispatch.py | 30 | ||||
| -rw-r--r-- | pyramid/view.py | 14 |
23 files changed, 303 insertions, 175 deletions
diff --git a/pyramid/asset.py b/pyramid/asset.py index 4bf0d7bf4..63be78c72 100644 --- a/pyramid/asset.py +++ b/pyramid/asset.py @@ -3,8 +3,10 @@ import pkg_resources from pyramid.compat import string_types -from pyramid.path import package_path -from pyramid.path import package_name +from pyramid.path import ( + package_path, + package_name, + ) def resolve_asset_spec(spec, pname='__main__'): if pname and not isinstance(pname, string_types): diff --git a/pyramid/authentication.py b/pyramid/authentication.py index 3909ce2d8..13ec4284a 100644 --- a/pyramid/authentication.py +++ b/pyramid/authentication.py @@ -8,19 +8,25 @@ import time as time_mod from zope.interface import implementer -from pyramid.compat import long -from pyramid.compat import text_type -from pyramid.compat import binary_type -from pyramid.compat import url_unquote -from pyramid.compat import url_quote -from pyramid.compat import bytes_ -from pyramid.compat import ascii_native_ - -from pyramid.interfaces import IAuthenticationPolicy -from pyramid.interfaces import IDebugLogger - -from pyramid.security import Authenticated -from pyramid.security import Everyone +from pyramid.compat import ( + long, + text_type, + binary_type, + url_unquote, + url_quote, + bytes_, + ascii_native_, + ) + +from pyramid.interfaces import ( + IAuthenticationPolicy, + IDebugLogger, + ) + +from pyramid.security import ( + Authenticated, + Everyone, + ) from pyramid.util import strings_differ diff --git a/pyramid/authorization.py b/pyramid/authorization.py index b1ef10033..fc711e88b 100644 --- a/pyramid/authorization.py +++ b/pyramid/authorization.py @@ -3,11 +3,14 @@ from zope.interface import implementer from pyramid.interfaces import IAuthorizationPolicy from pyramid.location import lineage -from pyramid.security import ACLAllowed -from pyramid.security import ACLDenied -from pyramid.security import Allow -from pyramid.security import Deny -from pyramid.security import Everyone + +from pyramid.security import ( + ACLAllowed, + ACLDenied, + Allow, + Deny, + Everyone, + ) @implementer(IAuthorizationPolicy) class ACLAuthorizationPolicy(object): diff --git a/pyramid/encode.py b/pyramid/encode.py index a259d1414..65bc95032 100644 --- a/pyramid/encode.py +++ b/pyramid/encode.py @@ -1,8 +1,10 @@ -from pyramid.compat import text_type -from pyramid.compat import binary_type -from pyramid.compat import is_nonstr_iter -from pyramid.compat import url_quote as _url_quote -from pyramid.compat import url_quote_plus as quote_plus # bw compat api (dnr) +from pyramid.compat import ( + text_type, + binary_type, + is_nonstr_iter, + url_quote as _url_quote, + url_quote_plus as quote_plus, # bw compat api (dnr) + ) def url_quote(s, safe=''): # bw compat api return _url_quote(s, safe=safe) diff --git a/pyramid/events.py b/pyramid/events.py index 4a2cd6240..9cb8b31ad 100644 --- a/pyramid/events.py +++ b/pyramid/events.py @@ -2,11 +2,13 @@ import venusian from zope.interface import implementer -from pyramid.interfaces import IContextFound -from pyramid.interfaces import INewRequest -from pyramid.interfaces import INewResponse -from pyramid.interfaces import IApplicationCreated -from pyramid.interfaces import IBeforeRender +from pyramid.interfaces import ( + IContextFound, + INewRequest, + INewResponse, + IApplicationCreated, + IBeforeRender, + ) class subscriber(object): """ Decorator activated via a :term:`scan` which treats the diff --git a/pyramid/exceptions.py b/pyramid/exceptions.py index ff598fe2d..04b6e20b7 100644 --- a/pyramid/exceptions.py +++ b/pyramid/exceptions.py @@ -1,5 +1,7 @@ -from pyramid.httpexceptions import HTTPNotFound -from pyramid.httpexceptions import HTTPForbidden +from pyramid.httpexceptions import ( + HTTPNotFound, + HTTPForbidden, + ) NotFound = HTTPNotFound # bw compat Forbidden = HTTPForbidden # bw compat diff --git a/pyramid/httpexceptions.py b/pyramid/httpexceptions.py index bd745df87..c82d6900c 100644 --- a/pyramid/httpexceptions.py +++ b/pyramid/httpexceptions.py @@ -128,12 +128,15 @@ from zope.interface import implementer from webob import html_escape as _html_escape +from pyramid.compat import ( + class_types, + text_type, + binary_type, + text_, + ) + from pyramid.interfaces import IExceptionResponse from pyramid.response import Response -from pyramid.compat import class_types -from pyramid.compat import text_type -from pyramid.compat import binary_type -from pyramid.compat import text_ def _no_escape(value): if value is None: diff --git a/pyramid/i18n.py b/pyramid/i18n.py index 889227130..b4bc0eaa7 100644 --- a/pyramid/i18n.py +++ b/pyramid/i18n.py @@ -1,18 +1,23 @@ import gettext import os -from translationstring import Translator -from translationstring import Pluralizer -from translationstring import TranslationString # API -from translationstring import TranslationStringFactory # API +from translationstring import ( + Translator, + Pluralizer, + TranslationString, # API + TranslationStringFactory, # API + ) TranslationString = TranslationString # PyFlakes TranslationStringFactory = TranslationStringFactory # PyFlakes from pyramid.compat import PY3 -from pyramid.interfaces import ILocalizer -from pyramid.interfaces import ITranslationDirectories -from pyramid.interfaces import ILocaleNegotiator + +from pyramid.interfaces import ( + ILocalizer, + ITranslationDirectories, + ILocaleNegotiator, + ) from pyramid.threadlocal import get_current_registry diff --git a/pyramid/interfaces.py b/pyramid/interfaces.py index fcdf72d01..5e7137345 100644 --- a/pyramid/interfaces.py +++ b/pyramid/interfaces.py @@ -1,5 +1,7 @@ -from zope.interface import Attribute -from zope.interface import Interface +from zope.interface import ( + Attribute, + Interface, + ) from pyramid.compat import PY3 diff --git a/pyramid/mako_templating.py b/pyramid/mako_templating.py index e4571ba1b..761695220 100644 --- a/pyramid/mako_templating.py +++ b/pyramid/mako_templating.py @@ -2,13 +2,21 @@ import os import sys import threading -from zope.interface import implementer -from zope.interface import Interface +from zope.interface import ( + implementer, + Interface, + ) + +from pyramid.asset import ( + resolve_asset_spec, + abspath_from_asset_spec, + ) + +from pyramid.compat import ( + is_nonstr_iter, + reraise, + ) -from pyramid.asset import resolve_asset_spec -from pyramid.asset import abspath_from_asset_spec -from pyramid.compat import is_nonstr_iter -from pyramid.compat import reraise from pyramid.interfaces import ITemplateRenderer from pyramid.settings import asbool from pyramid.util import DottedNameResolver diff --git a/pyramid/renderers.py b/pyramid/renderers.py index 3197ca6b8..89e5f03ea 100644 --- a/pyramid/renderers.py +++ b/pyramid/renderers.py @@ -6,21 +6,32 @@ import threading from zope.interface import implementer from zope.deprecation import deprecated -from pyramid.interfaces import IChameleonLookup -from pyramid.interfaces import IChameleonTranslate -from pyramid.interfaces import IRendererGlobalsFactory -from pyramid.interfaces import IRendererFactory -from pyramid.interfaces import IResponseFactory -from pyramid.interfaces import ITemplateRenderer -from pyramid.interfaces import IRendererInfo +from pyramid.interfaces import ( + IChameleonLookup, + IChameleonTranslate, + IRendererGlobalsFactory, + IRendererFactory, + IResponseFactory, + ITemplateRenderer, + IRendererInfo, + ) from pyramid.asset import asset_spec_from_abspath -from pyramid.compat import string_types -from pyramid.compat import text_type + +from pyramid.compat import ( + string_types, + text_type, + ) + from pyramid.decorator import reify + from pyramid.events import BeforeRender -from pyramid.path import caller_package -from pyramid.path import package_path + +from pyramid.path import ( + caller_package, + package_path, + ) + from pyramid.response import Response from pyramid.threadlocal import get_current_registry diff --git a/pyramid/request.py b/pyramid/request.py index 8f5dfbbb8..4005213fa 100644 --- a/pyramid/request.py +++ b/pyramid/request.py @@ -7,15 +7,22 @@ from zope.interface.interface import InterfaceClass from webob import BaseRequest -from pyramid.interfaces import IRequest -from pyramid.interfaces import IResponse -from pyramid.interfaces import ISessionFactory -from pyramid.interfaces import IResponseFactory - -from pyramid.compat import iterkeys_, itervalues_, iteritems_ -from pyramid.compat import text_ -from pyramid.compat import bytes_ -from pyramid.compat import native_ +from pyramid.interfaces import ( + IRequest, + IResponse, + ISessionFactory, + IResponseFactory, + ) + +from pyramid.compat import ( + iterkeys_, + itervalues_, + iteritems_, + text_, + bytes_, + native_, + ) + from pyramid.decorator import reify from pyramid.response import Response from pyramid.url import URLMethodsMixin diff --git a/pyramid/router.py b/pyramid/router.py index fb309eb03..608a66756 100644 --- a/pyramid/router.py +++ b/pyramid/router.py @@ -1,26 +1,37 @@ -from zope.interface import implementer -from zope.interface import providedBy - -from pyramid.interfaces import IDebugLogger -from pyramid.interfaces import IRequest -from pyramid.interfaces import IRootFactory -from pyramid.interfaces import IRouteRequest -from pyramid.interfaces import IRouter -from pyramid.interfaces import IRequestFactory -from pyramid.interfaces import IRoutesMapper -from pyramid.interfaces import ITraverser -from pyramid.interfaces import IView -from pyramid.interfaces import IViewClassifier -from pyramid.interfaces import ITweens - -from pyramid.events import ContextFound -from pyramid.events import NewRequest -from pyramid.events import NewResponse +from zope.interface import ( + implementer, + providedBy, + ) + +from pyramid.interfaces import ( + IDebugLogger, + IRequest, + IRootFactory, + IRouteRequest, + IRouter, + IRequestFactory, + IRoutesMapper, + ITraverser, + IView, + IViewClassifier, + ITweens, + ) + +from pyramid.events import ( + ContextFound, + NewRequest, + NewResponse, + ) + from pyramid.httpexceptions import HTTPNotFound from pyramid.request import Request from pyramid.threadlocal import manager -from pyramid.traversal import DefaultRootFactory -from pyramid.traversal import ResourceTreeTraverser + +from pyramid.traversal import ( + DefaultRootFactory, + ResourceTreeTraverser, + ) + from pyramid.tweens import excview_tween_factory @implementer(IRouter) diff --git a/pyramid/scripting.py b/pyramid/scripting.py index 47178c22e..f1dc24637 100644 --- a/pyramid/scripting.py +++ b/pyramid/scripting.py @@ -1,8 +1,12 @@ from pyramid.config import global_registries from pyramid.exceptions import ConfigurationError from pyramid.request import Request -from pyramid.interfaces import IRequestFactory -from pyramid.interfaces import IRootFactory + +from pyramid.interfaces import ( + IRequestFactory, + IRootFactory, + ) + from pyramid.threadlocal import manager as threadlocal_manager from pyramid.traversal import DefaultRootFactory diff --git a/pyramid/security.py b/pyramid/security.py index a552b613a..f29edd678 100644 --- a/pyramid/security.py +++ b/pyramid/security.py @@ -1,9 +1,11 @@ from zope.interface import providedBy -from pyramid.interfaces import IAuthenticationPolicy -from pyramid.interfaces import IAuthorizationPolicy -from pyramid.interfaces import ISecuredView -from pyramid.interfaces import IViewClassifier +from pyramid.interfaces import ( + IAuthenticationPolicy, + IAuthorizationPolicy, + ISecuredView, + IViewClassifier, + ) from pyramid.compat import map_ from pyramid.threadlocal import get_current_registry diff --git a/pyramid/session.py b/pyramid/session.py index 8d0c6c423..76b2b30b1 100644 --- a/pyramid/session.py +++ b/pyramid/session.py @@ -7,11 +7,14 @@ import os from zope.interface import implementer -from pyramid.compat import pickle -from pyramid.compat import PY3 -from pyramid.compat import text_ -from pyramid.compat import bytes_ -from pyramid.compat import native_ +from pyramid.compat import ( + pickle, + PY3, + text_, + bytes_, + native_, + ) + from pyramid.interfaces import ISession from pyramid.util import strings_differ diff --git a/pyramid/static.py b/pyramid/static.py index ba4ac0fa1..61ee67573 100644 --- a/pyramid/static.py +++ b/pyramid/static.py @@ -1,23 +1,34 @@ # -*- coding: utf-8 -*- import mimetypes import os -from os.path import normcase -from os.path import normpath -from os.path import join -from os.path import getmtime -from os.path import getsize -from os.path import isdir -from os.path import exists -from pkg_resources import resource_exists -from pkg_resources import resource_filename -from pkg_resources import resource_isdir + +from os.path import ( + normcase, + normpath, + join, + getmtime, + getsize, + isdir, + exists, + ) + +from pkg_resources import ( + resource_exists, + resource_filename, + resource_isdir, + ) from repoze.lru import lru_cache from pyramid.asset import resolve_asset_spec + from pyramid.compat import text_ -from pyramid.httpexceptions import HTTPNotFound -from pyramid.httpexceptions import HTTPMovedPermanently + +from pyramid.httpexceptions import ( + HTTPNotFound, + HTTPMovedPermanently, + ) + from pyramid.path import caller_package from pyramid.response import Response from pyramid.traversal import traversal_path_info diff --git a/pyramid/testing.py b/pyramid/testing.py index 0e27c301e..025730ac5 100644 --- a/pyramid/testing.py +++ b/pyramid/testing.py @@ -3,32 +3,49 @@ import os from zope.deprecation import deprecated -from zope.interface import implementer -from zope.interface import Interface -from zope.interface import alsoProvides - -from pyramid.interfaces import IRequest -from pyramid.interfaces import IResponseFactory -from pyramid.interfaces import ISecuredView -from pyramid.interfaces import IView -from pyramid.interfaces import IViewClassifier -from pyramid.interfaces import ISession - -from pyramid.compat import PY3 -from pyramid.compat import PYPY -from pyramid.compat import class_types +from zope.interface import ( + implementer, + Interface, + alsoProvides, + ) + +from pyramid.interfaces import ( + IRequest, + IResponseFactory, + ISecuredView, + IView, + IViewClassifier, + ISession, + ) + +from pyramid.compat import ( + PY3, + PYPY, + class_types, + ) + from pyramid.config import Configurator from pyramid.decorator import reify from pyramid.httpexceptions import HTTPForbidden from pyramid.response import Response from pyramid.registry import Registry -from pyramid.security import Authenticated -from pyramid.security import Everyone -from pyramid.security import has_permission -from pyramid.threadlocal import get_current_registry -from pyramid.threadlocal import manager -from pyramid.request import DeprecatedRequestMethodsMixin -from pyramid.request import CallbackMethodsMixin + +from pyramid.security import ( + Authenticated, + Everyone, + has_permission, + ) + +from pyramid.threadlocal import ( + get_current_registry, + manager, + ) + +from pyramid.request import ( + DeprecatedRequestMethodsMixin, + CallbackMethodsMixin, + ) + from pyramid.url import URLMethodsMixin _marker = object() diff --git a/pyramid/traversal.py b/pyramid/traversal.py index ee6b5fb7a..cd624fd30 100644 --- a/pyramid/traversal.py +++ b/pyramid/traversal.py @@ -5,20 +5,25 @@ from zope.interface.interfaces import IInterface from repoze.lru import lru_cache -from pyramid.interfaces import IContextURL -from pyramid.interfaces import IRequestFactory -from pyramid.interfaces import ITraverser -from pyramid.interfaces import VH_ROOT_KEY - -from pyramid.compat import PY3 -from pyramid.compat import native_ -from pyramid.compat import text_ -from pyramid.compat import bytes_ -from pyramid.compat import ascii_native_ -from pyramid.compat import text_type -from pyramid.compat import binary_type -from pyramid.compat import url_unquote_native -from pyramid.compat import is_nonstr_iter +from pyramid.interfaces import ( + IContextURL, + IRequestFactory, + ITraverser, + VH_ROOT_KEY, + ) + +from pyramid.compat import ( + PY3, + native_, + text_, + bytes_, + ascii_native_, + text_type, + binary_type, + url_unquote_native, + is_nonstr_iter, + ) + from pyramid.encode import url_quote from pyramid.exceptions import URLDecodeError from pyramid.location import lineage diff --git a/pyramid/tweens.py b/pyramid/tweens.py index 65d7c3919..73a95e1b8 100644 --- a/pyramid/tweens.py +++ b/pyramid/tweens.py @@ -1,6 +1,9 @@ import sys -from pyramid.interfaces import IExceptionViewClassifier -from pyramid.interfaces import IView + +from pyramid.interfaces import ( + IExceptionViewClassifier, + IView, + ) from zope.interface import providedBy diff --git a/pyramid/url.py b/pyramid/url.py index 617529955..3f934b364 100644 --- a/pyramid/url.py +++ b/pyramid/url.py @@ -4,17 +4,24 @@ import os from repoze.lru import lru_cache -from pyramid.interfaces import IContextURL -from pyramid.interfaces import IRoutesMapper -from pyramid.interfaces import IStaticURLInfo - -from pyramid.compat import native_ -from pyramid.compat import text_type +from pyramid.interfaces import ( + IContextURL, + IRoutesMapper, + IStaticURLInfo, + ) + +from pyramid.compat import ( + native_, + text_type, + ) from pyramid.encode import urlencode from pyramid.path import caller_package from pyramid.threadlocal import get_current_registry -from pyramid.traversal import TraversalContextURL -from pyramid.traversal import quote_path_segment + +from pyramid.traversal import ( + TraversalContextURL, + quote_path_segment, + ) class URLMethodsMixin(object): """ Request methods mixin for BaseRequest having to do with URL diff --git a/pyramid/urldispatch.py b/pyramid/urldispatch.py index 662615845..c7520b8d2 100644 --- a/pyramid/urldispatch.py +++ b/pyramid/urldispatch.py @@ -1,18 +1,26 @@ import re from zope.interface import implementer -from pyramid.interfaces import IRoutesMapper -from pyramid.interfaces import IRoute - -from pyramid.compat import native_ -from pyramid.compat import bytes_ -from pyramid.compat import text_type -from pyramid.compat import string_types -from pyramid.compat import is_nonstr_iter -from pyramid.compat import url_quote +from pyramid.interfaces import ( + IRoutesMapper, + IRoute, + ) + +from pyramid.compat import ( + native_, + bytes_, + text_type, + string_types, + is_nonstr_iter, + url_quote, + ) + from pyramid.exceptions import URLDecodeError -from pyramid.traversal import traversal_path_info -from pyramid.traversal import quote_path_segment + +from pyramid.traversal import ( + traversal_path_info, + quote_path_segment, + ) _marker = object() diff --git a/pyramid/view.py b/pyramid/view.py index f7d4d8945..da5a71c4c 100644 --- a/pyramid/view.py +++ b/pyramid/view.py @@ -3,13 +3,17 @@ import venusian from zope.interface import providedBy from zope.deprecation import deprecated -from pyramid.interfaces import IRoutesMapper -from pyramid.interfaces import IView -from pyramid.interfaces import IViewClassifier +from pyramid.interfaces import ( + IRoutesMapper, + IView, + IViewClassifier, + ) from pyramid.compat import map_ -from pyramid.httpexceptions import HTTPFound -from pyramid.httpexceptions import default_exceptionresponse_view +from pyramid.httpexceptions import ( + HTTPFound, + default_exceptionresponse_view, + ) from pyramid.path import caller_package from pyramid.static import static_view from pyramid.threadlocal import get_current_registry |
