DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
rename_duplicate_dals.ExtendedDal Class Reference
Collaboration diagram for rename_duplicate_dals.ExtendedDal:
[legend]

Public Member Functions

 __init__ (self, DalBase dal, Configuration config, RelationshipCache tree)
 
str id (self)
 
Dict[str, Any] attributes (self)
 
Dict[str, Set[str]] relations (self)
 
List[DalBaseget_parents (self)
 
None rename (self, str name)
 
bool __eq__ (self, object other)
 
bool has_same_parents (self, "ExtendedDal" other)
 

Public Attributes

 dal = dal
 
 config = config
 
 tree = tree
 
dict _relations = True):
 
str id = other.id
 
Dict[str, Any] attributes = other.attributes
 
Dict[str, Set[str]] relations = other.relations
 

Protected Attributes

Dict[str, Any]|None _attributes = None
 
Dict[str, Set[str]]|None _relations = None
 

Detailed Description

A DAL object enriched with its configuration and relationship tree.

Definition at line 70 of file rename_duplicate_dals.py.

Constructor & Destructor Documentation

◆ __init__()

rename_duplicate_dals.ExtendedDal.__init__ ( self,
DalBase dal,
Configuration config,
RelationshipCache tree )

Definition at line 73 of file rename_duplicate_dals.py.

73 def __init__(self, dal: DalBase, config: Configuration, tree: RelationshipCache):
74 self.dal = dal
75 self.config = config
76 self.tree = tree
77 self._attributes: Dict[str, Any] | None = None
78 self._relations: Dict[str, Set[str]] | None = None
79

Member Function Documentation

◆ __eq__()

bool rename_duplicate_dals.ExtendedDal.__eq__ ( self,
object other )

Definition at line 113 of file rename_duplicate_dals.py.

113 def __eq__(self, other: object) -> bool:
114 if not isinstance(other, ExtendedDal):
115 return False
116 return (
117 self.dal.className() == other.dal.className()
118 and self.id == other.id
119 and self.attributes == other.attributes
120 and self.relations == other.relations
121 )
122

◆ attributes()

Dict[str, Any] rename_duplicate_dals.ExtendedDal.attributes ( self)

Definition at line 85 of file rename_duplicate_dals.py.

85 def attributes(self) -> Dict[str, Any]:
86 if self._attributes is None:
87 self._attributes = {
88 a: getattr(self.dal, a, None)
89 for a in self.config.attributes(self.dal.className())
90 }
91 return self._attributes
92

◆ get_parents()

List[DalBase] rename_duplicate_dals.ExtendedDal.get_parents ( self)

Definition at line 106 of file rename_duplicate_dals.py.

106 def get_parents(self) -> List[DalBase]:
107 return self.tree.get_parents(self.dal)
108

◆ has_same_parents()

bool rename_duplicate_dals.ExtendedDal.has_same_parents ( self,
"ExtendedDal" other )

Definition at line 123 of file rename_duplicate_dals.py.

123 def has_same_parents(self, other: "ExtendedDal") -> bool:
124 return self.get_parents() == other.get_parents()
125
126
127# ----- Consolidated group of duplicate DALs -----
128

◆ id()

str rename_duplicate_dals.ExtendedDal.id ( self)

Definition at line 81 of file rename_duplicate_dals.py.

81 def id(self) -> str:
82 return self.dal.id
83

◆ relations()

Dict[str, Set[str]] rename_duplicate_dals.ExtendedDal.relations ( self)

Definition at line 94 of file rename_duplicate_dals.py.

94 def relations(self) -> Dict[str, Set[str]]:
95 if self._relations is None:
96 self._relations = {}
97 for rel in self.config.relations(self.dal.className(), all=True):
98 related = getattr(self.dal, rel, None)
99 if related is None:
100 related = []
101 elif not isinstance(related, list):
102 related = [related]
103 self._relations[rel] = {repr(r) for r in related}
104 return self._relations
105

◆ rename()

None rename_duplicate_dals.ExtendedDal.rename ( self,
str name )

Definition at line 109 of file rename_duplicate_dals.py.

109 def rename(self, name: str) -> None:
110 self.dal.rename(name)
111 self.config.update_dal(self.dal)
112

Member Data Documentation

◆ _attributes

Dict[str, Any] | None rename_duplicate_dals.ExtendedDal._attributes = None
protected

Definition at line 77 of file rename_duplicate_dals.py.

◆ _relations [1/2]

Dict[str, Set[str]] | None rename_duplicate_dals.ExtendedDal._relations = None
protected

Definition at line 78 of file rename_duplicate_dals.py.

◆ _relations [2/2]

dict rename_duplicate_dals.ExtendedDal._relations = True):

Definition at line 96 of file rename_duplicate_dals.py.

◆ attributes

Dict[str, Any] rename_duplicate_dals.ExtendedDal.attributes = other.attributes

Definition at line 119 of file rename_duplicate_dals.py.

◆ config

rename_duplicate_dals.ExtendedDal.config = config

Definition at line 75 of file rename_duplicate_dals.py.

◆ dal

rename_duplicate_dals.ExtendedDal.dal = dal

Definition at line 74 of file rename_duplicate_dals.py.

◆ id

str rename_duplicate_dals.ExtendedDal.id = other.id

Definition at line 118 of file rename_duplicate_dals.py.

◆ relations

Dict[str, Set[str]] rename_duplicate_dals.ExtendedDal.relations = other.relations

Definition at line 120 of file rename_duplicate_dals.py.

◆ tree

rename_duplicate_dals.ExtendedDal.tree = tree

Definition at line 76 of file rename_duplicate_dals.py.


The documentation for this class was generated from the following file: