Skip to content

Commit

Permalink
Update EventedModel docs and errors to refer field_dependencies
Browse files Browse the repository at this point in the history
`property_dependencies` was renamed to `field_dependencies` in #234 but some associated error messages and docs still refer to the deprecated name.
  • Loading branch information
sjdemartini authored Nov 8, 2024
1 parent 6d5b644 commit abe278e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/psygnal/_evented_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def c(self, val: Sequence[int]):
self.a, self.b = val
class Config:
property_dependencies={'c': ['a', 'b']}
field_dependencies={'c': ['a', 'b']}
"""
deps: Dict[str, Set[str]] = {}

Expand All @@ -330,7 +330,7 @@ class Config:
if cfg_deps:
if not isinstance(cfg_deps, dict): # pragma: no cover
raise TypeError(
f"Config property_dependencies must be a dict, not {cfg_deps!r}"
f"Config field_dependencies must be a dict, not {cfg_deps!r}"
)
for prop, fields in cfg_deps.items():
if prop not in {*model_fields, *cls.__property_setters__}:
Expand All @@ -345,7 +345,7 @@ class Config:
)
deps.setdefault(field, set()).add(prop)
if model_config.get(GUESS_PROPERTY_DEPENDENCIES, False):
# if property_dependencies haven't been explicitly defined, we can glean
# if field_dependencies haven't been explicitly defined, we can glean
# them from the property.fget code object:
# SKIP THIS MAGIC FOR NOW?
for prop, setter in cls.__property_setters__.items():
Expand Down Expand Up @@ -383,7 +383,7 @@ class EventedModel(pydantic.BaseModel, metaclass=EventedMetaclass):
one of the model fields it depends on is mutated you must set one of the
following options in the `Config`:
- `property_dependencies` may be a `Dict[str, List[str]]`, where the
- `field_dependencies` may be a `Dict[str, List[str]]`, where the
keys are the names of properties, and the values are a list of field names
(strings) that the property depends on for its value
- `guess_property_dependencies` may be set to `True` to "guess" property
Expand Down

0 comments on commit abe278e

Please sign in to comment.