Skip to content

Commit a7b1d36

Browse files
committed
handle float and int better
1 parent 28b0470 commit a7b1d36

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

jsonclasses/validators/float_validator.py

+8
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,11 @@ def validate(self, value, key_path, root, all_fields):
99
{ key_path: f'Value \'{value}\' at \'{key_path}\' should be float.' },
1010
root
1111
)
12+
13+
def transform(self, value):
14+
if value is None:
15+
return None
16+
elif type(value) is int:
17+
return float(value)
18+
else:
19+
return value

publish.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
rm -rf dist
2+
python setup.py sdist bdist_wheel
3+
twine check dist/*
4+
twine upload dist/*

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
README = (HERE / "README.md").read_text()
99

1010
setup(name='jsonclasses',
11-
version='0.1.5',
11+
version='0.1.6',
1212
description='Python @dataclass <=> JSON declarable, interchangeable, validatable, sanitizable.',
1313
long_description=README,
1414
long_description_content_type="text/markdown",

run_test.sh renamed to test.sh

File renamed without changes.

0 commit comments

Comments
 (0)