Datasets:

Modalities:
Text
Formats:
text
Size:
< 1K
ArXiv:
Libraries:
Datasets
jessezhaoxizhang's picture
Duplicate from jessezhaoxizhang/RepoZero-Py2JS
a839836
Raw
History Blame Contribute Delete
974 Bytes
#!/usr/bin/env python3
import argparse
import canonicaljson
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--a', type=str, required=True)
args = parser.parse_args()
data = [args.a]
result = canonicaljson.encode_canonical_json(data) # Encode list containing string as canonical JSON
print(result)
if __name__ == "__main__":
main()
# ==================================================
# Sample Test Cases (randomly selected)
# ==================================================
# ===== Test Case 1 =====
# Input:
# --a = '\t\ttabs\t\t'
# Output:
# b'["\\t\\ttabs\\t\\t"]'
# Return Code: 0
# ===== Test Case 2 =====
# Input:
# --a = 'MixedCase'
# Output:
# b'["MixedCase"]'
# Return Code: 0
# ===== Test Case 3 =====
# Input:
# --a = 'spaces '
# Output:
# b'["spaces "]'
# Return Code: 0
# ===== Test Case 4 =====
# Input:
# --a = ' whitespace '
# Output:
# b'[" whitespace "]'
# Return Code: 0