How to use the prettytable._compact.unicode_ function in prettytable

To help you get started, we’ve selected a few prettytable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kxxoling / PTable / prettytable / prettytable.py View on Github external
def _unicode(self, value):
        if not isinstance(value, basestring_):
            value = str(value)
        if not isinstance(value, unicode_):
            value = unicode_(value, self.encoding, "strict")
        return value
github kxxoling / PTable / prettytable / prettytable.py View on Github external
def _unicode(self, value):
        if not isinstance(value, basestring_):
            value = str(value)
        if not isinstance(value, unicode_):
            value = unicode_(value, self.encoding, "strict")
        return value
github kxxoling / PTable / prettytable / prettytable.py View on Github external
def min_width(self):
        """Controls minimum width of fields
        Arguments:

        min_width - minimum width integer"""
        if self.header:
            fields = self._field_names
        else:
            fields = self._rows[0] if self._rows else []
        result = {
            # minimum column width can't be lesser
            # than header's length
            name: max(
                _str_block_width(unicode_(name)),
                self._min_width.get(name, 0)
            )
            for name in fields
        }
        return result