Skip to content

Commit 3c52d85

Browse files
committed
Fixed additional flake8 errors that did not appear for python 3.12
1 parent 86e1ee9 commit 3c52d85

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/omnipy/data/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def _display_as_type(model: TypeForm):
178178
elif is_union(model):
179179
return ' | '.join(_display_as_type(arg) for arg in get_args(model))
180180
elif len(get_args(model)) > 0:
181-
return (f"{_display_as_type(get_origin(model))}"
181+
return (f'{_display_as_type(get_origin(model))}'
182182
f"[{', '.join(_display_as_type(arg) for arg in get_args(model))}]")
183183
elif isinstance(model, TypeVar):
184184
return str(model)

src/omnipy/data/param.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(cls, name: str, bases: tuple[type, ...], namespace: dict[str, objec
2525

2626
default_vals[field.name] = field.get_default()
2727
if default_vals[field.name] is None and not field.allow_none:
28-
raise ValueError(f"{model_cls.__name__}.{field.name} must have a default value")
28+
raise ValueError(f'{model_cls.__name__}.{field.name} must have a default value')
2929

3030
values, fields_set, validation_error = \
3131
validate_model(model_cls, input_data={k: v for k, v in default_vals.items()})
@@ -40,7 +40,7 @@ def __getattr__(cls, attr: str) -> object:
4040
model_cls = cast(type[BaseModel], cls)
4141
if attr in model_cls.__fields__:
4242
return cls._get_param_value(attr, model_cls)
43-
raise AttributeError(f"{model_cls.__name__}.{attr} is not defined")
43+
raise AttributeError(f'{model_cls.__name__}.{attr} is not defined')
4444

4545
@functools.cache
4646
def _get_param_value(cls, attr, model_cls):
@@ -52,9 +52,9 @@ def _get_param_value(cls, attr, model_cls):
5252
def __setattr__(cls, attr: str, value: object) -> None:
5353
model_cls = cast(type[BaseModel], cls)
5454
if attr in model_cls.__fields__:
55-
raise AttributeError(f"{model_cls.__name__}.{attr} is read-only")
55+
raise AttributeError(f'{model_cls.__name__}.{attr} is read-only')
5656
elif not attr.startswith('_'):
57-
raise AttributeError(f"{model_cls.__name__}.{attr} is not defined")
57+
raise AttributeError(f'{model_cls.__name__}.{attr} is not defined')
5858
super().__setattr__(attr, value)
5959

6060

@@ -64,7 +64,7 @@ class Config:
6464
smart_union = True
6565

6666
def __new__(cls, *args: object, **kwargs: object) -> None: # type: ignore[misc]
67-
raise RuntimeError(f"{cls.__name__} cannot be instantiated")
67+
raise RuntimeError(f'{cls.__name__} cannot be instantiated')
6868

6969
@classmethod
7070
def copy_and_adjust(cls, model_name: str, **kwargs: object) -> type['ParamsBase']:

src/omnipy/util/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def remove_forward_ref_notation(type_str: str):
291291

292292

293293
def format_classname_with_params(cls_name: str, params_str: str) -> str:
294-
return f"{cls_name}[{params_str}]"
294+
return f'{cls_name}[{params_str}]'
295295

296296

297297
class RefCountMemoDict(UserDict[int, _ObjT], Generic[_ObjT]):

src/omnipy/util/setdeque.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def __repr__(self):
134134
arg = args[0]
135135
arg_repr = f"[{arg.__name__ if hasattr(arg, '__name__') else repr(arg)}]"
136136
maxlen_repr = f', maxlen={self.maxlen}' if self.maxlen is not None else ''
137-
return f"{self.__class__.__name__}{arg_repr}({list(self)}{maxlen_repr})"
137+
return f'{self.__class__.__name__}{arg_repr}({list(self)}{maxlen_repr})'
138138

139139
def __sizeof__(self):
140140
return super().__sizeof__() + sys.getsizeof(self._set)

tests/hub/log/test_root_log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def test_daily_log_file_rotation(
318318
if j == 0:
319319
log_file_path_to_check = log_file_path
320320
else:
321-
log_file_path_to_check = f"{log_file_path}.{j}"
321+
log_file_path_to_check = f'{log_file_path}.{j}'
322322

323323
if j % 2 == 0:
324324
# Simulates that omnipy is running for two days at a time, and then restarted.

0 commit comments

Comments
 (0)