Skip to content

Commit 5555de6

Browse files
committed
refactor: Renamed dataclasses internal modules to models
1 parent cbce6a5 commit 5555de6

45 files changed

Lines changed: 138 additions & 138 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/extensions.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ both the visitor and inspector agents will trigger events.
146146
These events can be hooked on by extensions to alter or enhance
147147
Griffe's behavior. Some hooks will be passed just the current
148148
node being visited, others will be passed both the node
149-
and an instance of an [Object][griffe.dataclasses.Object] subclass,
150-
such as a [Module][griffe.dataclasses.Module],
151-
a [Class][griffe.dataclasses.Class],
152-
a [Function][griffe.dataclasses.Function],
153-
or an [Attribute][griffe.dataclasses.Attribute].
149+
and an instance of an [Object][griffe.models.Object] subclass,
150+
such as a [Module][griffe.models.Module],
151+
a [Class][griffe.models.Class],
152+
a [Function][griffe.models.Function],
153+
or an [Attribute][griffe.models.Attribute].
154154
Extensions will therefore be able to modify these instances.
155155

156156
The following flow chart shows an example of an AST visit.
@@ -180,11 +180,11 @@ contains a single class, which itself contains a single method:
180180

181181
- the agent (visitor or inspector) will walk through the tree
182182
by starting with the module node
183-
- it will instantiate a [Module][griffe.dataclasses.Module],
183+
- it will instantiate a [Module][griffe.models.Module],
184184
then walk through its members, continuing with the class node
185-
- it will instantiate a [Class][griffe.dataclasses.Class],
185+
- it will instantiate a [Class][griffe.models.Class],
186186
then walk through its members, continuing with the function node
187-
- it will instantiate a [Function][griffe.dataclasses.Function]
187+
- it will instantiate a [Function][griffe.models.Function]
188188
- then it will go back up and finish walking since there are
189189
no more nodes to walk through
190190

@@ -296,10 +296,10 @@ The "on node" events are triggered when the agent (visitor or inspector)
296296
starts handling a node in the tree (AST or object tree).
297297

298298
The "on instance" events are triggered when the agent
299-
just created an instance of [Module][griffe.dataclasses.Module],
300-
[Class][griffe.dataclasses.Class],
301-
[Function][griffe.dataclasses.Function],
302-
or [Attribute][griffe.dataclasses.Attribute],
299+
just created an instance of [Module][griffe.models.Module],
300+
[Class][griffe.models.Class],
301+
[Function][griffe.models.Function],
302+
or [Attribute][griffe.models.Attribute],
303303
and added it as a member of its parent.
304304

305305
The "on members" events are triggered when the agent

docs/loading.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,24 @@ mkdocs = loader.load("mkdocs", submodules=False)
3131
## Navigating into the loaded objects
3232

3333
Both the `load` function and the `GriffeLoader.load` method
34-
return an [`Object`][griffe.dataclasses.Object] instance.
34+
return an [`Object`][griffe.models.Object] instance.
3535
There are several ways to access members of an object:
3636

3737
- through its `members` attribute, which is a dictionary,
3838
with the usual `keys()`, `values()` and `items()` methods.
39-
- thanks to its `__getitem__` method. For example `griffe["dataclasses"]`
40-
returns the `Module` instance representing Griffe's `dataclasses` module.
41-
Since this module also has members, you can chain calls: `griffe["dataclasses"]["Module"]`.
42-
Conveniently, you can chain the names with dots in a single call: `griffe["dataclasses.Module"]`.
43-
You can even pass a tuple instead of a string: `griffe[("dataclasses", "Module")]`.
44-
- through the [`modules`][griffe.dataclasses.Object.modules],
45-
[`classes`][griffe.dataclasses.Object.classes],
46-
[`functions`][griffe.dataclasses.Object.functions] and
47-
[`attributes`][griffe.dataclasses.Object.attributes] properties,
39+
- thanks to its `__getitem__` method. For example `griffe["models"]`
40+
returns the `Module` instance representing Griffe's `models` module.
41+
Since this module also has members, you can chain calls: `griffe["models"]["Module"]`.
42+
Conveniently, you can chain the names with dots in a single call: `griffe["models.Module"]`.
43+
You can even pass a tuple instead of a string: `griffe[("models", "Module")]`.
44+
- through the [`modules`][griffe.models.Object.modules],
45+
[`classes`][griffe.models.Object.classes],
46+
[`functions`][griffe.models.Object.functions] and
47+
[`attributes`][griffe.models.Object.attributes] properties,
4848
which take care of filtering members based on their kind, and return dictionaries.
4949

