-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,274 additions
and
920 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,24 @@ | ||
from typing import Protocol | ||
|
||
from omnipy.api.protocols.public.config import IsDataConfig | ||
|
||
|
||
class IsDataConfigHolder(Protocol): | ||
"""""" | ||
@property | ||
def config(self) -> IsDataConfig: | ||
... | ||
|
||
def set_config(self, config: IsDataConfig) -> None: | ||
... | ||
|
||
|
||
class IsDataClassBase(Protocol): | ||
"""""" | ||
@property | ||
def _data_class_creator(self) -> IsDataConfigHolder: | ||
... | ||
|
||
@property | ||
def config(self) -> IsDataConfig: | ||
... |
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
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,36 @@ | ||
from abc import ABCMeta | ||
|
||
from omnipy.api.protocols.private.data import IsDataConfigHolder | ||
from omnipy.api.protocols.public.config import IsDataConfig | ||
from omnipy.config.data import DataConfig | ||
|
||
|
||
class DataClassCreator: | ||
def __init__(self) -> None: | ||
self._config: IsDataConfig = DataConfig() | ||
|
||
def set_config(self, config: IsDataConfig) -> None: | ||
self._config = config | ||
|
||
@property | ||
def config(self) -> IsDataConfig: | ||
return self._config | ||
|
||
|
||
class DataClassBaseMeta(ABCMeta): | ||
"""""" | ||
_data_class_creator_obj = DataClassCreator() | ||
|
||
@property | ||
def data_class_creator(self) -> IsDataConfigHolder: | ||
return self._data_class_creator_obj | ||
|
||
|
||
class DataClassBase(metaclass=DataClassBaseMeta): | ||
@property | ||
def _data_class_creator(self) -> IsDataConfigHolder: | ||
return self.__class__.data_class_creator | ||
|
||
@property | ||
def config(self) -> IsDataConfig: | ||
return self.__class__.data_class_creator.config |
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
Oops, something went wrong.