uttr.py
def convert_if_dimensionless(self, value):
        """Assign a unit to a dimensionless object.

        If the object already has a dimension it returns it without change

        Examples
        --------
        >>> uc = UnitConverter(u.km)

        >>> uc.convert_if_dimensionless(1)  # dimensionless then convert
        '<Quantity 1. km>'

        >>> # the same object is returned
        >>> uc.convert_if_dimensionless(1 * u.kpc)
        '<Quantity 1. kpc>'

        """
        if self.is_dimensionless(value) and value is not None:
            return value * self.unit
        return value
Assign a unit to a dimensionless object.

        If the object already has a dimension it returns it without change

        Examples
        --------
        >>> uc = UnitConverter(u.km)

        >>> uc.convert_if_dimensionless(1)  # dimensionless then convert
        '<Quantity 1. km>'

        >>> # the same object is returned
        >>> uc.convert_if_dimensionless(1 * u.kpc)
        '<Quantity 1. kpc>'

        
Assign a unit to a dimensionless object.
If the object already has a dimension it returns it without change

Examples






Assign a unit to a dimensionless object . If the object already has a dimension it returns it without change Examples
def convert_if_dimensionless(self, value):
        if self.is_dimensionless(value) and value is not None:
            return value * self.unit
        return value
def convert_if_dimensionless ( self , value ) : if self . is_dimensionless ( value ) and value is not None : return value * self . unit return value
Assign a unit to a dimensionless object.
Assign a unit to a dimensionless object .
"""Assign a unit to a dimensionless object.

        If the object already has a dimension it returns it without change

        Examples
        --------
        >>> uc = UnitConverter(u.km)

        >>> uc.convert_if_dimensionless(1)  # dimensionless then convert
        '<Quantity 1. km>'

        >>> # the same object is returned
        >>> uc.convert_if_dimensionless(1 * u.kpc)
        '<Quantity 1. kpc>'

        """
self
value