Skip to content

Commit

Permalink
Use key not in dict instead of key not in dict.keys()
Browse files Browse the repository at this point in the history
  • Loading branch information
lwesterhof committed Aug 15, 2024
1 parent 4304c21 commit 13f7b10
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion datarequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ def api_datarequest_assignment_submit(ctx, data, request_id):
try:
# Determine who is permitted to read
permitted_to_read = [GROUP_DM, GROUP_PM]
if 'assign_to' in data.keys():
if 'assign_to' in data:
permitted_to_read = permitted_to_read + data['assign_to'][:]

# Write form data to disk
Expand Down
4 changes: 2 additions & 2 deletions publication.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def get_publication_state(ctx, vault_package):
publ_metadata = get_collection_metadata(ctx, vault_package, constants.UUORGMETADATAPREFIX + 'publication_')

# Take over all actual values as saved earlier.
for key in publ_metadata.keys():
for key in publ_metadata:
publication_state[key] = publ_metadata[key]

# Handle access restriction.
Expand Down Expand Up @@ -199,7 +199,7 @@ def save_publication_state(ctx, vault_package, publication_state):
:param publication_state: Dict with state of the publication process
"""
ctx.msi_rmw_avu("-C", vault_package, constants.UUORGMETADATAPREFIX + 'publication_%', "%", "%")
for key in publication_state.keys():
for key in publication_state:
if publication_state[key] != "":
avu.set_on_coll(ctx, vault_package, constants.UUORGMETADATAPREFIX + 'publication_' + key, publication_state[key])

Expand Down
2 changes: 1 addition & 1 deletion tools/arb-update-resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def call_rule(session, rulename, params, number_outputs, rule_engine='irods_rule
"""
body = 'myRule {{\n {}('.format(rulename)

for input_var in params.keys():
for input_var in params:
body += "'*{}',".format(input_var)

if len(params) > 0:
Expand Down
2 changes: 1 addition & 1 deletion util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import yoda_names

if 'unittest' not in sys.modules.keys():
if 'unittest' not in sys.modules:
# We don't import everything when running unit tests, because then we'll have
# to deal with all the dependencies. Functions that have unit tests should
# import utils specifically
Expand Down
2 changes: 1 addition & 1 deletion util/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import rule
from config import config

if 'unittest' not in sys.modules.keys():
if 'unittest' not in sys.modules:
# We don't import the user functions when running unit tests, because then we'll have
# to deal with their dependencies. When running unit tests we should use a "None" ctx
# or some mocked object.
Expand Down

0 comments on commit 13f7b10

Please sign in to comment.