To convert from decimal hours to mixed units and format
them with left zero, we use Section 10.4, “MixedUnits.singleToMix(): Convert to
mixed units”.
# - - - S i d e r e a l T i m e . _ _ s t r _ _
def __str__ ( self ):
"""Convert to a string such as "[04h 40m 5.170s]".
"""
#-- 1 --
# [ values := self.hours as a list of mixed units
# in dmsUnits terms, formatted as left-zero
# filled strings with 3 digits after the decimal ]
mix = dmsUnits.singleToMix ( self.hours )
values = dmsUnits.format ( mix, decimals=3, lz=True )
#-- 2 --
return "[%sh %sm %ss]" % tuple(values)