@@ -9,7 +9,7 @@ The simplest possible usage is:
9
9
10
10
.. doctest ::
11
11
12
- >>> from attr import define
12
+ >>> from attrs import define
13
13
>>> @ define
14
14
... class Empty :
15
15
... pass
@@ -189,18 +189,16 @@ When you have a class with data, it often is very convenient to transform that c
189
189
190
190
.. doctest ::
191
191
192
- >>> from attr import asdict
192
+ >>> from attrs import asdict
193
193
194
194
>>> asdict(Coordinates(x = 1 , y = 2 ))
195
195
{'x': 1, 'y': 2}
196
196
197
197
Some fields cannot or should not be transformed.
198
- For that, `attr .asdict ` offers a callback that decides whether an attribute should be included:
198
+ For that, `attrs .asdict ` offers a callback that decides whether an attribute should be included:
199
199
200
200
.. doctest ::
201
201
202
- >>> from attr import asdict
203
-
204
202
>>> @ define
205
203
... class User (object ):
206
204
... email: str
@@ -219,7 +217,7 @@ For the common case where you want to `include <attr.filters.include>` or `exclu
219
217
220
218
.. doctest ::
221
219
222
- >>> from attr import asdict, filters, fields
220
+ >>> from attrs import asdict, filters, fields
223
221
224
222
>>> @ define
225
223
... class User :
@@ -247,7 +245,7 @@ Other times, all you want is a tuple and ``attrs`` won't let you down:
247
245
.. doctest ::
248
246
249
247
>>> import sqlite3
250
- >>> from attr import astuple
248
+ >>> from attrs import astuple
251
249
252
250
>>> @ define
253
251
... class Foo :
@@ -363,7 +361,7 @@ You can use a decorator:
363
361
364
362
.. doctest ::
365
363
366
- >>> from attr import validators
364
+ >>> from attrs import validators
367
365
368
366
>>> def x_smaller_than_y (instance , attribute , value ):
369
367
... if value >= instance.y:
@@ -454,7 +452,7 @@ All ``attrs`` attributes may include arbitrary metadata in the form of a read-on
454
452
455
453
.. doctest ::
456
454
457
- >>> from attr import fields
455
+ >>> from attrs import fields
458
456
459
457
>>> @ define
460
458
... class C :
@@ -478,7 +476,7 @@ Types
478
476
479
477
.. doctest ::
480
478
481
- >>> from attr import attrib, fields
479
+ >>> from attrs import attrib, fields
482
480
483
481
>>> @ define
484
482
... class C :
@@ -497,7 +495,7 @@ If you don't mind annotating *all* attributes, you can even drop the `attrs.fiel
497
495
.. doctest ::
498
496
499
497
>>> import typing
500
- >>> from attr import fields
498
+ >>> from attrs import fields
501
499
502
500
>>> @ define
503
501
... class AutoC :
@@ -527,7 +525,7 @@ This will replace the *type* attribute in the respective fields.
527
525
528
526
.. doctest ::
529
527
530
- >>> from attr import fields, resolve_types
528
+ >>> from attrs import fields, resolve_types
531
529
532
530
>>> @ define
533
531
... class A :
@@ -604,7 +602,7 @@ In Clojure that function is called `assoc <https://clojuredocs.org/clojure.core/
604
602
605
603
.. doctest ::
606
604
607
- >>> from attr import evolve
605
+ >>> from attrs import evolve
608
606
609
607
>>> @ frozen
610
608
... class C :
@@ -641,7 +639,7 @@ You can still have power over the attributes if you pass a dictionary of name: `
641
639
642
640
.. doctest ::
643
641
644
- >>> from attr import make_class
642
+ >>> from attrs import make_class
645
643
646
644
>>> C = make_class(" C" , {" x" : field(default = 42 ),
647
645
... " y" : field(default = Factory(list ))},
@@ -658,7 +656,7 @@ If you need to dynamically make a class with `attrs.make_class` and it needs to
658
656
659
657
.. doctest ::
660
658
661
- >>> from attr import make_class
659
+ >>> from attrs import make_class
662
660
663
661
>>> class D :
664
662
... def __eq__ (self , other ):
0 commit comments