/usr/lib/python2.7/dist-packages/pint/__init__.py is in python-pint 0.7.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | # -*- coding: utf-8 -*-
"""
pint
~~~~
Pint is Python module/package to define, operate and manipulate
**physical quantities**: the product of a numerical value and a
unit of measurement. It allows arithmetic operations between them
and conversions from and to different units.
:copyright: 2016 by Pint Authors, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement
import pkg_resources
from .formatting import formatter
from .unit import (UnitRegistry, LazyRegistry)
from .errors import (DimensionalityError, OffsetUnitCalculusError,
UndefinedUnitError)
from .util import pi_theorem, logger
from .context import Context
try: # pragma: no cover
__version__ = pkg_resources.get_distribution('pint').version
except: # pragma: no cover
# we seem to have a local copy not installed without setuptools
# so the reported version will be unknown
__version__ = "unknown"
#: A Registry with the default units and constants.
_DEFAULT_REGISTRY = LazyRegistry()
#: Registry used for unpickling operations.
_APP_REGISTRY = _DEFAULT_REGISTRY
def _build_quantity(value, units):
"""Build Quantity using the Application registry.
Used only for unpickling operations.
"""
global _APP_REGISTRY
return _APP_REGISTRY.Quantity(value, units)
def set_application_registry(registry):
"""Set the application registry which is used for unpickling operations.
:param registry: a UnitRegistry instance.
"""
assert isinstance(registry, UnitRegistry)
global _APP_REGISTRY
logger.debug('Changing app registry from %r to %r.', _APP_REGISTRY, registry)
_APP_REGISTRY = registry
def test():
"""Run all tests.
:return: a :class:`unittest.TestResult` object
"""
from .testsuite import run
return run()
|