-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocs_ex09_annotated.output
More file actions
40 lines (31 loc) · 2.38 KB
/
docs_ex09_annotated.output
File metadata and controls
40 lines (31 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<generated class X; x='Value of x', a='Not In __init__ signature', c=[], e='Value of e', f=42>
{'x': Attribute(default=<NOTHING OBJECT>, default_factory=<NOTHING OBJECT>, type=<class 'str'>, doc=None, init=True, repr=True, compare=True, kw_only=False, iter=True, serialize=True, metadata={}),
'a': Attribute(default='Not In __init__ signature', default_factory=<NOTHING OBJECT>, type=<class 'int'>, doc=None, init=False, repr=True, compare=True, kw_only=False, iter=True, serialize=True, metadata={}),
'b': Attribute(default='Not In Repr', default_factory=<NOTHING OBJECT>, type=<class 'str'>, doc=None, init=True, repr=False, compare=True, kw_only=False, iter=True, serialize=True, metadata={}),
'c': Attribute(default=<NOTHING OBJECT>, default_factory=<class 'list'>, type=list[str], doc=None, init=True, repr=True, compare=False, kw_only=False, iter=True, serialize=True, metadata={}),
'd': Attribute(default='Not Anywhere', default_factory=<NOTHING OBJECT>, type=<class 'str'>, doc=None, init=False, repr=False, compare=False, kw_only=False, iter=True, serialize=True, metadata={}),
'e': Attribute(default=<NOTHING OBJECT>, default_factory=<NOTHING OBJECT>, type=<class 'str'>, doc=None, init=True, repr=True, compare=False, kw_only=True, iter=True, serialize=True, metadata={}),
'f': Attribute(default=42, default_factory=<NOTHING OBJECT>, type=ForwardRef('unknown'), doc=None, init=True, repr=True, compare=False, kw_only=False, iter=True, serialize=False, metadata={})}
<generated class Y; x='Value of x', a='Not In __init__ signature', c=[], e='Value of e', f=42>
Slots: {'x': None, 'a': None, 'b': None, 'c': None, 'd': None, 'e': None, 'f': None}
Source:
def __eq__(self, other):
return (
self.x == other.x
and self.a == other.a
and self.b == other.b
) if self.__class__ is other.__class__ else NotImplemented
def __init__(self, x, b='Not In Repr', c=None, f=42, *, e):
self.x = x
self.a = 'Not In __init__ signature'
self.b = b
self.c = c if c is not None else []
self.d = 'Not Anywhere'
self.e = e
self.f = f
def __replace__(self, /, **changes):
new_kwargs = {'x': self.x, 'b': self.b, 'c': self.c, 'e': self.e, 'f': self.f}
new_kwargs |= changes
return self.__class__(**new_kwargs)
def __repr__(self):
return f'<generated class {type(self).__qualname__}; x={self.x!r}, a={self.a!r}, c={self.c!r}, e={self.e!r}, f={self.f!r}>'