From e1f22431284c9fc4ecb6c847b1f556ccdb964cde Mon Sep 17 00:00:00 2001 From: Pandu Rao Date: Mon, 12 May 2025 16:23:32 -0700 Subject: [PATCH] Fixed warning click-v8.2.0 about duplicate parameter --tokens --- tests/test_ttok.py | 12 ++++++------ ttok/cli.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_ttok.py b/tests/test_ttok.py index 1db5fd6..f9edc49 100644 --- a/tests/test_ttok.py +++ b/tests/test_ttok.py @@ -40,13 +40,13 @@ def test_ttok_count_and_tokens(args, expected_length, expected_tokens): ( (["hello", "world", "--encode"], "15339 1917"), (["15339", "1917", "--decode"], "hello world"), - (["hello", "world", "--encode", "--tokens"], "[b'hello', b' world']"), - (["15339", "1917", "--decode", "--tokens"], "[b'hello', b' world']"), - (["hello", "world", "--tokens"], "[b'hello', b' world']"), - # $ ttok --encode --tokens 私は学生です + (["hello", "world", "--encode", "--as-tokens"], "[b'hello', b' world']"), + (["15339", "1917", "--decode", "--as-tokens"], "[b'hello', b' world']"), + (["hello", "world", "--as-tokens"], "[b'hello', b' world']"), + # $ ttok --encode --as-tokens 私は学生です # [b'\xe7\xa7\x81', b'\xe3\x81\xaf', b'\xe5\xad\xa6', b'\xe7\x94\x9f', b'\xe3\x81\xa7\xe3\x81\x99'] ( - ["--encode", "--tokens", "私は学生です"], + ["--encode", "--as-tokens", "私は学生です"], "[b'\\xe7\\xa7\\x81', b'\\xe3\\x81\\xaf', b'\\xe5\\xad\\xa6', b'\\xe7\\x94\\x9f', b'\\xe3\\x81\\xa7\\xe3\\x81\\x99']", ), # $ ttok --encode 私は学生です @@ -58,7 +58,7 @@ def test_ttok_count_and_tokens(args, expected_length, expected_tokens): # $ ttok --decode 86127 15682 48864 21990 38641 # 私は学生です ( - [b"86127", b"15682", b"48864", b"21990", b"38641", "--decode", "--tokens"], + [b"86127", b"15682", b"48864", b"21990", b"38641", "--decode", "--as-tokens"], "[b'\\xe7\\xa7\\x81', b'\\xe3\\x81\\xaf', b'\\xe5\\xad\\xa6', b'\\xe7\\x94\\x9f', b'\\xe3\\x81\\xa7\\xe3\\x81\\x99']", ), ), diff --git a/ttok/cli.py b/ttok/cli.py index dfd8828..03c971d 100644 --- a/ttok/cli.py +++ b/ttok/cli.py @@ -18,7 +18,7 @@ @click.option( "decode_tokens", "--decode", is_flag=True, help="Convert token integers to text" ) -@click.option("as_tokens", "--tokens", is_flag=True, help="Output full tokens") +@click.option("as_tokens", "--as-tokens", is_flag=True, help="Output full tokens") @click.option("--allow-special", is_flag=True, help="Do not error on special tokens") def cli( prompt,