Skip to content

Commit e34598e

Browse files
committed
lint,black,isort
1 parent cf9bee9 commit e34598e

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

sarc/allocations/allocations.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from __future__ import annotations
22

33
from datetime import date, datetime
4-
from typing import Optional, Annotated
4+
from typing import Annotated, Optional
55

66
import pandas as pd
77
from flatten_dict import flatten
8-
from pydantic import ByteSize, BeforeValidator
8+
from pydantic import BeforeValidator, ByteSize
99
from pydantic_mongo import AbstractRepository, ObjectIdField
1010

1111
from sarc.config import BaseModel, config, validate_date

sarc/config.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
from datetime import date, datetime
88
from functools import cached_property
99
from pathlib import Path
10-
from typing import Any, Dict, Optional, Union, Annotated
10+
from typing import Annotated, Any, Dict, Optional, Union
1111

1212
import pydantic
1313
import tzlocal
1414
from bson import ObjectId
1515
from hostlist import expand_hostlist
16-
from pydantic import field_validator, Field, ConfigDict, BaseModel as _BaseModel, AfterValidator
16+
from pydantic import AfterValidator
17+
from pydantic import BaseModel as _BaseModel
18+
from pydantic import ConfigDict, Field, field_validator
1719

1820
MTL = zoneinfo.ZoneInfo("America/Montreal")
1921
PST = zoneinfo.ZoneInfo("America/Vancouver")
@@ -41,7 +43,12 @@ def validate_date(value: Union[str, date, datetime]) -> date:
4143
class BaseModel(_BaseModel):
4244
# TODO[pydantic]: The following keys were removed: `json_encoders`.
4345
# Check https://docs.pydantic.dev/dev-v2/migration/#changes-to-config for more information.
44-
model_config = ConfigDict(extra="forbid", ignored_types=(cached_property,), json_encoders={ObjectId: str}, arbitrary_types_allowed=True)
46+
model_config = ConfigDict(
47+
extra="forbid",
48+
ignored_types=(cached_property,),
49+
json_encoders={ObjectId: str},
50+
arbitrary_types_allowed=True,
51+
)
4552

4653
def dict(self, *args, **kwargs) -> dict[str, Any]:
4754
d = super().dict(*args, **kwargs)
@@ -257,7 +264,6 @@ class ScraperConfig(BaseModel):
257264
loki: LokiConfig = None
258265
tempo: TempoConfig = None
259266

260-
261267
@field_validator("clusters", mode="after")
262268
@classmethod
263269
def _complete_cluster_fields(cls, value, info):
@@ -300,7 +306,7 @@ def parse_config(config_path, config_cls=Config):
300306
)
301307

302308
try:
303-
with open(config_path) as f:
309+
with open(config_path, encoding="utf-8") as f:
304310
cfg = config_cls.model_validate_json(f.read())
305311
except json.JSONDecodeError as exc:
306312
raise ConfigurationError(f"'{config_path}' contains malformed JSON") from exc

sarc/testing/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def popen_reader(state, function, args, env, shell=False):
2121

2222
if len(line) > 0:
2323
function(line.strip(), state)
24-
print(line, end='')
24+
print(line, end="")
2525

2626
return sys.exit(process.poll())
2727
except KeyboardInterrupt:

0 commit comments

Comments
 (0)