tp7309 / TTPassGen

Consider using f-strings PYL-C0209
Performance
Minor
6 months ago6 months old
Formatting a regular string which could be a f-string
460        word_separator = separator
461
462    estimated_size = pretty_size(productor.total_size(sep=word_separator))
463    print(("estimated display size: %s, generate dict...") % (estimated_size))464
465    if not os.path.exists(
466            os.path.abspath(os.path.join(output, os.path.pardir))):
Formatting a regular string which could be a f-string
421            word_count, word_size = get_string_array_rule_data_size(rule)
422            word_count_list.append(word_count)
423            if word_size < 0:
424                echo("skip calculate StringArrayRule size, rule: %s" % (rule.raw_rule))425                word_size_list.append(0)
426            else:
427                word_size_list.append(word_size)
Formatting a regular string which could be a f-string
388                # empty string, skip insert
389                insert_index += 1
390            else:
391                echo("found normal string: %s" % (string_rule))392                string_array_rule = StringArrayRule(string_rule, 1, 1, [string_rule], global_repeat_mode)
393                rules.insert(insert_index, string_array_rule)
394                insert_index += 2
Formatting a regular string which could be a f-string
364                    echo("invalid min_repeat: %d or max_repeat: %d, rule: %s" % (min_length, max_length, match[0]))
365                    return None
366                if max_length > len(expanded_char_array):
367                    echo("rule '%s' is invalid, max_repeat(%d) cannot be greater than the size of char_array(%d)!"368                         % (match[0], max_length, len(expanded_char_array)))
369                    return None
370                char_array_rule = CharArrayRule(match[0], min_length, max_length,
Formatting a regular string which could be a f-string
361                    min_length = max_length = 1
362                if min_length < 0 or max_length < 0 or min_length > max_length \
363                                        or (min_length == 0 and max_length == 0):
364                    echo("invalid min_repeat: %d or max_repeat: %d, rule: %s" % (min_length, max_length, match[0]))365                    return None
366                if max_length > len(expanded_char_array):
367                    echo("rule '%s' is invalid, max_repeat(%d) cannot be greater than the size of char_array(%d)!"