Skip to content

Commit

Permalink
Manually fix identifier clashes in model field names
Browse files Browse the repository at this point in the history
Also fix job properties fields and ignore long lines in generated files
  • Loading branch information
PeterC-DLS committed Aug 29, 2023
1 parent c828ded commit 1e629d2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
14 changes: 7 additions & 7 deletions models/slurm_rest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# generated by datamodel-codegen:
# filename: slurm-rest.yaml
# timestamp: 2023-08-18T16:27:27+00:00

# ruff: noqa: E501 # ignore long lines
from __future__ import annotations

from enum import Enum
Expand Down Expand Up @@ -308,11 +308,11 @@ class JobProperties(BaseModel):
"""
Request that a minimum of minnodes nodes and a maximum node count.
"""
open_mode: OpenMode | None = "append"
open_mode: OpenMode | None = OpenMode.append
"""
Open the output and error files using append or truncate mode as specified.
"""
oversubscribe: bool | None = "false"
oversubscribe: bool | None = False
"""
The job allocation can over-subscribe resources with other running jobs.
"""
Expand Down Expand Up @@ -457,9 +457,9 @@ class Licenses(BaseModel):


class Version(BaseModel):
major: str | None = None
micro: str | None = None
minor: str | None = None
major: int | None = None
micro: int | None = None
minor: int | None = None


class Slurm(BaseModel):
Expand All @@ -480,7 +480,7 @@ class Plugin(BaseModel):


class Meta(BaseModel):
Slurm: Slurm | None = None
slurm: Slurm | None = Field(None, validation_alias="Slurm")
"""
Slurm information
"""
Expand Down
17 changes: 9 additions & 8 deletions models/slurmdb_rest.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# generated by datamodel-codegen:
# filename: slurmdb-rest.yaml
# timestamp: 2023-08-18T16:27:32+00:00
# ruff: noqa: E501 # ignore long lines

from __future__ import annotations

from typing import Any

from pydantic import BaseModel, RootModel
from pydantic import BaseModel, Field, RootModel


class Default(BaseModel):
Expand Down Expand Up @@ -167,7 +168,7 @@ class Controller(BaseModel):
class DbCoordinatorInfo(BaseModel):
direct: int | None = None
"""
If user is coordinator of this account directly or coordinator status was inheirted from a higher account in the tree
If user is coordinator of this account directly or coordinator status was inherited from a higher account in the tree
"""
name: str | None = None
"""
Expand Down Expand Up @@ -760,9 +761,9 @@ class Time3(BaseModel):


class Version(BaseModel):
major: str | None = None
micro: str | None = None
minor: str | None = None
major: int | None = None
micro: int | None = None
minor: int | None = None


class Slurm(BaseModel):
Expand All @@ -783,7 +784,7 @@ class Plugin(BaseModel):


class DbMeta(BaseModel):
Slurm: Slurm | None = None
slurm: Slurm | None = Field(None, validation_alias="Slurm")
"""
Slurm information
"""
Expand Down Expand Up @@ -888,7 +889,7 @@ class Preempt(BaseModel):
"""
Grace period (s) before jobs can preempted
"""
list: list[str] | None = None
qos: list[str] | None = Field(None, validation_alias="list")
"""
List of preemptable QOS
"""
Expand Down Expand Up @@ -1249,7 +1250,7 @@ class Tres2(BaseModel):


class DbJobStep(BaseModel):
CPU: CPU | None = None
cpu: CPU | None = Field(None, validation_alias="CPU")
"""
CPU properties
"""
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ log_cli = true

[tool.mypy]
plugins = "numpy.typing.mypy_plugin"

[tool.ruff]
line-length = 88

0 comments on commit 1e629d2

Please sign in to comment.