Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
from enum import Enum

from zepben.ewb.model.cim.extensions.zbex import zbex
from zepben.ewb.util import unique


@zbex
@unique
class PowerDirectionKind(Enum):
"""
[ZBEX]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

from enum import Enum

from zepben.ewb import unique
from zepben.ewb.model.cim.extensions.zbex import zbex


@zbex
@unique
class BatteryControlMode(Enum):
"""
[ZBEX]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

from enum import Enum

from zepben.ewb import unique
from zepben.ewb.model.cim.extensions.zbex import zbex


@zbex
@unique
class TransformerCoolingType(Enum):
"""
[ZBEX]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

from enum import Enum

from zepben.ewb import unique
from zepben.ewb.model.cim.extensions.zbex import zbex


@zbex
@unique
class VectorGroup(Enum):
"""
[ZBEX]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb import unique


@unique
class WireMaterialKind(Enum):
"""
Kind of wire material.
Expand Down
3 changes: 3 additions & 0 deletions src/zepben/ewb/model/cim/iec61968/customers/customer_kind.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb import unique


@unique
class CustomerKind(Enum):
"""
Kind of customer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb import unique


@unique
class TransformerConstructionKind(Enum):
"""
Kind of transformer construction.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb import unique


@unique
class TransformerFunctionKind(Enum):
"""
Function of a transformer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb import unique


@unique
class StreetlightLampKind(Enum):
"""
Kind of lamp for a `Streetlight`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
from enum import Enum
from typing import List, Union

from zepben.ewb import unique


@unique
class Appliance(Enum):
"""
The type of appliance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb import unique


@unique
class EndDeviceFunctionKind(Enum):
"""
Kind of end device function.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb import unique


@unique
class PotentialTransformerKind(Enum):
"""
The construction kind of the potential transformer.
Expand Down
2 changes: 2 additions & 0 deletions src/zepben/ewb/model/cim/iec61970/base/core/phase_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from enum import Enum
from typing import List, Set, Union

from zepben.ewb import unique
from zepben.ewb.model.cim.iec61970.base.wires.single_phase_kind import SinglePhaseKind


Expand All @@ -21,6 +22,7 @@ def phase_code_by_id(value: int):
return _PHASE_CODE_VALUES[value]


@unique
class PhaseCode(Enum):
"""
An unordered enumeration of phase identifiers. Allows designation of phases for both transmission and distribution equipment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb import unique


@unique
class DiagramStyle(Enum):
"""
The diagram style refer to a style used by the originating system for a diagram. A diagram style describes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb import unique


@unique
class OrientationKind(Enum):
"""
The orientation of the coordinate system with respect to top, left, and the coordinate number system.
Expand Down
3 changes: 3 additions & 0 deletions src/zepben/ewb/model/cim/iec61970/base/domain/unit_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from enum import Enum

from zepben.ewb import unique


def unit_symbol_from_cim_name(value: str):
return _unitsymbol_by_cim_name[value]
Expand All @@ -16,6 +18,7 @@ def unit_symbol_from_id(value: int):
return _unitsymbol_members_by_id[value]


# NOTE: We can't use `@unique` here, as there are duplicate unit strings.
class UnitSymbol(Enum):
"""
The derived units defined for usage in the CIM. In some cases, the derived unit is equal to an SI unit. Whenever possible, the standard derived symbol is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb import unique


@unique
class BatteryStateKind(Enum):
"""
Battery state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb.util import unique


@unique
class PhaseShuntConnectionKind(Enum):
"""
The configuration of phase connections for a single terminal device such as a load or capacitor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb import unique


@unique
class RegulatingControlModeKind(Enum):
"""
The kind of regulation model. For example regulating voltage, reactive power, active power, etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from enum import Enum
from typing import Union

from zepben.ewb import unique


#
# NOTE: The following import is actually at the bottom of this file to avoid cyclic imports.
Expand All @@ -25,6 +27,7 @@ def single_phase_kind_by_id(value):
return SINGLE_PHASE_KIND_VALUES[value]


@unique
class SinglePhaseKind(Enum):
"""
Enumeration of single phase identifiers. Allows designation of single phases for both transmission and distribution equipment, circuits and loads.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb import unique


@unique
class SVCControlMode(Enum):
"""
Static VAr Compensator control mode.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb import unique


@unique
class SynchronousMachineKind(Enum):
"""
Synchronous machine type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb import unique


@unique
class WindingConnection(Enum):
"""
Winding connection type.
Expand Down
3 changes: 3 additions & 0 deletions src/zepben/ewb/services/network/network_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb import unique


@unique
class NetworkState(Enum):
"""
Indicates which state of the network an operation should be performed on.
Expand Down
3 changes: 3 additions & 0 deletions src/zepben/ewb/streaming/get/included_energized_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb import unique


@unique
class IncludedEnergizedContainers(Enum):
"""
Indicates which energized contains should be included when fetching a container.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

from enum import Enum

from zepben.ewb.util import unique


@unique
class IncludedEnergizingContainers(Enum):
"""
Indicates which energizing contains should be included when fetching a container.
Expand Down
11 changes: 11 additions & 0 deletions src/zepben/ewb/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
"datetime_to_timestamp",
"none",
"classproperty",
"unique",
]

import os
import re
from collections.abc import Sized
from datetime import datetime
from enum import unique as enum_unique
from typing import List, Optional, Iterable, Callable, Any, TypeVar, Generator, Dict, Collection
from typing import TYPE_CHECKING
from uuid import UUID
Expand Down Expand Up @@ -187,3 +189,12 @@ def datetime_to_timestamp(date_time: datetime) -> PBTimestamp:
timestamp = PBTimestamp()
timestamp.FromDatetime(date_time)
return timestamp


def unique(enumeration: T) -> T:
"""
A wrapper for the enum.unique() wrapper to preserve typing so that undefined members are correctly
flagged by the linter.
"""
enum_unique(enumeration)
return enumeration