Skip to content

Commit 9ac6571

Browse files
committed
Fix up newer pylint and mypy warnings.
Signed-off-by: Chris Lalancette <clalancette@gmail.com>
1 parent bc5187a commit 9ac6571

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

pycdlib/pycdlib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4374,7 +4374,7 @@ def add_fp(self, fp, length, iso_path=None, rr_name=None, joliet_path=None,
43744374

43754375
def add_file(self, filename, iso_path=None, rr_name=None, joliet_path=None,
43764376
file_mode=None, udf_path=None):
4377-
# type: (str, Optional[str], Optional[str], str, Optional[int], Optional[str]) -> None
4377+
# type: (str, Optional[str], Optional[str], Optional[str], Optional[int], Optional[str]) -> None
43784378
"""
43794379
Add a file to the ISO. If the ISO is a Rock Ridge one, then a Rock
43804380
Ridge name must also be provided. If the ISO is a Joliet one, then a
@@ -4699,7 +4699,7 @@ def rm_hard_link(self, iso_path=None, joliet_path=None, udf_path=None):
46994699

47004700
def add_directory(self, iso_path=None, rr_name=None, joliet_path=None,
47014701
file_mode=None, udf_path=None):
4702-
# type: (Optional[str], Optional[str], Optional[str], int, Optional[str]) -> None
4702+
# type: (Optional[str], Optional[str], Optional[str], Optional[int], Optional[str]) -> None
47034703
"""
47044704
Add a directory to the ISO. At least one of an iso_path, joliet_path,
47054705
or udf_path must be provided. Providing joliet_path on a non-Joliet
@@ -5049,7 +5049,7 @@ def add_eltorito(self, bootfile_path, bootcatfile=None,
50495049
boot_load_size=None, platform_id=0, boot_info_table=False,
50505050
efi=False, media_name='noemul', bootable=True,
50515051
boot_load_seg=0, udf_bootcatfile=None):
5052-
# type: (str, Optional[str], Optional[str], Optional[str], int, int, bool, bool, str, bool, int, Optional[str]) -> None
5052+
# type: (str, Optional[str], Optional[str], Optional[str], Optional[int], int, bool, bool, str, bool, int, Optional[str]) -> None
50535053
"""
50545054
Add an El Torito Boot Record, and associated files, to the ISO. The
50555055
file that will be used as the bootfile must be passed into this function

pycdlib/pycdlibio.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@
2727

2828
# For mypy annotations
2929
if False: # pylint: disable=using-constant-test
30-
import ctypes # NOQA
31-
from mmap import mmap # NOQA
32-
import pickle # NOQA
30+
import collections.abc # NOQA pylint: disable=unused-import
31+
import ctypes # NOQA pylint: disable=unused-import
32+
from mmap import mmap # NOQA pylint: disable=unused-import
33+
import pickle # NOQA pylint: disable=unused-import
3334
from typing import Any, Optional, Union # NOQA pylint: disable=unused-import
3435

3536
have_py_3 = True
@@ -113,7 +114,7 @@ def readall(self):
113114
return data
114115

115116
def readinto(self, b):
116-
# type: (Union[bytearray, memoryview, array.array[Any], mmap, ctypes._CData, pickle.PickleBuffer]) -> int
117+
# type: (collections.abc.Buffer) -> int
117118
if not self._open:
118119
raise pycdlibexception.PyCdlibInvalidInput('I/O operation on closed file.')
119120

pycdlib/rockridge.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -984,13 +984,13 @@ def factory(name):
984984
A new Component object representing this name.
985985
"""
986986
if name == b'.':
987-
flags = (1 << 1)
987+
flags = 1 << 1
988988
length = 0
989989
elif name == b'..':
990-
flags = (1 << 2)
990+
flags = 1 << 2
991991
length = 0
992992
elif name == b'/':
993-
flags = (1 << 3)
993+
flags = 1 << 3
994994
length = 0
995995
else:
996996
flags = 0

pycdlib/udf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3178,7 +3178,7 @@ def new(self):
31783178

31793179
self.initialized = True
31803180

3181-
def set_extent_location(self, new_location, tag_location=None):
3181+
def set_extent_location(self, new_location, tag_location=-1):
31823182
# type: (int, int) -> None
31833183
"""
31843184
Set the location of this UDF Terminating Descriptor.
@@ -3193,7 +3193,7 @@ def set_extent_location(self, new_location, tag_location=None):
31933193
raise pycdlibexception.PyCdlibInternalError('UDF Terminating Descriptor not initialized')
31943194

31953195
self.new_extent_loc = new_location
3196-
if tag_location is None:
3196+
if tag_location < 0:
31973197
tag_location = new_location
31983198
self.desc_tag.tag_location = tag_location
31993199

pylint.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ max-bool-expr=10
318318

319319
# Exceptions that will emit a warning when being caught. Defaults to
320320
# "Exception"
321-
overgeneral-exceptions=Exception
321+
overgeneral-exceptions=builtins.Exception
322322

323323
[REFACTORING]
324324

0 commit comments

Comments
 (0)