From 398a55128e8787303e21658f722f43ca66fe51de Mon Sep 17 00:00:00 2001 From: hhh Date: Fri, 2 Feb 2024 22:39:03 +0200 Subject: [PATCH] init --- .gitignore | 6 +++ README.md | 1 + neko_demo_standard/__init__.py | 6 +++ neko_demo_standard/__internal/__init__.py | 3 ++ .../__internal/some_internal_logic_mixins.py | 22 +++++++++++ neko_demo_standard/neko/__init__.py | 1 + neko_demo_standard/neko/interfaces.py | 20 ++++++++++ neko_demo_standard/neko/types.py | 38 +++++++++++++++++++ pyproject.toml | 14 +++++++ 9 files changed, 111 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 neko_demo_standard/__init__.py create mode 100644 neko_demo_standard/__internal/__init__.py create mode 100644 neko_demo_standard/__internal/some_internal_logic_mixins.py create mode 100644 neko_demo_standard/neko/__init__.py create mode 100644 neko_demo_standard/neko/interfaces.py create mode 100644 neko_demo_standard/neko/types.py create mode 100644 pyproject.toml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e08268f --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/.idea/ +/tests/ + +poetry.lock + +*/__pycache__/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..4267334 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +[nekomata is now in early-dev state](https://nekomata.kotikot.com/) diff --git a/neko_demo_standard/__init__.py b/neko_demo_standard/__init__.py new file mode 100644 index 0000000..12a64a8 --- /dev/null +++ b/neko_demo_standard/__init__.py @@ -0,0 +1,6 @@ +from .neko.interfaces import DemoInterface +from .neko.types import SomeDemoClass, SomeOtherDemoClass + + +__all__ = [DemoInterface, SomeDemoClass, SomeOtherDemoClass] +__replacements__ = __all__ diff --git a/neko_demo_standard/__internal/__init__.py b/neko_demo_standard/__internal/__init__.py new file mode 100644 index 0000000..60c7982 --- /dev/null +++ b/neko_demo_standard/__internal/__init__.py @@ -0,0 +1,3 @@ +""" +Define mixins here +""" diff --git a/neko_demo_standard/__internal/some_internal_logic_mixins.py b/neko_demo_standard/__internal/some_internal_logic_mixins.py new file mode 100644 index 0000000..6dd9617 --- /dev/null +++ b/neko_demo_standard/__internal/some_internal_logic_mixins.py @@ -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 +""" diff --git a/neko_demo_standard/neko/__init__.py b/neko_demo_standard/neko/__init__.py new file mode 100644 index 0000000..2ae2839 --- /dev/null +++ b/neko_demo_standard/neko/__init__.py @@ -0,0 +1 @@ +pass diff --git a/neko_demo_standard/neko/interfaces.py b/neko_demo_standard/neko/interfaces.py new file mode 100644 index 0000000..df6d1d6 --- /dev/null +++ b/neko_demo_standard/neko/interfaces.py @@ -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__ diff --git a/neko_demo_standard/neko/types.py b/neko_demo_standard/neko/types.py new file mode 100644 index 0000000..bc4db91 --- /dev/null +++ b/neko_demo_standard/neko/types.py @@ -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 +""" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6a50143 --- /dev/null +++ b/pyproject.toml @@ -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"