Skip to content

Commit

Permalink
feat: Add extra attribute to objects
Browse files Browse the repository at this point in the history
This attribute acts as a namespaced dictionary
and is used by extensions
to add information to the objects.

If a particular projects expects
to find extra data in `obj.extra["project"]`,
then extensions who wish to communicate data
to this project can write into
its "project" namespace/dictionary.

Extensions can also simply write to their own namespace,
using their distribution name for example.
  • Loading branch information
pawamoy committed Jul 6, 2023
1 parent 591bacc commit 707a348
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/griffe/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ def __init__(
self.exports: set[str] | list[str | Name] | None = None
self.aliases: dict[str, Alias] = {}
self.runtime: bool = runtime
self.extra: dict[str, dict[str, Any]] = defaultdict(dict)
self._lines_collection: LinesCollection | None = lines_collection
self._modules_collection: ModulesCollection | None = modules_collection

Expand Down

0 comments on commit 707a348

Please sign in to comment.