summaryrefslogtreecommitdiff
path: root/tests/functional/t/too/too_few_public_methods.py
blob: 5ba528f798b916508a8135dd8fcd524e76cd67ef (plain)
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
40
41
42
43
44
45
46
47
48
49
50
# pylint: disable=missing-docstring, useless-object-inheritance
from __future__ import print_function


from enum import Enum


class Aaaa(object): # [too-few-public-methods]

    def __init__(self):
        pass

    def meth1(self):
        print(self)

    def _dontcount(self):
        print(self)


# Don't emit for these cases.
class Klass(object):
    """docstring"""

    def meth1(self):
        """first"""

    def meth2(self):
        """second"""


class EnoughPublicMethods(Klass):
    """We shouldn't emit too-few-public-methods for this."""


class BossMonster(Enum):
    """An enum does not need methods to be useful."""
    MEGASHARK = 1
    OCTOPUS = 2


class DumbList:
    """A class can define only special methods."""
    def __init__(self, iterable):
        self._list = list(iterable)

    def __len__(self):
        return len(self._list)

    def __getitem__(self, index):
        return self._list[index]