mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Fix linting errors
One more green checkmark! ✅
This commit is contained in:
parent
72ea0a6ad3
commit
cb4ba5b38c
8 changed files with 13 additions and 13 deletions
|
|
@ -24,7 +24,7 @@ class TestFilesystemStorage(StorageTests):
|
||||||
return inner
|
return inner
|
||||||
|
|
||||||
def test_is_not_directory(self, tmpdir):
|
def test_is_not_directory(self, tmpdir):
|
||||||
with pytest.raises(IOError):
|
with pytest.raises(OSError):
|
||||||
f = tmpdir.join('hue')
|
f = tmpdir.join('hue')
|
||||||
f.write('stub')
|
f.write('stub')
|
||||||
self.storage_class(str(tmpdir) + '/hue', '.txt')
|
self.storage_class(str(tmpdir) + '/hue', '.txt')
|
||||||
|
|
@ -55,7 +55,7 @@ class TestFilesystemStorage(StorageTests):
|
||||||
def test_post_hook_inactive(self, tmpdir, monkeypatch):
|
def test_post_hook_inactive(self, tmpdir, monkeypatch):
|
||||||
|
|
||||||
def check_call_mock(*args, **kwargs):
|
def check_call_mock(*args, **kwargs):
|
||||||
assert False
|
raise AssertionError()
|
||||||
|
|
||||||
monkeypatch.setattr(subprocess, 'call', check_call_mock)
|
monkeypatch.setattr(subprocess, 'call', check_call_mock)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ class TestHttpStorage(StorageTests):
|
||||||
try:
|
try:
|
||||||
with open(self.tmpfile, 'rb') as f:
|
with open(self.tmpfile, 'rb') as f:
|
||||||
r._content = f.read()
|
r._content = f.read()
|
||||||
except IOError:
|
except OSError:
|
||||||
r._content = b''
|
r._content = b''
|
||||||
|
|
||||||
r.headers['Content-Type'] = 'text/calendar'
|
r.headers['Content-Type'] = 'text/calendar'
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ def handle_cli_error(status_name=None, e=None):
|
||||||
'the issue tracker at {}'
|
'the issue tracker at {}'
|
||||||
.format(e, BUGTRACKER_HOME)
|
.format(e, BUGTRACKER_HOME)
|
||||||
)
|
)
|
||||||
except exceptions.CollectionRequired as e:
|
except exceptions.CollectionRequired:
|
||||||
cli_logger.error(
|
cli_logger.error(
|
||||||
'One or more storages don\'t support `collections = null`. '
|
'One or more storages don\'t support `collections = null`. '
|
||||||
'You probably want to set `collections = ["from a", "from b"]`.'
|
'You probably want to set `collections = ["from a", "from b"]`.'
|
||||||
|
|
@ -214,7 +214,7 @@ def manage_sync_status(base_path, pair_name, collection_name):
|
||||||
f.seek(0)
|
f.seek(0)
|
||||||
# json.load doesn't work on binary files for Python 3.5
|
# json.load doesn't work on binary files for Python 3.5
|
||||||
legacy_status = dict(json.loads(f.read().decode('utf-8')))
|
legacy_status = dict(json.loads(f.read().decode('utf-8')))
|
||||||
except (OSError, IOError, ValueError):
|
except (OSError, ValueError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if legacy_status is not None:
|
if legacy_status is not None:
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class _Session:
|
||||||
try:
|
try:
|
||||||
with open(self._auth_token_path) as f:
|
with open(self._auth_token_path) as f:
|
||||||
return f.read().strip() or None
|
return f.read().strip() or None
|
||||||
except (OSError, IOError):
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _set_auth_token(self, token):
|
def _set_auth_token(self, token):
|
||||||
|
|
@ -89,7 +89,7 @@ class _Session:
|
||||||
try:
|
try:
|
||||||
with open(self._key_path, 'rb') as f:
|
with open(self._key_path, 'rb') as f:
|
||||||
return f.read()
|
return f.read()
|
||||||
except (OSError, IOError):
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _set_key(self, content):
|
def _set_key(self, content):
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ class FilesystemStorage(Storage):
|
||||||
with open(fpath, 'rb') as f:
|
with open(fpath, 'rb') as f:
|
||||||
return (Item(f.read().decode(self.encoding)),
|
return (Item(f.read().decode(self.encoding)),
|
||||||
get_etag_from_file(fpath))
|
get_etag_from_file(fpath))
|
||||||
except IOError as e:
|
except OSError as e:
|
||||||
if e.errno == errno.ENOENT:
|
if e.errno == errno.ENOENT:
|
||||||
raise exceptions.NotFoundError(href)
|
raise exceptions.NotFoundError(href)
|
||||||
else:
|
else:
|
||||||
|
|
@ -172,7 +172,7 @@ class FilesystemStorage(Storage):
|
||||||
try:
|
try:
|
||||||
with open(fpath, 'rb') as f:
|
with open(fpath, 'rb') as f:
|
||||||
return normalize_meta_value(f.read().decode(self.encoding))
|
return normalize_meta_value(f.read().decode(self.encoding))
|
||||||
except IOError as e:
|
except OSError as e:
|
||||||
if e.errno == errno.ENOENT:
|
if e.errno == errno.ENOENT:
|
||||||
return u''
|
return u''
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class GoogleSession(dav.DAVSession):
|
||||||
try:
|
try:
|
||||||
with open(token_file) as f:
|
with open(token_file) as f:
|
||||||
token = json.load(f)
|
token = json.load(f)
|
||||||
except (OSError, IOError):
|
except OSError:
|
||||||
pass
|
pass
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
raise exceptions.UserError(
|
raise exceptions.UserError(
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ class SingleFileStorage(Storage):
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
import errno
|
import errno
|
||||||
if e.errno != errno.ENOENT: # file not found
|
if e.errno != errno.ENOENT: # file not found
|
||||||
raise IOError(e)
|
raise OSError(e)
|
||||||
text = None
|
text = None
|
||||||
|
|
||||||
if not text:
|
if not text:
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ def checkdir(path, create=False, mode=0o750):
|
||||||
|
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
raise IOError('{} is not a directory.'.format(path))
|
raise OSError('{} is not a directory.'.format(path))
|
||||||
if create:
|
if create:
|
||||||
os.makedirs(path, mode)
|
os.makedirs(path, mode)
|
||||||
else:
|
else:
|
||||||
|
|
@ -145,7 +145,7 @@ def checkfile(path, create=False):
|
||||||
checkdir(os.path.dirname(path), create=create)
|
checkdir(os.path.dirname(path), create=create)
|
||||||
if not os.path.isfile(path):
|
if not os.path.isfile(path):
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
raise IOError('{} is not a file.'.format(path))
|
raise OSError('{} is not a file.'.format(path))
|
||||||
if create:
|
if create:
|
||||||
with open(path, 'wb'):
|
with open(path, 'wb'):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue