Skip to content

Commit 1a10492

Browse files
committed
type checking fix
1 parent c4bf04e commit 1a10492

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/jsonparse/parser.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
# python imports
66
from typing import Union
7+
from collections import OrderedDict
78

89

910
class Parser:
@@ -406,8 +407,8 @@ def _queue_trace(self):
406407
# Input validation
407408

408409
def _valid_key_input(self, data, key):
409-
# type: (Union[dict, list], str) -> bool
410-
if not isinstance(data, (dict, list)):
410+
# type: (Union[dict, list, OrderedDict], str) -> bool
411+
if not isinstance(data, (dict, list, OrderedDict)):
411412
raise TypeError
412413
elif not isinstance(key, str):
413414
raise TypeError
@@ -416,8 +417,8 @@ def _valid_key_input(self, data, key):
416417
return True
417418

418419
def _valid_keys_input(self, data, keys, group):
419-
# type: (Union[dict, list], list, bool) -> bool
420-
if not isinstance(data, (dict, list)):
420+
# type: (Union[dict, list, OrderedDict], list, bool) -> bool
421+
if not isinstance(data, (dict, list, OrderedDict)):
421422
raise TypeError
422423
elif not isinstance(keys, list):
423424
raise TypeError
@@ -428,8 +429,8 @@ def _valid_keys_input(self, data, keys, group):
428429
return True
429430

430431
def _valid_key_chain_input(self, data, keys):
431-
# type: (Union[dict, list], list) -> bool
432-
if not isinstance(data, (dict, list)):
432+
# type: (Union[dict, list, OrderedDict], list) -> bool
433+
if not isinstance(data, (dict, list, OrderedDict)):
433434
raise TypeError
434435
elif not isinstance(keys, list):
435436
raise TypeError
@@ -443,8 +444,8 @@ def _valid_key_chain_input(self, data, keys):
443444
return True
444445

445446
def _valid_key_value_input(self, data, key, value):
446-
# type: (Union[dict, list], str, Union[str, int, float, bool, None]) -> bool
447-
if not isinstance(data, (dict, list)):
447+
# type: (Union[dict, list, OrderedDict], str, Union[str, int, float, bool, None]) -> bool
448+
if not isinstance(data, (dict, list, OrderedDict)):
448449
raise TypeError
449450
elif not isinstance(key, str):
450451
raise TypeError
@@ -455,8 +456,8 @@ def _valid_key_value_input(self, data, key, value):
455456
return True
456457

457458
def _valid_value_input(self, data, value):
458-
# type: (Union[dict, list], Union[str, int, float, bool, None]) -> bool
459-
if not isinstance(data, (dict, list)):
459+
# type: (Union[dict, list, OrderedDict], Union[str, int, float, bool, None]) -> bool
460+
if not isinstance(data, (dict, list, OrderedDict)):
460461
raise TypeError
461462
elif not isinstance(value, (str, int, float, bool, type(None))):
462463
raise TypeError

0 commit comments

Comments
 (0)