Updates the attributes of the current object from the attributes of another object. Args: source: The object from which to update the attributes. Returns: None
(self, source)
| 33 | def __getitem__(self, name): return getattr(self, name) |
| 34 | |
| 35 | def update_from(self, source): |
| 36 | """ |
| 37 | Updates the attributes of the current object from the attributes of another object. |
| 38 | |
| 39 | Args: |
| 40 | source: The object from which to update the attributes. |
| 41 | |
| 42 | Returns: |
| 43 | None |
| 44 | """ |
| 45 | self_vars = vars(self) # cache, for multiple checks |
| 46 | for key, value in vars(source).items(): |
| 47 | if (value is not None) and (key in self_vars): |
| 48 | self[key] = value |
| 49 | |
| 50 | if int(__version__.split('.')[0]) >= 2: |
| 51 | # Pydantic v2 config |
no outgoing calls
no test coverage detected