Skip to content

Commit

Permalink
fix some enum errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-goeldi committed Aug 30, 2023
1 parent 3b6a9a7 commit c0f27fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/kfactory/kcell.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import types
from collections import UserDict
from collections.abc import Callable, Hashable, Iterable, Iterator
from enum import IntEnum, IntFlag
from enum import IntEnum, IntFlag, auto
from hashlib import sha3_512
from pathlib import Path
from tempfile import gettempdir
Expand All @@ -27,7 +27,7 @@
import cachetools.func
import numpy as np
import ruamel.yaml
from aenum import Enum, auto, constant # type: ignore[import]
from aenum import Enum, constant # type: ignore[import]
from pydantic import BaseModel, Field, computed_field, model_validator
from pydantic_settings import BaseSettings
from typing_extensions import ParamSpec
Expand Down Expand Up @@ -1864,12 +1864,13 @@ def layerenum_from_dict(
kcl = _get_default_kcl()

def update_namespace(ns: dict[str, Any]) -> None:
ns.update({"kcl": constant(kcl)})
ns.update(layers)

return types.new_class(
name=name,
bases=(LayerEnum,),
kwds={"kcl": kcl},
kwds={},
exec_body=update_namespace,
)

Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# kf.config.logfilter.level = "ERROR"


class LAYER_CLASS(kf.LayerEnum, kcl=kf.kcl):
class LAYER_CLASS(kf.LayerEnum):
kcl = kf.constant(kf.kcl)
WG = (1, 0)
WGCLAD = (111, 0)
WGEXCLUDE = (1, 1)
Expand Down

0 comments on commit c0f27fe

Please sign in to comment.