ó
~9­\c           @   s€   d  Z  d d l m Z d d l m Z d d l m Z d d l m Z d d l	 m
 Z
 d d l m Z d	 e f d
 „  ƒ  YZ d S(   sG   
Unit system for physical quantities; include definition of constants.
iÿÿÿÿ(   t   division(   t   S(   t
   deprecated(   t   Quantity(   t   SymPyDeprecationWarningi   (   t   DimensionSystemt
   UnitSystemc           B   sk   e  Z d  Z d	 d d d „ Z d „  Z d „  Z d
 d d d „ Z d „  Z e d „  ƒ Z	 e d „  ƒ Z
 RS(   sð   
    UnitSystem represents a coherent set of units.

    A unit system is basically a dimension system with notions of scales. Many
    of the methods are defined in the same way.

    It is much better if all base units have a symbol.
    t    c            sá   | |  _  | |  _ g  | D] } | j ^ q } g  | D] } | j | k r5 | j ^ q5 } t | | ƒ |  _ |  j sƒ t d ƒ ‚ n  t t | ƒ t | ƒ Bƒ |  _	 t
 d „  | Dƒ ƒ ‰  t ‡  f d †  |  j j Dƒ ƒ |  _ d  S(   Ns   UnitSystem is not consistentc         s   s   |  ] } | j  | f Vq d  S(   N(   t	   dimension(   t   .0t   u(    (    s=   lib/python2.7/site-packages/sympy/physics/units/unitsystem.pys	   <genexpr>,   s    c         3   s   |  ] } ˆ  | Vq d  S(   N(    (   R	   t   d(   t	   base_dict(    s=   lib/python2.7/site-packages/sympy/physics/units/unitsystem.pys	   <genexpr>/   s    (   t   namet   descrR   R   t   _systemt   is_consistentt
   ValueErrort   tuplet   sett   _unitst   dictt	   base_dimst   _base_units(   t   selft   baset   unitsR   R   R
   R   t   derived_dims(    (   R   s=   lib/python2.7/site-packages/sympy/physics/units/unitsystem.pyt   __init__   s    		+	c         C   s8   |  j  d k r |  j  Sd d j d „  |  j Dƒ ƒ Sd S(   sš   
        Return the name of the system.

        If it does not exist, then it makes a list of symbols (or names) of
        the base dimensions.
        R   s   UnitSystem((%s))s   , c         s   s   |  ] } t  | ƒ Vq d  S(   N(   t   str(   R	   R   (    (    s=   lib/python2.7/site-packages/sympy/physics/units/unitsystem.pys	   <genexpr>=   s    N(   R   t   joinR   (   R   (    (    s=   lib/python2.7/site-packages/sympy/physics/units/unitsystem.pyt   __str__1   s    	c         C   s   d t  |  j ƒ S(   Ns   <UnitSystem: %s>(   t   reprR   (   R   (    (    s=   lib/python2.7/site-packages/sympy/physics/units/unitsystem.pyt   __repr__?   s    c         C   s9   |  j  t | ƒ } |  j t | ƒ } t | | | | ƒ S(   s  Extend the current system into a new one.

        Take the base and normal units of the current system to merge
        them to the base and normal units given in argument.
        If not provided, name and description are overridden by empty strings.
        (   R   R   R   R   (   R   R   R   R   t   description(    (    s=   lib/python2.7/site-packages/sympy/physics/units/unitsystem.pyt   extendB   s    c      	   C   sE   t  d d d d d d d d ƒ j ƒ  d	 d
 l m } | | |  j ƒ S(   sÈ   
        Useless method.

        DO NOT USE, use instead ``convert_to``.

        Give the string expression of a unit in term of the basis.

        Units are displayed by decreasing power.
        t   deprecated_since_versions   1.2t   issuei4  t   featuret   print_unit_baset
   useinsteadt
   convert_toiÿÿÿÿ(   R)   (   R   t   warnt   sympy.physics.unitsR)   R   (   R   t   unitR)   (    (    s=   lib/python2.7/site-packages/sympy/physics/units/unitsystem.pyR'   O   s    
c         C   s
   |  j  j S(   sr   
        Give the dimension of the system.

        That is return the number of units forming the basis.
        (   R   t   dim(   R   (    (    s=   lib/python2.7/site-packages/sympy/physics/units/unitsystem.pyR-   b   s    c         C   s
   |  j  j S(   sI   
        Check if the underlying dimension system is consistent.
        (   R   R   (   R   (    (    s=   lib/python2.7/site-packages/sympy/physics/units/unitsystem.pyR   l   s    (    (    (   t   __name__t
   __module__t   __doc__R   R   R!   R#   R'   t   propertyR-   R   (    (    (    s=   lib/python2.7/site-packages/sympy/physics/units/unitsystem.pyR      s   			
N(   R0   t
   __future__R    t   sympyR   t   sympy.core.decoratorsR   t   sympy.physics.units.quantitiesR   t   sympy.utilities.exceptionsR   t
   dimensionsR   t   objectR   (    (    (    s=   lib/python2.7/site-packages/sympy/physics/units/unitsystem.pyt   <module>   s   