<commit_before>import parser
import urllib
import urllib2 as url

DEFAULT_ENDPOINT = "http://localhost:8080"

def main():
    args = parser.get_args()

    our_file = open(args.filepath,'r')
    # TODO: this is dangerous if the file is TOO large
    file_contents = our_file.read()
    our_file.close()

    endpoint = args.endpoint if args.endpoint else DEFAULT_ENDPOINT
    request = url.Request(endpoint)
    http_args = {
            "method":args.mode,
            "decentralized-db-user":args.user,
            "secret-key":args.secret_key,
            "filename":args.filename,
            "file":file_contents
        }
    data = urllib.urlencode(http_args)

    resp = url.urlopen(request, data)
    out = resp.read()
    print out 

if __name__ == "__main__":
    main()<commit_msg>Used with keyword for file<commit_after>import parser
import urllib
import urllib2 as url

DEFAULT_ENDPOINT = "http://localhost:8080"

def main():
    args = parser.get_args()

    # TODO: this is dangerous if the file is TOO large
    with open(args.filepath, 'rb') as f:
        file_contents = f.read()

    endpoint = args.endpoint if args.endpoint else DEFAULT_ENDPOINT
    request = url.Request(endpoint)
    http_args = {
            "method":args.mode,
            "decentralized-db-user":args.user,
            "secret-key":args.secret_key,
            "filename":args.filename,
            "file":file_contents
        }

    data = urllib.urlencode(http_args)
    resp = url.urlopen(request, data)

    out = resp.read()
    print out 

if __name__ == "__main__":
    main()
{'fraction_non_alphanumeric': 0.1108998732572877, 'fraction_numerical': 0.0063371356147021544, 'mean_word_length': 2.621559633027523, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '5234540', 'n_tokens_mistral': 507, 'n_tokens_neox': 491, 'n_words': 117}