Skip to content

Commit

Permalink
Merge pull request #3571 from slav0nic/py3features
Browse files Browse the repository at this point in the history
py3 features
  • Loading branch information
mmerickel committed Apr 23, 2020
2 parents 48cf45b + 6a24932 commit 4f57089
Show file tree
Hide file tree
Showing 104 changed files with 385 additions and 396 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTORS.txt
Expand Up @@ -350,3 +350,5 @@ Contributors
- Jan Likar, 2019/11/07

- Andrea Borghi, 2019/11/11

- Sergey Maranchuk, 2020/04/18
2 changes: 1 addition & 1 deletion docs/quick_tour/sqla_demo/tests/test_it.py
Expand Up @@ -43,7 +43,7 @@ def tearDown(self):
class TestMyViewSuccessCondition(BaseTest):

def setUp(self):
super(TestMyViewSuccessCondition, self).setUp()
super().setUp()
self.init_database()

from sqla_demo.models import MyModel
Expand Down
2 changes: 1 addition & 1 deletion docs/quick_tutorial/authorization/tutorial/resources.py
@@ -1,7 +1,7 @@
from pyramid.authorization import Allow, Everyone


class Root(object):
class Root:
__acl__ = [(Allow, Everyone, 'view'),
(Allow, 'group:editors', 'edit')]

Expand Down
2 changes: 1 addition & 1 deletion docs/quick_tutorial/databases/tutorial/models.py
Expand Up @@ -27,7 +27,7 @@ class Page(Base):
body = Column(Text)


class Root(object):
class Root:
__acl__ = [(Allow, Everyone, 'view'),
(Allow, 'group:editors', 'edit')]

Expand Down
2 changes: 1 addition & 1 deletion docs/quick_tutorial/databases/tutorial/views.py
Expand Up @@ -15,7 +15,7 @@ class WikiPage(colander.MappingSchema):
)


class WikiViews(object):
class WikiViews:
def __init__(self, request):
self.request = request

Expand Down
2 changes: 1 addition & 1 deletion docs/quick_tutorial/forms/tutorial/views.py
Expand Up @@ -18,7 +18,7 @@ class WikiPage(colander.MappingSchema):
)


class WikiViews(object):
class WikiViews:
def __init__(self, request):
self.request = request

Expand Down
2 changes: 1 addition & 1 deletion docs/quick_tutorial/more_view_classes/tutorial/views.py
Expand Up @@ -5,7 +5,7 @@


@view_defaults(route_name='hello')
class TutorialViews(object):
class TutorialViews:
def __init__(self, request):
self.request = request
self.view_name = 'TutorialViews'
Expand Down
2 changes: 1 addition & 1 deletion docs/quick_tutorial/retail_forms/tutorial/views.py
Expand Up @@ -18,7 +18,7 @@ class WikiPage(colander.MappingSchema):
)


class WikiViews(object):
class WikiViews:
def __init__(self, request):
self.request = request

Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/wiki2/src/authorization/tutorial/routes.py
Expand Up @@ -28,7 +28,7 @@ def new_page_factory(request):
raise HTTPSeeOther(location=next_url)
return NewPage(pagename)

class NewPage(object):
class NewPage:
def __init__(self, pagename):
self.pagename = pagename

Expand All @@ -45,7 +45,7 @@ def page_factory(request):
raise HTTPNotFound
return PageResource(page)

class PageResource(object):
class PageResource:
def __init__(self, page):
self.page = page

Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/wiki2/src/tests/tutorial/routes.py
Expand Up @@ -28,7 +28,7 @@ def new_page_factory(request):
raise HTTPSeeOther(location=next_url)
return NewPage(pagename)

class NewPage(object):
class NewPage:
def __init__(self, pagename):
self.pagename = pagename

Expand All @@ -45,7 +45,7 @@ def page_factory(request):
raise HTTPNotFound
return PageResource(page)

class PageResource(object):
class PageResource:
def __init__(self, page):
self.page = page

Expand Down
6 changes: 3 additions & 3 deletions src/pyramid/authentication.py
Expand Up @@ -23,7 +23,7 @@
VALID_TOKEN = re.compile(r"^[A-Za-z][A-Za-z0-9+_-]*$")


class CallbackAuthenticationPolicy(object):
class CallbackAuthenticationPolicy:
""" Abstract class """

debug = False
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/pyramid/authorization.py
Expand Up @@ -47,7 +47,7 @@ class ACLDenied(_ACLDenied):


@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.
Expand Down
8 changes: 4 additions & 4 deletions src/pyramid/config/actions.py
Expand Up @@ -15,7 +15,7 @@
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
Expand Down Expand Up @@ -155,7 +155,7 @@ def commit(self):


# 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 = []
Expand Down Expand Up @@ -330,7 +330,7 @@ def execute_actions(self, clear=True, introspector=None):
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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/pyramid/config/adapters.py
Expand Up @@ -7,7 +7,7 @@
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
Expand Down
8 changes: 4 additions & 4 deletions src/pyramid/config/assets.py
Expand Up @@ -85,7 +85,7 @@ def resource_listdir(self, resource_name):


