Skip to content

Commit

Permalink
Merge a9b17d0 into 4c79484
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrieldemarmiesse authored Aug 3, 2019
2 parents 4c79484 + a9b17d0 commit f694efd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion sacred/config/config_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class ConfigSummary(dict):
def __init__(self, added=(), modified=(), typechanged=(),
ignored_fallbacks=(), docs=()):
super(ConfigSummary, self).__init__()
super().__init__()
self.added = set(added)
self.modified = set(modified) # TODO: test for this member
self.typechanged = dict(typechanged)
Expand Down
2 changes: 1 addition & 1 deletion sacred/config/custom_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def fallback_dict(fallback, **kwargs):

class DogmaticDict(dict):
def __init__(self, fixed=None, fallback=None):
super(DogmaticDict, self).__init__()
super().__init__()
self.typechanges = {}
self.fallback_writes = []
self.modified = set()
Expand Down
2 changes: 1 addition & 1 deletion sacred/observers/tinydb_hashfs_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class BufferedReaderWrapper(BufferedReader):

def __init__(self, f_obj):
f_obj = FileIO(f_obj.name)
super(BufferedReaderWrapper, self).__init__(f_obj)
super().__init__(f_obj)

def __copy__(self):
f = open(self.name, self.mode)
Expand Down
16 changes: 8 additions & 8 deletions tests/test_observers/failing_mongo_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class FailingMongoClient(mongomock.MongoClient):
def __init__(self, max_calls_before_failure=2,
exception_to_raise=pymongo.errors.AutoReconnect, **kwargs):
super(FailingMongoClient, self).__init__(**kwargs)
super().__init__(**kwargs)
self._max_calls_before_failure = max_calls_before_failure
self.exception_to_raise = exception_to_raise
self._exception_to_raise = exception_to_raise
Expand All @@ -25,7 +25,7 @@ def get_database(self, name, codec_options=None, read_preference=None,
class FailingDatabase(mongomock.Database):
def __init__(self, max_calls_before_failure, exception_to_raise=None,
**kwargs):
super(FailingDatabase, self).__init__(**kwargs)
super().__init__(**kwargs)
self._max_calls_before_failure = max_calls_before_failure
self._exception_to_raise = exception_to_raise

Expand All @@ -42,7 +42,7 @@ def get_collection(self, name, codec_options=None, read_preference=None,

class FailingCollection(mongomock.Collection):
def __init__(self, max_calls_before_failure, exception_to_raise, **kwargs):
super(FailingCollection, self).__init__(**kwargs)
super().__init__(**kwargs)
self._max_calls_before_failure = max_calls_before_failure
self._exception_to_raise = exception_to_raise
self._calls = 0
Expand All @@ -52,20 +52,20 @@ def insert_one(self, document):
if self._calls > self._max_calls_before_failure:
raise pymongo.errors.ConnectionFailure
else:
return super(FailingCollection, self).insert_one(document)
return super().insert_one(document)

def update_one(self, filter, update, upsert=False):
self._calls += 1
if self._calls > self._max_calls_before_failure:
raise pymongo.errors.ConnectionFailure
else:
return super(FailingCollection, self).update_one(filter, update,
return super().update_one(filter, update,
upsert)


class ReconnectingMongoClient(FailingMongoClient):
def __init__(self, max_calls_before_reconnect, **kwargs):
super(ReconnectingMongoClient, self).__init__(**kwargs)
super().__init__(**kwargs)
self._max_calls_before_reconnect = max_calls_before_reconnect

def get_database(self, name, codec_options=None, read_preference=None,
Expand All @@ -82,7 +82,7 @@ def get_database(self, name, codec_options=None, read_preference=None,

class ReconnectingDatabase(FailingDatabase):
def __init__(self, max_calls_before_reconnect, **kwargs):
super(ReconnectingDatabase, self).__init__(**kwargs)
super().__init__(**kwargs)
self._max_calls_before_reconnect = max_calls_before_reconnect

def get_collection(self, name, codec_options=None, read_preference=None,
Expand All @@ -99,7 +99,7 @@ def get_collection(self, name, codec_options=None, read_preference=None,

class ReconnectingCollection(FailingCollection):
def __init__(self, max_calls_before_reconnect, **kwargs):
super(ReconnectingCollection, self).__init__(**kwargs)
super().__init__(**kwargs)
self._max_calls_before_reconnect = max_calls_before_reconnect

def insert_one(self, document):
Expand Down

0 comments on commit f694efd

Please sign in to comment.