From d2f9fcffb2ea3f7a310dc016e40d6a26874c8da3 Mon Sep 17 00:00:00 2001 From: Alessandro Pisa Date: Sat, 15 Oct 2022 12:38:38 +0200 Subject: [PATCH] Run pyupgrade --py36-plus (#235) * Run pyupgrade --py36-plus * Update docs/conf.py Co-authored-by: Jens Vagelpohl Co-authored-by: Jens Vagelpohl --- docs/conf.py | 19 +++++++++---------- tests/builtins/test_utilities.py | 4 ++-- tests/transformer/test_base_types.py | 2 +- tests/transformer/test_yield.py | 3 +-- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index bd9ffbc..58e1a40 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # RestrictedPython documentation build configuration file, created by # sphinx-quickstart on Thu May 19 12:43:20 2016. @@ -47,18 +46,18 @@ master_doc = 'index' # General information about the project. -project = u'RestrictedPython' -copyright = u'2017-2020, Zope Foundation and Contributors' -author = u'The Zope developer community' +project = 'RestrictedPython' +copyright = '2017-2022, Zope Foundation and Contributors' +author = 'The Zope developer community' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = u'5.0' +version = '5.0' # The full version, including alpha/beta/rc tags. -release = u'5.0' +release = '5.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -240,8 +239,8 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'RestrictedPython.tex', u'RestrictedPython Documentation', - u'Alexander Loechel', 'manual'), + (master_doc, 'RestrictedPython.tex', 'RestrictedPython Documentation', + 'Alexander Loechel', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -270,7 +269,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (master_doc, 'restrictedpython', u'RestrictedPython Documentation', + (master_doc, 'restrictedpython', 'RestrictedPython Documentation', [author], 1) ] @@ -284,7 +283,7 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'RestrictedPython', u'RestrictedPython Documentation', + (master_doc, 'RestrictedPython', 'RestrictedPython Documentation', author, 'RestrictedPython', 'One line description of project.', 'Miscellaneous'), ] diff --git a/tests/builtins/test_utilities.py b/tests/builtins/test_utilities.py index 254661b..13d7d38 100644 --- a/tests/builtins/test_utilities.py +++ b/tests/builtins/test_utilities.py @@ -74,7 +74,7 @@ def test_sametype_only_two_args_same(): def test_sametype_only_two_args_different(): from RestrictedPython.Utilities import same_type - class Foo(object): + class Foo: pass assert same_type(object(), Foo()) is False @@ -87,7 +87,7 @@ def test_sametype_only_multiple_args_same(): def test_sametype_only_multipe_args_one_different(): from RestrictedPython.Utilities import same_type - class Foo(object): + class Foo: pass assert same_type(object(), object(), Foo()) is False diff --git a/tests/transformer/test_base_types.py b/tests/transformer/test_base_types.py index a815f0f..95054a8 100644 --- a/tests/transformer/test_base_types.py +++ b/tests/transformer/test_base_types.py @@ -14,7 +14,7 @@ def test_Bytes(): def test_Set(): """It allows to use set literals.""" - assert restricted_eval('{1, 2, 3}') == set([1, 2, 3]) + assert restricted_eval('{1, 2, 3}') == {1, 2, 3} def test_Ellipsis(): diff --git a/tests/transformer/test_yield.py b/tests/transformer/test_yield.py index a85e603..541021c 100644 --- a/tests/transformer/test_yield.py +++ b/tests/transformer/test_yield.py @@ -33,8 +33,7 @@ def test_yield_from(): def my_external_generator(): my_list = [1, 2, 3, 4, 5] - for elem in my_list: - yield elem + yield from my_list local = {} exec(result.code, {}, local)