def __truediv__(self, u):
        """ Divide Unit by u (Unit object). """
        if not isinstance(u, Unit):
            if isinstance(u, (numeric_type, list, tuple, np.ndarray)):
                from unyt.array import unyt_quantity

                return unyt_quantity(1.0, self) / u
            else:
                raise InvalidUnitOperation(
                    "Tried to divide a Unit object by '%s' (type %s). This "
                    "behavior is undefined." % (u, type(u))
                )

        base_offset = 0.0
        if self.base_offset or u.base_offset:
            if self.dimensions in (temperature, angle) and u.is_dimensionless:
                base_offset = self.base_offset
            else:
                raise InvalidUnitOperation(
                    "Quantities with units of Farhenheit "
                    "and Celsius cannot be divided."
                )

        return Unit(
            self.expr / u.expr,
            base_value=(self.base_value / u.base_value),
            base_offset=base_offset,
            dimensions=(self.dimensions / u.dimensions),
            registry=self.registry,
        )
def __truediv__ ( self , u ) : if not isinstance ( u , Unit ) : if isinstance ( u , ( numeric_type , list , tuple , np . ndarray ) ) : from unyt . array import unyt_quantity return unyt_quantity ( 1.0 , self ) / u else : raise InvalidUnitOperation ( "Tried to divide a Unit object by '%s' (type %s). This " "behavior is undefined." % ( u , type ( u ) ) ) base_offset = 0.0 if self . base_offset or u . base_offset : if self . dimensions in ( temperature , angle ) and u . is_dimensionless : base_offset = self . base_offset else : raise InvalidUnitOperation ( "Quantities with units of Farhenheit " "and Celsius cannot be divided." ) return Unit ( self . expr / u . expr , base_value = ( self . base_value / u . base_value ) , base_offset = base_offset , dimensions = ( self . dimensions / u . dimensions ) , registry = self . registry , )
Divide Unit by u (Unit object).