Skip to content

Commit 1fda74d

Browse files
Apply "unsafe" ruff fixes
```console $ uv run ruff check --fix --unsafe-fixes protovalidate/ test/ ```
1 parent 7ac029a commit 1fda74d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

protovalidate/internal/extra_func.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def cel_is_inf(val: celtypes.Value, sign: celtypes.Value | None = None) -> celpy
325325

326326

327327
def cel_unique(val: celtypes.Value) -> celpy.Result:
328-
if not isinstance(val, (celtypes.ListType, list)):
328+
if not isinstance(val, celtypes.ListType | list):
329329
msg = "invalid argument, expected list"
330330
raise celpy.CELEvalError(msg)
331331
return celtypes.BoolType(len(val) == len(set(val)))

protovalidate/internal/string_format.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def __format_exponential(self, arg: celtypes.Value, precision: int) -> str:
121121
raise celpy.CELEvalError(msg)
122122

123123
def __format_int(self, arg: celtypes.Value) -> str:
124-
if isinstance(arg, (celtypes.IntType, celtypes.UintType, celtypes.DoubleType)):
124+
if isinstance(arg, celtypes.IntType | celtypes.UintType | celtypes.DoubleType):
125125
result = self.__validate_number(arg)
126126
if result is not None:
127127
return result
@@ -133,7 +133,7 @@ def __format_int(self, arg: celtypes.Value) -> str:
133133
raise celpy.CELEvalError(msg)
134134

135135
def __format_hex(self, arg: celtypes.Value) -> str:
136-
if isinstance(arg, (celtypes.IntType, celtypes.UintType)):
136+
if isinstance(arg, celtypes.IntType | celtypes.UintType):
137137
return f"{arg:x}"
138138
if isinstance(arg, celtypes.BytesType):
139139
return arg.hex()
@@ -146,7 +146,7 @@ def __format_hex(self, arg: celtypes.Value) -> str:
146146
raise celpy.CELEvalError(msg)
147147

148148
def __format_oct(self, arg: celtypes.Value) -> str:
149-
if isinstance(arg, (celtypes.IntType, celtypes.UintType)):
149+
if isinstance(arg, celtypes.IntType | celtypes.UintType):
150150
return f"{arg:o}"
151151
msg = (
152152
"error during formatting: octal clause can only be used on integers, was given "
@@ -155,7 +155,7 @@ def __format_oct(self, arg: celtypes.Value) -> str:
155155
raise celpy.CELEvalError(msg)
156156

157157
def __format_bin(self, arg: celtypes.Value) -> str:
158-
if isinstance(arg, (celtypes.IntType, celtypes.UintType, celtypes.BoolType)):
158+
if isinstance(arg, celtypes.IntType | celtypes.UintType | celtypes.BoolType):
159159
return f"{arg:b}"
160160
msg = (
161161
"error during formatting: only integers and bools can be formatted as binary, was given "

0 commit comments

Comments
 (0)