Coverage for pyEDAA/ProjectModel/Attributes.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.6.7, created at 2024-11-20 23:18 +0000

1# ==================================================================================================================== # 

2# _____ ____ _ _ ____ _ _ __ __ _ _ # 

3# _ __ _ _| ____| _ \ / \ / \ | _ \ _ __ ___ (_) ___ ___| |_| \/ | ___ __| | ___| | # 

4# | '_ \| | | | _| | | | |/ _ \ / _ \ | |_) | '__/ _ \| |/ _ \/ __| __| |\/| |/ _ \ / _` |/ _ \ | # 

5# | |_) | |_| | |___| |_| / ___ \ / ___ \ _| __/| | | (_) | | __/ (__| |_| | | | (_) | (_| | __/ | # 

6# | .__/ \__, |_____|____/_/ \_\/_/ \_(_)_| |_| \___// |\___|\___|\__|_| |_|\___/ \__,_|\___|_| # 

7# |_| |___/ |__/ # 

8# ==================================================================================================================== # 

9# Authors: # 

10# Patrick Lehmann # 

11# # 

12# License: # 

13# ==================================================================================================================== # 

14# Copyright 2017-2024 Patrick Lehmann - Boetzingen, Germany # 

15# # 

16# Licensed under the Apache License, Version 2.0 (the "License"); # 

17# you may not use this file except in compliance with the License. # 

18# You may obtain a copy of the License at # 

19# # 

20# http://www.apache.org/licenses/LICENSE-2.0 # 

21# # 

22# Unless required by applicable law or agreed to in writing, software # 

23# distributed under the License is distributed on an "AS IS" BASIS, # 

24# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # 

25# See the License for the specific language governing permissions and # 

26# limitations under the License. # 

27# # 

28# SPDX-License-Identifier: Apache-2.0 # 

29# ==================================================================================================================== # 

30# 

31"""A set of common attributes to store meta information on ProjectModel entities (project, design, fileset, file, ...).""" 

32from typing import Dict 

33from pyTooling.Decorators import export 

34 

35from pyEDAA.ProjectModel import Attribute 

36 

37 

38@export 

39class KeyValueAttribute(Attribute): 

40 KEY = "ID" 

41 

42 _keyValuePairs: Dict[str, str] 

43 

44 def __init__(self) -> None: 

45 super().__init__() 

46 

47 self._keyValuePairs = {} 

48 

49 def __getitem__(self, item: str) -> str: 

50 return self._keyValuePairs[item] 

51 

52 def __setitem__(self, key: str, value: str) -> None: 

53 self._keyValuePairs[key] = value