Skip to content

Commit

Permalink
revert: re-define frozendicts as a utility module
Browse files Browse the repository at this point in the history
  • Loading branch information
ruancomelli committed Jul 27, 2022
1 parent bf772bc commit 9c8fc11
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion boiling_learning/daq/channels.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import enum
from typing import Dict, List, Optional, Type, TypeVar, Union

from frozendict import frozendict
from nidaqmx.constants import ChannelType as NIChannelType
from nidaqmx.task import Task

from boiling_learning.daq.devices import Device
from boiling_learning.utils.frozendicts import frozendict

T = TypeVar('T')

Expand Down
3 changes: 1 addition & 2 deletions boiling_learning/data/samples.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from frozendict import frozendict

from boiling_learning.utils import geometry
from boiling_learning.utils.frozendicts import frozendict
from boiling_learning.utils.units import unit_registry as ureg

WIRE_SAMPLES = frozendict[int, geometry.Prism](
Expand Down
2 changes: 1 addition & 1 deletion boiling_learning/io/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

from classes import AssociatedType, Supports
from classes import typeclass as _typeclass
from frozendict import frozendict
from typing_extensions import Protocol, TypedDict, runtime_checkable

from boiling_learning.utils.dataclasses import is_dataclass_instance, shallow_asdict
from boiling_learning.utils.frozendicts import frozendict
from boiling_learning.utils.functional import P, Pack
from boiling_learning.utils.pathutils import PathLike, resolve
from boiling_learning.utils.table_dispatch import TableDispatcher
Expand Down
2 changes: 1 addition & 1 deletion boiling_learning/preprocessing/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# from boiling_learning.preprocessing.experiment_video import ExperimentVideo
# from boiling_learning.preprocessing.transformers import Transformer
# from boiling_learning.preprocessing.video import VideoFrame
# from frozendict import frozendict
# from boiling_learning.utils.frozendicts import frozendict
# from boiling_learning.utils.functional import P, Pack, nth_arg

# _T = TypeVar('_T')
Expand Down
2 changes: 1 addition & 1 deletion boiling_learning/scripts/set_condensation_datasets_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

import parse
import yaml
from frozendict import frozendict
from loguru import logger

from boiling_learning.preprocessing.experiment_video import ExperimentVideo
from boiling_learning.preprocessing.image_datasets import ImageDataset
from boiling_learning.preprocessing.video import Video
from boiling_learning.scripts.utils.setting_data import check_experiment_video_dataframe_indices
from boiling_learning.utils.frozendicts import frozendict
from boiling_learning.utils.pathutils import PathLike, resolve

_SUBCASE_PATTERNS = frozendict(
Expand Down
2 changes: 1 addition & 1 deletion boiling_learning/utils/descriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from typing import Any, Dict, FrozenSet, Generic, List, Set, Tuple, Type, TypeVar, Union

from classes import AssociatedType, Supports, typeclass
from frozendict import frozendict
from typing_extensions import Protocol, final, runtime_checkable

from boiling_learning.utils.dataclasses import is_dataclass_instance, shallow_asdict
from boiling_learning.utils.frozendicts import frozendict

_AnyType = TypeVar('_AnyType', bound=Type[Any])
_Description = TypeVar('_Description')
Expand Down
20 changes: 20 additions & 0 deletions boiling_learning/utils/frozendicts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import sys
from typing import Generic, TypeVar

from frozendict import frozendict as _frozendict

_T = TypeVar('_T')
_S = TypeVar('_S')


__all__ = ('frozendict',)

if sys.version_info >= (3, 9, 0):

class frozendict(_frozendict):
pass

else:

class frozendict(_frozendict, Generic[_T, _S]):
pass
2 changes: 1 addition & 1 deletion boiling_learning/utils/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
)

import funcy
from frozendict import frozendict

from boiling_learning.utils.descriptions import describe
from boiling_learning.utils.frozendicts import frozendict
from boiling_learning.utils.sentinels import Sentinel

# TODO: when variadic generics are available, they will be very useful here
Expand Down
2 changes: 1 addition & 1 deletion tests/test_io_.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import Any, Dict

import pytest
from frozendict import frozendict

from boiling_learning.io import json
from boiling_learning.utils.frozendicts import frozendict
from boiling_learning.utils.functional import P


Expand Down

0 comments on commit 9c8fc11

Please sign in to comment.