<commit_before>#!/usr/bin/env python3

import sys
import subprocess

url = 'https://based.lol/run.ty'

if len(sys.argv) <= 1:
    print('Usage: ty` <code> [-stdin=<input>]')
    sys.exit(0)

cmd = ' '.join(sys.argv[1:]).replace('\\n', '\n')

[code, *input] = cmd.split('-stdin=')

print(subprocess.run(['curl', url, '-F', f'code={code}', '-F', f'input={"".join(input)}'], text=True, capture_output=True).stdout.rstrip())
<commit_msg>applets/ty.py: URL-encode form data<commit_after>#!/usr/bin/env python3

import sys
import subprocess

url = 'https://based.lol/run.ty'

if len(sys.argv) <= 1:
    print('usage: ty` <code> [-stdin=<input>]')
    sys.exit(0)

cmd = ' '.join(sys.argv[1:]).replace('\\n', '\n')

[code, *input] = cmd.split('-stdin=')

print(
    subprocess.run([
        'curl', url,
        '--data-urlencode', f'code={code}',
        '--data-urlencode', f'input={"".join(input)}'
    ], text=True, capture_output=True).stdout.rstrip()
)

{'fraction_non_alphanumeric': 0.25210084033613445, 'fraction_numerical': 0.008403361344537815, 'mean_word_length': 3.887179487179487, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4349775', 'n_tokens_mistral': 388, 'n_tokens_neox': 381, 'n_words': 65}