@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)
Expand Down Expand Up @@ -206,7 +206,7 @@ def __call__(self, resource_name):
return self.source, ''


class PackageAssetSource(object):
class PackageAssetSource:
"""
An asset source relative to a package.
Expand Down Expand Up @@ -258,7 +258,7 @@ def listdir(self, resource_name):
return pkg_resources.resource_listdir(self.pkg_name, path)


class FSAssetSource(object):
class FSAssetSource:
"""
An asset source relative to a path in the filesystem.
Expand Down Expand Up @@ -306,7 +306,7 @@ def listdir(self, resource_name):
return os.listdir(path)


class AssetsConfiguratorMixin(object):
class AssetsConfiguratorMixin:
def _override(
self, package, path, override_source, PackageOverrides=PackageOverrides
):
Expand Down
4 changes: 2 additions & 2 deletions src/pyramid/config/factories.py
Expand Up @@ -15,7 +15,7 @@
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
Expand Down Expand Up @@ -257,7 +257,7 @@ def register():


@implementer(IRequestExtensions)
class _RequestExtensions(object):
class _RequestExtensions:
def __init__(self):
self.descriptors = {}
self.methods = {}
2 changes: 1 addition & 1 deletion src/pyramid/config/i18n.py
Expand Up @@ -4,7 +4,7 @@
from pyramid.path import AssetResolver


class I18NConfiguratorMixin(object):
class I18NConfiguratorMixin:
@action_method
def set_locale_negotiator(self, negotiator):
"""
Expand Down
11 changes: 6 additions & 5 deletions src/pyramid/config/predicates.py
Expand Up @@ -11,7 +11,7 @@
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:
Expand Down Expand Up @@ -52,7 +52,7 @@ def register():
) # must be registered early


class not_(object):
class not_:
"""
You can invert the meaning of any predicate value by wrapping it in a call
Expand Down Expand Up @@ -96,15 +96,15 @@ def __init__(self, value):
# over = before


class PredicateInfo(object):
class PredicateInfo:
def __init__(self, package, registry, settings, maybe_dotted):
self.package = package
self.registry = registry
self.settings = settings
self.maybe_dotted = maybe_dotted


class PredicateList(object):
class PredicateList:
def __init__(self):
self.sorter = TopologicalSorter()
self.last_added = None
Expand Down Expand Up @@ -205,7 +205,8 @@ def make(self, config, **kw):
score = 0
for bit in weights:
score = score | bit
order = (MAX_ORDER - score) / (len(preds) + 1)
order = (MAX_ORDER - score) // (len(preds) + 1)

return order, preds, phash.hexdigest()


Expand Down
2 changes: 1 addition & 1 deletion src/pyramid/config/rendering.py
Expand Up @@ -8,7 +8,7 @@
)


class RenderingConfiguratorMixin(object):
class RenderingConfiguratorMixin:
def add_default_renderers(self):
for name, renderer in DEFAULT_RENDERERS:
self.add_renderer(name, renderer)
Expand Down
2 changes: 1 addition & 1 deletion src/pyramid/config/routes.py
Expand Up @@ -17,7 +17,7 @@
from pyramid.util import as_sorted_tuple, is_nonstr_iter


class RoutesConfiguratorMixin(object):
class RoutesConfiguratorMixin:
@action_method
def add_route(
self,
Expand Down
4 changes: 2 additions & 2 deletions src/pyramid/config/security.py
Expand Up @@ -18,7 +18,7 @@
from pyramid.util import as_sorted_tuple


class SecurityConfiguratorMixin(object):
class SecurityConfiguratorMixin:
def add_default_security(self):
self.set_csrf_storage_policy(LegacySessionCSRFStoragePolicy())

Expand Down Expand Up @@ -371,7 +371,7 @@ def register():


@implementer(IDefaultCSRFOptions)
class DefaultCSRFOptions(object):
class DefaultCSRFOptions:
def __init__(
self,
require_csrf,
Expand Down
2 changes: 1 addition & 1 deletion src/pyramid/config/settings.py
Expand Up @@ -3,7 +3,7 @@
from pyramid.settings import asbool, aslist


class SettingsConfiguratorMixin(object):
class SettingsConfiguratorMixin:
def _set_settings(self, mapping):
if mapping is None:
mapping = {}
Expand Down
2 changes: 1 addition & 1 deletion src/pyramid/config/testing.py
Expand Up @@ -6,7 +6,7 @@
from pyramid.traversal import split_path_info


class TestingConfiguratorMixin(object):
class TestingConfiguratorMixin:
# testing API
def testing_securitypolicy(
self,
Expand Down
4 changes: 2 additions & 2 deletions src/pyramid/config/tweens.py
Expand Up @@ -11,7 +11,7 @@
)


class TweensConfiguratorMixin(object):
class TweensConfiguratorMixin:
def add_tween(self, tween_factory, under=None, over=None):
"""
.. versionadded:: 1.2
Expand Down Expand Up @@ -162,7 +162,7 @@ def register():


@implementer(ITweens)
class Tweens(object):
class Tweens:
def __init__(self):
self.sorter = TopologicalSorter(
default_before=None,
Expand Down

0 comments on commit 4f57089

Please sign in to comment.