コード例 #1
0
    def show(self, output: OutputFormat = OutputFormat.TABLE):
        """
        Show the current schema on stdout
        """
        if isinstance(output, str):
            output = OutputFormat(output)

        if output == OutputFormat.JSON:
            print(json.dumps(self.json))
        if output == OutputFormat.HTML:
            df = TablePrinter.get_table_dataframe(Field, self.fields())
            return TablePrinter.print_html(df)
        else:
            print(TablePrinter.get_table(Field, self.fields()))
        return self
コード例 #2
0
    def show(self, output: OutputFormat = OutputFormat.TABLE):
        """
        Show the current page on stdout
        """
        if isinstance(output, str):
            output = OutputFormat(output)

        if output == OutputFormat.JSON:
            print(json.dumps(self.json_dict, indent=4))
        elif output == OutputFormat.HTML:
            df = TablePrinter.get_table_dataframe(self.page_class, self.content)
            return TablePrinter.print_html(df)

        else:
            table = TablePrinter.get_table(self.page_class, self.content)
            print(table.get_string(title=colored(self.metadata.elements_type.upper(), 'yellow', attrs=['bold'])))
            print(colored(f'page {self.metadata.page_number}/{self.metadata.total_pages}', 'yellow'))
        return self