Returns the set of simple symbols that this QN relies on. This would be the smallest set of symbols necessary for the QN to statically resolve (assuming properties and index ranges are verified at runtime). Examples: 'a.b' has only one support symbol, 'a' 'a[i]' has two
(self)
| 139 | |
| 140 | @property |
| 141 | def support_set(self): |
| 142 | """Returns the set of simple symbols that this QN relies on. |
| 143 | |
| 144 | This would be the smallest set of symbols necessary for the QN to |
| 145 | statically resolve (assuming properties and index ranges are verified |
| 146 | at runtime). |
| 147 | |
| 148 | Examples: |
| 149 | 'a.b' has only one support symbol, 'a' |
| 150 | 'a[i]' has two support symbols, 'a' and 'i' |
| 151 | """ |
| 152 | # TODO(mdan): This might be the set of Name nodes in the AST. Track those? |
| 153 | roots = set() |
| 154 | if self.has_attr(): |
| 155 | roots.update(self.parent.support_set) |
| 156 | elif self.has_subscript(): |
| 157 | roots.update(self.parent.support_set) |
| 158 | roots.update(self.qn[1].support_set) |
| 159 | else: |
| 160 | roots.add(self) |
| 161 | return roots |
| 162 | |
| 163 | def __hash__(self): |
| 164 | return hash(self.qn + (self._has_attr, self._has_subscript)) |
nothing calls this directly
no test coverage detected