diff options
| author | Sergey Maranchuk <slav0nic@python.su> | 2020-04-17 22:12:06 +0300 |
|---|---|---|
| committer | Sergey Maranchuk <slav0nic@python.su> | 2020-04-17 22:12:06 +0300 |
| commit | 6668e43d2d67db4574e08a9d54bd80eb105c1b28 (patch) | |
| tree | 10eda61b15ae53815af24af956267e2f632a46f7 /src | |
| parent | 48cf45b0a1ac04e701101fa18778164825edd429 (diff) | |
| download | pyramid-6668e43d2d67db4574e08a9d54bd80eb105c1b28.tar.gz pyramid-6668e43d2d67db4574e08a9d54bd80eb105c1b28.tar.bz2 pyramid-6668e43d2d67db4574e08a9d54bd80eb105c1b28.zip | |
inheriting from `object` not necessary in py3
Diffstat (limited to 'src')
45 files changed, 113 insertions, 113 deletions
diff --git a/src/pyramid/authentication.py b/src/pyramid/authentication.py index 3bfab78ee..47570d5fc 100644 --- a/src/pyramid/authentication.py +++ b/src/pyramid/authentication.py @@ -23,7 +23,7 @@ from pyramid.util import ( VALID_TOKEN = re.compile(r"^[A-Za-z][A-Za-z0-9+_-]*$") -class CallbackAuthenticationPolicy(object): +class CallbackAuthenticationPolicy: """ Abstract class """ debug = False @@ -660,7 +660,7 @@ def b64decode(v): # this class licensed under the MIT license (stolen from Paste) -class AuthTicket(object): +class AuthTicket: """ This class represents an authentication token. You must pass in the shared secret, the userid, and the IP address. Optionally you @@ -821,7 +821,7 @@ def encode_ip_timestamp(ip, timestamp): return bytes_(ip_chars + ts_chars) -class AuthTktCookieHelper(object): +class AuthTktCookieHelper: """ A helper class for security policies that obtains data from an "auth ticket" cookie. diff --git a/src/pyramid/authorization.py b/src/pyramid/authorization.py index 42171088f..f148fae32 100644 --- a/src/pyramid/authorization.py +++ b/src/pyramid/authorization.py @@ -47,7 +47,7 @@ DENY_ALL = (Deny, Everyone, ALL_PERMISSIONS) # api @implementer(IAuthorizationPolicy) -class ACLAuthorizationPolicy(object): +class ACLAuthorizationPolicy: """ An :term:`authorization policy` which consults an :term:`ACL` object attached to a :term:`context` to determine authorization information about a :term:`principal` or multiple principals. diff --git a/src/pyramid/config/actions.py b/src/pyramid/config/actions.py index 7a0ec500a..4003a6e3f 100644 --- a/src/pyramid/config/actions.py +++ b/src/pyramid/config/actions.py @@ -15,7 +15,7 @@ from pyramid.registry import undefer from pyramid.util import is_nonstr_iter, reraise -class ActionConfiguratorMixin(object): +class ActionConfiguratorMixin: @property def action_info(self): info = self.info # usually a ZCML action (ParserInfo) if self.info @@ -155,7 +155,7 @@ class ActionConfiguratorMixin(object): # this class is licensed under the ZPL (stolen from Zope) -class ActionState(object): +class ActionState: def __init__(self): # NB "actions" is an API, dep'd upon by pyramid_zcml's load_zcml func self.actions = [] @@ -330,7 +330,7 @@ class ActionState(object): self.actions = [] -class ConflictResolverState(object): +class ConflictResolverState: def __init__(self): # keep a set of resolved discriminators to test against to ensure # that a new action does not conflict with something already executed @@ -527,7 +527,7 @@ def expand_action_tuple( @implementer(IActionInfo) -class ActionInfo(object): +class ActionInfo: def __init__(self, file, line, function, src): self.file = file self.line = line diff --git a/src/pyramid/config/adapters.py b/src/pyramid/config/adapters.py index 867b5d33f..6a8a0aa32 100644 --- a/src/pyramid/config/adapters.py +++ b/src/pyramid/config/adapters.py @@ -7,7 +7,7 @@ from pyramid.interfaces import IResourceURL, IResponse, ITraverser from pyramid.util import takes_one_arg -class AdaptersConfiguratorMixin(object): +class AdaptersConfiguratorMixin: @action_method def add_subscriber(self, subscriber, iface=None, **predicates): """Add an event :term:`subscriber` for the event stream diff --git a/src/pyramid/config/assets.py b/src/pyramid/config/assets.py index 8257a34a7..0522f8d2d 100644 --- a/src/pyramid/config/assets.py +++ b/src/pyramid/config/assets.py @@ -85,7 +85,7 @@ class OverrideProvider(pkg_resources.DefaultProvider): @implementer(IPackageOverrides) -class PackageOverrides(object): +class PackageOverrides: # pkg_resources arg in kw args below for testing def __init__(self, package, pkg_resources=pkg_resources): loader = self._real_loader = getattr(package, '__loader__', None) @@ -206,7 +206,7 @@ class FileOverride: return self.source, '' -class PackageAssetSource(object): +class PackageAssetSource: """ An asset source relative to a package. @@ -258,7 +258,7 @@ class PackageAssetSource(object): return pkg_resources.resource_listdir(self.pkg_name, path) -class FSAssetSource(object): +class FSAssetSource: """ An asset source relative to a path in the filesystem. @@ -306,7 +306,7 @@ class FSAssetSource(object): return os.listdir(path) -class AssetsConfiguratorMixin(object): +class AssetsConfiguratorMixin: def _override( self, package, path, override_source, PackageOverrides=PackageOverrides ): diff --git a/src/pyramid/config/factories.py b/src/pyramid/config/factories.py index ad64f5aaf..9636d0bad 100644 --- a/src/pyramid/config/factories.py +++ b/src/pyramid/config/factories.py @@ -15,7 +15,7 @@ from pyramid.traversal import DefaultRootFactory from pyramid.util import InstancePropertyHelper, get_callable_name -class FactoriesConfiguratorMixin(object): +class FactoriesConfiguratorMixin: @action_method def set_root_factory(self, factory): """ Add a :term:`root factory` to the current configuration @@ -257,7 +257,7 @@ class FactoriesConfiguratorMixin(object): @implementer(IRequestExtensions) -class _RequestExtensions(object): +class _RequestExtensions: def __init__(self): self.descriptors = {} self.methods = {} diff --git a/src/pyramid/config/i18n.py b/src/pyramid/config/i18n.py index 3db0d1bf5..f4bea0d71 100644 --- a/src/pyramid/config/i18n.py +++ b/src/pyramid/config/i18n.py @@ -4,7 +4,7 @@ from pyramid.interfaces import ILocaleNegotiator, ITranslationDirectories from pyramid.path import AssetResolver -class I18NConfiguratorMixin(object): +class I18NConfiguratorMixin: @action_method def set_locale_negotiator(self, negotiator): """ diff --git a/src/pyramid/config/predicates.py b/src/pyramid/config/predicates.py index 2868ea580..4d0bdae60 100644 --- a/src/pyramid/config/predicates.py +++ b/src/pyramid/config/predicates.py @@ -11,7 +11,7 @@ MAX_ORDER = 1 << 30 DEFAULT_PHASH = md5().hexdigest() -class PredicateConfiguratorMixin(object): +class PredicateConfiguratorMixin: def get_predlist(self, name): predlist = self.registry.queryUtility(IPredicateList, name=name) if predlist is None: @@ -52,7 +52,7 @@ class PredicateConfiguratorMixin(object): ) # must be registered early -class not_(object): +class not_: """ You can invert the meaning of any predicate value by wrapping it in a call @@ -96,7 +96,7 @@ class not_(object): # over = before -class PredicateInfo(object): +class PredicateInfo: def __init__(self, package, registry, settings, maybe_dotted): self.package = package self.registry = registry @@ -104,7 +104,7 @@ class PredicateInfo(object): self.maybe_dotted = maybe_dotted -class PredicateList(object): +class PredicateList: def __init__(self): self.sorter = TopologicalSorter() self.last_added = None diff --git a/src/pyramid/config/rendering.py b/src/pyramid/config/rendering.py index c1d5e803e..c2e9e892c 100644 --- a/src/pyramid/config/rendering.py +++ b/src/pyramid/config/rendering.py @@ -8,7 +8,7 @@ DEFAULT_RENDERERS = ( ) -class RenderingConfiguratorMixin(object): +class RenderingConfiguratorMixin: def add_default_renderers(self): for name, renderer in DEFAULT_RENDERERS: self.add_renderer(name, renderer) diff --git a/src/pyramid/config/routes.py b/src/pyramid/config/routes.py index 6e416c384..7c78fbfa7 100644 --- a/src/pyramid/config/routes.py +++ b/src/pyramid/config/routes.py @@ -17,7 +17,7 @@ from pyramid.urldispatch import RoutesMapper from pyramid.util import as_sorted_tuple, is_nonstr_iter -class RoutesConfiguratorMixin(object): +class RoutesConfiguratorMixin: @action_method def add_route( self, diff --git a/src/pyramid/config/security.py b/src/pyramid/config/security.py index 182656e7c..a661bef96 100644 --- a/src/pyramid/config/security.py +++ b/src/pyramid/config/security.py @@ -18,7 +18,7 @@ from pyramid.security import LegacySecurityPolicy from pyramid.util import as_sorted_tuple -class SecurityConfiguratorMixin(object): +class SecurityConfiguratorMixin: def add_default_security(self): self.set_csrf_storage_policy(LegacySessionCSRFStoragePolicy()) @@ -371,7 +371,7 @@ class SecurityConfiguratorMixin(object): @implementer(IDefaultCSRFOptions) -class DefaultCSRFOptions(object): +class DefaultCSRFOptions: def __init__( self, require_csrf, diff --git a/src/pyramid/config/settings.py b/src/pyramid/config/settings.py index 07b469c29..d47743ec7 100644 --- a/src/pyramid/config/settings.py +++ b/src/pyramid/config/settings.py @@ -3,7 +3,7 @@ import os from pyramid.settings import asbool, aslist -class SettingsConfiguratorMixin(object): +class SettingsConfiguratorMixin: def _set_settings(self, mapping): if mapping is None: mapping = {} diff --git a/src/pyramid/config/testing.py b/src/pyramid/config/testing.py index ea3f92d17..75a2d1c64 100644 --- a/src/pyramid/config/testing.py +++ b/src/pyramid/config/testing.py @@ -6,7 +6,7 @@ from pyramid.renderers import RendererHelper from pyramid.traversal import split_path_info -class TestingConfiguratorMixin(object): +class TestingConfiguratorMixin: # testing API def testing_securitypolicy( self, diff --git a/src/pyramid/config/tweens.py b/src/pyramid/config/tweens.py index 02255a4b6..dbd6b14ed 100644 --- a/src/pyramid/config/tweens.py +++ b/src/pyramid/config/tweens.py @@ -11,7 +11,7 @@ from pyramid.util import ( ) -class TweensConfiguratorMixin(object): +class TweensConfiguratorMixin: def add_tween(self, tween_factory, under=None, over=None): """ .. versionadded:: 1.2 @@ -162,7 +162,7 @@ class TweensConfiguratorMixin(object): @implementer(ITweens) -class Tweens(object): +class Tweens: def __init__(self): self.sorter = TopologicalSorter( default_before=None, diff --git a/src/pyramid/config/views.py b/src/pyramid/config/views.py index e1026fb07..466c31f94 100644 --- a/src/pyramid/config/views.py +++ b/src/pyramid/config/views.py @@ -75,7 +75,7 @@ view_description = view_description # bw-compat @implementer(IMultiView) -class MultiView(object): +class MultiView: def __init__(self, name): self.name = name self.media_views = {} @@ -235,7 +235,7 @@ def combine_decorators(*decorators): return decorated -class ViewsConfiguratorMixin(object): +class ViewsConfiguratorMixin: @viewdefaults @action_method def add_view( @@ -2125,7 +2125,7 @@ def runtime_exc_view(view, excview): @implementer(IViewDeriverInfo) -class ViewDeriverInfo(object): +class ViewDeriverInfo: def __init__( self, view, registry, package, predicates, exception_only, options ): @@ -2142,7 +2142,7 @@ class ViewDeriverInfo(object): @implementer(IStaticURLInfo) -class StaticURLInfo(object): +class StaticURLInfo: def __init__(self): self.registrations = [] self.cache_busters = [] diff --git a/src/pyramid/config/zca.py b/src/pyramid/config/zca.py index 7bf637632..69b65a8eb 100644 --- a/src/pyramid/config/zca.py +++ b/src/pyramid/config/zca.py @@ -1,7 +1,7 @@ from pyramid.threadlocal import get_current_registry -class ZCAConfiguratorMixin(object): +class ZCAConfiguratorMixin: def hook_zca(self): """ Call :func:`zope.component.getSiteManager.sethook` with the argument :data:`pyramid.threadlocal.get_current_registry`, causing diff --git a/src/pyramid/csrf.py b/src/pyramid/csrf.py index 8e56c56fc..75ad1b734 100644 --- a/src/pyramid/csrf.py +++ b/src/pyramid/csrf.py @@ -16,7 +16,7 @@ from pyramid.util import ( @implementer(ICSRFStoragePolicy) -class LegacySessionCSRFStoragePolicy(object): +class LegacySessionCSRFStoragePolicy: """ A CSRF storage policy that defers control of CSRF storage to the session. @@ -49,7 +49,7 @@ class LegacySessionCSRFStoragePolicy(object): @implementer(ICSRFStoragePolicy) -class SessionCSRFStoragePolicy(object): +class SessionCSRFStoragePolicy: """ A CSRF storage policy that persists the CSRF token in the session. Note that using this CSRF implementation requires that @@ -92,7 +92,7 @@ class SessionCSRFStoragePolicy(object): @implementer(ICSRFStoragePolicy) -class CookieCSRFStoragePolicy(object): +class CookieCSRFStoragePolicy: """ An alternative CSRF implementation that stores its information in unauthenticated cookies, known as the 'Double Submit Cookie' method in the `OWASP CSRF guidelines diff --git a/src/pyramid/decorator.py b/src/pyramid/decorator.py index 525111ccd..82579182a 100644 --- a/src/pyramid/decorator.py +++ b/src/pyramid/decorator.py @@ -1,7 +1,7 @@ from functools import update_wrapper -class reify(object): +class reify: """ Use as a class method decorator. It operates almost exactly like the Python ``@property`` decorator, but it puts the result of the method it decorates into the instance dict after the first call, effectively @@ -13,7 +13,7 @@ class reify(object): >>> from pyramid.decorator import reify - >>> class Foo(object): + >>> class Foo: ... @reify ... def jammy(self): ... print('jammy called') diff --git a/src/pyramid/events.py b/src/pyramid/events.py index 8186cb327..86e7c3454 100644 --- a/src/pyramid/events.py +++ b/src/pyramid/events.py @@ -11,7 +11,7 @@ from pyramid.interfaces import ( ) -class subscriber(object): +class subscriber: """ Decorator activated via a :term:`scan` which treats the function being decorated as an event subscriber for the set of interfaces passed as ``*ifaces`` and the set of predicate terms passed as ``**predicates`` @@ -111,7 +111,7 @@ class subscriber(object): @implementer(INewRequest) -class NewRequest(object): +class NewRequest: """ An instance of this class is emitted as an :term:`event` whenever :app:`Pyramid` begins to process a new request. The event instance has an attribute, ``request``, which is a @@ -123,7 +123,7 @@ class NewRequest(object): @implementer(INewResponse) -class NewResponse(object): +class NewResponse: """ An instance of this class is emitted as an :term:`event` whenever any :app:`Pyramid` :term:`view` or :term:`exception view` returns a :term:`response`. @@ -161,7 +161,7 @@ class NewResponse(object): @implementer(IBeforeTraversal) -class BeforeTraversal(object): +class BeforeTraversal: """ An instance of this class is emitted as an :term:`event` after the :app:`Pyramid` :term:`router` has attempted to find a :term:`route` object @@ -182,7 +182,7 @@ class BeforeTraversal(object): @implementer(IContextFound) -class ContextFound(object): +class ContextFound: """ An instance of this class is emitted as an :term:`event` after the :app:`Pyramid` :term:`router` finds a :term:`context` object (after it performs traversal) but before any view code is @@ -211,7 +211,7 @@ AfterTraversal = ContextFound # b/c as of 1.0 @implementer(IApplicationCreated) -class ApplicationCreated(object): +class ApplicationCreated: """ An instance of this class is emitted as an :term:`event` when the :meth:`pyramid.config.Configurator.make_wsgi_app` is called. The instance has an attribute, ``app``, which is an diff --git a/src/pyramid/httpexceptions.py b/src/pyramid/httpexceptions.py index dcf61b9e5..f840d8344 100644 --- a/src/pyramid/httpexceptions.py +++ b/src/pyramid/httpexceptions.py @@ -280,7 +280,7 @@ ${body}''' if comment: html_comment = escape(comment) - class JsonPageTemplate(object): + class JsonPageTemplate: def __init__(self, excobj): self.excobj = excobj diff --git a/src/pyramid/i18n.py b/src/pyramid/i18n.py index b9e00b54b..da8068f35 100644 --- a/src/pyramid/i18n.py +++ b/src/pyramid/i18n.py @@ -18,7 +18,7 @@ TranslationStringFactory = TranslationStringFactory # PyFlakes DEFAULT_PLURAL = lambda n: int(n != 1) -class Localizer(object): +class Localizer: """ An object providing translation and pluralizations related to the current request's locale name. A @@ -366,7 +366,7 @@ class Translations(gettext.GNUTranslations, object): return self._domains.get(domain, self).ngettext(singular, plural, num) -class LocalizerRequestMixin(object): +class LocalizerRequestMixin: @reify def localizer(self): """ Convenience property to return a localizer """ diff --git a/src/pyramid/path.py b/src/pyramid/path.py index e3f9c8c49..6d387f55b 100644 --- a/src/pyramid/path.py +++ b/src/pyramid/path.py @@ -80,7 +80,7 @@ def package_path(package): return prefix -class _CALLER_PACKAGE(object): +class _CALLER_PACKAGE: def __repr__(self): # pragma: no cover (for docs) return 'pyramid.path.CALLER_PACKAGE' @@ -88,7 +88,7 @@ class _CALLER_PACKAGE(object): CALLER_PACKAGE = _CALLER_PACKAGE() -class Resolver(object): +class Resolver: def __init__(self, package=CALLER_PACKAGE): if package in (None, CALLER_PACKAGE): self.package = package @@ -393,7 +393,7 @@ class DottedNameResolver(Resolver): @implementer(IAssetDescriptor) -class PkgResourcesAssetDescriptor(object): +class PkgResourcesAssetDescriptor: pkg_resources = pkg_resources def __init__(self, pkg_name, path): @@ -422,7 +422,7 @@ class PkgResourcesAssetDescriptor(object): @implementer(IAssetDescriptor) -class FSAssetDescriptor(object): +class FSAssetDescriptor: def __init__(self, path): self.path = os.path.abspath(path) diff --git a/src/pyramid/predicates.py b/src/pyramid/predicates.py index e0bd189c5..f51ea3b21 100644 --- a/src/pyramid/predicates.py +++ b/src/pyramid/predicates.py @@ -12,7 +12,7 @@ from pyramid.util import as_sorted_tuple, is_nonstr_iter, object_description _marker = object() -class XHRPredicate(object): +class XHRPredicate: def __init__(self, val, config): self.val = bool(val) @@ -25,7 +25,7 @@ class XHRPredicate(object): return bool(request.is_xhr) is self.val -class RequestMethodPredicate(object): +class RequestMethodPredicate: def __init__(self, val, config): request_method = as_sorted_tuple(val) if 'GET' in request_method and 'HEAD' not in request_method: @@ -42,7 +42,7 @@ class RequestMethodPredicate(object): return request.method in self.val -class PathInfoPredicate(object): +class PathInfoPredicate: def __init__(self, val, config): self.orig = val try: @@ -60,7 +60,7 @@ class PathInfoPredicate(object): return self.val.match(request.upath_info) is not None -class RequestParamPredicate(object): +class RequestParamPredicate: def __init__(self, val, config): val = as_sorted_tuple(val) reqs = [] @@ -96,7 +96,7 @@ class RequestParamPredicate(object): return True -class HeaderPredicate(object): +class HeaderPredicate: def __init__(self, val, config): name = val v = None @@ -127,7 +127,7 @@ class HeaderPredicate(object): return self.val.match(val) is not None -class AcceptPredicate(object): +class AcceptPredicate: def __init__(self, values, config): if not is_nonstr_iter(values): values = (values,) @@ -142,7 +142,7 @@ class AcceptPredicate(object): return bool(request.accept.acceptable_offers(self.values)) -class ContainmentPredicate(object): +class ContainmentPredicate: def __init__(self, val, config): self.val = config.maybe_dotted(val) @@ -156,7 +156,7 @@ class ContainmentPredicate(object): return find_interface(ctx, self.val) is not None -class RequestTypePredicate(object): +class RequestTypePredicate: def __init__(self, val, config): self.val = val @@ -169,7 +169,7 @@ class RequestTypePredicate(object): return self.val.providedBy(request) -class MatchParamPredicate(object): +class MatchParamPredicate: def __init__(self, val, config): val = as_sorted_tuple(val) self.val = val @@ -193,7 +193,7 @@ class MatchParamPredicate(object): return True -class CustomPredicate(object): +class CustomPredicate: def __init__(self, func, config): self.func = func @@ -217,7 +217,7 @@ class CustomPredicate(object): return self.func(context, request) -class TraversePredicate(object): +class TraversePredicate: # Can only be used as a *route* "predicate"; it adds 'traverse' to the # matchdict if it's specified in the routing args. This causes the # ResourceTreeTraverser to use the resolved traverse pattern as the @@ -247,7 +247,7 @@ class TraversePredicate(object): return True -class PhysicalPathPredicate(object): +class PhysicalPathPredicate: def __init__(self, val, config): if is_nonstr_iter(val): self.val = tuple(val) @@ -266,7 +266,7 @@ class PhysicalPathPredicate(object): return False -class EffectivePrincipalsPredicate(object): +class EffectivePrincipalsPredicate: def __init__(self, val, config): if is_nonstr_iter(val): self.val = set(val) @@ -287,7 +287,7 @@ class EffectivePrincipalsPredicate(object): return False -class Notted(object): +class Notted: def __init__(self, predicate): self.predicate = predicate diff --git a/src/pyramid/registry.py b/src/pyramid/registry.py index 680669602..37a39fedb 100644 --- a/src/pyramid/registry.py +++ b/src/pyramid/registry.py @@ -115,7 +115,7 @@ class Registry(Components, dict): @implementer(IIntrospector) -class Introspector(object): +class Introspector: def __init__(self): self._refs = {} self._categories = {} @@ -266,7 +266,7 @@ class Introspectable(dict): ) -class Deferred(object): +class Deferred: """ Can be used by a third-party configuration extender to wrap a :term:`discriminator` during configuration if an immediately hashable discriminator cannot be computed because it relies on unresolved values. diff --git a/src/pyramid/renderers.py b/src/pyramid/renderers.py index 9f6c50936..b17c7d64d 100644 --- a/src/pyramid/renderers.py +++ b/src/pyramid/renderers.py @@ -177,7 +177,7 @@ def string_renderer_factory(info): _marker = object() -class JSON(object): +class JSON: """ Renderer that returns a JSON-encoded string. Configure a custom JSON renderer using the @@ -243,7 +243,7 @@ class JSON(object): .. code-block:: python - class Foo(object): + class Foo: x = 5 def foo_adapter(obj, request): @@ -397,7 +397,7 @@ class JSONP(JSON): @implementer(IRendererInfo) -class RendererHelper(object): +class RendererHelper: def __init__(self, name=None, package=None, registry=None): if name and '.' in name: rtype = os.path.splitext(name)[1] diff --git a/src/pyramid/request.py b/src/pyramid/request.py index 62bd22589..ef0efaa64 100644 --- a/src/pyramid/request.py +++ b/src/pyramid/request.py @@ -26,11 +26,11 @@ from pyramid.util import ( from pyramid.view import ViewMethodsMixin -class TemplateContext(object): +class TemplateContext: pass -class CallbackMethodsMixin(object): +class CallbackMethodsMixin: @reify def finished_callbacks(self): return deque() diff --git a/src/pyramid/response.py b/src/pyramid/response.py index 03090941d..cb82b5b94 100644 --- a/src/pyramid/response.py +++ b/src/pyramid/response.py @@ -69,7 +69,7 @@ class FileResponse(Response): self.cache_expires = cache_max_age -class FileIter(object): +class FileIter: """ A fixed-block-size iterator for use as a WSGI app_iter. ``file`` is a Python file pointer (or at least an object with a ``read`` @@ -95,7 +95,7 @@ class FileIter(object): self.file.close() -class response_adapter(object): +class response_adapter: """ Decorator activated via a :term:`scan` which treats the function being decorated as a :term:`response adapter` for the set of types or interfaces passed as ``*types_or_ifaces`` to the decorator constructor. diff --git a/src/pyramid/router.py b/src/pyramid/router.py index 178c68e87..644a6a395 100644 --- a/src/pyramid/router.py +++ b/src/pyramid/router.py @@ -27,7 +27,7 @@ from pyramid.view import _call_view @implementer(IRouter) -class Router(object): +class Router: debug_notfound = False debug_routematch = False diff --git a/src/pyramid/scripts/prequest.py b/src/pyramid/scripts/prequest.py index b828c9c30..32d9bc250 100644 --- a/src/pyramid/scripts/prequest.py +++ b/src/pyramid/scripts/prequest.py @@ -13,7 +13,7 @@ def main(argv=sys.argv, quiet=False): return command.run() -class PRequestCommand(object): +class PRequestCommand: description = """\ Submit a HTTP request to a web application. diff --git a/src/pyramid/scripts/proutes.py b/src/pyramid/scripts/proutes.py index ee3cb0f04..75db52182 100644 --- a/src/pyramid/scripts/proutes.py +++ b/src/pyramid/scripts/proutes.py @@ -211,7 +211,7 @@ def get_route_data(route, registry): return final_routes -class PRoutesCommand(object): +class PRoutesCommand: description = """\ Print all URL dispatch routes used by a Pyramid application in the order in which they are evaluated. Each route includes the name of the diff --git a/src/pyramid/scripts/pserve.py b/src/pyramid/scripts/pserve.py index 6e8d0b599..ce0c454e6 100644 --- a/src/pyramid/scripts/pserve.py +++ b/src/pyramid/scripts/pserve.py @@ -30,7 +30,7 @@ def main(argv=sys.argv, quiet=False, original_ignore_files=None): return command.run() -class PServeCommand(object): +class PServeCommand: description = """\ This command serves a web application that uses a PasteDeploy diff --git a/src/pyramid/scripts/pshell.py b/src/pyramid/scripts/pshell.py index 2f2939e99..1d345ed31 100644 --- a/src/pyramid/scripts/pshell.py +++ b/src/pyramid/scripts/pshell.py @@ -24,7 +24,7 @@ def python_shell_runner(env, help, interact=interact): interact(banner, local=env) -class PShellCommand(object): +class PShellCommand: description = """\ Open an interactive shell with a Pyramid app loaded. This command accepts one positional argument named "config_uri" which specifies the diff --git a/src/pyramid/scripts/ptweens.py b/src/pyramid/scripts/ptweens.py index f90e0967f..494575ff7 100644 --- a/src/pyramid/scripts/ptweens.py +++ b/src/pyramid/scripts/ptweens.py @@ -13,7 +13,7 @@ def main(argv=sys.argv, quiet=False): return command.run() -class PTweensCommand(object): +class PTweensCommand: description = """\ Print all implicit and explicit tween objects used by a Pyramid application. The handler output includes whether the system is using an diff --git a/src/pyramid/scripts/pviews.py b/src/pyramid/scripts/pviews.py index ac7725c99..db7f10b20 100644 --- a/src/pyramid/scripts/pviews.py +++ b/src/pyramid/scripts/pviews.py @@ -14,7 +14,7 @@ def main(argv=sys.argv, quiet=False): return command.run() -class PViewsCommand(object): +class PViewsCommand: description = """\ Print, for a given URL, the views that might match. Underneath each potentially matching route, list the predicates required. Underneath @@ -102,7 +102,7 @@ class PViewsCommand(object): adapters = registry.adapters @implementer(IMultiView) - class RoutesMultiView(object): + class RoutesMultiView: def __init__(self, infos, context_iface, root_factory, request): self.views = [] for info in infos: diff --git a/src/pyramid/security.py b/src/pyramid/security.py index 657af045a..58bc72116 100644 --- a/src/pyramid/security.py +++ b/src/pyramid/security.py @@ -272,7 +272,7 @@ class SecurityAPIMixin: return policy.permits(self, context, permission) -class AuthenticationAPIMixin(object): +class AuthenticationAPIMixin: """ Mixin for Request class providing compatibility properties. """ @property @@ -390,7 +390,7 @@ Allow = 'Allow' Deny = 'Deny' -class AllPermissionsList(object): +class AllPermissionsList: """ Stand in 'permission list' to represent all permissions """ def __iter__(self): diff --git a/src/pyramid/session.py b/src/pyramid/session.py index e683fd77a..5d5f3b939 100644 --- a/src/pyramid/session.py +++ b/src/pyramid/session.py @@ -39,7 +39,7 @@ def manage_changed(wrapped): return changed -class PickleSerializer(object): +class PickleSerializer: """ .. deprecated:: 2.0 diff --git a/src/pyramid/static.py b/src/pyramid/static.py index d71fa750b..e555fc1e2 100644 --- a/src/pyramid/static.py +++ b/src/pyramid/static.py @@ -13,7 +13,7 @@ from pyramid.response import FileResponse, _guess_type from pyramid.traversal import traversal_path_info -class static_view(object): +class static_view: """ An instance of this class is a callable which can act as a :app:`Pyramid` :term:`view callable`; this view will serve static files from a directory on disk based on the ``root_dir`` @@ -285,7 +285,7 @@ def _secure_path(path_tuple): return encoded -class QueryStringCacheBuster(object): +class QueryStringCacheBuster: """ An implementation of :class:`~pyramid.interfaces.ICacheBuster` which adds a token for cache busting in the query string of an asset URL. @@ -334,7 +334,7 @@ class QueryStringConstantCacheBuster(QueryStringCacheBuster): return self._token -class ManifestCacheBuster(object): +class ManifestCacheBuster: """ An implementation of :class:`~pyramid.interfaces.ICacheBuster` which uses a supplied manifest file to map an asset path to a cache-busted diff --git a/src/pyramid/testing.py b/src/pyramid/testing.py index 405be7d21..7c54d7428 100644 --- a/src/pyramid/testing.py +++ b/src/pyramid/testing.py @@ -21,7 +21,7 @@ from pyramid.view import ViewMethodsMixin _marker = object() -class DummyRootFactory(object): +class DummyRootFactory: __parent__ = None __name__ = None @@ -30,7 +30,7 @@ class DummyRootFactory(object): self.__dict__.update(request['bfg.routes.matchdict']) -class DummySecurityPolicy(object): +class DummySecurityPolicy: """ A standin for a :term:`security policy`.""" def __init__( @@ -69,7 +69,7 @@ class DummySecurityPolicy(object): return self.forget_result -class DummyTemplateRenderer(object): +class DummyTemplateRenderer: """ An instance of this class is returned from :meth:`pyramid.config.Configurator.testing_add_renderer`. It has a @@ -555,7 +555,7 @@ def cleanUp(*arg, **kw): return setUp(*arg, **kw) -class DummyRendererFactory(object): +class DummyRendererFactory: """ Registered by :meth:`pyramid.config.Configurator.testing_add_renderer` as a dummy renderer factory. The indecision about what to use as a @@ -592,7 +592,7 @@ class DummyRendererFactory(object): return renderer -class MockTemplate(object): +class MockTemplate: def __init__(self, response): self._received = {} self.response = response diff --git a/src/pyramid/threadlocal.py b/src/pyramid/threadlocal.py index 24bc0ec33..473bacfc8 100644 --- a/src/pyramid/threadlocal.py +++ b/src/pyramid/threadlocal.py @@ -71,7 +71,7 @@ def get_current_registry( return manager.get()['registry'] -class RequestContext(object): +class RequestContext: def __init__(self, request): self.request = request diff --git a/src/pyramid/traversal.py b/src/pyramid/traversal.py index cfa29f279..39cfc4f2e 100644 --- a/src/pyramid/traversal.py +++ b/src/pyramid/traversal.py @@ -580,7 +580,7 @@ def quote_path_segment(segment, safe=PATH_SEGMENT_SAFE): @implementer(ITraverser) -class ResourceTreeTraverser(object): +class ResourceTreeTraverser: """ A resource tree traverser that should be used (for speed) when every resource in the tree supplies a ``__name__`` and ``__parent__`` attribute (ie. every resource in the tree is @@ -711,7 +711,7 @@ ModelGraphTraverser = ( @implementer(IResourceURL) -class ResourceURL(object): +class ResourceURL: VH_ROOT_KEY = VH_ROOT_KEY def __init__(self, resource, request): diff --git a/src/pyramid/url.py b/src/pyramid/url.py index b79604d96..438400ae8 100644 --- a/src/pyramid/url.py +++ b/src/pyramid/url.py @@ -56,7 +56,7 @@ def parse_url_overrides(request, kw): return app_url, qs, frag -class URLMethodsMixin(object): +class URLMethodsMixin: """ Request methods mixin for BaseRequest having to do with URL generation """ diff --git a/src/pyramid/urldispatch.py b/src/pyramid/urldispatch.py index 920aeffb5..37bc70962 100644 --- a/src/pyramid/urldispatch.py +++ b/src/pyramid/urldispatch.py @@ -10,7 +10,7 @@ _marker = object() @implementer(IRoute) -class Route(object): +class Route: def __init__( self, name, pattern, factory=None, predicates=(), pregenerator=None ): @@ -24,7 +24,7 @@ class Route(object): @implementer(IRoutesMapper) -class RoutesMapper(object): +class RoutesMapper: def __init__(self): self.routelist = [] self.static_routes = [] diff --git a/src/pyramid/util.py b/src/pyramid/util.py index bc589b36f..4a92986ae 100644 --- a/src/pyramid/util.py +++ b/src/pyramid/util.py @@ -73,7 +73,7 @@ def as_sorted_tuple(val): return val -class SettableProperty(object): +class SettableProperty: # this is just like reify but does not store the computed result on # the class such that subsequent invocations invoke the callable again def __init__(self, wrapped): @@ -86,7 +86,7 @@ class SettableProperty(object): return self.wrapped(obj) -class InstancePropertyHelper(object): +class InstancePropertyHelper: """A helper object for assigning properties and descriptors to instances. It is not normally possible to do this because descriptors must be defined on the class itself. @@ -187,7 +187,7 @@ class InstancePropertyHelper(object): self.apply_properties(target, self.properties) -class InstancePropertyMixin(object): +class InstancePropertyMixin: """ Mixin that will allow an instance to add properties at run-time as if they had been defined via @property or @reify on the class itself. @@ -250,7 +250,7 @@ class InstancePropertyMixin(object): ) -class WeakOrderedSet(object): +class WeakOrderedSet: """ Maintain a set of items. Each item is stored as a weakref to avoid extending their lifetime. @@ -410,7 +410,7 @@ def shortrepr(object, closer): return r -class Sentinel(object): +class Sentinel: def __init__(self, repr): self.repr = repr @@ -422,7 +422,7 @@ FIRST = Sentinel('FIRST') LAST = Sentinel('LAST') -class TopologicalSorter(object): +class TopologicalSorter: """ A utility class which can be used to perform topological sorts against tuple-like data.""" @@ -695,7 +695,7 @@ def takes_one_arg(callee, attr=None, argname=None): return False -class SimpleSerializer(object): +class SimpleSerializer: def loads(self, bstruct): return text_(bstruct) diff --git a/src/pyramid/view.py b/src/pyramid/view.py index 3253924da..3911ad375 100644 --- a/src/pyramid/view.py +++ b/src/pyramid/view.py @@ -135,7 +135,7 @@ def render_view(context, request, name='', secure=True): return b''.join(iterable) -class view_config(object): +class view_config: """ A function, class or method :term:`decorator` which allows a developer to create view registrations nearer to a :term:`view callable` definition than use :term:`imperative @@ -261,7 +261,7 @@ def view_defaults(**settings): return wrap -class AppendSlashNotFoundViewFactory(object): +class AppendSlashNotFoundViewFactory: """ There can only be one :term:`Not Found view` in any :app:`Pyramid` application. Even if you use :func:`pyramid.view.append_slash_notfound_view` as the Not @@ -348,7 +348,7 @@ view as the Not Found view:: """ -class notfound_view_config(object): +class notfound_view_config: """ .. versionadded:: 1.3 @@ -444,7 +444,7 @@ class notfound_view_config(object): return wrapped -class forbidden_view_config(object): +class forbidden_view_config: """ .. versionadded:: 1.3 @@ -508,7 +508,7 @@ class forbidden_view_config(object): return wrapped -class exception_view_config(object): +class exception_view_config: """ .. versionadded:: 1.8 @@ -666,7 +666,7 @@ def _call_view( return response -class ViewMethodsMixin(object): +class ViewMethodsMixin: """ Request methods mixin for BaseRequest having to do with executing views """ diff --git a/src/pyramid/viewderivers.py b/src/pyramid/viewderivers.py index d91295143..7f15559b1 100644 --- a/src/pyramid/viewderivers.py +++ b/src/pyramid/viewderivers.py @@ -39,7 +39,7 @@ def requestonly(view, attr=None): @implementer(IViewMapper) @provider(IViewMapperFactory) -class DefaultViewMapper(object): +class DefaultViewMapper: def __init__(self, **kw): self.attr = kw.get('attr') |