50-
Most of the time, you will only use classes from the [`griffe.dataclasses`][griffe.dataclasses]
51-
and [`griffe.docstrings.dataclasses`][griffe.docstrings.dataclasses] modules.
50+
Most of the time, you will only use classes from the [`griffe.models`][griffe.models]
51+
and [`griffe.docstrings.models`][griffe.docstrings.models] modules.
5252

5353

5454
## Class inheritance
@@ -64,7 +64,7 @@ from using inheritance support in Griffe.
6464
Griffe supports class inheritance, both when visiting and inspecting modules.
6565

6666
To access members of a class that are inherited from base classes,
67-
use [`Object.inherited_members`][griffe.dataclasses.Object.inherited_members].
67+
use [`Object.inherited_members`][griffe.models.Object.inherited_members].
6868
If this is the first time you access inherited members, the base classes
6969
of the given class will be resolved and cached, then the MRO (Method Resolution Order)
7070
will be computed for these bases classes, and a dictionary of inherited members
@@ -94,15 +94,15 @@ If a base class cannot be resolved during computation
9494
of inherited members, Griffe logs a DEBUG message.
9595

9696
If you want to access all members at once (both declared and inherited),
97-
use [`Object.all_members`][griffe.dataclasses.Object.all_members].
97+
use [`Object.all_members`][griffe.models.Object.all_members].
9898

9999
If you want to access only declared members,
100-
use [`Object.members`][griffe.dataclasses.Object].
100+
use [`Object.members`][griffe.models.Object].
101101

102-
Accessing [`Object.attributes`][griffe.dataclasses.Object.attributes],
103-
[`Object.functions`][griffe.dataclasses.Object.functions],
104-
[`Object.classes`][griffe.dataclasses.Object.classes] or
105-
[`Object.modules`][griffe.dataclasses.Object.modules]
102+
Accessing [`Object.attributes`][griffe.models.Object.attributes],
103+
[`Object.functions`][griffe.models.Object.functions],
104+
[`Object.classes`][griffe.models.Object.classes] or
105+
[`Object.modules`][griffe.models.Object.modules]
106106
will trigger inheritance computation, so make sure to only call it
107107
once everything is loaded by Griffe. Don't access inherited members
108108
in extensions, while visiting or inspecting a module.

docs/parsing_docstrings.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
You can use Griffe to parse arbitrary docstrings.
44
You don't have to load anything through the Griffe loader.
5-
You just need to import the [`Docstring`][griffe.dataclasses.Docstring] class.
5+
You just need to import the [`Docstring`][griffe.models.Docstring] class.
66
Then you can build a `Docstring` instance and call its `parse` method,
77
choosing the parsing-style to use:
88

99
```python
10-
from griffe.dataclasses import Docstring
10+
from griffe.models import Docstring
1111

1212
text = "Hello I'm a docstring!"
1313
docstring = Docstring(text, lineno=1)
@@ -19,7 +19,7 @@ annotations from the object from which the docstring originates,
1919
you can manually create the parent objects and link them to the docstring:
2020

2121
```python
22-
from griffe.dataclasses import Docstring, Function, Parameters, Parameter, ParameterKind
22+
from griffe.models import Docstring, Function, Parameters, Parameter, ParameterKind
2323

2424
function = Function(
2525
"func",

0 commit comments

Comments
 (0)