Skip to content

Commit

Permalink
Support Python 3
Browse files Browse the repository at this point in the history
	modified:   .gitignore
	modified:   dbsnap_verify/__init__.py
	modified:   dbsnap_verify/rds_funcs.py
	modified:   dbsnap_verify/state_doc.py
  • Loading branch information
russellballestrini committed Feb 21, 2018
1 parent 6850786 commit fbc2141
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ coverage.xml
*.cover
.hypothesis/

# pytest
.pytest_cache

# Translations
*.mo
*.pot
Expand Down
6 changes: 3 additions & 3 deletions dbsnap_verify/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from rds_funcs import (
from .rds_funcs import (
get_latest_snapshot,
get_database_description,
restore_from_latest_snapshot,
Expand All @@ -9,14 +9,14 @@
rds_event_messages,
)

from state_doc import (
from .state_doc import (
current_state,
transition_state,
get_or_create_state_doc,
clean_state_doc,
)

from time_funcs import (
from .time_funcs import (
now_datetime,
timestamp_to_datetime,
datetime_to_date_str,
Expand Down
12 changes: 7 additions & 5 deletions dbsnap_verify/rds_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

from random import choice

from string import (
letters,
digits,
)
from string import digits

try:
from string import letters
except ImportError:
from string import ascii_letters as letters

VALID_SNAPSHOT_TYPES = ["automated", "manual"]

Expand Down Expand Up @@ -45,7 +47,7 @@ def get_available_snapshots(session, db_id, snapshot_type=None):
r = session.describe_db_snapshots(**args)
snapshots = r['DBSnapshots']
snapshots.sort(key=itemgetter("SnapshotCreateTime"))
return filter(lambda x: x["Status"] == "available", snapshots)
return list(filter(lambda x: x["Status"] == "available", snapshots))


def get_latest_snapshot(session, db_id, snapshot_type=None):
Expand Down
4 changes: 2 additions & 2 deletions dbsnap_verify/state_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

import boto3

from time_funcs import (
from .time_funcs import (
now_timestamp,
today_datetime,
add_days_to_datetime,
subtract_days_from_datetime,
datetime_to_timestamp,
)
from rds_funcs import dbsnap_verify_db_id
from .rds_funcs import dbsnap_verify_db_id

DB_ID_PREFIX_LEN = 14

Expand Down

0 comments on commit fbc2141

Please sign in to comment.