~duplicity-team/duplicity/0.8-series

« back to all changes in this revision

Viewing changes to duplicity/backends/dpbxbackend.py

* Merged in lp:~kenneth-loafman/duplicity/duplicity-pylint
  - Enable additional pylint warnings. Make 1st pass at correction.
      unused-argument,
      unused-wildcard-import,
      redefined-builtin,
      bad-indentation,
      mixed-indentation,
     unreachable
  - Renamed globals to config to fix conflict with __builtin__.glogals()
  - Resolved conflict between duplicity.config and testing.manual.config
  - Normalized emacs mode line to have encoding:utf8 on all *.py files

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
 
1
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4; encoding:utf8 -*-
2
2
#
3
3
# Copyright 2013 jno <jno@pisem.net>
4
4
# Copyright 2016 Dmitry Nezhevenko <dion@dion.org.ua>
41
41
import urllib.parse  # pylint: disable=import-error
42
42
import urllib.error  # pylint: disable=import-error
43
43
 
44
 
from duplicity import log, globals
 
44
from duplicity import log, config
45
45
from duplicity import progress
46
46
from duplicity.errors import BackendException
47
 
from duplicity.globals import num_retries
48
 
from requests.exceptions import ConnectionError
 
47
from requests.exceptions import ConnectionError  # pylint: disable=redefined-builtin
49
48
import duplicity.backend
50
49
 
51
50
# This is chunk size for upload using Dpbx chumked API v2. It doesn't
71
70
    f.close()
72
71
 
73
72
 
74
 
def command(login_required=True):
 
73
def command(login_required=True):  # pylint: disable=unused-argument
75
74
    u"""a decorator for handling authentication and exceptions"""
76
75
    def decorate(f):
77
76
        def wrapper(self, *args):
194
193
        log.Info(u"dpbx: Successfully authenticated as %s" %
195
194
                 self.api_account.name.display_name)
196
195
 
197
 
    def _error_code(self, operation, e):
 
196
    def _error_code(self, operation, e):  # pylint: disable=unused-argument
198
197
        if isinstance(e, ApiError):
199
198
            err = e.error
200
199
 
269
268
 
270
269
            requested_offset = None
271
270
            current_chunk_size = DPBX_UPLOAD_CHUNK_SIZE
272
 
            retry_number = globals.num_retries
 
271
            retry_number = config.num_retries
273
272
            is_eof = False
274
273
 
275
274
            # We're doing our own error handling and retrying logic because
291
290
                    # reset temporary status variables
292
291
                    requested_offset = None
293
292
                    current_chunk_size = DPBX_UPLOAD_CHUNK_SIZE
294
 
                    retry_number = globals.num_retries
 
293
                    retry_number = config.num_retries
295
294
 
296
295
                    if not is_eof:
297
296
                        assert len(buf) != 0