Commit Graph

16 Commits

Author SHA1 Message Date
Samuel Colvin 39d30c24df fix parsing of tiny timedelta values (#4329) 2022-08-05 11:31:13 +00:00
Samuel Colvin 7e83fdd256 Merge pull request from GHSA-5jqp-qgf6-3pvh
* fix infinite loop in datetime parsing

* add change description

* switch to set a max datetime number
2021-05-11 18:08:48 +01:00
Noel Evans 5da8b9cded Parse time with tz (#1814)
* Parse timezone information in time str

* Add description of change fixing issue 1744

* Guard against TZ over 24 hours

* Parse timezone information in time str

* Datetime and time TZ parsed in separate fn

* Sharpen annotation, many return statements

* Fix mypy errors raised on datetime_parse

* fix type hints

* update docs and correct types

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2020-10-25 16:08:38 +00:00
Mlbiche 113921c6c5 Update datetime parser to support negative timestamps (#1605)
- Negative timestamps corresponds to dates before 1970/1/1
2020-06-27 14:52:20 +01:00
Samuel Colvin 9dee83a689 better error message for TypeError on datetime parsing (#766)
* better error message for TypeError on datetime parsing

* add change, fix tests

* reduce scope of errors caught
2019-08-21 13:45:11 +01:00
Samuel Colvin 0e8cfba713 small performance improvements to validators and fields (#763)
* small performance improvements to validators and fields

* simplify ErrorWrapper and ValidationError

* more cleanup of errors, combine test_error_wrapper.py and test_error.py

* tweak datetime_parse.py

* fix for python 3.6

* add change

* fix bug with int or float passed to datetime.time
2019-08-18 16:48:39 +01:00
Samuel Colvin 8fa1382beb change ms/s watershed for datetime parsing (#385)
* change ms/s watershed for datetime parsing

* more tests for ms, μs and ns

* fix formatting

* uprev
2019-02-04 22:09:51 +00:00
Samuel Colvin ef140056fa cast datetime to date in parse_date, (#298)
* cast datetime to date in parse_date, fix #295

* tweak, update history
2018-11-15 12:21:15 +00:00
Samuel Colvin 15850a43c5 moving to black (#287)
* moving to black

* put back flake8

* remove isort option

* putting back isort

* uprev pycodestyle

* remove black from docs/examples

* tweak parse.py
2018-11-15 11:30:07 +00:00
Samuel Colvin f46dc0c56f timedelta json encoding (#247)
* timedelta json encoding, altnative to #220

* history and tests

* fix comments and tests

* docs for json_encoders

* tests plain timedelta object parsing

* uprev

* tweak docs
2018-08-25 17:06:32 +01:00
Nikita Grishko 4f4e22ef47 Error context and message (#183)
* POC of error context and message

* Move type errors to the `errors.py` module; Change errors interface a bit

* Rename `.as_dict()` to `.dict()`

* Fix `PydanticErrorMixin` constructor

* Rename `exceptions.py` to `error_wrappers.py`

* Do not include nullable `ctx`

* Fix tests

* Added `int_validator`; Added `IntegerError`

* Added `float_validator`; Added `FloatError`

* Get rid of `__mro__` in prior of `exc.code`

* Removed `min_number_size` and `max_number_size` from config (#174)

* Added `NumberMinSizeError` and `NumberMaxSizeError`

* Added `NoneIsNotAllowedError`

* Added `EnumError`

* Added `path_validator`; Added `PathError`

* Added `DictError`

* Added `ListError`

* Added `TupleError`

* Added `SetError`

* Added `datetime` related errors

* Added `bytes` and `str` related errors

* Added `SequenceError`

* Improved code coverage

* Display error context in string representation of validation error

* Redefine error message templates using config

* Review fixes

* Updated changelog
2018-05-31 14:35:38 +01:00
YannLuo 778a33fac9 fix parse error of parse_date() and parse_datetime() when input is 0 (#144) 2018-03-26 11:48:53 +01:00
Samuel Colvin 423137cefe allow pything dates and times (#122)
* allow pything dates and times

* update history
2018-02-01 17:20:06 +00:00
Samuel Colvin 044fd42f4f parser methods (#58), fix #39
* working on parsers

* starting parse tests

* proper tests for parse

* adding parse docs

* tweaks and history

* add test for datetime direct, fix tests

* tweak docs
2017-07-08 18:39:24 +01:00
Samuel Colvin c859ec8543 adding datetime, date, time and timedelta validation 2017-05-05 19:59:25 +01:00
Samuel Colvin 90bc681137 adding datetime parsing stolen from django 2017-05-05 19:38:12 +01:00