Skip to content

Commit

Permalink
Drop support for Python 2.7 up to 3.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed Feb 10, 2023
1 parent 21e7d43 commit 11ddbdf
Show file tree
Hide file tree
Showing 22 changed files with 61 additions and 98 deletions.
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#
##############################################################################
# This package is developed by the Zope Toolkit project, documented here:
# http://docs.zope.org/zopetoolkit
# https://zopetoolkit.readthedocs.io/
# When developing and releasing this package, please follow the documented
# Zope Toolkit policies as described by this documentation.
##############################################################################
Expand All @@ -33,7 +33,7 @@ def read(*rnames):
name='zope.securitypolicy',
version='5.0.dev0',
author='Zope Foundation and Contributors',
author_email='zope-dev@zope.org',
author_email='zope-dev@zope.dev',
description='Default security policy for Zope3',
long_description=(
read('README.rst')
Expand Down Expand Up @@ -66,6 +66,7 @@ def read(*rnames):
packages=find_packages('src'),
package_dir={'': 'src'},
namespace_packages=['zope'],
python_requires='>=3.7',
install_requires=[
'persistent',
'setuptools',
Expand Down
2 changes: 1 addition & 1 deletion src/zope/securitypolicy/grantinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@


@implementer(IGrantInfo)
class AnnotationGrantInfo(object):
class AnnotationGrantInfo:

def __init__(self, context):
self._context = context
Expand Down
12 changes: 6 additions & 6 deletions src/zope/securitypolicy/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ class IRole(Interface):
"""A role object."""

id = TextLine(
title=u"Id",
description=u"Id as which this role will be known and used.",
title="Id",
description="Id as which this role will be known and used.",
readonly=True,
required=True)

title = TextLine(
title=u"Title",
description=u"Provides a title for the role.",
title="Title",
description="Provides a title for the role.",
required=True)

description = Text(
title=u"Description",
description=u"Provides a description for the role.",
title="Description",
description="Provides a description for the role.",
required=False)


Expand Down
18 changes: 9 additions & 9 deletions src/zope/securitypolicy/metadirectives.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ class ISecurityObjectAssignmentDirective(Interface):
"""Abstract schema for security policy declarations."""

principal = Id(
title=u"Principal",
description=u"Specifies the Principal to be mapped.",
title="Principal",
description="Specifies the Principal to be mapped.",
required=False)

role = Id(
title=u"Role",
description=u"Specifies the Role to be mapped.",
title="Role",
description="Specifies the Role to be mapped.",
required=False)


Expand All @@ -43,15 +43,15 @@ class ISpecificSecurityObjectAssignmentDirective(
"""Abstract schema to set up one or more permissions"""

permission = Permission(
title=u"Permission",
description=u"Specifies the Permission to be mapped.",
title="Permission",
description="Specifies the Permission to be mapped.",
required=False)

permissions = Tokens(
title=u"Permissions",
title="Permissions",
description=(
u"Specifies a whitespace-separated list of permissions to be "
u"mapped."),
"Specifies a whitespace-separated list of permissions to be "
"mapped."),
value_type=Permission(),
required=False)

Expand Down
6 changes: 3 additions & 3 deletions src/zope/securitypolicy/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@


@implementer(IRole)
class Role(object):
class Role:

def __init__(self, id, title, description=""):
self.id = id
Expand Down Expand Up @@ -58,7 +58,7 @@ def setIdOnActivation(role, event):
>>> role1 = LocalRole('Role 1', 'A first role')
>>> role1.id
u'<role not activated>'
'<role not activated>'
>>> import zope.interface.interfaces
>>> event = zope.interface.interfaces.Registered(
... Registration(role1, 'role1'))
Expand Down Expand Up @@ -96,7 +96,7 @@ def unsetIdOnDeactivation(role, event):
>>> unsetIdOnDeactivation(role1, event)
>>> role1.id
u'<role not activated>'
'<role not activated>'
"""
role.id = NULL_ID

Expand Down
2 changes: 1 addition & 1 deletion src/zope/securitypolicy/securitymap.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from zope.security.management import queryInteraction


class SecurityMap(object):
class SecurityMap:

def __init__(self):
self._clear()
Expand Down
2 changes: 1 addition & 1 deletion src/zope/securitypolicy/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"""


class PermissionSetting(object):
class PermissionSetting:
"""PermissionSettings should be considered as immutable.
They can be compared by identity. They are identified by
their name.
Expand Down
27 changes: 0 additions & 27 deletions src/zope/securitypolicy/testing.py

This file was deleted.

8 changes: 4 additions & 4 deletions src/zope/securitypolicy/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


@implementer(IAuthentication)
class DummyPrincipalRegistry(object):
class DummyPrincipalRegistry:
"""Dummy principal registry that only implements getPrincipal
and definePrincipal method that are needed for securitypolicy tests."""

Expand All @@ -30,7 +30,7 @@ def getPrincipal(self, id):
raise PrincipalLookupError(id)
return self._principals[id]

def definePrincipal(self, id, title=u'', description=u''):
def definePrincipal(self, id, title='', description=''):
p = DummyPrincipal(id, title, description)
self._principals[id] = p
return p
Expand All @@ -40,10 +40,10 @@ def definePrincipal(self, id, title=u'', description=u''):


@implementer(IPrincipal)
class DummyPrincipal(object):
class DummyPrincipal:
"""Very simple principal implementation"""

def __init__(self, id, title=u'', description=u''):
def __init__(self, id, title='', description=''):
self.id = id
self.title = title
self.description = description
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@


@implementer(IAttributeAnnotatable)
class Manageable(object):
class Manageable:
pass


class Test(PlacelessSetup, unittest.TestCase):

def setUp(self):
super(Test, self).setUp()
super().setUp()
provideAdapter(AttributeAnnotations)

def _make_principal(self, id=None, title=None):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


@implementer(IAttributeAnnotatable)
class Manageable(object):
class Manageable:
pass


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@


@implementer(IAttributeAnnotatable)
class Manageable(object):
class Manageable:
pass


Expand Down
2 changes: 1 addition & 1 deletion src/zope/securitypolicy/tests/test_grantinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

# pylint:disable=protected-access

class Manager(object):
class Manager:

def __init__(self):
self._bycol = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def definePermission(id, title=None, description=None):
class Test(PlacelessSetup, unittest.TestCase):

def setUp(self):
super(Test, self).setUp()
super().setUp()
provideUtility(principalRegistry, IAuthentication)

def _make_principal(self, id=None, title=None):
Expand Down
2 changes: 1 addition & 1 deletion src/zope/securitypolicy/tests/test_principalrolemanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def defineRole(id, title=None, description=None):
class Test(PlacelessSetup, unittest.TestCase):

def setUp(self):
super(Test, self).setUp()
super().setUp()
provideUtility(principalRegistry, IAuthentication)

def _make_principal(self, id=None, title=None):
Expand Down
9 changes: 2 additions & 7 deletions src/zope/securitypolicy/tests/test_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,10 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Doctests for 'permission' module.
"""Doctests for 'role' module.
"""
import unittest
from doctest import DocTestSuite

from zope.securitypolicy import testing


def test_suite():
return unittest.TestSuite((
DocTestSuite('zope.securitypolicy.role', checker=testing.checker),
))
return DocTestSuite('zope.securitypolicy.role')
8 changes: 4 additions & 4 deletions src/zope/securitypolicy/tests/test_securitydirectives.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def defineRole(id, title=None, description=None):
class TestBase(PlacelessSetup):

def setUp(self):
super(TestBase, self).setUp()
super().setUp()
zope.component.provideUtility(principalRegistry, IAuthentication)


Expand All @@ -70,7 +70,7 @@ def testDuplicationRegistration(self):
class TestSecurityGrantMapping(TestBase, unittest.TestCase):

def setUp(self):
super(TestSecurityGrantMapping, self).setUp()
super().setUp()
zope.component.provideUtility(Permission('zope.Foo', ''),
IPermission, 'zope.Foo')
zope.component.provideUtility(Permission('zope.Qwer', ''),
Expand Down Expand Up @@ -155,7 +155,7 @@ def test_RolePrincipalMap(self):
class TestSecurityGrantAllMapping(TestBase, unittest.TestCase):

def setUp(self):
super(TestSecurityGrantAllMapping, self).setUp()
super().setUp()
zope.component.provideUtility(Permission('zope.Qwer', ''),
IPermission, 'zope.Qwer')
zope.component.provideUtility(Permission('zope.Qux', ''),
Expand Down Expand Up @@ -194,7 +194,7 @@ def test_principal_and_role_not_allowed(self):
class TestSecurityDenyMapping(TestBase, unittest.TestCase):

def setUp(self):
super(TestSecurityDenyMapping, self).setUp()
super().setUp()
zope.component.provideUtility(Permission('zope.Foo', ''),
IPermission, 'zope.Foo')
zope.component.provideUtility(Permission('zope.Qwer', ''),
Expand Down
6 changes: 3 additions & 3 deletions src/zope/securitypolicy/tests/test_securitymap.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from zope.securitypolicy.securitymap import SecurityMap


class InteractionStub(object):
class InteractionStub:
invalidated = 0

def invalidate_cache(self):
Expand Down Expand Up @@ -64,7 +64,7 @@ def test_addCell(self):

def test_addCell_no_invalidation(self):

class NoInvalidation(object):
class NoInvalidation:
attrs = ()

def __getattr__(self, name):
Expand Down Expand Up @@ -189,7 +189,7 @@ def test_changed_sets_map(self):

from zope.securitypolicy.securitymap import AnnotationSecurityMap

class Context(object):
class Context:
def __init__(self):
self.annotations = {}

Expand Down
8 changes: 1 addition & 7 deletions src/zope/securitypolicy/tests/test_vocabulary.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,8 @@
##############################################################################
"""Role vocabluary doc tests.
"""
import unittest
from doctest import DocTestSuite

from zope.securitypolicy import testing


def test_suite():
return unittest.TestSuite((
DocTestSuite(
'zope.securitypolicy.vocabulary', checker=testing.checker),
))
return DocTestSuite('zope.securitypolicy.vocabulary')

0 comments on commit 11ddbdf

Please sign in to comment.