diff options
author | Kali Kaneko <kali@leap.se> | 2015-07-23 14:01:43 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2015-07-23 14:03:01 -0400 |
commit | 6cdcb2e32ff0876847c6ab4aba99dfc087da0617 (patch) | |
tree | 9c7fb55d86d97c6a385bbc39548aa70d92d92fd3 /client | |
parent | e35341d57ac5fa87be5de64d62e219a105389c4c (diff) |
[style] pep8 cleanup
to make all CIs happy :)
Diffstat (limited to 'client')
7 files changed, 23 insertions, 21 deletions
diff --git a/client/src/leap/soledad/client/adbapi.py b/client/src/leap/soledad/client/adbapi.py index 9675c048..2bf89a6c 100644 --- a/client/src/leap/soledad/client/adbapi.py +++ b/client/src/leap/soledad/client/adbapi.py @@ -55,7 +55,7 @@ SQLCIPHER_MAX_RETRIES = 10 def getConnectionPool(opts, openfun=None, driver="pysqlcipher", - sync_enc_pool=None): + sync_enc_pool=None): """ Return a connection pool. diff --git a/client/src/leap/soledad/client/api.py b/client/src/leap/soledad/client/api.py index 2bc524c3..6c9dce54 100644 --- a/client/src/leap/soledad/client/api.py +++ b/client/src/leap/soledad/client/api.py @@ -273,7 +273,7 @@ class Soledad(object): # deferred encryption and decryption configurations. self._initialize_sync_db(opts) self._dbpool = adbapi.getConnectionPool( - opts, sync_enc_pool=self._sync_enc_pool) + opts, sync_enc_pool=self._sync_enc_pool) def _init_u1db_syncer(self): """ @@ -767,7 +767,6 @@ class Soledad(object): self._sync_enc_pool = encdecpool.SyncEncrypterPool( self._crypto, self._sync_db) - @property def _sync_db_extra_init(self): """ @@ -785,8 +784,6 @@ class Soledad(object): decr.TABLE_NAME, decr.FIELD_NAMES)) return (sql_encr_table_query, sql_decr_table_query) - - # # ISecretsStorage # diff --git a/client/src/leap/soledad/client/examples/benchmarks/measure_index_times.py b/client/src/leap/soledad/client/examples/benchmarks/measure_index_times.py index 7fa1e38f..08775580 100644 --- a/client/src/leap/soledad/client/examples/benchmarks/measure_index_times.py +++ b/client/src/leap/soledad/client/examples/benchmarks/measure_index_times.py @@ -106,7 +106,7 @@ def get_from_index(_): d = dbpool.runU1DBQuery( "get_from_index", "by-chash", - #"1150c7f10fabce0a57ce13071349fc5064f15bdb0cc1bf2852f74ef3f103aff5") + # "1150c7f10fabce0a57ce13071349fc5064f15bdb0cc1bf2852f74ef3f103aff5") # XXX this is line 89 from the hacker crackdown... # Should accept any other optional hash as an enviroment variable. "57793320d4997a673fc7062652da0596c36a4e9fbe31310d2281e67d56d82469") @@ -151,7 +151,6 @@ def printResult(r, **kwargs): def allDone(_): debug("ALL DONE!") - #if silent: end_time = datetime.datetime.now() print((end_time - start_time).total_seconds()) reactor.stop() diff --git a/client/src/leap/soledad/client/examples/benchmarks/measure_index_times_custom_docid.py b/client/src/leap/soledad/client/examples/benchmarks/measure_index_times_custom_docid.py index c6d76e6b..9deba136 100644 --- a/client/src/leap/soledad/client/examples/benchmarks/measure_index_times_custom_docid.py +++ b/client/src/leap/soledad/client/examples/benchmarks/measure_index_times_custom_docid.py @@ -106,7 +106,7 @@ def get_from_index(_): d = dbpool.runU1DBQuery( "get_doc", - #"1150c7f10fabce0a57ce13071349fc5064f15bdb0cc1bf2852f74ef3f103aff5") + # "1150c7f10fabce0a57ce13071349fc5064f15bdb0cc1bf2852f74ef3f103aff5") # XXX this is line 89 from the hacker crackdown... # Should accept any other optional hash as an enviroment variable. "57793320d4997a673fc7062652da0596c36a4e9fbe31310d2281e67d56d82469") @@ -151,7 +151,6 @@ def printResult(r, **kwargs): def allDone(_): debug("ALL DONE!") - #if silent: end_time = datetime.datetime.now() print((end_time - start_time).total_seconds()) reactor.stop() diff --git a/client/src/leap/soledad/client/http_target.py b/client/src/leap/soledad/client/http_target.py index f1e83130..e586c7b5 100644 --- a/client/src/leap/soledad/client/http_target.py +++ b/client/src/leap/soledad/client/http_target.py @@ -53,6 +53,7 @@ logger = logging.getLogger(__name__) class SoledadHTTPSyncTarget(SyncTarget): + """ A SyncTarget that encrypts data before sending and decrypts data after receiving. @@ -311,8 +312,8 @@ class SoledadHTTPSyncTarget(SyncTarget): self._sync_enc_pool.delete_encrypted_doc( doc.doc_id, doc.rev) emit(SOLEDAD_SYNC_SEND_STATUS, - "Soledad sync send status: %d/%d" - % (idx, total)) + "Soledad sync send status: %d/%d" + % (idx, total)) response_dict = json.loads(result)[0] gen_after_send = response_dict['new_generation'] trans_id_after_send = response_dict['new_transaction_id'] @@ -383,9 +384,9 @@ class SoledadHTTPSyncTarget(SyncTarget): headers = self._auth_header.copy() headers.update({'content-type': ['application/x-soledad-sync-get']}) - #--------------------------------------------------------------------- + # --------------------------------------------------------------------- # maybe receive the first document - #--------------------------------------------------------------------- + # --------------------------------------------------------------------- # we fetch the first document before fetching the rest because we need # to know the total number of documents to be received, and this @@ -399,9 +400,9 @@ class SoledadHTTPSyncTarget(SyncTarget): if defer_decryption: self._sync_decr_pool.start(number_of_changes) - #--------------------------------------------------------------------- + # --------------------------------------------------------------------- # maybe receive the rest of the documents - #--------------------------------------------------------------------- + # --------------------------------------------------------------------- # launch many asynchronous fetches and inserts of received documents # in the temporary sync db. Will wait for all results before @@ -425,9 +426,9 @@ class SoledadHTTPSyncTarget(SyncTarget): if deferreds: _, new_generation, new_transaction_id = results.pop() - #--------------------------------------------------------------------- + # --------------------------------------------------------------------- # wait for async decryption to finish - #--------------------------------------------------------------------- + # --------------------------------------------------------------------- if defer_decryption: yield self._sync_decr_pool.deferred diff --git a/client/src/leap/soledad/client/secrets.py b/client/src/leap/soledad/client/secrets.py index e89e21aa..3b6755e1 100644 --- a/client/src/leap/soledad/client/secrets.py +++ b/client/src/leap/soledad/client/secrets.py @@ -50,12 +50,14 @@ logger = logging.getLogger(name=__name__) class SecretsException(Exception): + """ Generic exception type raised by this module. """ class NoStorageSecret(SecretsException): + """ Raised when trying to use a storage secret but none is available. """ @@ -63,6 +65,7 @@ class NoStorageSecret(SecretsException): class PassphraseTooShort(SecretsException): + """ Raised when trying to change the passphrase but the provided passphrase is too short. @@ -70,6 +73,7 @@ class PassphraseTooShort(SecretsException): class BootstrapSequenceError(SecretsException): + """ Raised when an attempt to generate a secret and store it in a recovery document on server failed. @@ -81,6 +85,7 @@ class BootstrapSequenceError(SecretsException): # class SoledadSecrets(object): + """ Soledad secrets handler. @@ -449,10 +454,11 @@ class SoledadSecrets(object): sha256).hexdigest() else: raise crypto.UnknownMacMethodError('Unknown MAC method: %s.' % - data[crypto.MAC_METHOD_KEY]) + data[crypto.MAC_METHOD_KEY]) if mac != data[crypto.MAC_KEY]: - raise crypto.WrongMacError('Could not authenticate recovery document\'s ' - 'contents.') + raise crypto.WrongMacError( + 'Could not authenticate recovery document\'s ' + 'contents.') # include secrets in the secret pool. secret_count = 0 secrets = data[self.STORAGE_SECRETS_KEY].items() diff --git a/client/src/leap/soledad/client/shared_db.py b/client/src/leap/soledad/client/shared_db.py index f1a2642e..6abf8ea3 100644 --- a/client/src/leap/soledad/client/shared_db.py +++ b/client/src/leap/soledad/client/shared_db.py @@ -115,7 +115,7 @@ class SoledadSharedDatabase(http_database.HTTPDatabase, TokenBasedAuth): :rtype: SoledadSharedDatabase """ # XXX fix below, doesn't work with tests. - #if syncable and not url.startswith('https://'): + # if syncable and not url.startswith('https://'): # raise ImproperlyConfiguredError( # "Remote soledad server must be an https URI") db = SoledadSharedDatabase(url, uuid, creds=creds) |