diff --git a/neispy/client.py b/neispy/client.py index a947ffa..7df986a 100644 --- a/neispy/client.py +++ b/neispy/client.py @@ -48,8 +48,8 @@ def sync( KEY: Optional[str] = None, pIndex: int = 1, pSize: int = 100, - ) -> SyncNeispy: - return cast(SyncNeispy, super().sync(KEY, pIndex, pSize)) + ) -> "SyncNeispy": + return cast("SyncNeispy", super().sync(KEY, pIndex, pSize)) async def schoolInfo( self, diff --git a/neispy/domain/classinfo.py b/neispy/domain/classinfo.py index d451f16..a76d5bf 100644 --- a/neispy/domain/classinfo.py +++ b/neispy/domain/classinfo.py @@ -13,12 +13,18 @@ class ClassInfoRow(SchoolRelated): "학년도" GRADE: str "학년" - CLASS_NM: str - "학급명" - DDDEP_NM: str - "학과명" + DGHT_CRSE_SC_NM: str + "주야과정명" SCHUL_CRSE_SC_NM: str "학교과정명" + ORD_SC_NM: str + "계열명" + DDDEP_NM: str + "학과명" + CLASS_NM: str + "학급명" + LOAD_DTM: str + "수정일" @dataclass diff --git a/neispy/domain/schoolmajorinfo.py b/neispy/domain/schoolmajorinfo.py index ac6f20f..cb0588c 100644 --- a/neispy/domain/schoolmajorinfo.py +++ b/neispy/domain/schoolmajorinfo.py @@ -21,7 +21,7 @@ class SchoolMajorInfoRow(SchoolRelated): @dataclass class SchoolMajorInfo(Deserializer): - schoolMajorInfo: NeisObject[SchoolMajorInfoRow] + schoolMajorinfo: NeisObject[SchoolMajorInfoRow] @classmethod def from_dict(cls, d: SchoolMajorInfoDict) -> SchoolMajorInfo: diff --git a/neispy/domain/schoolschedule.py b/neispy/domain/schoolschedule.py index 69b7c12..5eecf9d 100644 --- a/neispy/domain/schoolschedule.py +++ b/neispy/domain/schoolschedule.py @@ -48,6 +48,3 @@ def from_dict( cls, d: SchoolScheduleDict ) -> SchoolSchedule: # type: ignore[valid-type] return super().from_dict(d) - - -SchoolSchedule.SchoolSchedule[1].row[0].AY diff --git a/neispy/domain/schulaflcoinfo.py b/neispy/domain/schulaflcoinfo.py index bf31df8..4988d7a 100644 --- a/neispy/domain/schulaflcoinfo.py +++ b/neispy/domain/schulaflcoinfo.py @@ -19,7 +19,7 @@ class SchulAflcoInfoRow(SchoolRelated): @dataclass class SchulAflcoInfo(Deserializer): - schulAflcoInfo: NeisObject[SchulAflcoInfoRow] + schulAflcoinfo: NeisObject[SchulAflcoInfoRow] @classmethod def from_dict(cls, d: SchulAflcoInfoDict) -> SchulAflcoInfo: diff --git a/neispy/http.py b/neispy/http.py index c7e7f4c..abc1559 100644 --- a/neispy/http.py +++ b/neispy/http.py @@ -48,7 +48,7 @@ def sync( KEY: Optional[str], pIndex: int, pSize: int, - ) -> SyncNeispyRequest: + ) -> "SyncNeispyRequest": http = cls(KEY, pIndex, pSize, None) origin_request_func = getattr(http, "request") loop = get_event_loop() @@ -95,7 +95,7 @@ def dont_use_sync(*args: Any, **kwargs: Any) -> NoReturn: http.__setattr__(method, to_sync_func(getattr(http, method))) setattr(http.__class__, "sync", property(dont_use_sync)) - return cast(SyncNeispyRequest, http) + return cast("SyncNeispyRequest", http) async def request( self, diff --git a/neispy/utils.py b/neispy/utils.py index beb62fd..eb4bc6c 100644 --- a/neispy/utils.py +++ b/neispy/utils.py @@ -1,5 +1,5 @@ from datetime import datetime, timedelta, timezone -from typing import Any, Tuple +from typing import Any, Tuple, get_type_hints from typing_extensions import Self @@ -15,14 +15,13 @@ def now() -> str: class Deserializer: @classmethod def from_dict(cls, d: Any) -> Self: - annotations = cls.__annotations__ + annotations = get_type_hints(cls) key = list(annotations.keys())[0] # 유형주석의 첫번째는 튜플형식 입니다. # 튜플의 첫번째는 Head이고 두번째는 Row입니다. # 그러므로 __args__[1]을 사용하여 Row를 가져옵니다. # Row의 제네릭 타입을 가져와서 객체를 생성해야하기 때문에 다시 __args__[0]을 사용합니다. row_type: AbstractRow = list(annotations.values())[0].__args__[1].__args__[0] - obj: Tuple[Head, Row[Any]] = ( Head.from_dict(d[key][0]), Row.from_dict([row_type.from_dict(d) for d in d[key][1]["row"]]),