diff --git a/pycdlib/pycdlib.py b/pycdlib/pycdlib.py index d9aa951b..42f0aa87 100644 --- a/pycdlib/pycdlib.py +++ b/pycdlib/pycdlib.py @@ -4374,7 +4374,7 @@ def add_fp(self, fp, length, iso_path=None, rr_name=None, joliet_path=None, def add_file(self, filename, iso_path=None, rr_name=None, joliet_path=None, file_mode=None, udf_path=None): - # type: (str, Optional[str], Optional[str], str, Optional[int], Optional[str]) -> None + # type: (str, Optional[str], Optional[str], Optional[str], Optional[int], Optional[str]) -> None """ Add a file to the ISO. If the ISO is a Rock Ridge one, then a Rock 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): def add_directory(self, iso_path=None, rr_name=None, joliet_path=None, file_mode=None, udf_path=None): - # type: (Optional[str], Optional[str], Optional[str], int, Optional[str]) -> None + # type: (Optional[str], Optional[str], Optional[str], Optional[int], Optional[str]) -> None """ Add a directory to the ISO. At least one of an iso_path, joliet_path, 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, boot_load_size=None, platform_id=0, boot_info_table=False, efi=False, media_name='noemul', bootable=True, boot_load_seg=0, udf_bootcatfile=None): - # type: (str, Optional[str], Optional[str], Optional[str], int, int, bool, bool, str, bool, int, Optional[str]) -> None + # type: (str, Optional[str], Optional[str], Optional[str], Optional[int], int, bool, bool, str, bool, int, Optional[str]) -> None """ Add an El Torito Boot Record, and associated files, to the ISO. The file that will be used as the bootfile must be passed into this function diff --git a/pycdlib/pycdlibio.py b/pycdlib/pycdlibio.py index 892bb349..1263f59a 100644 --- a/pycdlib/pycdlibio.py +++ b/pycdlib/pycdlibio.py @@ -27,9 +27,10 @@ # For mypy annotations if False: # pylint: disable=using-constant-test - import ctypes # NOQA - from mmap import mmap # NOQA - import pickle # NOQA + import collections.abc # NOQA pylint: disable=unused-import + import ctypes # NOQA pylint: disable=unused-import + from mmap import mmap # NOQA pylint: disable=unused-import + import pickle # NOQA pylint: disable=unused-import from typing import Any, Optional, Union # NOQA pylint: disable=unused-import have_py_3 = True @@ -113,7 +114,7 @@ def readall(self): return data def readinto(self, b): - # type: (Union[bytearray, memoryview, array.array[Any], mmap, ctypes._CData, pickle.PickleBuffer]) -> int + # type: (collections.abc.Buffer) -> int if not self._open: raise pycdlibexception.PyCdlibInvalidInput('I/O operation on closed file.') diff --git a/pycdlib/rockridge.py b/pycdlib/rockridge.py index 57c32080..840105d0 100644 --- a/pycdlib/rockridge.py +++ b/pycdlib/rockridge.py @@ -984,13 +984,13 @@ def factory(name): A new Component object representing this name. """ if name == b'.': - flags = (1 << 1) + flags = 1 << 1 length = 0 elif name == b'..': - flags = (1 << 2) + flags = 1 << 2 length = 0 elif name == b'/': - flags = (1 << 3) + flags = 1 << 3 length = 0 else: flags = 0 diff --git a/pycdlib/udf.py b/pycdlib/udf.py index 94db434d..58862e06 100644 --- a/pycdlib/udf.py +++ b/pycdlib/udf.py @@ -3178,7 +3178,7 @@ def new(self): self.initialized = True - def set_extent_location(self, new_location, tag_location=None): + def set_extent_location(self, new_location, tag_location=-1): # type: (int, int) -> None """ Set the location of this UDF Terminating Descriptor. @@ -3193,7 +3193,7 @@ def set_extent_location(self, new_location, tag_location=None): raise pycdlibexception.PyCdlibInternalError('UDF Terminating Descriptor not initialized') self.new_extent_loc = new_location - if tag_location is None: + if tag_location < 0: tag_location = new_location self.desc_tag.tag_location = tag_location diff --git a/pylint.conf b/pylint.conf index d2975e4d..2270003f 100644 --- a/pylint.conf +++ b/pylint.conf @@ -318,7 +318,7 @@ max-bool-expr=10 # Exceptions that will emit a warning when being caught. Defaults to # "Exception" -overgeneral-exceptions=Exception +overgeneral-exceptions=builtins.Exception [REFACTORING]