<commit_before>from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer

authorizer = DummyAuthorizer()
authorizer.add_user("user", "12345", "/ftp_root/user", perm="elradfmw")
authorizer.add_anonymous("/ftp_root/nobody")

handler = FTPHandler
handler.authorizer = authorizer

server = FTPServer(("127.0.0.1", 21), handler)
server.serve_forever()<commit_msg>add argparse<commit_after>import os.path
import argparse

from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer

FTP_ROOT = '/ftp_root'


def run_ftpd(user, password, host='127.0.0.1', port=21, anon=True):
    user_dir = os.path.join(FTP_ROOT, user)
    os.mkdir(user_dir)
    authorizer = DummyAuthorizer()
    authorizer.add_user(user, password, user_dir, perm="elradfmw")
    if anon:
        authorizer.add_anonymous("/ftp_root/nobody")

    handler = FTPHandler
    handler.authorizer = authorizer

    server = FTPServer((host, port), handler)
    server.serve_forever()


def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--user', default='user')
    parser.add_argument('--password', default='password')
    parser.add_argument('--host', default='127.0.0.1')
    parser.add_argument('--port', type=int, default=21)
    parser.add_argument('--anon', action='store_true')
    args = parser.parse_args()
    run_ftpd(**vars(args))

if __name__ == '__main__':
    main()
{'fraction_non_alphanumeric': 0.13311258278145696, 'fraction_numerical': 0.019205298013245033, 'mean_word_length': 4.996031746031746, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 3, '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': '1471670', 'n_tokens_mistral': 533, 'n_tokens_neox': 510, 'n_words': 96}