Skip to content

Commit

Permalink
Fixed Python 3 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hkage committed Jan 3, 2020
1 parent b01e189 commit 7be3966
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Development

## 0.2.4 (2020-01-03)

* Fixed several issues with the usage of ``dict.keys`` and Python 3

## 0.2.3 (2020-01-02)

* Fixed the wrong cStringIO import for Python 3
Expand Down
8 changes: 4 additions & 4 deletions pganonymizer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def anonymize_tables(connection, definitions, verbose=False):
:param bool verbose: Display logging information and a progress bar.
"""
for definition in definitions:
table_name = definition.keys()[0]
table_name = list(definition.keys())[0]
logging.info('Found table definition "%s"', table_name)
table_definition = definition[table_name]
columns = table_definition.get('fields', [])
Expand Down Expand Up @@ -92,7 +92,7 @@ def row_matches_excludes(row, excludes=None):
"""
excludes = excludes if excludes else []
for definition in excludes:
column = definition.keys()[0]
column = list(definition.keys())[0]
for exclude in definition.get(column, []):
pattern = re.compile(exclude, re.IGNORECASE)
if pattern.match(row[column]):
Expand Down Expand Up @@ -209,7 +209,7 @@ def get_column_dict(columns):
"""
column_dict = {}
for definition in columns:
column_name = definition.keys()[0]
column_name = list(definition.keys())[0]
column_dict[column_name] = None
return column_dict

Expand All @@ -233,7 +233,7 @@ def get_column_values(row, columns):
"""
column_dict = {}
for definition in columns:
column_name = definition.keys()[0]
column_name = list(definition.keys())[0]
column_definition = definition[column_name]
provider_config = column_definition.get('provider')
orig_value = row.get(column_name)
Expand Down
2 changes: 1 addition & 1 deletion pganonymizer/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-

__version__ = '0.2.3'
__version__ = '0.2.4'

0 comments on commit 7be3966

Please sign in to comment.