From d2deab385b9ee8be828e9ada0622675015d0f398 Mon Sep 17 00:00:00 2001 From: Pete Zaitcev Date: Fri, 31 Mar 2023 18:44:53 -0500 Subject: [PATCH] Stop pinning pep8 related packages These practices cause conflicts periodically. Not right now: the gate is okay with the current values, which this patch deletes. However, like sun raising in the east it is sure to happen again. This patch lets workarounds work that the infra team puts in place. The downside is, we need to fix the code once in a while as new checks get added. Change-Id: Ia7a96fb4b6de4251862a8a96c995cefa94dbc271 --- keystone/assignment/core.py | 2 +- keystone/cmd/cli.py | 2 +- keystone/common/fernet_utils.py | 4 ++-- keystone/tests/unit/test_backend_ldap.py | 2 +- test-requirements.txt | 4 ++-- tox.ini | 5 +---- 6 files changed, 8 insertions(+), 11 deletions(-) diff --git a/keystone/assignment/core.py b/keystone/assignment/core.py index 6d2025d530..a6db545c46 100644 --- a/keystone/assignment/core.py +++ b/keystone/assignment/core.py @@ -652,7 +652,7 @@ class Manager(manager.Manager): role_refs_to_check = list(role_refs) ref_results = list(role_refs) checked_role_refs = list() - while(role_refs_to_check): + while role_refs_to_check: next_ref = role_refs_to_check.pop() checked_role_refs.append(next_ref) next_role_id = next_ref['role_id'] diff --git a/keystone/cmd/cli.py b/keystone/cmd/cli.py index 9239cac1cf..ce4ceebc01 100644 --- a/keystone/cmd/cli.py +++ b/keystone/cmd/cli.py @@ -433,7 +433,7 @@ class FernetSetup(BasePermissionsSetup): os.path.abspath(CONF.fernet_receipts.key_repository)): cls.initialize_fernet_repository( keystone_user_id, keystone_group_id, 'fernet_receipts') - elif(CONF.fernet_tokens.max_active_keys != + elif (CONF.fernet_tokens.max_active_keys != CONF.fernet_receipts.max_active_keys): # WARNING(adriant): If the directories are the same, # 'max_active_keys' is ignored from fernet_receipts in favor of diff --git a/keystone/common/fernet_utils.py b/keystone/common/fernet_utils.py index 928c2488d1..cb28f332fd 100644 --- a/keystone/common/fernet_utils.py +++ b/keystone/common/fernet_utils.py @@ -64,8 +64,8 @@ class FernetUtils(object): else: # ensure the key repository isn't world-readable stat_info = os.stat(self.key_repository) - if(stat_info.st_mode & stat.S_IROTH or - stat_info.st_mode & stat.S_IXOTH): + if (stat_info.st_mode & stat.S_IROTH or + stat_info.st_mode & stat.S_IXOTH): LOG.warning( 'key_repository is world readable: %s', self.key_repository) diff --git a/keystone/tests/unit/test_backend_ldap.py b/keystone/tests/unit/test_backend_ldap.py index bd804d7e7d..84ec1a6e5c 100644 --- a/keystone/tests/unit/test_backend_ldap.py +++ b/keystone/tests/unit/test_backend_ldap.py @@ -988,7 +988,7 @@ class BaseLDAPIdentity(LDAPTestSetup, IdentityTests, AssignmentTests, # List groups for user. ref_list = PROVIDERS.identity_api.list_groups_for_user(public_user_id) for ref in ref_list: - del(ref['membership_expires_at']) + del ref['membership_expires_at'] group['id'] = public_group_id self.assertThat(ref_list, matchers.Equals([group])) diff --git a/test-requirements.txt b/test-requirements.txt index 1fca35803e..cd3ebfd29e 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,5 +1,5 @@ -hacking~=4.1.0 # Apache-2.0 -flake8-docstrings~=1.6.0 # MIT +hacking +flake8-docstrings bashate~=2.1.0 # Apache-2.0 stestr>=1.0.0 # Apache-2.0 freezegun>=0.3.6 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 32dd244a1e..ec80e9d93d 100644 --- a/tox.ini +++ b/tox.ini @@ -95,15 +95,12 @@ enable-extensions = H203,H904 # D107: Missing docstring in __init__ # D203: 1 blank line required before class docstring (deprecated in pep257) # D401: First line should be in imperative mood; try rephrasing -# TODO(wxy): Fix the pep8 issue. -# E305: # E402: module level import not at top of file # H211: Use assert{Is,IsNot}instance # H214: Use assertIn/NotIn(A, B) rather than assertTrue/False(A in/not in B) when checking collection contents. # W503: line break before binary operator # W504: line break after binary operator -# W605: -ignore = D100,D101,D102,D103,D104,D106,D107,D203,D401,E305,E402,H211,H214,W503,W504,W605 +ignore = D100,D101,D102,D103,D104,D106,D107,D203,D401,E402,H211,H214,W503,W504 exclude = .venv,.git,.tox,build,dist,*lib/python*,*egg,tools,vendor,.update-venv,*.ini,*.po,*.pot max-complexity = 24 per-file-ignores =