aboutsummaryrefslogtreecommitdiff
path: root/tools/seqstat/seqstat.py
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-10-17 19:15:02 -0700
committerFranck Cuny <franck@fcuny.net>2022-10-17 19:15:23 -0700
commit60ca05e1e2fb152dbeb69f0558be4d8f42e7b523 (patch)
tree5a935c1982408572da2b6cfbea57fcb53789349a /tools/seqstat/seqstat.py
parentfeat(home/python): add lsp/mypy packages (diff)
downloadinfra-60ca05e1e2fb152dbeb69f0558be4d8f42e7b523.tar.gz
ref(tools/python): make mypy happy
Diffstat (limited to 'tools/seqstat/seqstat.py')
-rwxr-xr-xtools/seqstat/seqstat.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/tools/seqstat/seqstat.py b/tools/seqstat/seqstat.py
index 8450ec8..55b6ecc 100755
--- a/tools/seqstat/seqstat.py
+++ b/tools/seqstat/seqstat.py
@@ -4,12 +4,6 @@ import argparse
ticks = ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"]
-parser = argparse.ArgumentParser()
-parser.add_argument(
- "numbers", metavar="N", type=float, nargs="+", help="a number for the accumulator"
-)
-args = parser.parse_args()
-
def histogram(sequence):
min_val = min(sequence)
@@ -22,5 +16,15 @@ def histogram(sequence):
return [ticks[int((int(i - min_val) << 8) / scale)] for i in sequence]
-h = histogram(args.numbers)
-print("".join(h))
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser()
+ parser.add_argument(
+ "numbers",
+ metavar="N",
+ type=float,
+ nargs="+",
+ help="a number for the accumulator",
+ )
+ args = parser.parse_args()
+ h = histogram(args.numbers)
+ print("".join(h))