Skip to content

Commit

Permalink
feat: support multi-line intent
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenWrong committed Mar 12, 2024
1 parent efcd78a commit be24e24
Showing 1 changed file with 42 additions and 4 deletions.
46 changes: 42 additions & 4 deletions print_utils.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,57 @@
import numpy as np
import pandas as pd


def _process_list(info, prefix):
if not isinstance(info, str):
info = info.__str__()

info_list = info.split('\n')
if len(info_list) > 1:
lines = []
for it in info_list:
lines.append(prefix + it)
print('\n'.join(lines))
else:
print(prefix + info)


def part_print(info):
print('='*4, info, '='*4)


def print_h1(info):
print('-', info)
_process_list(info, '- ')


def print_h2(info):
print(' *', info)
_process_list(info, ' * ')


def print_h3(info):
print(' +', info)
_process_list(info, ' + ')


def print_h4(info):
print(' ~', info)
_process_list(info, ' ~ ')


if __name__ == "__main__":
arr = np.array([1,2,3,3,3,1])
df = pd.DataFrame(arr)

part_print('Label Distribution Check')
print_h1('y train check')
print_h2(df.value_counts())
print_h3('label 1 cnt valid')
print_h3('label 2 cnt valid')

print_h1('y valid check')
print_h2(df.value_counts())
print_h3('label 1 cnt valid')
print_h3('label 2 cnt valid')

print_h1('y test check')
print_h2(df.value_counts())
print_h3('label 1 cnt valid')
print_h3('label 2 cnt valid')

0 comments on commit be24e24

Please sign in to comment.