1
1
"""All isort specific exception classes should be defined here"""
2
+ from functools import partial
2
3
from pathlib import Path
3
4
from typing import Any , Dict , List , Type , Union
4
5
8
9
class ISortError (Exception ):
9
10
"""Base isort exception object from which all isort sourced exceptions should inherit"""
10
11
12
+ def __reduce__ (self ): # type: ignore
13
+ return (partial (type (self ), ** self .__dict__ ), ())
14
+
11
15
12
16
class InvalidSettingsPath (ISortError ):
13
17
"""Raised when a settings path is provided that is neither a valid file or directory"""
@@ -48,13 +52,14 @@ class FileSkipped(ISortError):
48
52
49
53
def __init__ (self , message : str , file_path : str ):
50
54
super ().__init__ (message )
55
+ self .message = message
51
56
self .file_path = file_path
52
57
53
58
54
59
class FileSkipComment (FileSkipped ):
55
60
"""Raised when an entire file is skipped due to a isort skip file comment"""
56
61
57
- def __init__ (self , file_path : str ):
62
+ def __init__ (self , file_path : str , ** kwargs : str ):
58
63
super ().__init__ (
59
64
f"{ file_path } contains a file skip comment and was skipped." , file_path = file_path
60
65
)
@@ -63,7 +68,7 @@ def __init__(self, file_path: str):
63
68
class FileSkipSetting (FileSkipped ):
64
69
"""Raised when an entire file is skipped due to provided isort settings"""
65
70
66
- def __init__ (self , file_path : str ):
71
+ def __init__ (self , file_path : str , ** kwargs : str ):
67
72
super ().__init__ (
68
73
f"{ file_path } was skipped as it's listed in 'skip' setting"
69
74
" or matches a glob in 'skip_glob' setting" ,
0 commit comments