Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for python 3.8 #3719

Merged
merged 4 commits into from
Jan 20, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove manipulations of mappings while it is being iterated
This behavior will raise starting from python 3.8.
  • Loading branch information
sphuber committed Jan 20, 2020
commit 47ee7c2698a239954071aeea1c8f1f5c60ba33ba
9 changes: 6 additions & 3 deletions aiida/orm/querybuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -981,14 +981,17 @@ def _process_filters(self, filters):
if not isinstance(filters, dict):
raise InputValidationError('Filters have to be passed as dictionaries')

processed_filters = {}

for key, value in filters.items():
if isinstance(value, entities.Entity):
# Convert to be the id of the joined entity because we can't query
# for the object instance directly
filters.pop(key)
filters['{}_id'.format(key)] = value.id
processed_filters['{}_id'.format(key)] = value.id
else:
processed_filters[key] = value

return filters
return processed_filters

def _add_type_filter(self, tagspec, classifiers, subclassing):
"""
Expand Down
5 changes: 3 additions & 2 deletions aiida/tools/importexport/migration/v03_to_v04.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Where id is a SQLA id and migration-name is the name of the particular migration.
"""
# pylint: disable=invalid-name

import copy
import os

import numpy as np
Expand Down Expand Up @@ -312,7 +312,8 @@ def _migration_calc_job_option_attribute_keys(attr_id, content):
'jobresource_params': 'resources',
'parser': 'parser_name'
}
for key in content:
# Need to loop over a clone because the `content` needs to be modified in place
for key in copy.deepcopy(content):
dev-zero marked this conversation as resolved.
Show resolved Hide resolved
if key in key_mapper:
content[key_mapper[key]] = content.pop(key)

Expand Down