diff options
author | Bruno Wagner <bwgpro@gmail.com> | 2015-07-23 14:53:09 -0300 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2015-07-24 11:40:01 -0400 |
commit | efee0cc6ae62e870e2419d3a7ac04f4647ebc752 (patch) | |
tree | ede7a30e67b8e236df14611244b86857d748e6e3 /client/src/leap/soledad | |
parent | 0ad34468bb736220b5c7b88f7d7c7fc8b4900b29 (diff) |
[style] fixed soledad client pep8 warnings
Diffstat (limited to 'client/src/leap/soledad')
6 files changed, 14 insertions, 17 deletions
diff --git a/client/src/leap/soledad/client/_version.py b/client/src/leap/soledad/client/_version.py index 65efb714..588e4eb5 100644 --- a/client/src/leap/soledad/client/_version.py +++ b/client/src/leap/soledad/client/_version.py @@ -1,5 +1,3 @@ - -IN_LONG_VERSION_PY = True # This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (build by setup.py sdist) and build @@ -10,12 +8,16 @@ IN_LONG_VERSION_PY = True # versioneer-0.7+ (https://github.com/warner/python-versioneer) # these strings will be replaced by git during git-archive -git_refnames = "$Format:%d$" -git_full = "$Format:%H$" - import subprocess import sys +import re +import os.path + +IN_LONG_VERSION_PY = True + +git_refnames = "$Format:%d$" +git_full = "$Format:%H$" def run_command(args, cwd=None, verbose=False): @@ -37,9 +39,6 @@ def run_command(args, cwd=None, verbose=False): return None return stdout -import re -import os.path - def get_expanded_variables(versionfile_source): # the code embedded in _version.py can just fetch the value of these @@ -85,7 +84,7 @@ def versions_from_expanded_variables(variables, tag_prefix, verbose=False): # "stabilization", as well as "HEAD" and "master". tags = set([r for r in refs if re.search(r'\d', r)]) if verbose: - print("discarding '%s', no digits" % ",".join(refs-tags)) + print("discarding '%s', no digits" % ",".join(refs - tags)) if verbose: print("likely tags: %s" % ",".join(sorted(tags))) for ref in sorted(tags): 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 9deba136..76f8e4e3 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 @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +># -*- coding: utf-8 -*- # measure_index_times.py # Copyright (C) 2014 LEAP # diff --git a/client/src/leap/soledad/client/examples/soledad_sync.py b/client/src/leap/soledad/client/examples/soledad_sync.py index 6d0f6595..63077ee3 100644 --- a/client/src/leap/soledad/client/examples/soledad_sync.py +++ b/client/src/leap/soledad/client/examples/soledad_sync.py @@ -1,7 +1,7 @@ from leap.bitmask.config.providerconfig import ProviderConfig from leap.bitmask.crypto.srpauth import SRPAuth from leap.soledad.client import Soledad - +from twisted.internet import reactor import logging logging.basicConfig(level=logging.DEBUG) @@ -60,6 +60,4 @@ srpauth = SRPAuth(provider) d = srpauth.authenticate(user, _pass) d.addCallbacks(init_soledad, printErr) - -from twisted.internet import reactor reactor.run() diff --git a/client/src/leap/soledad/client/secrets.py b/client/src/leap/soledad/client/secrets.py index 3b6755e1..57a1169a 100644 --- a/client/src/leap/soledad/client/secrets.py +++ b/client/src/leap/soledad/client/secrets.py @@ -459,6 +459,7 @@ class SoledadSecrets(object): 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/sqlcipher.py b/client/src/leap/soledad/client/sqlcipher.py index 68802dd6..de752267 100644 --- a/client/src/leap/soledad/client/sqlcipher.py +++ b/client/src/leap/soledad/client/sqlcipher.py @@ -318,8 +318,7 @@ class SQLCipherDatabase(sqlite_backend.SQLitePartialExpandDatabase): novalue_where = ["d.doc_id = d%d.doc_id" " AND d%d.field_name = ?" % (i, i) for i in range(len(definition))] - exact_where = [novalue_where[i] - + (" AND d%d.value = ?" % (i,)) + exact_where = [novalue_where[i] + (" AND d%d.value = ?" % (i,)) for i in range(len(definition))] args = [] where = [] diff --git a/client/src/leap/soledad/client/sync.py b/client/src/leap/soledad/client/sync.py index 14c547cf..77abd868 100644 --- a/client/src/leap/soledad/client/sync.py +++ b/client/src/leap/soledad/client/sync.py @@ -197,8 +197,8 @@ class SoledadSynchronizer(Synchronizer): :rtype: twisted.internet.defer.Deferred """ cur_gen, trans_id = self.source._get_generation_info() - if (cur_gen == start_generation + self.num_inserted - and self.num_inserted > 0): + if (cur_gen == start_generation + self.num_inserted and + self.num_inserted > 0): return self.sync_target.record_sync_info( self.source._replica_uid, cur_gen, trans_id) return defer.succeed(None) |