Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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
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