uselessvevo / fuse-box Goto Github PK
View Code? Open in Web Editor NEWMinimalistic library for data processing and validation
License: GNU General Public License v3.0
Minimalistic library for data processing and validation
License: GNU General Public License v3.0
Just an experiment to port core modules to cython
Append short-methods to use validators without defining Field
instance (-s)
For example:
# validators.py
def validate_range(
value: list[Number, Number],
raise_exception: bool = False
) -> bool:
...
At this moment, class Field
has allowed_types
attribute, but string
, integer
and etc. classes doesn't implement this attribute
For example:
Remove MinLengthValidator
and MaxLengthValidator
because we have a CompareValidator
This line doesn't make any sense, because this check requires a value type not value itself.
Because there is a reason to expand exceptions list on demand. And it means, that we need to add this attribute into __init__
method as well.
At this moment, all tests are a little bit messy. For example, test with fields contains validators and etc. Just do a little clean.
Just a thought, but we can add array of operators to handle multiple comparisons. For example:
validators=[CompareValidator(">", "<"), ...]
FloatField.set
variable new_value is not used in get_separator
method
At this moment, we dont have any built-in cleaner-methods. For example:
def clean_digits(value: str) -> Union[str, None]:
value = re.search(r'^[\d+\,]+|^[\d+]', value)
if value:
value = value.group(0)
value = value.replace(',', '.')
return value
integer_field = IntegerField(method=clean_digits)
integer_field_result = integer_field.set('123@@@')
print(f"input value: '123@@@', integer_field value: {integer_field.value}")
float_field = FloatField(method=clean_digits)
float_field_result = float_field.set('222,00')
print(f"input value: '222,00', float_field value: {float_field.value}")
All handlers are named like Mapper
, Regex
and etc. Just add Handler at the end.
I mean that word new doesn't represent a purpose of this attribute, because this attribute meant to add new into __slots__
, not overwrite it.
Converter should serialize and deserialize data from dataclass into basic data structures, dump and load from json and etc.
There is no clear reason to keep ORM part of this project. So, this package will be moved to the independent project.
Add optional parameter to support input data type checking.
Add optional parameter to support input data type checking.
Why? Because of certain conditions we want add or remove handlers or validators.
For example:
if <condition>:
field.add_handler(Handler(...))
field.add_validator(Validator(...))
Just a small enhancement in CompareValidator
to prevent NoneType error
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.