A DAL object enriched with its configuration and relationship tree.
Definition at line 70 of file rename_duplicate_dals.py.
◆ __init__()
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
◆ __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
128
◆ id()
| str rename_duplicate_dals.ExtendedDal.id |
( |
| self | ) |
|
◆ 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
◆ _attributes
| Dict[str, Any] | None rename_duplicate_dals.ExtendedDal._attributes = None |
|
protected |
◆ _relations [1/2]
| Dict[str, Set[str]] | None rename_duplicate_dals.ExtendedDal._relations = None |
|
protected |
◆ _relations [2/2]
| dict rename_duplicate_dals.ExtendedDal._relations = True): |
◆ attributes
| Dict[str, Any] rename_duplicate_dals.ExtendedDal.attributes = other.attributes |
◆ config
| rename_duplicate_dals.ExtendedDal.config = config |
◆ dal
| rename_duplicate_dals.ExtendedDal.dal = dal |
◆ id
| str rename_duplicate_dals.ExtendedDal.id = other.id |
◆ relations
| Dict[str, Set[str]] rename_duplicate_dals.ExtendedDal.relations = other.relations |
◆ tree
| rename_duplicate_dals.ExtendedDal.tree = tree |
The documentation for this class was generated from the following file: