X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=code%2Fnetwork-generator%2Fnetwork_generation%2Fmodel%2Fpython%2Ftype_definitions.py;h=9dc0c8a1501d231db1973cd0ae481d20ecdb2b24;hb=091313ef66ae97923fd970be160e01d46649a835;hp=43a71620b872b8e33df62e0a59fa0c827d15385f;hpb=7004840bca352043aec43d36df79436b90bcbd5a;p=oam.git diff --git a/code/network-generator/network_generation/model/python/type_definitions.py b/code/network-generator/network_generation/model/python/type_definitions.py index 43a7162..9dc0c8a 100644 --- a/code/network-generator/network_generation/model/python/type_definitions.py +++ b/code/network-generator/network_generation/model/python/type_definitions.py @@ -12,14 +12,26 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!/usr/bin/python +# !/usr/bin/python """ A collection of TypeDefinitions """ from enum import Enum +from typing import TypedDict + from network_generation.model.python.countries import Country +# from typing import Any, TypedDict, TypeVar + + +# from network_generation.model.python.o_ran_node import IORanNode +# from network_generation.model.python.o_ran_object import IORanObject +# from network_generation.model.python.top import ITop + +# Generic Types based on inheritance +# IORanType = TypeVar("IORanType", ITop, IORanObject, IORanNode) + # Define AdministrativeState enum class AdministrativeState(Enum): @@ -31,16 +43,16 @@ class AdministrativeState(Enum): # Define AlarmState type AlarmState = int + # Define Address type -AddressType = { - "street": str, - "building": str, - "room": str, - "city": str, - "zip": str, - "state": str, - "country": Country, -} +class AddressType(TypedDict): + street: str + building: str + room: str + city: str + zip: str + state: str + country: Country # Define OperationalState enum @@ -65,20 +77,4 @@ class UsageState(Enum): UNUSED = "unused" -# Define Enumerate type -def Enumerate(N, Acc=None): - if Acc is None: - Acc = [] - if len(Acc) == N: - return Acc[-1] - return Enumerate(N, Acc + [len(Acc)]) - - -# Define Range type -def Range(F, T) -> list[int]: - return [i for i in range(F, T + 1)] - - -# Define Procent and Utilization types -Procent = Range(0, 100) -Utilization = Procent +Utilization = int