mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +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
|
||||
|
||||
def test_is_not_directory(self, tmpdir):
|
||||
with pytest.raises(IOError):
|
||||
with pytest.raises(OSError):
|
||||
f = tmpdir.join('hue')
|
||||
f.write('stub')
|
||||
self.storage_class(str(tmpdir) + '/hue', '.txt')
|
||||
|
|
@ -55,7 +55,7 @@ class TestFilesystemStorage(StorageTests):
|
|||
def test_post_hook_inactive(self, tmpdir, monkeypatch):
|
||||
|
||||
def check_call_mock(*args, **kwargs):
|
||||
assert False
|
||||
raise AssertionError()
|
||||
|
||||
monkeypatch.setattr(subprocess, 'call', check_call_mock)
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class TestHttpStorage(StorageTests):
|
|||
try:
|
||||
with open(self.tmpfile, 'rb') as f:
|
||||
r._content = f.read()
|
||||
except IOError:
|
||||
except OSError:
|
||||
r._content = b''
|
||||
|
||||
r.headers['Content-Type'] = 'text/calendar'
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ def handle_cli_error(status_name=None, e=None):
|
|||
'the issue tracker at {}'
|
||||
.format(e, BUGTRACKER_HOME)
|
||||
)
|
||||
except exceptions.CollectionRequired as e:
|
||||
except exceptions.CollectionRequired:
|
||||
cli_logger.error(
|
||||
'One or more storages don\'t support `collections = null`. '
|
||||
'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)
|
||||
# json.load doesn't work on binary files for Python 3.5
|
||||
legacy_status = dict(json.loads(f.read().decode('utf-8')))
|
||||
except (OSError, IOError, ValueError):
|
||||
except (OSError, ValueError):
|
||||
pass
|
||||
|
||||
if legacy_status is not None:
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class _Session:
|
|||
try:
|
||||
with open(self._auth_token_path) as f:
|
||||
return f.read().strip() or None
|
||||
except (OSError, IOError):
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
def _set_auth_token(self, token):
|
||||
|
|
@ -89,7 +89,7 @@ class _Session:
|
|||
try:
|
||||
with open(self._key_path, 'rb') as f:
|
||||
return f.read()
|
||||
except (OSError, IOError):
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
def _set_key(self, content):
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class FilesystemStorage(Storage):
|
|||
with open(fpath, 'rb') as f:
|
||||
return (Item(f.read().decode(self.encoding)),
|
||||
get_etag_from_file(fpath))
|
||||
except IOError as e:
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
raise exceptions.NotFoundError(href)
|
||||
else:
|
||||
|
|
@ -172,7 +172,7 @@ class FilesystemStorage(Storage):
|
|||
try:
|
||||
with open(fpath, 'rb') as f:
|
||||
return normalize_meta_value(f.read().decode(self.encoding))
|
||||
except IOError as e:
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
return u''
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class GoogleSession(dav.DAVSession):
|
|||
try:
|
||||
with open(token_file) as f:
|
||||
token = json.load(f)
|
||||
except (OSError, IOError):
|
||||
except OSError:
|
||||
pass
|
||||
except ValueError as e:
|
||||
raise exceptions.UserError(
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class SingleFileStorage(Storage):
|
|||
except OSError as e:
|
||||
import errno
|
||||
if e.errno != errno.ENOENT: # file not found
|
||||
raise IOError(e)
|
||||
raise OSError(e)
|
||||
text = None
|
||||
|
||||
if not text:
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ def checkdir(path, create=False, mode=0o750):
|
|||
|
||||
if not os.path.isdir(path):
|
||||
if os.path.exists(path):
|
||||
raise IOError('{} is not a directory.'.format(path))
|
||||
raise OSError('{} is not a directory.'.format(path))
|
||||
if create:
|
||||
os.makedirs(path, mode)
|
||||
else:
|
||||
|
|
@ -145,7 +145,7 @@ def checkfile(path, create=False):
|
|||
checkdir(os.path.dirname(path), create=create)
|
||||
if not os.path.isfile(path):
|
||||
if os.path.exists(path):
|
||||
raise IOError('{} is not a file.'.format(path))
|
||||
raise OSError('{} is not a file.'.format(path))
|
||||
if create:
|
||||
with open(path, 'wb'):
|
||||
pass
|
||||
|
|
|
|||
Loading…
Reference in a new issue