Exemplo n.º 1
0
        def _repr_pretty_(self, p: PrettyPrinter, cycle: bool):
            if cycle:
                p.text(self.__class__.__name__ + '(<cyclic>)')
                return

            p.text('Tree ')
            p.pretty(self.root)
Exemplo n.º 2
0
        def _repr_pretty_(self, p: PrettyPrinter, cycle: bool):
            '''Cleanly wrappable display in Jupyter.'''
            if cycle:
                p.text(self.__class__.__name__ + '(<cyclic>)')
                return

            if self.skip_level_field:
                p.pretty(getattr(self, self.skip_level_field))
                return

            if self.main_field:
                p.pretty(getattr(self, self.main_field))
                return

            if self.string_format:
                p.pretty(self.string_format.format(**self.field_values))
                return

            fields = self.display_fields or self.field_order
            with p.group(4, self.__class__.__name__ + '(', ')'):
                if len(fields) > 1:
                    for idx, name in enumerate(fields):
                        if idx:
                            p.text(',')
                            p.breakable()
                        p.text(name + '=')
                        p.pretty(self.field_values[name])
                else:
                    p.pretty(self.field_values[fields[0]])
Exemplo n.º 3
0
        def _repr_pretty_(self, p: PrettyPrinter, cycle: bool):
            cls = self.__class__.__name__
            if cycle:
                p.text(f'{cls}(<cyclic>)')
                return

            if 'value' in self.field_values:
                p.pretty(self.value)
            else:
                p.text(f'{cls}(index={self.index})')
Exemplo n.º 4
0
        def _repr_pretty_(self, p: PrettyPrinter, cycle: bool):
            if cycle:
                p.text(self.__class__.__name__ + '(<cyclic>)')
                return

            p.pretty(self._data)
            with p.group(4, '', ''):
                for node in self._nodes:
                    p.break_()
                    p.pretty(node)
Exemplo n.º 5
0
        def _repr_pretty_(self, p: PrettyPrinter, cycle: bool):
            '''Clean property format: Name[index] = (type) value'''
            if cycle:
                p.text(self.__class__.__name__ + '(<cyclic>)')
                return

            p.text(str(self.header.name) + '[')
            p.pretty(self.header.index)
            p.text(f'] = ')
            # p.text(f'{str(self.header.type)}) ')
            p.pretty(self.value)
Exemplo n.º 6
0
        def _repr_pretty_(self, p: PrettyPrinter, cycle: bool):
            '''Cleanly wrappable display in Jupyter.'''
            if cycle:
                p.text(self.__class__.__name__ + '(<cyclic>)')
                return

            with p.group(4, self.__class__.__name__ + '(', ')'):
                for idx, value in enumerate(self.values):
                    if idx:
                        p.text(',')
                        p.breakable()
                    p.pretty(value)
Exemplo n.º 7
0
        def _repr_pretty_(self, p: PrettyPrinter, cycle: bool):
            '''Cleanly wrappable display in Jupyter.'''
            if cycle:
                p.text(self.__class__.__name__ + '(<cyclic>)')
                return

            with p.group(4, self.__class__.__name__ + '(', ')'):
                p.text(f'count={self.count}, itemType={self.itemType.__name__}')
                for idx, value in enumerate(self.values):
                    p.text(',')
                    p.breakable()
                    p.text(f'0x{idx:04X} ({idx:<4}): ')
                    p.pretty(value)
Exemplo n.º 8
0
 def _repr_pretty_(self, p: PrettyPrinter, cycle: bool) -> None:
     class_name = self.__class__.__name__
     if cycle:
         p.text(f"{class_name}(...)")
     else:
         with p.group(indent=2, open=f"{class_name}("):
             p.breakable()
             p.text("sliders=")
             p.pretty(self._sliders)
             p.text(",")
             p.breakable()
             p.text("arg_to_symbol=")
             p.pretty(self._arg_to_symbol)
             p.text(",")
         p.breakable()
         p.text(")")
Exemplo n.º 9
0
        def _repr_pretty_(self, p: PrettyPrinter, cycle: bool):
            '''Cleanly wrappable display in Jupyter.'''
            if cycle:
                p.text(self.__class__.__name__ + '(<cyclic>)')
                return

            p.text(self.__class__.__name__ + '(')
            if self.enum.index == self.asset.none_index:
                p.pretty(self.value)
            else:
                p.pretty(self.enum)
                p.text(', ')
                p.pretty(self.value)
            p.text(')')