@staticmethod
    def _assign_max_widths(stdout, x, max_width, min_width=0):
        if min_width:
            x.min_width = min_width

        if max_width > 0:
            x.max_width = max_width
            return

        term_width = utils.terminal_width(stdout)
        if not term_width:
            # not a tty, so do not set any max widths
            return
        field_count = len(x.field_names)

        try:
            first_line = x.get_string().splitlines()[0]
            if term_width <= len(first_line):
                return
        except IndexError:
            return

        usable_total_width, optimal_width = TableFormatter._width_info(
            term_width, field_count)

        field_widths = TableFormatter._field_widths(x.field_names, first_line)

        shrink_fields, shrink_remaining = TableFormatter._build_shrink_fields(
            usable_total_width, optimal_width, field_widths, x.field_names)

        shrink_to = shrink_remaining // len(shrink_fields)
        # make all shrinkable fields size shrink_to apart from the last one
        for field in shrink_fields[:-1]:
            x.max_width[field] = max(min_width, shrink_to)
            shrink_remaining -= shrink_to

        # give the last shrinkable column shrink_to plus any remaining
        field = shrink_fields[-1]
        x.max_width[field] = max(min_width, shrink_remaining)
dataset/ETHPy150Open openstack/cliff/cliff/formatters/table.py/TableFormatter._assign_max_widths/swapped operands of `<=`