core: add helper to 'freeze' dataclasses, in order to derive a schema from the properties

This commit is contained in:
Dima Gerasimov 2021-02-22 21:58:19 +00:00 committed by karlicoss
parent 86497f9b13
commit ca4d58e4e7
5 changed files with 81 additions and 5 deletions

View file

@ -1,11 +1,9 @@
from .common import assert_subpackage; assert_subpackage(__name__)
from contextlib import contextmanager
from pathlib import Path
from typing import Optional
# can lead to some unexpected issues if you 'import cachew' which being in my/core directory.. so let's protect against it
# NOTE: if we use overlay, name can be smth like my.origg.my.core.cachew ...
assert 'my.core' in __name__, f'Expected module __name__ ({__name__}) to start with my.core'
def disable_cachew() -> None:
try:
import cachew