mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-03 13:45:31 +00:00
style and cosmetic fixes, no semantic changes
use simpler super() syntax of python 3.x remove fixed errors/warnings' codes from setup.cfg flake8 configuration fix file exclusion list for flake8
This commit is contained in:
parent
95828c576d
commit
0580f2b4eb
13 changed files with 61 additions and 61 deletions
|
@ -107,7 +107,7 @@ def is_full(self):
|
||||||
class CacheChunkBuffer(ChunkBuffer):
|
class CacheChunkBuffer(ChunkBuffer):
|
||||||
|
|
||||||
def __init__(self, cache, key, stats, chunker_params=CHUNKER_PARAMS):
|
def __init__(self, cache, key, stats, chunker_params=CHUNKER_PARAMS):
|
||||||
super(CacheChunkBuffer, self).__init__(key, chunker_params)
|
super().__init__(key, chunker_params)
|
||||||
self.cache = cache
|
self.cache = cache
|
||||||
self.stats = stats
|
self.stats = stats
|
||||||
|
|
||||||
|
@ -127,7 +127,6 @@ class AlreadyExists(Error):
|
||||||
class IncompatibleFilesystemEncodingError(Error):
|
class IncompatibleFilesystemEncodingError(Error):
|
||||||
"""Failed to encode filename "{}" into file system encoding "{}". Consider configuring the LANG environment variable."""
|
"""Failed to encode filename "{}" into file system encoding "{}". Consider configuring the LANG environment variable."""
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, repository, key, manifest, name, cache=None, create=False,
|
def __init__(self, repository, key, manifest, name, cache=None, create=False,
|
||||||
checkpoint_interval=300, numeric_owner=False, progress=False,
|
checkpoint_interval=300, numeric_owner=False, progress=False,
|
||||||
chunker_params=CHUNKER_PARAMS):
|
chunker_params=CHUNKER_PARAMS):
|
||||||
|
@ -232,9 +231,11 @@ def add(id):
|
||||||
count, size, csize = cache.chunks[id]
|
count, size, csize = cache.chunks[id]
|
||||||
stats.update(size, csize, count == 1)
|
stats.update(size, csize, count == 1)
|
||||||
cache.chunks[id] = count - 1, size, csize
|
cache.chunks[id] = count - 1, size, csize
|
||||||
|
|
||||||
def add_file_chunks(chunks):
|
def add_file_chunks(chunks):
|
||||||
for id, _, _ in chunks:
|
for id, _, _ in chunks:
|
||||||
add(id)
|
add(id)
|
||||||
|
|
||||||
# This function is a bit evil since it abuses the cache to calculate
|
# This function is a bit evil since it abuses the cache to calculate
|
||||||
# the stats. The cache transaction must be rolled back afterwards
|
# the stats. The cache transaction must be rolled back afterwards
|
||||||
unpacker = msgpack.Unpacker(use_list=False)
|
unpacker = msgpack.Unpacker(use_list=False)
|
||||||
|
@ -551,7 +552,7 @@ class RobustUnpacker():
|
||||||
item_keys = [msgpack.packb(name) for name in ('path', 'mode', 'source', 'chunks', 'rdev', 'xattrs', 'user', 'group', 'uid', 'gid', 'mtime')]
|
item_keys = [msgpack.packb(name) for name in ('path', 'mode', 'source', 'chunks', 'rdev', 'xattrs', 'user', 'group', 'uid', 'gid', 'mtime')]
|
||||||
|
|
||||||
def __init__(self, validator):
|
def __init__(self, validator):
|
||||||
super(RobustUnpacker, self).__init__()
|
super().__init__()
|
||||||
self.validator = validator
|
self.validator = validator
|
||||||
self._buffered_data = []
|
self._buffered_data = []
|
||||||
self._resync = False
|
self._resync = False
|
||||||
|
@ -810,4 +811,3 @@ def verify_chunks(self):
|
||||||
self.repository.delete(id_)
|
self.repository.delete(id_)
|
||||||
self.manifest.write()
|
self.manifest.write()
|
||||||
self.repository.commit()
|
self.repository.commit()
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ class Cache:
|
||||||
class RepositoryReplay(Error):
|
class RepositoryReplay(Error):
|
||||||
"""Cache is newer than repository, refusing to continue"""
|
"""Cache is newer than repository, refusing to continue"""
|
||||||
|
|
||||||
|
|
||||||
class CacheInitAbortedError(Error):
|
class CacheInitAbortedError(Error):
|
||||||
"""Cache initialization aborted"""
|
"""Cache initialization aborted"""
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ class FuseOperations(llfuse.Operations):
|
||||||
"""Export archive as a fuse filesystem
|
"""Export archive as a fuse filesystem
|
||||||
"""
|
"""
|
||||||
def __init__(self, key, repository, manifest, archive):
|
def __init__(self, key, repository, manifest, archive):
|
||||||
super(FuseOperations, self).__init__()
|
super().__init__()
|
||||||
self._inode_count = 0
|
self._inode_count = 0
|
||||||
self.key = key
|
self.key = key
|
||||||
self.repository = cache_if_remote(repository)
|
self.repository = cache_if_remote(repository)
|
||||||
|
|
|
@ -73,10 +73,13 @@ def release(self):
|
||||||
|
|
||||||
def check_extension_modules():
|
def check_extension_modules():
|
||||||
from . import platform
|
from . import platform
|
||||||
if (hashindex.API_VERSION != 2 or
|
if hashindex.API_VERSION != 2:
|
||||||
chunker.API_VERSION != 2 or
|
raise ExtensionModuleError
|
||||||
crypto.API_VERSION != 2 or
|
if chunker.API_VERSION != 2:
|
||||||
platform.API_VERSION != 2):
|
raise ExtensionModuleError
|
||||||
|
if crypto.API_VERSION != 2:
|
||||||
|
raise ExtensionModuleError
|
||||||
|
if platform.API_VERSION != 2:
|
||||||
raise ExtensionModuleError
|
raise ExtensionModuleError
|
||||||
|
|
||||||
|
|
||||||
|
@ -529,9 +532,9 @@ def canonical_path(self):
|
||||||
else:
|
else:
|
||||||
path = self.path
|
path = self.path
|
||||||
return 'ssh://{}{}{}{}'.format('{}@'.format(self.user) if self.user else '',
|
return 'ssh://{}{}{}{}'.format('{}@'.format(self.user) if self.user else '',
|
||||||
self.host,
|
self.host,
|
||||||
':{}'.format(self.port) if self.port else '',
|
':{}'.format(self.port) if self.port else '',
|
||||||
path)
|
path)
|
||||||
|
|
||||||
|
|
||||||
def location_validator(archive=None):
|
def location_validator(archive=None):
|
||||||
|
@ -606,7 +609,7 @@ def daemonize():
|
||||||
class StableDict(dict):
|
class StableDict(dict):
|
||||||
"""A dict subclass with stable items() ordering"""
|
"""A dict subclass with stable items() ordering"""
|
||||||
def items(self):
|
def items(self):
|
||||||
return sorted(super(StableDict, self).items())
|
return sorted(super().items())
|
||||||
|
|
||||||
|
|
||||||
if sys.version < '3.3':
|
if sys.version < '3.3':
|
||||||
|
@ -642,4 +645,3 @@ def int_to_bigint(value):
|
||||||
if value.bit_length() > 63:
|
if value.bit_length() > 63:
|
||||||
return value.to_bytes((value.bit_length() + 9) // 8, 'little', signed=True)
|
return value.to_bytes((value.bit_length() + 9) // 8, 'little', signed=True)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ class UnsupportedPayloadError(Error):
|
||||||
"""Unsupported payload type {}. A newer version is required to access this repository.
|
"""Unsupported payload type {}. A newer version is required to access this repository.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class KeyfileNotFoundError(Error):
|
class KeyfileNotFoundError(Error):
|
||||||
"""No key file for repository {} found in {}.
|
"""No key file for repository {} found in {}.
|
||||||
"""
|
"""
|
||||||
|
@ -231,8 +232,7 @@ def find_key_file(cls, repository):
|
||||||
filename = os.path.join(keys_dir, name)
|
filename = os.path.join(keys_dir, name)
|
||||||
with open(filename, 'r') as fd:
|
with open(filename, 'r') as fd:
|
||||||
line = fd.readline().strip()
|
line = fd.readline().strip()
|
||||||
if (line and line.startswith(cls.FILE_ID) and
|
if line and line.startswith(cls.FILE_ID) and line[len(cls.FILE_ID)+1:] == id:
|
||||||
line[len(cls.FILE_ID)+1:] == id):
|
|
||||||
return filename
|
return filename
|
||||||
raise KeyfileNotFoundError(repository._location.canonical_path(), get_keys_dir())
|
raise KeyfileNotFoundError(repository._location.canonical_path(), get_keys_dir())
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class LRUCache(dict):
|
class LRUCache(dict):
|
||||||
|
|
||||||
def __init__(self, capacity):
|
def __init__(self, capacity):
|
||||||
super(LRUCache, self).__init__()
|
super().__init__()
|
||||||
self._lru = []
|
self._lru = []
|
||||||
self._capacity = capacity
|
self._capacity = capacity
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ def __setitem__(self, key, value):
|
||||||
self._lru.append(key)
|
self._lru.append(key)
|
||||||
while len(self._lru) > self._capacity:
|
while len(self._lru) > self._capacity:
|
||||||
del self[self._lru[0]]
|
del self[self._lru[0]]
|
||||||
return super(LRUCache, self).__setitem__(key, value)
|
return super().__setitem__(key, value)
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
try:
|
try:
|
||||||
|
@ -21,21 +21,21 @@ def __getitem__(self, key):
|
||||||
self._lru.append(key)
|
self._lru.append(key)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
return super(LRUCache, self).__getitem__(key)
|
return super().__getitem__(key)
|
||||||
|
|
||||||
def __delitem__(self, key):
|
def __delitem__(self, key):
|
||||||
try:
|
try:
|
||||||
self._lru.remove(key)
|
self._lru.remove(key)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
return super(LRUCache, self).__delitem__(key)
|
return super().__delitem__(key)
|
||||||
|
|
||||||
def pop(self, key, default=None):
|
def pop(self, key, default=None):
|
||||||
try:
|
try:
|
||||||
self._lru.remove(key)
|
self._lru.remove(key)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
return super(LRUCache, self).pop(key, default)
|
return super().pop(key, default)
|
||||||
|
|
||||||
def _not_implemented(self, *args, **kw):
|
def _not_implemented(self, *args, **kw):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
|
@ -25,24 +25,25 @@ class ConnectionClosed(Error):
|
||||||
class PathNotAllowed(Error):
|
class PathNotAllowed(Error):
|
||||||
"""Repository path not allowed"""
|
"""Repository path not allowed"""
|
||||||
|
|
||||||
|
|
||||||
class InvalidRPCMethod(Error):
|
class InvalidRPCMethod(Error):
|
||||||
"""RPC method is not valid"""
|
"""RPC method is not valid"""
|
||||||
|
|
||||||
|
|
||||||
class RepositoryServer:
|
class RepositoryServer:
|
||||||
rpc_methods = (
|
rpc_methods = (
|
||||||
'__len__',
|
'__len__',
|
||||||
'check',
|
'check',
|
||||||
'commit',
|
'commit',
|
||||||
'delete',
|
'delete',
|
||||||
'get',
|
'get',
|
||||||
'list',
|
'list',
|
||||||
'negotiate',
|
'negotiate',
|
||||||
'open',
|
'open',
|
||||||
'put',
|
'put',
|
||||||
'repair',
|
'repair',
|
||||||
'rollback',
|
'rollback',
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, restrict_to_paths):
|
def __init__(self, restrict_to_paths):
|
||||||
self.repository = None
|
self.repository = None
|
||||||
|
@ -71,7 +72,7 @@ def serve(self):
|
||||||
type, msgid, method, args = unpacked
|
type, msgid, method, args = unpacked
|
||||||
method = method.decode('ascii')
|
method = method.decode('ascii')
|
||||||
try:
|
try:
|
||||||
if not method in self.rpc_methods:
|
if method not in self.rpc_methods:
|
||||||
raise InvalidRPCMethod(method)
|
raise InvalidRPCMethod(method)
|
||||||
try:
|
try:
|
||||||
f = getattr(self, method)
|
f = getattr(self, method)
|
||||||
|
|
|
@ -119,5 +119,3 @@ def loadTestsFromName(self, pattern, module=None):
|
||||||
if pattern.lower() in test.id().lower():
|
if pattern.lower() in test.id().lower():
|
||||||
tests.addTest(test)
|
tests.addTest(test)
|
||||||
return tests
|
return tests
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import llfuse
|
import llfuse
|
||||||
has_llfuse = True
|
has_llfuse = True or llfuse # avoids "unused import"
|
||||||
except ImportError:
|
except ImportError:
|
||||||
has_llfuse = False
|
has_llfuse = False
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ def create_test_files(self):
|
||||||
self.create_regular_file('empty', size=0)
|
self.create_regular_file('empty', size=0)
|
||||||
# next code line raises OverflowError on 32bit cpu (raspberry pi 2):
|
# next code line raises OverflowError on 32bit cpu (raspberry pi 2):
|
||||||
# 2600-01-01 > 2**64 ns
|
# 2600-01-01 > 2**64 ns
|
||||||
#os.utime('input/empty', (19880895600, 19880895600))
|
# os.utime('input/empty', (19880895600, 19880895600))
|
||||||
# thus, we better test with something not that far in future:
|
# thus, we better test with something not that far in future:
|
||||||
# 2038-01-19 (1970 + 2^31 - 1 seconds) is the 32bit "deadline":
|
# 2038-01-19 (1970 + 2^31 - 1 seconds) is the 32bit "deadline":
|
||||||
os.utime('input/empty', (2**31 - 1, 2**31 - 1))
|
os.utime('input/empty', (2**31 - 1, 2**31 - 1))
|
||||||
|
@ -157,9 +157,9 @@ def create_test_files(self):
|
||||||
os.chmod('input/file1', 0o7755)
|
os.chmod('input/file1', 0o7755)
|
||||||
os.chmod('input/dir2', 0o555)
|
os.chmod('input/dir2', 0o555)
|
||||||
# Block device
|
# Block device
|
||||||
os.mknod('input/bdev', 0o600 | stat.S_IFBLK, os.makedev(10, 20))
|
os.mknod('input/bdev', 0o600 | stat.S_IFBLK, os.makedev(10, 20))
|
||||||
# Char device
|
# Char device
|
||||||
os.mknod('input/cdev', 0o600 | stat.S_IFCHR, os.makedev(30, 40))
|
os.mknod('input/cdev', 0o600 | stat.S_IFCHR, os.makedev(30, 40))
|
||||||
# Hard link
|
# Hard link
|
||||||
os.link(os.path.join(self.input_path, 'file1'),
|
os.link(os.path.join(self.input_path, 'file1'),
|
||||||
os.path.join(self.input_path, 'hardlink'))
|
os.path.join(self.input_path, 'hardlink'))
|
||||||
|
@ -172,7 +172,7 @@ def create_test_files(self):
|
||||||
# same for newer ubuntu and centos.
|
# same for newer ubuntu and centos.
|
||||||
# if this is supported just on specific platform, platform should be checked first,
|
# if this is supported just on specific platform, platform should be checked first,
|
||||||
# so that the test setup for all tests using it does not fail here always for others.
|
# so that the test setup for all tests using it does not fail here always for others.
|
||||||
#xattr.setxattr(os.path.join(self.input_path, 'link1'), 'user.foo_symlink', b'bar_symlink', follow_symlinks=False)
|
# xattr.setxattr(os.path.join(self.input_path, 'link1'), 'user.foo_symlink', b'bar_symlink', follow_symlinks=False)
|
||||||
# FIFO node
|
# FIFO node
|
||||||
os.mkfifo(os.path.join(self.input_path, 'fifo1'))
|
os.mkfifo(os.path.join(self.input_path, 'fifo1'))
|
||||||
if has_lchflags:
|
if has_lchflags:
|
||||||
|
@ -253,7 +253,7 @@ def test_repository_swap_detection(self):
|
||||||
self.cmd('init', '--encryption=none', self.repository_location)
|
self.cmd('init', '--encryption=none', self.repository_location)
|
||||||
self._set_repository_id(self.repository_path, repository_id)
|
self._set_repository_id(self.repository_path, repository_id)
|
||||||
self.assert_equal(repository_id, self._extract_repository_id(self.repository_path))
|
self.assert_equal(repository_id, self._extract_repository_id(self.repository_path))
|
||||||
self.assert_raises(Cache.EncryptionMethodMismatch, lambda :self.cmd('create', self.repository_location + '::test.2', 'input'))
|
self.assert_raises(Cache.EncryptionMethodMismatch, lambda: self.cmd('create', self.repository_location + '::test.2', 'input'))
|
||||||
|
|
||||||
def test_repository_swap_detection2(self):
|
def test_repository_swap_detection2(self):
|
||||||
self.create_test_files()
|
self.create_test_files()
|
||||||
|
@ -263,7 +263,7 @@ def test_repository_swap_detection2(self):
|
||||||
self.cmd('create', self.repository_location + '_encrypted::test', 'input')
|
self.cmd('create', self.repository_location + '_encrypted::test', 'input')
|
||||||
shutil.rmtree(self.repository_path + '_encrypted')
|
shutil.rmtree(self.repository_path + '_encrypted')
|
||||||
os.rename(self.repository_path + '_unencrypted', self.repository_path + '_encrypted')
|
os.rename(self.repository_path + '_unencrypted', self.repository_path + '_encrypted')
|
||||||
self.assert_raises(Cache.RepositoryAccessAborted, lambda :self.cmd('create', self.repository_location + '_encrypted::test.2', 'input'))
|
self.assert_raises(Cache.RepositoryAccessAborted, lambda: self.cmd('create', self.repository_location + '_encrypted::test.2', 'input'))
|
||||||
|
|
||||||
def test_strip_components(self):
|
def test_strip_components(self):
|
||||||
self.cmd('init', self.repository_location)
|
self.cmd('init', self.repository_location)
|
||||||
|
@ -524,7 +524,7 @@ def test_aes_counter_uniqueness_passphrase(self):
|
||||||
class ArchiverCheckTestCase(ArchiverTestCaseBase):
|
class ArchiverCheckTestCase(ArchiverTestCaseBase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ArchiverCheckTestCase, self).setUp()
|
super().setUp()
|
||||||
with patch.object(ChunkBuffer, 'BUFFER_SIZE', 10):
|
with patch.object(ChunkBuffer, 'BUFFER_SIZE', 10):
|
||||||
self.cmd('init', self.repository_location)
|
self.cmd('init', self.repository_location)
|
||||||
self.create_src_archive('archive1')
|
self.create_src_archive('archive1')
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import msgpack
|
import msgpack
|
||||||
|
|
||||||
from ..helpers import adjust_patterns, exclude_path, Location, format_timedelta, IncludePattern, ExcludePattern, make_path_safe, UpgradableLock, prune_within, prune_split, to_localtime, \
|
from ..helpers import adjust_patterns, exclude_path, Location, format_timedelta, ExcludePattern, make_path_safe, UpgradableLock, prune_within, prune_split, \
|
||||||
StableDict, int_to_bigint, bigint_to_int, parse_timestamp
|
StableDict, int_to_bigint, bigint_to_int, parse_timestamp
|
||||||
from . import BaseTestCase
|
from . import BaseTestCase
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ def test(self):
|
||||||
['/etc/passwd', '/etc/hosts', '/home', '/var/log/messages', '/var/log/dmesg'])
|
['/etc/passwd', '/etc/hosts', '/home', '/var/log/messages', '/var/log/dmesg'])
|
||||||
self.assert_equal(self.evaluate(['/home/u'], []), [])
|
self.assert_equal(self.evaluate(['/home/u'], []), [])
|
||||||
self.assert_equal(self.evaluate(['/', '/home', '/etc/hosts'], ['/']), [])
|
self.assert_equal(self.evaluate(['/', '/home', '/etc/hosts'], ['/']), [])
|
||||||
self.assert_equal(self.evaluate(['/home/'], ['/home/user2']),
|
self.assert_equal(self.evaluate(['/home/'], ['/home/user2']),
|
||||||
['/home', '/home/user/.profile', '/home/user/.bashrc'])
|
['/home', '/home/user/.profile', '/home/user/.bashrc'])
|
||||||
self.assert_equal(self.evaluate(['/'], ['*.profile', '/var/log']),
|
self.assert_equal(self.evaluate(['/'], ['*.profile', '/var/log']),
|
||||||
['/etc/passwd', '/etc/hosts', '/home', '/home/user/.bashrc', '/home/user2/public_html/index.html'])
|
['/etc/passwd', '/etc/hosts', '/home', '/home/user/.bashrc', '/home/user2/public_html/index.html'])
|
||||||
|
@ -118,6 +118,7 @@ def test(self):
|
||||||
self.assert_equal(make_path_safe('/'), '.')
|
self.assert_equal(make_path_safe('/'), '.')
|
||||||
self.assert_equal(make_path_safe('/'), '.')
|
self.assert_equal(make_path_safe('/'), '.')
|
||||||
|
|
||||||
|
|
||||||
class UpgradableLockTestCase(BaseTestCase):
|
class UpgradableLockTestCase(BaseTestCase):
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
|
@ -161,7 +162,7 @@ def dotest(test_archives, n, skip, indices):
|
||||||
for ta in test_archives, reversed(test_archives):
|
for ta in test_archives, reversed(test_archives):
|
||||||
self.assert_equal(set(prune_split(ta, '%Y-%m', n, skip)),
|
self.assert_equal(set(prune_split(ta, '%Y-%m', n, skip)),
|
||||||
subset(test_archives, indices))
|
subset(test_archives, indices))
|
||||||
|
|
||||||
test_pairs = [(1, 1), (2, 1), (2, 28), (3, 1), (3, 2), (3, 31), (5, 1)]
|
test_pairs = [(1, 1), (2, 1), (2, 28), (3, 1), (3, 2), (3, 31), (5, 1)]
|
||||||
test_dates = [local_to_UTC(month, day) for month, day in test_pairs]
|
test_dates = [local_to_UTC(month, day) for month, day in test_pairs]
|
||||||
test_archives = [MockArchive(date) for date in test_dates]
|
test_archives = [MockArchive(date) for date in test_dates]
|
||||||
|
@ -185,24 +186,24 @@ def dotest(test_archives, within, indices):
|
||||||
for ta in test_archives, reversed(test_archives):
|
for ta in test_archives, reversed(test_archives):
|
||||||
self.assert_equal(set(prune_within(ta, within)),
|
self.assert_equal(set(prune_within(ta, within)),
|
||||||
subset(test_archives, indices))
|
subset(test_archives, indices))
|
||||||
|
|
||||||
# 1 minute, 1.5 hours, 2.5 hours, 3.5 hours, 25 hours, 49 hours
|
# 1 minute, 1.5 hours, 2.5 hours, 3.5 hours, 25 hours, 49 hours
|
||||||
test_offsets = [60, 90*60, 150*60, 210*60, 25*60*60, 49*60*60]
|
test_offsets = [60, 90*60, 150*60, 210*60, 25*60*60, 49*60*60]
|
||||||
now = datetime.now(timezone.utc)
|
now = datetime.now(timezone.utc)
|
||||||
test_dates = [now - timedelta(seconds=s) for s in test_offsets]
|
test_dates = [now - timedelta(seconds=s) for s in test_offsets]
|
||||||
test_archives = [MockArchive(date) for date in test_dates]
|
test_archives = [MockArchive(date) for date in test_dates]
|
||||||
|
|
||||||
dotest(test_archives, '1H', [0])
|
dotest(test_archives, '1H', [0])
|
||||||
dotest(test_archives, '2H', [0, 1])
|
dotest(test_archives, '2H', [0, 1])
|
||||||
dotest(test_archives, '3H', [0, 1, 2])
|
dotest(test_archives, '3H', [0, 1, 2])
|
||||||
dotest(test_archives, '24H', [0, 1, 2, 3])
|
dotest(test_archives, '24H', [0, 1, 2, 3])
|
||||||
dotest(test_archives, '26H', [0, 1, 2, 3, 4])
|
dotest(test_archives, '26H', [0, 1, 2, 3, 4])
|
||||||
dotest(test_archives, '2d', [0, 1, 2, 3, 4])
|
dotest(test_archives, '2d', [0, 1, 2, 3, 4])
|
||||||
dotest(test_archives, '50H', [0, 1, 2, 3, 4, 5])
|
dotest(test_archives, '50H', [0, 1, 2, 3, 4, 5])
|
||||||
dotest(test_archives, '3d', [0, 1, 2, 3, 4, 5])
|
dotest(test_archives, '3d', [0, 1, 2, 3, 4, 5])
|
||||||
dotest(test_archives, '1w', [0, 1, 2, 3, 4, 5])
|
dotest(test_archives, '1w', [0, 1, 2, 3, 4, 5])
|
||||||
dotest(test_archives, '1m', [0, 1, 2, 3, 4, 5])
|
dotest(test_archives, '1m', [0, 1, 2, 3, 4, 5])
|
||||||
dotest(test_archives, '1y', [0, 1, 2, 3, 4, 5])
|
dotest(test_archives, '1y', [0, 1, 2, 3, 4, 5])
|
||||||
|
|
||||||
|
|
||||||
class StableDictTestCase(BaseTestCase):
|
class StableDictTestCase(BaseTestCase):
|
||||||
|
|
|
@ -102,4 +102,3 @@ def test_access_acl(self):
|
||||||
self.set_acl(file2.name, b'!#acl 1\ngroup:ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000000:staff:0:allow:read\nuser:FFFFEEEE-DDDD-CCCC-BBBB-AAAA00000000:root:0:allow:read\n', numeric_owner=True)
|
self.set_acl(file2.name, b'!#acl 1\ngroup:ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000000:staff:0:allow:read\nuser:FFFFEEEE-DDDD-CCCC-BBBB-AAAA00000000:root:0:allow:read\n', numeric_owner=True)
|
||||||
self.assert_in(b'group:ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000000:wheel:0:allow:read', self.get_acl(file2.name)[b'acl_extended'])
|
self.assert_in(b'group:ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000000:wheel:0:allow:read', self.get_acl(file2.name)[b'acl_extended'])
|
||||||
self.assert_in(b'group:ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000000::0:allow:read', self.get_acl(file2.name, numeric_owner=True)[b'acl_extended'])
|
self.assert_in(b'group:ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000000::0:allow:read', self.get_acl(file2.name, numeric_owner=True)[b'acl_extended'])
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
python_files = testsuite/*.py
|
python_files = testsuite/*.py
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
ignore = E123,E126,E127,E129,E203,E221,E226,E231,E241,E265,E301,E302,E303,E713,F401,F403,W291,W293,W391
|
ignore = E226,F403
|
||||||
max-line-length = 250
|
max-line-length = 250
|
||||||
exclude = versioneer.py,docs/conf.py,borg/_version.py
|
exclude = versioneer.py,docs/conf.py,borg/_version.py,build,dist,.git,.idea,.cache
|
||||||
max-complexity = 100
|
max-complexity = 100
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -47,7 +47,7 @@ def make_distribution(self):
|
||||||
'borg/platform_freebsd.c',
|
'borg/platform_freebsd.c',
|
||||||
'borg/platform_darwin.c',
|
'borg/platform_darwin.c',
|
||||||
])
|
])
|
||||||
super(Sdist, self).make_distribution()
|
super().make_distribution()
|
||||||
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
class Sdist(versioneer.cmd_sdist):
|
class Sdist(versioneer.cmd_sdist):
|
||||||
|
|
Loading…
Reference in a new issue