1 | #!/usr/bin/env python2
|
2 | """
|
3 | invalid_too_many_defaults.py
|
4 | """
|
5 | from __future__ import print_function
|
6 |
|
7 | from typing import List
|
8 |
|
9 |
|
10 | def ok_None(x=None):
|
11 | # type: (str) -> None
|
12 | pass
|
13 |
|
14 |
|
15 | def ok_bool(x=False):
|
16 | # type: (bool) -> None
|
17 | pass
|
18 |
|
19 |
|
20 | def too_many_defaults(x, y=4, z=5):
|
21 | # type: (int, int, int) -> None
|
22 | pass
|
23 |
|
24 |
|
25 | # I think we should allow None, bool, and int
|
26 | def mutable_default(x, y=[]):
|
27 | # type: (int, List[int]) -> None
|
28 | pass
|
29 |
|
30 |
|
31 | class TooManyDefaults(object):
|
32 |
|
33 | def __init__(self, x, y=42, z=5):
|
34 | # type: (int, int, int) -> None
|
35 | self.x = x
|
36 | self.y = y
|
37 |
|
38 |
|
39 | class MutableDefault(object):
|
40 |
|
41 | def __init__(self, x, y=42, z=[]):
|
42 | # type: (int, int, List[int]) -> None
|
43 | self.x = x
|
44 | self.y = y
|