|
7 | 7 | from jsonschema.exceptions import UndefinedTypeCheck |
8 | 8 |
|
9 | 9 |
|
10 | | -def is_array(instance): |
| 10 | +def is_array(checker, instance): |
11 | 11 | return isinstance(instance, list) |
12 | 12 |
|
13 | 13 |
|
14 | | -def is_bool(instance): |
| 14 | +def is_bool(checker, instance): |
15 | 15 | return isinstance(instance, bool) |
16 | 16 |
|
17 | 17 |
|
18 | | -def is_integer(instance): |
| 18 | +def is_integer(checker, instance): |
19 | 19 | # bool inherits from int, so ensure bools aren't reported as ints |
20 | 20 | if isinstance(instance, bool): |
21 | 21 | return False |
22 | 22 | return isinstance(instance, int_types) |
23 | 23 |
|
24 | 24 |
|
25 | | -def is_null(instance): |
| 25 | +def is_null(checker, instance): |
26 | 26 | return instance is None |
27 | 27 |
|
28 | 28 |
|
29 | | -def is_number(instance): |
| 29 | +def is_number(checker, instance): |
30 | 30 | # bool inherits from int, so ensure bools aren't reported as ints |
31 | 31 | if isinstance(instance, bool): |
32 | 32 | return False |
33 | 33 | return isinstance(instance, numbers.Number) |
34 | 34 |
|
35 | 35 |
|
36 | | -def is_object(instance): |
| 36 | +def is_object(checker, instance): |
37 | 37 | return isinstance(instance, dict) |
38 | 38 |
|
39 | 39 |
|
40 | | -def is_string(instance): |
| 40 | +def is_string(checker, instance): |
41 | 41 | return isinstance(instance, str_types) |
42 | 42 |
|
43 | 43 |
|
44 | | -def is_any(instance): |
| 44 | +def is_any(checker, instance): |
45 | 45 | return True |
46 | 46 |
|
47 | 47 |
|
@@ -90,7 +90,7 @@ def is_type(self, instance, type): |
90 | 90 | if type is unknown to this object. |
91 | 91 | """ |
92 | 92 | try: |
93 | | - return self._type_checkers[type](instance) |
| 93 | + return self._type_checkers[type](self, instance) |
94 | 94 | except KeyError: |
95 | 95 | raise UndefinedTypeCheck |
96 | 96 |
|
|
0 commit comments