<s> import six <EOL> from taskflow . utils import misc <EOL> class Depth ( misc . StrEnum ) : <EOL> """<STR_LIT>""" <EOL> ALL = '<STR_LIT>' <EOL> """<STR_LIT>""" <EOL> FLOW = '<STR_LIT>' <EOL> """<STR_LIT>""" <EOL> NEIGHBORS = '<STR_LIT>' <EOL> """<STR_LIT>""" <EOL> ATOM = '<STR_LIT>' <EOL> """<STR_LIT>""" <EOL> @ classmethod <EOL> def translate ( cls , desired_depth ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( desired_depth , cls ) : <EOL> return desired_depth <EOL> if not isinstance ( desired_depth , six . string_types ) : <EOL> raise TypeError ( "<STR_LIT>" <EOL> "<STR_LIT>" % type ( desired_depth ) ) <EOL> try : <EOL> return cls ( desired_depth . upper ( ) ) <EOL> except ValueError : <EOL> pretty_depths = sorted ( [ a_depth . name for a_depth in cls ] ) <EOL> raise ValueError ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" % ( pretty_depths , desired_depth ) ) <EOL> _ORDERING = tuple ( [ <EOL> Depth . ALL , Depth . FLOW , Depth . NEIGHBORS , Depth . ATOM , <EOL> ] ) <EOL> def pick_widest ( depths ) : <EOL> """<STR_LIT>""" <EOL> return _ORDERING [ min ( _ORDERING . index ( d ) for d in depths ) ] </s>
