Skip to content

Commit cb4ba5b

Browse files
author
Hugo Osvaldo Barrera
committed
Fix linting errors
One more green checkmark! ✅
1 parent 72ea0a6 commit cb4ba5b

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

tests/storage/test_filesystem.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def inner(collection='test'):
2424
return inner
2525

2626
def test_is_not_directory(self, tmpdir):
27-
with pytest.raises(IOError):
27+
with pytest.raises(OSError):
2828
f = tmpdir.join('hue')
2929
f.write('stub')
3030
self.storage_class(str(tmpdir) + '/hue', '.txt')
@@ -55,7 +55,7 @@ def test_too_long_uid(self, tmpdir):
5555
def test_post_hook_inactive(self, tmpdir, monkeypatch):
5656

5757
def check_call_mock(*args, **kwargs):
58-
assert False
58+
raise AssertionError()
5959

6060
monkeypatch.setattr(subprocess, 'call', check_call_mock)
6161

tests/storage/test_http_with_singlefile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def _request(method, url, *args, **kwargs):
6363
try:
6464
with open(self.tmpfile, 'rb') as f:
6565
r._content = f.read()
66-
except IOError:
66+
except OSError:
6767
r._content = b''
6868

6969
r.headers['Content-Type'] = 'text/calendar'

vdirsyncer/cli/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def handle_cli_error(status_name=None, e=None):
136136
'the issue tracker at {}'
137137
.format(e, BUGTRACKER_HOME)
138138
)
139-
except exceptions.CollectionRequired as e:
139+
except exceptions.CollectionRequired:
140140
cli_logger.error(
141141
'One or more storages don\'t support `collections = null`. '
142142
'You probably want to set `collections = ["from a", "from b"]`.'
@@ -214,7 +214,7 @@ def manage_sync_status(base_path, pair_name, collection_name):
214214
f.seek(0)
215215
# json.load doesn't work on binary files for Python 3.5
216216
legacy_status = dict(json.loads(f.read().decode('utf-8')))
217-
except (OSError, IOError, ValueError):
217+
except (OSError, ValueError):
218218
pass
219219

220220
if legacy_status is not None:

vdirsyncer/storage/etesync.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _get_auth_token(self):
7676
try:
7777
with open(self._auth_token_path) as f:
7878
return f.read().strip() or None
79-
except (OSError, IOError):
79+
except OSError:
8080
pass
8181

8282
def _set_auth_token(self, token):
@@ -89,7 +89,7 @@ def _get_key(self):
8989
try:
9090
with open(self._key_path, 'rb') as f:
9191
return f.read()
92-
except (OSError, IOError):
92+
except OSError:
9393
pass
9494

9595
def _set_key(self, content):

vdirsyncer/storage/filesystem.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def get(self, href):
8989
with open(fpath, 'rb') as f:
9090
return (Item(f.read().decode(self.encoding)),
9191
get_etag_from_file(fpath))
92-
except IOError as e:
92+
except OSError as e:
9393
if e.errno == errno.ENOENT:
9494
raise exceptions.NotFoundError(href)
9595
else:
@@ -172,7 +172,7 @@ def get_meta(self, key):
172172
try:
173173
with open(fpath, 'rb') as f:
174174
return normalize_meta_value(f.read().decode(self.encoding))
175-
except IOError as e:
175+
except OSError as e:
176176
if e.errno == errno.ENOENT:
177177
return u''
178178
else:

vdirsyncer/storage/google.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def _init_token(self, token_file, client_id, client_secret):
5050
try:
5151
with open(token_file) as f:
5252
token = json.load(f)
53-
except (OSError, IOError):
53+
except OSError:
5454
pass
5555
except ValueError as e:
5656
raise exceptions.UserError(

vdirsyncer/storage/singlefile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def list(self):
105105
except OSError as e:
106106
import errno
107107
if e.errno != errno.ENOENT: # file not found
108-
raise IOError(e)
108+
raise OSError(e)
109109
text = None
110110

111111
if not text:

vdirsyncer/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def checkdir(path, create=False, mode=0o750):
127127

128128
if not os.path.isdir(path):
129129
if os.path.exists(path):
130-
raise IOError('{} is not a directory.'.format(path))
130+
raise OSError('{} is not a directory.'.format(path))
131131
if create:
132132
os.makedirs(path, mode)
133133
else:
@@ -145,7 +145,7 @@ def checkfile(path, create=False):
145145
checkdir(os.path.dirname(path), create=create)
146146
if not os.path.isfile(path):
147147
if os.path.exists(path):
148-
raise IOError('{} is not a file.'.format(path))
148+
raise OSError('{} is not a file.'.format(path))
149149
if create:
150150
with open(path, 'wb'):
151151
pass

0 commit comments

Comments
 (0)