Skip to content

Commit

Permalink
fix: remove optional typing in models
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoPascoli committed Sep 30, 2024
1 parent ede7b3e commit 3a6a7c8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
1 change: 0 additions & 1 deletion antarest/study/business/link_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import typing as t


from antarest.core.exceptions import ConfigFileNotFound, LinkValidationError
from antarest.core.model import JSON
from antarest.study.business.all_optional_meta import all_optional_model, camel_case_model
Expand Down
27 changes: 14 additions & 13 deletions antarest/study/storage/variantstudy/model/command/create_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# SPDX-License-Identifier: MPL-2.0
#
# This file is part of the Antares project.
import typing as t
from typing import Any, Dict, List, Optional, Tuple, Union, cast

from pydantic import BaseModel, Field, ValidationInfo, field_validator, model_validator
Expand All @@ -34,26 +35,26 @@ class AreaInfo(BaseModel):


class LinkInfoProperties(BaseModel):
hurdles_cost: Optional[bool] = False
loop_flow: Optional[bool] = False
use_phase_shifter: Optional[bool] = False
transmission_capacities: Optional[TransmissionCapacity] = TransmissionCapacity.ENABLED
asset_type: Optional[AssetType] = AssetType.AC
display_comments: Optional[bool] = True
colorr: Optional[int] = Field(default=DEFAULT_COLOR, gt=0, lt=255)
colorb: Optional[int] = Field(default=DEFAULT_COLOR, gt=0, lt=255)
colorg: Optional[int] = Field(default=DEFAULT_COLOR, gt=0, lt=255)
link_width: Optional[float] = 1
link_style: Optional[LinkStyle] = LinkStyle.PLAIN
hurdles_cost: bool = False
loop_flow: bool = False
use_phase_shifter: bool = False
transmission_capacities: TransmissionCapacity = TransmissionCapacity.ENABLED
asset_type: AssetType= AssetType.AC
display_comments: bool = True
colorr: int = Field(default=DEFAULT_COLOR, gt=0, lt=255)
colorb: int = Field(default=DEFAULT_COLOR, gt=0, lt=255)
colorg: int = Field(default=DEFAULT_COLOR, gt=0, lt=255)
link_width: float = 1
link_style: LinkStyle = LinkStyle.PLAIN

class Config:
alias_generator = to_kebab_case
allow_population_by_field_name = True


class LinkInfoProperties820(LinkInfoProperties):
filter_synthesis: Optional[str] = None
filter_year_by_year: Optional[str] = None
filter_synthesis: t.Optional[str] = None
filter_year_by_year: t.Optional[str] = None

class Config:
alias_generator = to_kebab_case
Expand Down

0 comments on commit 3a6a7c8

Please sign in to comment.