Skip to content

Commit 3c5eca2

Browse files
julthepsprytnykPierre-Sassoulas
authored
Add documentation examples for too-many-ancestors (#7067)
Co-authored-by: Vladyslav Krylasov <vladyslav.krylasov@gmail.com> Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
1 parent 24aa4d2 commit 3c5eca2

File tree

3 files changed

+57
-2
lines changed

3 files changed

+57
-2
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
class Animal: ...
2+
class BeakyAnimal(Animal): ...
3+
class FurryAnimal(Animal): ...
4+
class Swimmer(Animal): ...
5+
class EggLayer(Animal): ...
6+
class VenomousAnimal(Animal): ...
7+
class ProtectedSpecie(Animal): ...
8+
class BeaverTailedAnimal(Animal): ...
9+
class Vertebrate(Animal): ...
10+
11+
12+
# max of 7 by default, can be configured
13+
# each edge of a diamond inheritance counts
14+
class Playtypus( # [too-many-ancestors]
15+
BeakyAnimal,
16+
FurryAnimal,
17+
Swimmer,
18+
EggLayer,
19+
VenomousAnimal,
20+
ProtectedSpecie,
21+
BeaverTailedAnimal,
22+
Vertebrate,
23+
):
24+
pass

doc/data/messages/t/too-many-ancestors/details.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,33 @@
1-
# This is a placeholder for correct code for this message.
1+
class Animal:
2+
beaver_tailed: bool
3+
can_swim: bool
4+
has_beak: bool
5+
has_fur: bool
6+
has_vertebrae: bool
7+
lays_egg: bool
8+
protected_specie: bool
9+
venomous: bool
10+
11+
12+
class Invertebrate(Animal):
13+
has_vertebrae = False
14+
15+
16+
class Vertebrate(Animal):
17+
has_vertebrae = True
18+
19+
20+
class Mammal(Vertebrate):
21+
has_beak = False
22+
has_fur = True
23+
lays_egg = False
24+
venomous = False
25+
26+
27+
class Playtypus(Mammal):
28+
beaver_tailed = True
29+
can_swim = True
30+
has_beak = True
31+
lays_egg = False
32+
protected_specie = True
33+
venomous = True

0 commit comments

Comments
 (0)