Skip to content

Commit

Permalink
Get rid of Python 2 code.
Browse files Browse the repository at this point in the history
pyupgrade --py37-plus
  • Loading branch information
mauritsvanrees committed Dec 20, 2021
1 parent 38b44be commit 627f0a8
Show file tree
Hide file tree
Showing 14 changed files with 10 additions and 24 deletions.
1 change: 0 additions & 1 deletion Products/CMFDynamicViewFTI/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from Products.CMFCore import utils as cmf_utils
from Products.CMFCore.permissions import AddPortalContent
from Products.CMFCore.permissions import AddPortalFolders
Expand Down
1 change: 0 additions & 1 deletion Products/CMFDynamicViewFTI/browser/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Browser subpackage
"""
Expand Down
3 changes: 1 addition & 2 deletions Products/CMFDynamicViewFTI/browser/typeinfo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Add DynamicView FTI form (ZMI)
"""
Expand All @@ -13,4 +12,4 @@ class DVFactoryTypeInformationAddView(FactoryTypeInformationAddView):

klass = DynamicViewTypeInformation

description = u'A dynamic view type information object defines a portal type.'
description = 'A dynamic view type information object defines a portal type.'
7 changes: 3 additions & 4 deletions Products/CMFDynamicViewFTI/browserdefault.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Mixin class for selectable views
This module contains a mixin-class to support selecting default layout
Expand Down Expand Up @@ -163,7 +162,7 @@ def setLayout(self, layout):
# 'layout' should be one of the list returned by getAvailableLayouts(),
# but it is not enforced. If a default page has been set with
# setDefaultPage(), it is turned off by calling setDefaultPage(None).
if not (layout and isinstance(layout, six.string_types)):
if not (layout and isinstance(layout, str)):
raise ValueError(
"layout must be a non empty string, got %s(%s)" %
(layout, type(layout))
Expand All @@ -179,7 +178,7 @@ def setLayout(self, layout):
if getattr(aq_base(self), 'layout', _marker) is not _marker:
# Archetypes remains? clean up
old = self.layout
if old and not isinstance(old, six.string_types):
if old and not isinstance(old, str):
raise RuntimeError(
"layout attribute exists on %s and is no string: %s" %
(self, type(old))
Expand Down Expand Up @@ -216,7 +215,7 @@ def getAvailableLayouts(self):
spec = (providedBy(self), providedBy(self.REQUEST))
gsm = getSiteManager()
for mid in method_ids:
if not isinstance(mid, six.string_types):
if not isinstance(mid, str):
mid = mid.decode()
factory = gsm.adapters.lookup(spec, Interface, mid)
if factory is not None:
Expand Down
1 change: 0 additions & 1 deletion Products/CMFDynamicViewFTI/content_for_tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from Products.CMFCore.PortalFolder import PortalFolder
from Products.CMFCore.PortalContent import PortalContent
from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin
Expand Down
9 changes: 4 additions & 5 deletions Products/CMFDynamicViewFTI/fti.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_base
from AccessControl.class_init import InitializeClass
Expand Down Expand Up @@ -108,7 +107,7 @@ def manage_changeProperties(self, **kw):
if not view_methods:
self.view_methods = view_methods = (default_view, )
if default_view and default_view not in view_methods:
raise ValueError("%s not in %s" % (default_view, view_methods))
raise ValueError(f"{default_view} not in {view_methods}")

@security.protected(View)
def getDefaultViewMethod(self, context):
Expand All @@ -119,7 +118,7 @@ def getDefaultViewMethod(self, context):
def getAvailableViewMethods(self, context):
# Get a list of registered view methods.
methods = self.view_methods
if isinstance(methods, six.string_types):
if isinstance(methods, str):
methods = (methods, )
return tuple(methods)

Expand All @@ -139,7 +138,7 @@ def getViewMethod(
layout = layout()
if not layout:
return default
if not isinstance(layout, six.string_types):
if not isinstance(layout, str):
raise TypeError(
"layout of %s must be a string, got %s" %
(repr(context), type(layout))
Expand Down Expand Up @@ -223,7 +222,7 @@ def queryMethodID(self, alias, default=None, context=None):
default=default,
context=context
)
if not isinstance(methodTarget, six.string_types):
if not isinstance(methodTarget, str):
# nothing to do, method_id is probably None
return methodTarget

Expand Down
1 change: 0 additions & 1 deletion Products/CMFDynamicViewFTI/interface.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# BBB module will be removed at some point. We will still need it as long as
# we plan to support Plone 4.3.x
from Products.CMFDynamicViewFTI.interfaces import *
Expand Down
1 change: 0 additions & 1 deletion Products/CMFDynamicViewFTI/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from Products.CMFCore.interfaces import ITypeInformation
from zope.interface import Interface

Expand Down
1 change: 0 additions & 1 deletion Products/CMFDynamicViewFTI/permissions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from AccessControl.Permission import addPermission

ModifyViewTemplate = "Modify view template"
Expand Down
1 change: 0 additions & 1 deletion Products/CMFDynamicViewFTI/tests/CMFDVFTITestCase.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from plone.app import testing
from plone.app.testing import PLONE_FIXTURE
from plone.app.testing import PloneSandboxLayer
Expand Down
1 change: 0 additions & 1 deletion Products/CMFDynamicViewFTI/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
# -*- coding: utf-8 -*-
3 changes: 1 addition & 2 deletions Products/CMFDynamicViewFTI/tests/test_browserdefault.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from Products.CMFCore.utils import getToolByName
from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin
from Products.CMFDynamicViewFTI.interfaces import IBrowserDefault
Expand Down Expand Up @@ -34,7 +33,7 @@ def test_extendsInterface(self):
class TestAvailableLayouts(CMFDVFTITestCase.CMFDVFTITestCase):

def setUp(self):
super(TestAvailableLayouts, self).setUp()
super().setUp()
self.dfolder = DummyFolder()
self.dfolder.fti = self.types['DynFolder']

Expand Down
3 changes: 1 addition & 2 deletions Products/CMFDynamicViewFTI/tests/test_fti.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from plone.app.testing import TEST_USER_NAME
from plone.app.testing import TEST_USER_PASSWORD
from Products.CMFCore.interfaces import ITypeInformation
Expand Down Expand Up @@ -215,7 +214,7 @@ class TestEmptyLayoutBug(CMFDVFTITestCase.CMFDVFTITestCase):
# Finally, here is why we did all this...

def setUp(self):
super(TestEmptyLayoutBug, self).setUp()
super().setUp()
# Make a DynFolder
self.folder.invokeFactory('DynFolder', id='dynfolder')
self.dynfolder = self.folder.dynfolder
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 627f0a8

Please sign in to comment.