🏷️ Make python linters happy
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
from enum import StrEnum
|
||||
from typing import Self
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
@@ -29,10 +28,11 @@ class TransportMode(StrEnum):
|
||||
# idfm_types.TransportMode.rail + idfm_types.TransportSubMode.railShuttle
|
||||
val = "val"
|
||||
|
||||
# Self return type replaced by "TransportMode" to fix following mypy error:
|
||||
# Incompatible return value type (got "TransportMode", expected "Self")
|
||||
# TODO: Is it the good fix ?
|
||||
@classmethod
|
||||
def from_idfm_transport_mode(
|
||||
cls, mode: IdfmTransportMode, sub_mode: IdfmTransportSubMode
|
||||
) -> Self:
|
||||
def from_idfm_transport_mode(cls, mode: str, sub_mode: str) -> "TransportMode":
|
||||
if mode == IdfmTransportMode.rail:
|
||||
if sub_mode == IdfmTransportSubMode.regionalRail:
|
||||
return cls.rail_ter
|
||||
@@ -42,7 +42,7 @@ class TransportMode(StrEnum):
|
||||
return cls.rail_transilien
|
||||
if sub_mode == IdfmTransportSubMode.railShuttle:
|
||||
return cls.val
|
||||
return TransportMode(mode)
|
||||
return cls(mode)
|
||||
|
||||
|
||||
class Line(BaseModel):
|
||||
|
Reference in New Issue
Block a user