Commit a071175
committed
Fix Ruff lint errors related to docstrings
See the relevant rules in the Ruff documentation:
* [D205](https://docs.astral.sh/ruff/rules/missing-blank-line-after-summary/)
* [D401](https://docs.astral.sh/ruff/rules/non-imperative-mood/)
This commit fixes the following lint errors:
```console
$ ruff --version
ruff 0.14.10
$ ruff check --statistics --ignore E501 $(git ls-files '*.py')
16 D205 missing-blank-line-after-summary
3 D401 non-imperative-mood
Found 19 errors.
$ ruff check --ignore E501 $(git ls-files '*.py')
D205 1 blank line required between summary line and description
--> kaitaistruct.py:341:9
|
340 | def read_bits_int(self, n):
341 | / """Deprecated and no longer used as of KSC 0.9. It is only available
342 | | for backwards compatibility and will be removed in the future.
343 | |
344 | | KSC 0.9 and later uses `read_bits_int_be()` instead.
345 | | """
| |___________^
346 | warnings.warn(
347 | "read_bits_int() is deprecated since 0.9, use read_bits_int_be() instead",
|
help: Insert single blank line
D401 First line of docstring should be in imperative mood: "Deprecated and no longer used as of KSC 0.9. It is only available"
--> kaitaistruct.py:341:9
|
340 | def read_bits_int(self, n):
341 | / """Deprecated and no longer used as of KSC 0.9. It is only available
342 | | for backwards compatibility and will be removed in the future.
343 | |
344 | | KSC 0.9 and later uses `read_bits_int_be()` instead.
345 | | """
| |___________^
346 | warnings.warn(
347 | "read_bits_int() is deprecated since 0.9, use read_bits_int_be() instead",
|
D205 1 blank line required between summary line and description
--> kaitaistruct.py:470:9
|
469 | def ensure_fixed_contents(self, expected):
470 | / """Deprecated and no longer used as of KSC 0.9. It is only available
471 | | for backwards compatibility and will be removed in the future.
472 | |
473 | | KSC 0.9 and later explicitly raises `ValidationNotEqualError` from an
474 | | `if` statement instead.
475 | | """
| |___________^
476 | warnings.warn(
477 | "ensure_fixed_contents() is deprecated since 0.9, explicitly raise "
|
help: Insert single blank line
D401 First line of docstring should be in imperative mood: "Deprecated and no longer used as of KSC 0.9. It is only available"
--> kaitaistruct.py:470:9
|
469 | def ensure_fixed_contents(self, expected):
470 | / """Deprecated and no longer used as of KSC 0.9. It is only available
471 | | for backwards compatibility and will be removed in the future.
472 | |
473 | | KSC 0.9 and later explicitly raises `ValidationNotEqualError` from an
474 | | `if` statement instead.
475 | | """
| |___________^
476 | warnings.warn(
477 | "ensure_fixed_contents() is deprecated since 0.9, explicitly raise "
|
D205 1 blank line required between summary line and description
--> kaitaistruct.py:829:9
|
827 | @staticmethod
828 | def resolve_enum(enum_obj, value):
829 | / """Resolves value using enum: if the value is not found in the map,
830 | | we'll just use literal value per se. Works around problem with Python
831 | | enums throwing an exception when encountering unknown value.
832 | | """
| |___________^
833 | try:
834 | return enum_obj(value)
|
help: Insert single blank line
D401 First line of docstring should be in imperative mood: "Resolves value using enum: if the value is not found in the map,"
--> kaitaistruct.py:829:9
|
827 | @staticmethod
828 | def resolve_enum(enum_obj, value):
829 | / """Resolves value using enum: if the value is not found in the map,
830 | | we'll just use literal value per se. Works around problem with Python
831 | | enums throwing an exception when encountering unknown value.
832 | | """
| |___________^
833 | try:
834 | return enum_obj(value)
|
D205 1 blank line required between summary line and description
--> kaitaistruct.py:874:5
|
873 | class KaitaiStructError(Exception):
874 | / """Common ancestor for all errors originating from correct Kaitai Struct
875 | | usage (i.e. errors that indicate a problem with user input, not errors
876 | | indicating incorrect usage that are not meant to be caught but fixed in the
877 | | application code). Use this exception type in the `except` clause if you
878 | | want to handle all parse errors and serialization errors.
879 | |
880 | | If available, the `src_path` attribute will contain the KSY source path
881 | | pointing to the element where the error occurred. If it is not available,
882 | | `src_path` will be `None`.
883 | | """
| |_______^
884 |
885 | def __init__(self, msg, src_path):
|
help: Insert single blank line
D205 1 blank line required between summary line and description
--> kaitaistruct.py:891:5
|
890 | class InvalidArgumentError(KaitaiStructError, ValueError):
891 | / """Indicates that an invalid argument value was received (like `ValueError`),
892 | | but used in places where this might indicate invalid user input and
893 | | therefore represents a parse error or serialization error.
894 | | """
| |_______^
895 |
896 | def __init__(self, msg):
|
help: Insert single blank line
D205 1 blank line required between summary line and description
--> kaitaistruct.py:901:5
|
900 | class EndOfStreamError(KaitaiStructError, EOFError):
901 | / """Read or write beyond end of stream. Provides the `bytes_needed` (number
902 | | of bytes requested to read or write) and `bytes_available` (number of bytes
903 | | remaining in the stream) attributes.
904 | | """
| |_______^
905 |
906 | def __init__(self, msg, bytes_needed, bytes_available):
|
help: Insert single blank line
D205 1 blank line required between summary line and description
--> kaitaistruct.py:913:5
|
912 | class NoTerminatorFoundError(EndOfStreamError):
913 | / """Special type of `EndOfStreamError` that occurs when end of stream is
914 | | reached before the required terminator is found. If you want to tolerate a
915 | | missing terminator, you can specify `eos-error: false` in the KSY
916 | | specification, in which case the end of stream will be considered a valid
917 | | end of field and this error will no longer be raised.
918 | |
919 | | The `term` attribute contains a `bytes` object with the searched terminator.
920 | | """
| |_______^
921 |
922 | def __init__(self, term, bytes_available):
|
help: Insert single blank line
D205 1 blank line required between summary line and description
--> kaitaistruct.py:932:5
|
931 | class UndecidedEndiannessError(KaitaiStructError):
932 | / """Error that occurs when default endianness should be decided with
933 | | switch, but nothing matches (although using endianness expression
934 | | implies that there should be some positive result).
935 | | """
| |_______^
936 |
937 | def __init__(self, src_path):
|
help: Insert single blank line
D205 1 blank line required between summary line and description
--> kaitaistruct.py:942:5
|
941 | class ValidationFailedError(KaitaiStructError):
942 | / """Common ancestor for all validation failures. Stores pointer to
943 | | KaitaiStream IO object which was involved in an error.
944 | | """
| |_______^
945 |
946 | def __init__(self, msg, io, src_path):
|
help: Insert single blank line
D205 1 blank line required between summary line and description
--> kaitaistruct.py:957:5
|
956 | class ValidationNotEqualError(ValidationFailedError):
957 | / """Signals validation failure: we required "actual" value to be equal to
958 | | "expected", but it turned out that it's not.
959 | | """
| |_______^
960 |
961 | def __init__(self, expected, actual, io, src_path):
|
help: Insert single blank line
D205 1 blank line required between summary line and description
--> kaitaistruct.py:970:5
|
969 | class ValidationLessThanError(ValidationFailedError):
970 | / """Signals validation failure: we required "actual" value to be
971 | | greater than or equal to "min", but it turned out that it's not.
972 | | """
| |_______^
973 |
974 | def __init__(self, min_bound, actual, io, src_path):
|
help: Insert single blank line
D205 1 blank line required between summary line and description
--> kaitaistruct.py:983:5
|
982 | class ValidationGreaterThanError(ValidationFailedError):
983 | / """Signals validation failure: we required "actual" value to be
984 | | less than or equal to "max", but it turned out that it's not.
985 | | """
| |_______^
986 |
987 | def __init__(self, max_bound, actual, io, src_path):
|
help: Insert single blank line
D205 1 blank line required between summary line and description
--> kaitaistruct.py:996:5
|
995 | class ValidationNotAnyOfError(ValidationFailedError):
996 | / """Signals validation failure: we required "actual" value to be
997 | | from the list, but it turned out that it's not.
998 | | """
| |_______^
999 |
1000 | def __init__(self, actual, io, src_path):
|
help: Insert single blank line
D205 1 blank line required between summary line and description
--> kaitaistruct.py:1006:5
|
1005 | class ValidationNotInEnumError(ValidationFailedError):
1006 | / """Signals validation failure: we required "actual" value to be in
1007 | | the enum, but it turned out that it's not.
1008 | | """
| |_______^
1009 |
1010 | def __init__(self, actual, io, src_path):
|
help: Insert single blank line
D205 1 blank line required between summary line and description
--> kaitaistruct.py:1016:5
|
1015 | class ValidationExprError(ValidationFailedError):
1016 | / """Signals validation failure: we required "actual" value to match
1017 | | the expression, but it turned out that it doesn't.
1018 | | """
| |_______^
1019 |
1020 | def __init__(self, actual, io, src_path):
|
help: Insert single blank line
D205 1 blank line required between summary line and description
--> kaitaistruct.py:1036:5
|
1035 | class ConsistencyNotCheckedError(Exception):
1036 | / """Thrown when attempting to write an object whose consistency hasn't been
1037 | | checked since the last modification.
1038 | | """
| |_______^
1039 |
1040 | def __init__(self):
|
help: Insert single blank line
Found 19 errors.
```1 parent 5230054 commit a071175
1 file changed
+105
-41
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
| 313 | + | |
313 | 314 | | |
314 | 315 | | |
315 | 316 | | |
| |||
338 | 339 | | |
339 | 340 | | |
340 | 341 | | |
341 | | - | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
342 | 345 | | |
343 | 346 | | |
344 | 347 | | |
| |||
351 | 354 | | |
352 | 355 | | |
353 | 356 | | |
| 357 | + | |
354 | 358 | | |
355 | 359 | | |
356 | 360 | | |
| |||
467 | 471 | | |
468 | 472 | | |
469 | 473 | | |
470 | | - | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
471 | 477 | | |
472 | 478 | | |
473 | 479 | | |
| |||
826 | 832 | | |
827 | 833 | | |
828 | 834 | | |
829 | | - | |
830 | | - | |
831 | | - | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
832 | 845 | | |
833 | 846 | | |
834 | 847 | | |
| |||
871 | 884 | | |
872 | 885 | | |
873 | 886 | | |
874 | | - | |
875 | | - | |
876 | | - | |
877 | | - | |
878 | | - | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
879 | 895 | | |
880 | 896 | | |
881 | 897 | | |
| |||
888 | 904 | | |
889 | 905 | | |
890 | 906 | | |
891 | | - | |
892 | | - | |
893 | | - | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
894 | 913 | | |
895 | 914 | | |
896 | 915 | | |
897 | 916 | | |
898 | 917 | | |
899 | 918 | | |
900 | 919 | | |
901 | | - | |
902 | | - | |
903 | | - | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
904 | 924 | | |
905 | 925 | | |
906 | 926 | | |
| |||
910 | 930 | | |
911 | 931 | | |
912 | 932 | | |
913 | | - | |
914 | | - | |
915 | | - | |
916 | | - | |
917 | | - | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
918 | 944 | | |
919 | 945 | | |
920 | 946 | | |
| |||
929 | 955 | | |
930 | 956 | | |
931 | 957 | | |
932 | | - | |
933 | | - | |
934 | | - | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
935 | 963 | | |
936 | 964 | | |
937 | 965 | | |
938 | 966 | | |
939 | 967 | | |
940 | 968 | | |
941 | 969 | | |
942 | | - | |
943 | | - | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
944 | 976 | | |
945 | 977 | | |
946 | 978 | | |
| |||
954 | 986 | | |
955 | 987 | | |
956 | 988 | | |
957 | | - | |
958 | | - | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
959 | 999 | | |
960 | 1000 | | |
961 | 1001 | | |
| |||
967 | 1007 | | |
968 | 1008 | | |
969 | 1009 | | |
970 | | - | |
971 | | - | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
972 | 1019 | | |
973 | 1020 | | |
974 | 1021 | | |
| |||
980 | 1027 | | |
981 | 1028 | | |
982 | 1029 | | |
983 | | - | |
984 | | - | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
985 | 1039 | | |
986 | 1040 | | |
987 | 1041 | | |
| |||
993 | 1047 | | |
994 | 1048 | | |
995 | 1049 | | |
996 | | - | |
997 | | - | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
998 | 1056 | | |
999 | 1057 | | |
1000 | 1058 | | |
| |||
1003 | 1061 | | |
1004 | 1062 | | |
1005 | 1063 | | |
1006 | | - | |
1007 | | - | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
1008 | 1070 | | |
1009 | 1071 | | |
1010 | 1072 | | |
| |||
1013 | 1075 | | |
1014 | 1076 | | |
1015 | 1077 | | |
1016 | | - | |
1017 | | - | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
1018 | 1084 | | |
1019 | 1085 | | |
1020 | 1086 | | |
| |||
1033 | 1099 | | |
1034 | 1100 | | |
1035 | 1101 | | |
1036 | | - | |
1037 | | - | |
1038 | | - | |
| 1102 | + | |
1039 | 1103 | | |
1040 | 1104 | | |
1041 | 1105 | | |
| |||
0 commit comments