init
This commit is contained in:
6
neko_demo_standard/__init__.py
Normal file
6
neko_demo_standard/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from .neko.interfaces import DemoInterface
|
||||
from .neko.types import SomeDemoClass, SomeOtherDemoClass
|
||||
|
||||
|
||||
__all__ = [DemoInterface, SomeDemoClass, SomeOtherDemoClass]
|
||||
__replacements__ = __all__
|
||||
3
neko_demo_standard/__internal/__init__.py
Normal file
3
neko_demo_standard/__internal/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
"""
|
||||
Define mixins here
|
||||
"""
|
||||
22
neko_demo_standard/__internal/some_internal_logic_mixins.py
Normal file
22
neko_demo_standard/__internal/some_internal_logic_mixins.py
Normal 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
|
||||
"""
|
||||
1
neko_demo_standard/neko/__init__.py
Normal file
1
neko_demo_standard/neko/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
pass
|
||||
20
neko_demo_standard/neko/interfaces.py
Normal file
20
neko_demo_standard/neko/interfaces.py
Normal 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__
|
||||
38
neko_demo_standard/neko/types.py
Normal file
38
neko_demo_standard/neko/types.py
Normal 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
|
||||
"""
|
||||
Reference in New Issue
Block a user