This commit is contained in:
hhh
2024-02-02 22:39:03 +02:00
commit 398a55128e
9 changed files with 111 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
/.idea/
/tests/
poetry.lock
*/__pycache__/

1
README.md Normal file
View File

@@ -0,0 +1 @@
[nekomata is now in early-dev state](https://nekomata.kotikot.com/)

View File

@@ -0,0 +1,6 @@
from .neko.interfaces import DemoInterface
from .neko.types import SomeDemoClass, SomeOtherDemoClass
__all__ = [DemoInterface, SomeDemoClass, SomeOtherDemoClass]
__replacements__ = __all__

View File

@@ -0,0 +1,3 @@
"""
Define mixins here
"""

View File

@@ -0,0 +1,22 @@
from abc import ABC, abstractmethod
class FirstAbstractMixin(ABC):
"""
You can force implementation developer to use mixins for logic
"""
@abstractmethod
def first_method(self) -> None:
...
class SecondAbstractMixin(ABC):
@abstractmethod
def second_method(self) -> None:
...
"""
Or just leave one abstractclass, that can be split into mixins by implementation
developer
"""

View File

@@ -0,0 +1 @@
pass

View File

@@ -0,0 +1,20 @@
from abc import ABC, abstractmethod
class DemoInterface(ABC):
"""
Includes only static methods that would be regular functions outside of classes if
you were developing a regular python module
"""
@staticmethod
@abstractmethod
def some_very_useful_method(very_important_arg: str = "h") -> None:
"""
Include docstrings here, in standards
:param very_important_arg: Probably this one is important
:return:
"""
__all__ = [DemoInterface]
__replacements__ = __all__

View File

@@ -0,0 +1,38 @@
from ..__internal.some_internal_logic_mixins import (
FirstAbstractMixin,
SecondAbstractMixin,
)
from abc import ABC, abstractmethod
class SomeDemoClass(
FirstAbstractMixin,
SecondAbstractMixin,
ABC
):
"""
ABC needs to be LAST thing here
"""
pass
class SomeOtherDemoClass(ABC):
@abstractmethod
def first_method(self) -> None:
...
@abstractmethod
def second_method(self) -> None:
...
__all__ = [SomeDemoClass, SomeOtherDemoClass]
__replacements__ = __all__
"""
Everything that is indicated in the list of replacements must be created directly in
same file to simplify the structure, otherwise the implementation developer will
have to completely repeat the structure of the internal folders with mixins that were
created in the standard.
Mixins can be imported from internals of standard
"""

14
pyproject.toml Normal file
View File

@@ -0,0 +1,14 @@
[tool.poetry]
name = "neko-demo-standard"
version = "0.1.0"
description = ""
authors = ["hhh"]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.11"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"