diff options
| author | Éric Araujo <merwok@netwok.org> | 2020-05-07 14:29:20 -0400 |
|---|---|---|
| committer | Éric Araujo <merwok@netwok.org> | 2020-05-07 14:29:20 -0400 |
| commit | e1be97b3261661af865a0157f755fdc728b9f1f7 (patch) | |
| tree | 6094838c31cf413554a02ea8f56d36c8f6f82f24 /src | |
| parent | ce6685e1b4a6c240ce9382464b1e0055a33d2b4a (diff) | |
| parent | 1722cbb7bf40ce9d3793faf38f63e9f00d577613 (diff) | |
| download | pyramid-e1be97b3261661af865a0157f755fdc728b9f1f7.tar.gz pyramid-e1be97b3261661af865a0157f755fdc728b9f1f7.tar.bz2 pyramid-e1be97b3261661af865a0157f755fdc728b9f1f7.zip | |
merge master
Diffstat (limited to 'src')
| -rw-r--r-- | src/pyramid/config/actions.py | 4 | ||||
| -rw-r--r-- | src/pyramid/config/adapters.py | 2 | ||||
| -rw-r--r-- | src/pyramid/config/routes.py | 2 | ||||
| -rw-r--r-- | src/pyramid/config/views.py | 6 | ||||
| -rw-r--r-- | src/pyramid/csrf.py | 4 | ||||
| -rw-r--r-- | src/pyramid/i18n.py | 2 | ||||
| -rw-r--r-- | src/pyramid/predicates.py | 2 | ||||
| -rw-r--r-- | src/pyramid/renderers.py | 2 | ||||
| -rw-r--r-- | src/pyramid/scripts/proutes.py | 2 | ||||
| -rw-r--r-- | src/pyramid/static.py | 5 | ||||
| -rw-r--r-- | src/pyramid/urldispatch.py | 2 | ||||
| -rw-r--r-- | src/pyramid/viewderivers.py | 6 |
12 files changed, 18 insertions, 21 deletions
diff --git a/src/pyramid/config/actions.py b/src/pyramid/config/actions.py index 4003a6e3f..b19f35b9b 100644 --- a/src/pyramid/config/actions.py +++ b/src/pyramid/config/actions.py @@ -398,8 +398,8 @@ def resolveConflicts(actions, state=None): # error out if we went backward in order if state.min_order is not None and order < state.min_order: r = [ - 'Actions were added to order={0} after execution had moved ' - 'on to order={1}. Conflicting actions: '.format( + 'Actions were added to order={} after execution had moved ' + 'on to order={}. Conflicting actions: '.format( order, state.min_order ) ] diff --git a/src/pyramid/config/adapters.py b/src/pyramid/config/adapters.py index 6a8a0aa32..5035651cb 100644 --- a/src/pyramid/config/adapters.py +++ b/src/pyramid/config/adapters.py @@ -121,7 +121,7 @@ class AdaptersConfiguratorMixin: # with all args, the eventonly hack would not have been required. # At this point, though, using .subscriptions and manual execution # is not possible without badly breaking backwards compatibility. - if all((predicate(*arg) for predicate in predicates)): + if all(predicate(*arg) for predicate in predicates): return derived_subscriber(*arg) if hasattr(subscriber, '__name__'): diff --git a/src/pyramid/config/routes.py b/src/pyramid/config/routes.py index 41c7108df..4896ce0ea 100644 --- a/src/pyramid/config/routes.py +++ b/src/pyramid/config/routes.py @@ -389,7 +389,7 @@ class RoutesConfiguratorMixin: scheme = parsed.scheme else: scheme = request.scheme - kw['_app_url'] = '{0}://{1}'.format(scheme, parsed.netloc) + kw['_app_url'] = '{}://{}'.format(scheme, parsed.netloc) if original_pregenerator: elements, kw = original_pregenerator(request, elements, kw) diff --git a/src/pyramid/config/views.py b/src/pyramid/config/views.py index ebef7840d..170f8a028 100644 --- a/src/pyramid/config/views.py +++ b/src/pyramid/config/views.py @@ -196,7 +196,7 @@ def predicated_view(view, info): return view(context, request) def checker(context, request): - return all((predicate(context, request) for predicate in preds)) + return all(predicate(context, request) for predicate in preds) predicate_wrapper.__predicated__ = checker predicate_wrapper.__predicates__ = preds @@ -2322,7 +2322,7 @@ class StaticURLInfo: rawspec = None if pkg_name is not None: - pathspec = '{0}:{1}{2}'.format(pkg_name, pkg_subpath, subpath) + pathspec = '{}:{}{}'.format(pkg_name, pkg_subpath, subpath) overrides = registry.queryUtility(IPackageOverrides, name=pkg_name) if overrides is not None: resource_name = posixpath.join(pkg_subpath, subpath) @@ -2330,7 +2330,7 @@ class StaticURLInfo: for source, filtered_path in sources: rawspec = source.get_path(filtered_path) if hasattr(source, 'pkg_name'): - rawspec = '{0}:{1}'.format(source.pkg_name, rawspec) + rawspec = '{}:{}'.format(source.pkg_name, rawspec) break else: diff --git a/src/pyramid/csrf.py b/src/pyramid/csrf.py index 75ad1b734..4c3689714 100644 --- a/src/pyramid/csrf.py +++ b/src/pyramid/csrf.py @@ -335,7 +335,7 @@ def check_csrf_origin( request.registry.settings.get("pyramid.csrf_trusted_origins", []) ) - if request.host_port not in set(["80", "443"]): + if request.host_port not in {"80", "443"}: trusted_origins.append("{0.domain}:{0.host_port}".format(request)) else: trusted_origins.append(request.domain) @@ -360,6 +360,6 @@ def check_csrf_origin( if not any( is_same_domain(originp.netloc, host) for host in trusted_origins ): - return _fail("{0} does not match any trusted origins.".format(origin)) + return _fail("{} does not match any trusted origins.".format(origin)) return True diff --git a/src/pyramid/i18n.py b/src/pyramid/i18n.py index da8068f35..8c7d01d39 100644 --- a/src/pyramid/i18n.py +++ b/src/pyramid/i18n.py @@ -220,7 +220,7 @@ def get_localizer(request): return request.localizer -class Translations(gettext.GNUTranslations, object): +class Translations(gettext.GNUTranslations): """An extended translation catalog class (ripped off from Babel) """ DEFAULT_DOMAIN = 'messages' diff --git a/src/pyramid/predicates.py b/src/pyramid/predicates.py index 0c74ed6d5..576bbbce6 100644 --- a/src/pyramid/predicates.py +++ b/src/pyramid/predicates.py @@ -281,7 +281,7 @@ class EffectivePrincipalsPredicate: if is_nonstr_iter(val): self.val = set(val) else: - self.val = set((val,)) + self.val = {val} def text(self): return 'effective_principals = %s' % sorted(list(self.val)) diff --git a/src/pyramid/renderers.py b/src/pyramid/renderers.py index b17c7d64d..8da6270c3 100644 --- a/src/pyramid/renderers.py +++ b/src/pyramid/renderers.py @@ -387,7 +387,7 @@ class JSONP(JSON): ) ct = 'application/javascript' - body = '/**/{0}({1});'.format(callback, val) + body = '/**/{}({});'.format(callback, val) response = request.response if response.content_type == response.default_content_type: response.content_type = ct diff --git a/src/pyramid/scripts/proutes.py b/src/pyramid/scripts/proutes.py index 75db52182..64cd37727 100644 --- a/src/pyramid/scripts/proutes.py +++ b/src/pyramid/scripts/proutes.py @@ -82,7 +82,7 @@ def _get_request_methods(route_request_methods, view_request_methods): if has_methods and not request_methods: request_methods = '<route mismatch>' elif request_methods: - if excludes and request_methods == set([ANY_KEY]): + if excludes and request_methods == {ANY_KEY}: for exclude in excludes: request_methods.add('!%s' % exclude) diff --git a/src/pyramid/static.py b/src/pyramid/static.py index bf843f385..ccd6404da 100644 --- a/src/pyramid/static.py +++ b/src/pyramid/static.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from functools import lru_cache import json import mimetypes @@ -260,7 +259,7 @@ def _add_vary(response, option): response.vary = vary -_seps = set(['/', os.sep]) +_seps = {'/', os.sep} def _contains_slash(item): @@ -269,7 +268,7 @@ def _contains_slash(item): return True -_has_insecure_pathelement = set(['..', '.', '']).intersection +_has_insecure_pathelement = {'..', '.', ''}.intersection @lru_cache(1000) diff --git a/src/pyramid/urldispatch.py b/src/pyramid/urldispatch.py index 37bc70962..7aea1146b 100644 --- a/src/pyramid/urldispatch.py +++ b/src/pyramid/urldispatch.py @@ -85,7 +85,7 @@ class RoutesMapper: if match is not None: preds = route.predicates info = {'match': match, 'route': route} - if preds and not all((p(info, request) for p in preds)): + if preds and not all(p(info, request) for p in preds): continue return info diff --git a/src/pyramid/viewderivers.py b/src/pyramid/viewderivers.py index 7f15559b1..6461c4829 100644 --- a/src/pyramid/viewderivers.py +++ b/src/pyramid/viewderivers.py @@ -46,10 +46,8 @@ class DefaultViewMapper: def __call__(self, view): if is_unbound_method(view) and self.attr is None: raise ConfigurationError( - ( - 'Unbound method calls are not supported, please set the ' - 'class as your `view` and the method as your `attr`' - ) + 'Unbound method calls are not supported, please set the ' + 'class as your `view` and the method as your `attr`' ) if inspect.isclass(view): |
