Skip to content

Commit

Permalink
chore: pyupgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
gforcada committed Feb 8, 2023
1 parent 85ede24 commit 9c01c2f
Show file tree
Hide file tree
Showing 13 changed files with 9 additions and 29 deletions.
9 changes: 1 addition & 8 deletions borg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
# -*- coding: utf-8 -*-
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = locals()['__path__'] # make pyflakes happy...
__path__ = extend_path(__path__, __name__)
__import__('pkg_resources').declare_namespace(__name__)
1 change: 0 additions & 1 deletion borg/localrole/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from AccessControl.Permissions import add_user_folders
from borg.localrole import workspace
from Products.PluggableAuthService import registerMultiPlugin
Expand Down
1 change: 0 additions & 1 deletion borg/localrole/bbb/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
# -*- coding: utf-8 -*-
1 change: 0 additions & 1 deletion borg/localrole/bbb/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from zope.interface import Interface


Expand Down
1 change: 0 additions & 1 deletion borg/localrole/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Configuration constants

LOCALROLE_PLUGIN_NAME = 'borg_localroles'
5 changes: 2 additions & 3 deletions borg/localrole/default_adapter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from borg.localrole.interfaces import ILocalRoleProvider
from zope.component import adapter
from zope.interface import implementer
Expand All @@ -9,7 +8,7 @@

@implementer(ILocalRoleProvider)
@adapter(Interface)
class DefaultLocalRoleAdapter(object):
class DefaultLocalRoleAdapter:
"""Looks at __ac_local_roles__ to find local roles stored
persistently on an object::
Expand Down Expand Up @@ -77,4 +76,4 @@ def getRoles(self, principal_id):
def getAllRoles(self):
"""Returns all the local roles assigned in this context:
(principal_id, [role1, role2])"""
return six.iteritems(self._rolemap)
return self._rolemap.items()
3 changes: 1 addition & 2 deletions borg/localrole/factory_adapter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from Acquisition import aq_inner
from Acquisition import aq_parent
from borg.localrole.interfaces import IFactoryTempFolder
Expand All @@ -10,7 +9,7 @@

@implementer(ILocalRoleProvider)
@adapter(IFactoryTempFolder)
class FactoryTempFolderProvider(object):
class FactoryTempFolderProvider:
"""A simple local role provider which just gathers the roles from
the desired context::
Expand Down
1 change: 0 additions & 1 deletion borg/localrole/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from zope.deferredimport import deprecated
from zope.interface import Interface

Expand Down
1 change: 0 additions & 1 deletion borg/localrole/setuphandlers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from borg.localrole.utils import setup_localrole_plugin


Expand Down
7 changes: 3 additions & 4 deletions borg/localrole/tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from borg.localrole import default_adapter
from borg.localrole import factory_adapter
from plone.app.testing import PLONE_INTEGRATION_TESTING
Expand All @@ -14,7 +13,7 @@


@implementer(borg.localrole.interfaces.ILocalRoleProvider)
class SimpleLocalRoleProvider(object):
class SimpleLocalRoleProvider:

def __init__(self, context):
self.context = context
Expand All @@ -29,7 +28,7 @@ def getAllRoles(self):
yield ('bogus_user', ('Foo', ))


class DummyUser(object):
class DummyUser:
def __init__(self, uid, group_ids=()):
self.id = uid
self._groups = group_ids
Expand All @@ -50,7 +49,7 @@ def getRoles(self):
class Py23DocChecker(doctest.OutputChecker):
def check_output(self, want, got, optionflags):
if six.PY2:
got = re.sub("set\(\[(.*?)\]\)", "{\\1}", got)
got = re.sub(r"set\(\[(.*?)\]\)", "{\\1}", got)
want = re.sub(
'plone.memoize.volatile.DontCache',
'DontCache', want
Expand Down
4 changes: 1 addition & 3 deletions borg/localrole/utils.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
from Acquisition import aq_base
from borg.localrole.config import LOCALROLE_PLUGIN_NAME
from borg.localrole.workspace import manage_addWorkspaceLocalRoleManager
from Products.CMFCore.utils import getToolByName
from Products.PlonePAS.plugins.local_role import LocalRolesManager
from Products.PlonePAS.setuphandlers import activatePluginInterfaces
from six import StringIO
from io import StringIO


def setup_localrole_plugin(portal):
Expand Down
3 changes: 1 addition & 2 deletions borg/localrole/workspace.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from AccessControl import ClassSecurityInfo
from Acquisition import aq_get
from Acquisition import aq_inner
Expand Down Expand Up @@ -39,7 +38,7 @@ def manage_addWorkspaceLocalRoleManager(

if REQUEST is not None:
REQUEST.RESPONSE.redirect(
'{0}/manage_workspace?'
'{}/manage_workspace?'
'manage_tabs_message=WorkspaceLocalRoleManager+added.'.format(
dispatcher.absolute_url()
)
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from setuptools import find_packages
from setuptools import setup

Expand Down

0 comments on commit 9c01c2f

Please sign in to comment.