Skip to content

Commit b94fa79

Browse files
committed
Bump version to 0.3.2
1 parent f5fb662 commit b94fa79

File tree

2 files changed

+5
-65
lines changed

2 files changed

+5
-65
lines changed

sqlalchemyseed/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
from .seeder import Seeder
33

44

5-
__version__ = '0.3.1'
5+
__version__ = '0.3.2'

sqlalchemyseed/validator.py

Lines changed: 4 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -35,68 +35,6 @@ def _walk(self, obj):
3535
return print(obj)
3636

3737

38-
# class SchemaValidator:
39-
# def __init__(self):
40-
# self.root_type = dict
41-
# self.root_length = 2
42-
#
43-
# self._required_keys = (
44-
# ('model', 'data'),
45-
# ('model', 'filter')
46-
# )
47-
# self._model_type = str
48-
# self._entity_types = [dict, list]
49-
#
50-
# def validate(self, obj):
51-
# if isinstance(obj, list):
52-
# for i in obj:
53-
# self.validate(i)
54-
# else:
55-
# self._validate(obj)
56-
#
57-
# def _validate(self, obj):
58-
# if not isinstance(obj, dict):
59-
# raise TypeError('\'obj\' object is not type \'dict\'.')
60-
#
61-
# if len(obj) > 2:
62-
# raise ValueError('obj length exceeds to \'2\'')
63-
# # elif len(obj) < 2:
64-
# # raise ValueError('obj length lesser than \'2\'')
65-
# elif len(obj) == 0:
66-
# return
67-
#
68-
# obj_keys = None
69-
# for keys in self._required_keys:
70-
# if all(key in obj.keys() for key in keys):
71-
# obj_keys = keys
72-
# break
73-
#
74-
# if obj_keys is None:
75-
# raise KeyError('keys not accepted')
76-
#
77-
# if not isinstance(obj[obj_keys[0]], self._model_type):
78-
# raise TypeError(f'obj[{obj_keys[0]}] is not type \'str\'')
79-
# if type(obj[obj_keys[1]]) not in self._entity_types:
80-
# raise KeyError(f'obj[{obj_keys[1]}] is not type \'dict\' or \'list\'')
81-
# # print(obj_keys[1], '=', obj[obj_keys[1]])
82-
# if isinstance(obj[obj_keys[1]], list):
83-
# if len(obj[obj_keys[1]]) == 0:
84-
# raise ValueError(f'obj[{obj_keys[1]}]: value is empty')
85-
# elif not all(isinstance(item, dict) for item in obj[obj_keys[1]]):
86-
# raise TypeError(f'\'obj[{obj_keys[1]}]\': items is not type \'dict\'')
87-
# else:
88-
# for items in obj[obj_keys[1]]:
89-
# for k, v in items.items():
90-
# if str(k).startswith('!'):
91-
# self.validate(v)
92-
# elif isinstance(obj[obj_keys[1]], dict):
93-
# # print(obj_keys[1], '=', obj[obj_keys[1]])
94-
# for k, v in obj[obj_keys[1]].items():
95-
# # print(f'{k}, {v}')
96-
# if str(k).startswith('!'):
97-
# self.validate(v)
98-
99-
10038
class SchemaValidator:
10139
# root_type = dict
10240
# root_length = 2
@@ -139,13 +77,15 @@ def _validate(cls, obj):
13977
if not isinstance(obj[obj_keys[0]], cls._model_type):
14078
raise TypeError(f'obj[{obj_keys[0]}] is not type \'str\'')
14179
if type(obj[obj_keys[1]]) not in cls._entity_types:
142-
raise KeyError(f'obj[{obj_keys[1]}] is not type \'dict\' or \'list\'')
80+
raise KeyError(
81+
f'obj[{obj_keys[1]}] is not type \'dict\' or \'list\'')
14382
# print(obj_keys[1], '=', obj[obj_keys[1]])
14483
if isinstance(obj[obj_keys[1]], list):
14584
if len(obj[obj_keys[1]]) == 0:
14685
raise ValueError(f'obj[{obj_keys[1]}]: value is empty')
14786
elif not all(isinstance(item, dict) for item in obj[obj_keys[1]]):
148-
raise TypeError(f'\'obj[{obj_keys[1]}]\': items is not type \'dict\'')
87+
raise TypeError(
88+
f'\'obj[{obj_keys[1]}]\': items is not type \'dict\'')
14989
else:
15090
for items in obj[obj_keys[1]]:
15191
for k, v in items.items():

0 commit comments

Comments
 (0)