mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
fix new pylint raise-missing-from lint
This commit is contained in:
parent
ec6164c807
commit
20432ccecf
7 changed files with 14 additions and 13 deletions
|
@ -12,8 +12,7 @@ if sys.version_info[0] < 3 or sys.version_info[1] < 7:
|
|||
# ensure unicode filenames are supported
|
||||
try:
|
||||
"テスト".encode(sys.getfilesystemencoding())
|
||||
except UnicodeEncodeError:
|
||||
raise Exception("Anki requires a UTF-8 locale.")
|
||||
|
||||
except UnicodeEncodeError as exc:
|
||||
raise Exception("Anki requires a UTF-8 locale.") from exc
|
||||
|
||||
__all__ = ["Collection"]
|
||||
|
|
|
@ -33,8 +33,8 @@ class ConfigManager:
|
|||
def get_immutable(self, key: str) -> Any:
|
||||
try:
|
||||
return from_json_bytes(self.col.backend.get_config_json(key))
|
||||
except NotFoundError:
|
||||
raise KeyError
|
||||
except NotFoundError as exc:
|
||||
raise KeyError from exc
|
||||
|
||||
def set(self, key: str, val: Any) -> None:
|
||||
self.col.backend.set_config_json(key=key, value_json=to_json_bytes(val))
|
||||
|
|
|
@ -228,8 +228,8 @@ class DeckManager:
|
|||
g["id"] = self.col.backend.add_or_update_deck_legacy(
|
||||
deck=to_json_bytes(g), preserve_usn_and_mtime=preserve_usn
|
||||
)
|
||||
except anki.rsbackend.DeckIsFilteredError:
|
||||
raise DeckRenameError("deck was filtered")
|
||||
except anki.rsbackend.DeckIsFilteredError as exc:
|
||||
raise DeckRenameError("deck was filtered") from exc
|
||||
|
||||
def rename(self, g: Deck, newName: str) -> None:
|
||||
"Rename deck prefix to NAME if not exists. Updates children."
|
||||
|
|
|
@ -58,8 +58,8 @@ class MediaManager:
|
|||
self._oldcwd = None
|
||||
try:
|
||||
os.chdir(self._dir)
|
||||
except OSError:
|
||||
raise Exception("invalidTempFolder")
|
||||
except OSError as exc:
|
||||
raise Exception("invalidTempFolder") from exc
|
||||
|
||||
def __repr__(self) -> str:
|
||||
d = dict(self.__dict__)
|
||||
|
|
|
@ -106,8 +106,8 @@ class Note:
|
|||
def _fieldOrd(self, key: str) -> Any:
|
||||
try:
|
||||
return self._fmap[key][0]
|
||||
except:
|
||||
raise KeyError(key)
|
||||
except Exception as exc:
|
||||
raise KeyError(key) from exc
|
||||
|
||||
def __getitem__(self, key: str) -> str:
|
||||
return self.fields[self._fieldOrd(key)]
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# pylint: disable=raise-missing-from
|
||||
|
||||
import inspect
|
||||
import json
|
||||
import os
|
||||
|
|
|
@ -100,8 +100,8 @@ class ProfileManager:
|
|||
sys.exit(1)
|
||||
try:
|
||||
self.load(profile)
|
||||
except TypeError:
|
||||
raise Exception("Provided profile does not exist.")
|
||||
except TypeError as exc:
|
||||
raise Exception("Provided profile does not exist.") from exc
|
||||
|
||||
# Base creation
|
||||
######################################################################
|
||||
|
|
Loading…
Reference in a new issue