diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/soledad/backends/couch.py | 8 | ||||
-rw-r--r-- | src/leap/soledad/backends/leap_backend.py | 4 | ||||
-rw-r--r-- | src/leap/soledad/backends/objectstore.py | 12 | ||||
-rw-r--r-- | src/leap/soledad/backends/sqlcipher.py | 7 | ||||
-rw-r--r-- | src/leap/soledad/server.py | 2 | ||||
-rw-r--r-- | src/leap/soledad/shared_db.py | 7 | ||||
-rw-r--r-- | src/leap/soledad/tests/test_couch.py | 23 | ||||
-rw-r--r-- | src/leap/soledad/tests/test_sqlcipher.py | 11 | ||||
-rw-r--r-- | src/leap/soledad/util.py | 24 |
9 files changed, 49 insertions, 49 deletions
diff --git a/src/leap/soledad/backends/couch.py b/src/leap/soledad/backends/couch.py index 5407f992..1843bad1 100644 --- a/src/leap/soledad/backends/couch.py +++ b/src/leap/soledad/backends/couch.py @@ -110,10 +110,10 @@ class CouchDatabase(ObjectStoreDatabase): except ResourceNotFound: self._server.create(self._dbname) self._database = self._server[self._dbname] - super(CouchDatabase, self).__init__(replica_uid=replica_uid, - # TODO: move the factory choice - # away - document_factory=LeapDocument) + ObjectStoreDatabase.__init__(self, replica_uid=replica_uid, + # TODO: move the factory choice + # away + document_factory=LeapDocument) #------------------------------------------------------------------------- # methods from Database diff --git a/src/leap/soledad/backends/leap_backend.py b/src/leap/soledad/backends/leap_backend.py index 3110c662..52a8463d 100644 --- a/src/leap/soledad/backends/leap_backend.py +++ b/src/leap/soledad/backends/leap_backend.py @@ -90,7 +90,7 @@ class LeapDocument(Document): @param syncable: Should this document be synced with remote replicas? @type syncable: bool """ - super(LeapDocument, self).__init__(doc_id, rev, json, has_conflicts) + Document.__init__(self, doc_id, rev, json, has_conflicts) self._soledad = soledad self._syncable = syncable if encrypted_json: @@ -209,7 +209,7 @@ class LeapSyncTarget(HTTPSyncTarget): document contents when syncing. @type soledad: soledad.Soledad """ - super(LeapSyncTarget, self).__init__(url, creds) + HTTPSyncTarget.__init__(self, url, creds) self._soledad = soledad def _parse_sync_stream(self, data, return_doc_cb, ensure_callback=None): diff --git a/src/leap/soledad/backends/objectstore.py b/src/leap/soledad/backends/objectstore.py index 38de421f..8afac3ec 100644 --- a/src/leap/soledad/backends/objectstore.py +++ b/src/leap/soledad/backends/objectstore.py @@ -66,7 +66,8 @@ class ObjectStoreDatabase(InMemoryDatabase): parameters as Document.__init__. @type document_factory: callable """ - super(ObjectStoreDatabase, self).__init__( + InMemoryDatabase.__init__( + self, replica_uid, document_factory=document_factory) # sync data in memory with data in object store @@ -85,7 +86,7 @@ class ObjectStoreDatabase(InMemoryDatabase): @param replica_uid: The uid of the replica. @type replica_uid: str """ - super(ObjectStoreDatabase, self)._set_replica_uid(replica_uid) + InMemoryDatabase._set_replica_uid(self, replica_uid) self._store_u1db_data() def _put_doc(self, doc): @@ -185,7 +186,7 @@ class ObjectStoreDatabase(InMemoryDatabase): @param index_name: The name of the index we are removing. @type index_name: str """ - super(ObjectStoreDatabase, self).delete_index(index_name) + InMemoryDatabase.delete_index(self, index_name) self._store_u1db_data() def _replace_conflicts(self, doc, conflicts): @@ -199,7 +200,7 @@ class ObjectStoreDatabase(InMemoryDatabase): @param conflicts: The new set of conflicts. @type conflicts: list """ - super(ObjectStoreDatabase, self)._replace_conflicts(doc, conflicts) + InMemoryDatabase._replace_conflicts(self, doc, conflicts) self._store_u1db_data() def _do_set_replica_gen_and_trans_id(self, other_replica_uid, @@ -220,7 +221,8 @@ class ObjectStoreDatabase(InMemoryDatabase): generation. @type other_transaction_id: str """ - super(ObjectStoreDatabase, self)._do_set_replica_gen_and_trans_id( + InMemoryDatabase._do_set_replica_gen_and_trans_id( + self, other_replica_uid, other_generation, other_transaction_id) diff --git a/src/leap/soledad/backends/sqlcipher.py b/src/leap/soledad/backends/sqlcipher.py index 9e3c38c9..a4d53fa8 100644 --- a/src/leap/soledad/backends/sqlcipher.py +++ b/src/leap/soledad/backends/sqlcipher.py @@ -256,7 +256,8 @@ class SQLCipherDatabase(sqlite_backend.SQLitePartialExpandDatabase): @param doc: The new version of the document. @type doc: u1db.Document """ - super(SQLCipherDatabase, self)._put_and_update_indexes(old_doc, doc) + sqlite_backend.SQLitePartialExpandDatabase._put_and_update_indexes( + self, old_doc, doc) c = self._db_handle.cursor() c.execute('UPDATE document SET syncable=? WHERE doc_id=?', (doc.syncable, doc.doc_id)) @@ -275,8 +276,8 @@ class SQLCipherDatabase(sqlite_backend.SQLitePartialExpandDatabase): @return: a Document object. @type: u1db.Document """ - doc = super(SQLCipherDatabase, self)._get_doc(doc_id, - check_for_conflicts) + doc = sqlite_backend.SQLitePartialExpandDatabase._get_doc( + self, doc_id, check_for_conflicts) if doc: c = self._db_handle.cursor() c.execute('SELECT syncable FROM document WHERE doc_id=?', diff --git a/src/leap/soledad/server.py b/src/leap/soledad/server.py index 53bb62f0..fdb98916 100644 --- a/src/leap/soledad/server.py +++ b/src/leap/soledad/server.py @@ -195,7 +195,7 @@ class SoledadApp(http_app.HTTPApp): @return: HTTP application results. @rtype: list """ - return super(SoledadApp, self).__call__(environ, start_response) + return http_app.HTTPApp.__call__(self, environ, start_response) #----------------------------------------------------------------------------- diff --git a/src/leap/soledad/shared_db.py b/src/leap/soledad/shared_db.py index 5fce8ac2..01296885 100644 --- a/src/leap/soledad/shared_db.py +++ b/src/leap/soledad/shared_db.py @@ -107,8 +107,8 @@ class SoledadSharedDatabase(http_database.HTTPDatabase): @type token: str """ self._token = token - super(SoledadSharedDatabase, self).__init__(url, document_factory, - creds) + http_database.HTTPDatabase.__init__(self, url, document_factory, + creds) def _request(self, method, url_parts, params=None, body=None, content_type=None, auth=True): @@ -142,7 +142,8 @@ class SoledadSharedDatabase(http_database.HTTPDatabase): if not params: params = {} params['auth_token'] = self._token - return super(SoledadSharedDatabase, self)._request( + return http_database.HTTPDatabase._request( + self, method, url_parts, params, body, diff --git a/src/leap/soledad/tests/test_couch.py b/src/leap/soledad/tests/test_couch.py index c02d485b..d9cdf788 100644 --- a/src/leap/soledad/tests/test_couch.py +++ b/src/leap/soledad/tests/test_couch.py @@ -112,14 +112,14 @@ class CouchDBTestCase(unittest.TestCase): self.wrapper = CouchDBWrapper() self.wrapper.start() #self.db = self.wrapper.db - super(CouchDBTestCase, self).setUp() + unittest.TestCase.setUp(self) def tearDown(self): """ Stop CouchDB instance for test. """ self.wrapper.stop() - super(CouchDBTestCase, self).tearDown() + unittest.TestCase.tearDown(self) #----------------------------------------------------------------------------- @@ -177,7 +177,7 @@ class CouchTests(test_backends.AllDatabaseTests, CouchDBTestCase): def tearDown(self): self.db.delete_database() - super(CouchTests, self).tearDown() + test_backends.AllDatabaseTests.tearDown(self) class CouchDatabaseTests(test_backends.LocalDatabaseTests, CouchDBTestCase): @@ -186,7 +186,7 @@ class CouchDatabaseTests(test_backends.LocalDatabaseTests, CouchDBTestCase): def tearDown(self): self.db.delete_database() - super(CouchDatabaseTests, self).tearDown() + test_backends.LocalDatabaseTests.tearDown(self) class CouchValidateGenNTransIdTests( @@ -196,7 +196,7 @@ class CouchValidateGenNTransIdTests( def tearDown(self): self.db.delete_database() - super(CouchValidateGenNTransIdTests, self).tearDown() + test_backends.LocalDatabaseValidateGenNTransIdTests.tearDown(self) class CouchValidateSourceGenTests( @@ -206,7 +206,7 @@ class CouchValidateSourceGenTests( def tearDown(self): self.db.delete_database() - super(CouchValidateSourceGenTests, self).tearDown() + test_backends.LocalDatabaseValidateSourceGenTests.tearDown(self) class CouchWithConflictsTests( @@ -216,7 +216,7 @@ class CouchWithConflictsTests( def tearDown(self): self.db.delete_database() - super(CouchWithConflictsTests, self).tearDown() + test_backends.LocalDatabaseWithConflictsTests.tearDown(self) # Notice: the CouchDB backend is currently used for storing encrypted data in @@ -229,7 +229,7 @@ class CouchIndexTests(test_backends.DatabaseIndexTests, CouchDBTestCase): def tearDown(self): self.db.delete_database() - super(CouchIndexTests, self).tearDown() + test_backends.DatabaseIndexTests.tearDown(self) #----------------------------------------------------------------------------- @@ -251,7 +251,7 @@ class CouchDatabaseSyncTargetTests(test_sync.DatabaseSyncTargetTests, def tearDown(self): self.db.delete_database() - super(CouchDatabaseSyncTargetTests, self).tearDown() + test_sync.DatabaseSyncTargetTests.tearDown(self) def test_sync_exchange_returns_many_new_docs(self): # This test was replicated to allow dictionaries to be compared after @@ -293,7 +293,8 @@ class CouchDatabaseSyncTests(test_sync.DatabaseSyncTests, CouchDBTestCase): self.db1 = None self.db2 = None self.db3 = None - super(CouchDatabaseSyncTests, self).setUp() + test_sync.DatabaseSyncTests.setUp(self) + CouchDBTestCase.setUp(self) def tearDown(self): self.db and self.db.delete_database() @@ -306,7 +307,7 @@ class CouchDatabaseSyncTests(test_sync.DatabaseSyncTests, CouchDBTestCase): db.delete_database() db = self.create_database('test3', 'target') db.delete_database() - super(CouchDatabaseSyncTests, self).tearDown() + test_sync.DatabaseSyncTests.tearDown(self) #----------------------------------------------------------------------------- diff --git a/src/leap/soledad/tests/test_sqlcipher.py b/src/leap/soledad/tests/test_sqlcipher.py index 23847556..b71478ac 100644 --- a/src/leap/soledad/tests/test_sqlcipher.py +++ b/src/leap/soledad/tests/test_sqlcipher.py @@ -139,11 +139,11 @@ class TestSQLCipherDatabase(test_sqlite_backend.TestSQLiteDatabase): def __init__(self, dbname, ntry): self._try = ntry self._is_initialized_invocations = 0 - super(SQLCipherDatabaseTesting, self).__init__(dbname, - PASSWORD) + SQLCipherDatabase.__init__(self, dbname, PASSWORD) def _is_initialized(self, c): - res = super(SQLCipherDatabaseTesting, self)._is_initialized(c) + res = \ + SQLCipherDatabase._is_initialized(self, c) if self._try == 1: self._is_initialized_invocations += 1 if self._is_initialized_invocations == 2: @@ -183,8 +183,7 @@ class TestSQLCipherPartialExpandDatabase( # our backend be instantiated in place. def setUp(self): - super(test_sqlite_backend.TestSQLitePartialExpandDatabase, - self).setUp() + test_sqlite_backend.TestSQLitePartialExpandDatabase.setUp(self) self.db = SQLCipherDatabase(':memory:', PASSWORD) self.db._set_replica_uid('test') @@ -264,7 +263,7 @@ class TestSQLCipherPartialExpandDatabase( @classmethod def _which_index_storage(cls, c): - res = super(SQLiteDatabaseTesting, cls)._which_index_storage(c) + res = SQLCipherDatabase._which_index_storage(c) db._ensure_schema() # init db observed.append(res[0]) return res diff --git a/src/leap/soledad/util.py b/src/leap/soledad/util.py index 47e4c78d..90797501 100644 --- a/src/leap/soledad/util.py +++ b/src/leap/soledad/util.py @@ -106,12 +106,9 @@ class GPGWrapper(gnupg.GPG): @raise: RuntimeError with explanation message if there is a problem invoking gpg. """ - super(GPGWrapper, self).__init__(gnupghome=gnupghome, - gpgbinary=gpgbinary, - verbose=verbose, - use_agent=use_agent, - keyring=keyring, - options=options) + gnupg.GPG.__init__(self, gnupghome=gnupghome, gpgbinary=gpgbinary, + verbose=verbose, use_agent=use_agent, + keyring=keyring, options=options) self.result_map['list-packets'] = ListPackets def find_key_by_email(self, email, secret=False): @@ -211,11 +208,11 @@ class GPGWrapper(gnupg.GPG): @rtype: gnupg.Crypt """ # TODO: devise a way so we don't need to "always trust". - return super(GPGWrapper, self).encrypt(data, recipient, sign=sign, - always_trust=always_trust, - passphrase=passphrase, - symmetric=symmetric, - cipher_algo='AES256') + return gnupg.GPG.encrypt(self, data, recipient, sign=sign, + always_trust=always_trust, + passphrase=passphrase, + symmetric=symmetric, + cipher_algo='AES256') def decrypt(self, data, always_trust=True, passphrase=None): """ @@ -234,9 +231,8 @@ class GPGWrapper(gnupg.GPG): @rtype: gnupg.Crypt """ # TODO: devise a way so we don't need to "always trust". - return super(GPGWrapper, self).decrypt(data, - always_trust=always_trust, - passphrase=passphrase) + return gnupg.GPG.decrypt(self, data, always_trust=always_trust, + passphrase=passphrase) def send_keys(self, keyserver, *keyids): """ |