summaryrefslogtreecommitdiff
path: root/pint/errors.py
Commit message (Collapse)AuthorAgeFilesLines
* Python's 3.9 compatible typing annotationsHernan Grecco2023-05-141-1/+2
|
* Typing related fixesHernan Grecco2023-05-091-1/+1
|
* Typing improvementsHernan Grecco2023-05-011-9/+19
| | | | | | | | | | | While there is still a lot of work to do (mainly in Registry, Quantity, Unit), this large PR makes several changes all around the code. There has not been any intended functional change, but certain typing improvements required code minor code refactoring to streamline input and output types of functions. An important experimental idea is the PintScalar and PintArray protocols, and Magnitude type. This is to overcome the lack of a proper numerical hierarchy in Python.
* Merge branch 'master' into fix-nonmult-docHernan Grecco2023-04-251-1/+0
|\
| * Run pre-commit run --all-files . Mostly removed empty linesHernan2023-04-241-1/+0
| |
* | Update error URLs for log / offset units.Constantine Evans2023-03-201-2/+2
|/ | | | | | | | Log / offset unit documentation changed location, making the URLs shown in error message no longer valid. In addition, the two are on separate pages in the most recent documentation. This commit updates the URLs. It also, as it seems most likely to be stably useful for users, points to the latest stable documentation, rather than the latest dev version.
* Using frozen=False in errors to avoid problems with daskHernan2022-10-121-11/+11
|
* Final step to split the registry from the parserHernan2022-09-301-49/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Overview: - All the code in facets is now independent of the definition textual format. In particular, defintions such as UnitDefinition, ContextDefinition an so on cannot be built directly from a string. (some functions are kept only temporarily to simplify but transition) Building Definition objects from string requires a parser that emits them. - The standart pint format is implemented in delegates/txt_parser using flexparser. Briefly each single line statement is mapped to a ParsedStatement class and each larger construct to a Block class. - The registry then has an adder function that takes a definition an incorporate it into the registry. A few nice features of this approach: 1. The Definition objects are standalone public objects, you can now build them in a programatic way and incorporate them to the registry using the define function that will dispatch to the correct adder: >>> new_unit = UnitDefintion( ....) >>> ureg.define(new_unit) # might be called add in the future No more being forced to use string definitions (but you can still use them if you want) 2. Composition over inheritance. The Registry does not know how to parse a definition, but it delegates this to another class which can be changed. This makes it very easy to write another parser (faster, simpler) o try out a completely different file format. 3. Error messages can be more meaningful. Backwards incompatible changes - is_base parameter Definitions is not needed any more. It is now computed automatically leading to a leaner experience and also avoiding incompatible states - alias for dimensionality has been removed (for now at least) The only one defined was speed as an alias of velocity. - (Context|Group|System).from_lines and Definition.from string have been rewritten in terms of the new parser. But will be likely removed in the future - Changing non_int_type is not possible after registry has been created - load_definition raises FileNotFoundError instead of a generic exception if the file was not found - the string representation of several definitions is now not so user friendly terms of the new parser. But will be likely removed in the future - Changing non_int_type is not possible after registry has been created - load_definition raises FileNotFoundError instead of a generic exception if the file was not found - the string representation of several definitions is now not so user friendly.
* Improved type checking consistencyHernan2022-05-071-0/+2
|
* Add root exception for all pint errorsClemens Wolff2021-05-281-5/+9
|
* Implements Error for LogarithmicUnit computation5igno2020-02-141-1/+19
|
* Manual edits after pymentHernan2019-12-271-5/+5
|
* Run pyment -w --convert -o numpydoc .Hernan2019-12-271-10/+5
|
* Remove redundant encoding information (utf8 is the default)Guido Imperiale2019-12-131-1/+0
|
* Correct commentGuido Imperiale2019-12-051-2/+2
|
* pickle exceptionsGuido Imperiale2019-12-041-28/+39
|
* Thorough str tests for all exceptionsGuido Imperiale2019-12-041-39/+36
|
* Exceptions overhaulGuido Imperiale2019-12-041-35/+34
|
* Sphinx fixesGuido Imperiale2019-09-131-1/+1
|
* Improve OffsetUnitCalculusError message.Christoph Buchner2019-08-211-0/+1
| | | Closes #839.
* Added UnitStrippedWarning when an unsupported ufunc attempts to read the ↵kanhua2018-03-231-0/+4
| | | | magnitude of a physical quantity
* Remove positional string formattersHugo2017-10-191-8/+8
|
* fixed `super()` statements in two constructors.Johan Hidding2017-02-271-2/+2
|
* changed UndefinedUnitError to inherit from AttributeError, so `hasattr` ↵Johan Hidding2017-02-271-2/+2
| | | | works on unit registry.
* Updated copyright yearHernan Grecco2016-02-121-1/+1
|
* Move definitions, errors, and converters into their own modules.Matthieu Dartiailh2015-01-061-0/+113
Move definitions, errors and converters tests to their own modules. (tests pass locally)