-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat, refactor!: store objects as ayumu object instead of just object…
…, rename exception module to `errors`, capital o (`O`) in `:o` and dash (`-`) for type define is now allowed, replace `self.types` with `OsakaType` and modularized a lot of the parsing in OsakerParser
- Loading branch information
1 parent
240e50f
commit 1f2ee8f
Showing
7 changed files
with
147 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"cSpell.words": [ | ||
"Ayumu", | ||
"CHIYO", | ||
"NYAN", | ||
"osaker" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from __future__ import annotations | ||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from typing import Any | ||
|
||
from .osaka_type import OsakaType | ||
|
||
from dataclasses import dataclass | ||
|
||
__all__ = ( | ||
"AyumuObject", | ||
) | ||
|
||
@dataclass | ||
class AyumuObject(): | ||
type: OsakaType | ||
value: Any |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from __future__ import annotations | ||
|
||
from enum import Enum | ||
|
||
__all__ = ( | ||
"OsakaType", | ||
) | ||
|
||
class OsakaType(Enum): | ||
NYAN = str | ||
CHIYO = int | ||
|
||
@classmethod | ||
def from_python_type(cls, py_type: type) -> OsakaType: | ||
return cls._value2member_map_[py_type] | ||
|
||
@classmethod | ||
def from_osaka_type_string(cls, osaka_type: str) -> OsakaType: | ||
return cls._member_map_[osaka_type.upper()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters