summaryrefslogtreecommitdiff
path: root/pint/systems.py
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'felixonmars-patch-1' into developHernan2021-01-071-1/+1
|\
| * Correct a typo in systems.pyFelix Yan2020-10-141-1/+1
| |
* | Run linter on all filesHernan2021-01-071-14/+7
|/
* ran black -t py36 . && isort -rc . && flake8root2020-03-291-2/+1
|
* Merge branch 'master' into masterGiulio Malventi2020-03-141-75/+88
|\
| * Removed passing registry to to_units_container in Systems.from_linesHernan2020-01-221-3/+1
| |
| * Add support for other numerical types at the registry levelHernan2020-01-221-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until this commit, `int` and `float` were special types in Pint (just as they are in Python). Numbers were parsed from strings as int/float from the definition files and from user provided strings; and exponents of units were also stored as int/float. This commit change this by adding a new argument (`non_int_type`) to classes and methods. It indicates how numeric values will be parsed and defaulted. Any numerical class can be used such as `float` (default), Decimal, Fraction. This argument will be found in the following places 1. UnitRegistry: used for parsing the definition files and any value provided as a string. 2. UnitsContainer: used to compare equality with strings, multiply and divide by strings (which is equivalent to parse the string) 3. All methods OUTSIDE the UnitRegistry/Quantity that can parse strings have a `non_int_type` argument. (e.g. Definition.from_string) Tests have been added for by duplicating most cases in `test_quantity.py`. (Some tests have been deleted such as those dealing with numpy.) The new file `test_non_int.py` run the tests for `Decimal`, `Fraction` and `float` (which is redundant but is kept as a crosscheck for the implementation of this testsuite) BREAKING CHANGE: `use_decimal` is deprecated. Use `non_int_type` keyword argument when instantiating the registry. >>> from decimal import Decimal >>> ureg = UnitRegistry(non_int_type=Decimal)
| * Replace 1.0 and 0.0 (floats) by 1 and 0 (integers)Hernan2020-01-211-2/+2
| | | | | | | | | | | | | | | | | | | | In the original codebase, many accumulators, default values and so on were initialized with floats (instead fo integers). The reason behind this decision was that in Python 2 the division (/) was by default an integer division if all values were ints. Therefore, using a float ensured "the right result". Now that the codebase is Python 3, we can safely use integers everywhere. This wil be helpful when a different non integer type is desired.
| * Sphinx fixesGuido Imperiale2020-01-061-2/+3
| |
| * Fixes W293Hernan2019-12-271-14/+14
| |
| * Manual edits after pymentHernan2019-12-271-84/+1
| |
| * Run pyment -w --convert -o numpydoc .Hernan2019-12-271-30/+102
| |
| * Improved babel experienceHernan2019-12-211-2/+2
| | | | | | | | | | | | | | | | | | 1. UnitRegistry now has an optional keyword argument (`locale`) that can be used to define the default value for `Quantity.format_babel` locale argument. 2. When Babel is not installed, `Quantity.format_babel` display a nicer and more informative exception. Closes #899, #904
| * Remove redundant encoding information (utf8 is the default)Guido Imperiale2019-12-131-1/+0
| |
| * isortGuido Imperiale2019-12-131-4/+5
| |
| * blackGuido Imperiale2019-12-131-27/+43
| |
| * Merge branch 'master' into standard_exceptionsGuido Imperiale2019-12-051-8/+8
| |\
| | * Merge branch 'master' into py27_cleanupGuido Imperiale2019-12-051-2/+2
| | |\
| | | * mark all regexp / tex strings to raw stringsKeewis2019-12-021-2/+2
| | | |
| | * | Remove 2.7 support from codebaseGuido Imperiale2019-12-031-6/+6
| | |/
| * | Thorough str tests for all exceptionsGuido Imperiale2019-12-041-2/+5
| |/
| * Sphinx fixesGuido Imperiale2019-09-131-3/+2
| |
| * Unit and Quantity in root moduleGuido Imperiale2019-09-131-8/+8
| |
| * Successfully complete copy.deepcopy(UnitRegistry())Guido Imperiale2019-08-301-4/+4
| |
| * Fix crash in copy.deepcopy(ParserHelper(1))Guido Imperiale2019-08-301-0/+3
| |
* | Changed to relative importGiulio Malventi2020-03-141-1/+1
|/
* Remove positional string formattersHugo2017-10-191-2/+2
|
* Add warning when a System contains an unknown GroupHernan Grecco2017-04-021-2/+5
| | | | | | | | The commit also add a test to make sure that the definition file included in Pint does not contain System with references to unknown Groups Close #472
* Change system lister dir return value typeGloriaVictis2016-08-191-1/+1
| | | Return a list instead of a frozenset. Fixes #425
* Merge conflicts in testsuiteHernan Grecco2016-08-071-0/+13
|\
| * adjusted to cope with upstream babel tipalexbodn@gmail.com2016-08-061-3/+5
| |
| * added translation of the measuring systems by locale.alexbodn@gmail.com2016-03-251-0/+11
| | | | | | | | renamed the babel_units module to babel_names
* | Split UnitRegistry functionality into several classesHernan Grecco2016-05-051-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The module defines 5 registries with different capabilites: - BaseRegistry: Basic unit definition and querying. Conversion between multiplicative units. - NonMultiplicativeRegistry: Conversion between non multiplicative (offset) units. (e.g. Temperature) * Inherits from BaseRegistry - ContextRegisty: Conversion between units with different dimenstions according to previously established relations (contexts). (e.g. in the spectroscopy, conversion between frequency and energy is possible) * Inherits from BaseRegistry - SystemRegistry: Group unit and changing of base units. (e.g. in MKS, meter, kilogram and second are base units.) * Inherits from BaseRegistry - UnitRegistry: Combine all previous capabilities, it is exposed by Pint. There is performance penalty in some functions (< 10%) maybe due to method calls but the code is cleaner a easier to understand.
* | Moved Registry to its own fileHernan Grecco2016-04-301-1/+2
|/
* Updated copyright yearHernan Grecco2016-02-121-1/+1
|
* Stabilized systems APIHernan Grecco2016-02-091-0/+21
|
* Changed Systems and Groups to be aware of the Registry in which they are.Hernan Grecco2016-01-071-101/+93
| | | | Additionally used SourceIterator and improved error reporting
* Systems defined in default and parsedHernan Grecco2015-07-241-0/+6
|
* Merged systems into UnitRegistryHernan Grecco2015-07-211-97/+37
|
* Implemented systems and test for itHernan Grecco2015-01-121-91/+201
| | | | See #215
* Implementing Systems and Groups (WIP)Hernan Grecco2015-01-051-0/+367
The implementation is added in a separate, independent file for prototyping. Functions are written independent of the Registry. Test for Groups are added.