<commit_before>import os
import os.path as op
import getpass
import tempfile
import pandas as pd

import github as gh
import git


def upload(target, repo_name, uname=None, upass=None, token=None):
    """
    Upload an assembled AFQ-Browser site to a github pages website.

    Parameters
    ----------
    target : str
        Local path to the file-system location where the AFQ-Browser files are
        (need to run `assemble` before running this function)
    repo_name : str
        The website will be at https://<username>.github.io/<repo_name>
    uname : str, optional
        GitHub user-name
    upass : str, optional
        GitHub password

    """
    # Get all the files that will be committed/pushed
    file_list = []
    client_folder = op.join(target, 'client')
    for path, dirs, files in os.walk(client_folder):
        for f in files:
            file_list.append(os.path.abspath(op.join(path, f)))
    # Get credentials from the user
    if uname is None:
        uname = getpass.getpass("GitHub user-name? ")
    if not any([upass, token]):
        upass = getpass.getpass("GitHub password (leave blank if using 2FA and personal access token)? ")
        if not upass:
            token = getpass.getpass("GitHub personal access token? ")
            print('If prompted again for username and password, use your access token as the password.')

    login_uname = uname if token is None else token

    # Create the remote repo on GitHub (use PyGithub)
    g = gh.Github(login_uname, upass)
    u = g.get_user()
    remote = u.create_repo(repo_name)
    # Create the local repo using GitPython:
    r = git.Repo.init(client_folder)
    # Add all of the files to the repo's gh-pages branch
    r.index.add(file_list)
    r.index.commit("Commit everything")
    # Add a .nojekyll file
    f = open(op.join(client_folder, '.nojekyll'), 'w')
    f.close()
    r.index.add([os.path.abspath(f.name)])
    r.index.commit("Add nojekyll file")
    # Push to GitHub
    branch = r.create_head("gh-pages")
    branch.checkout()
    o = r.create_remote("origin", remote.clone_url)
    assert o.exists()

    o.push("gh-pages")
<commit_msg>Fix PEP8 'line too long' errors<commit_after>import os
import os.path as op
import getpass
import tempfile
import pandas as pd

import github as gh
import git


def upload(target, repo_name, uname=None, upass=None, token=None):
    """
    Upload an assembled AFQ-Browser site to a github pages website.

    Parameters
    ----------
    target : str
        Local path to the file-system location where the AFQ-Browser files are
        (need to run `assemble` before running this function)
    repo_name : str
        The website will be at https://<username>.github.io/<repo_name>
    uname : str, optional
        GitHub user-name
    upass : str, optional
        GitHub password

    """
    # Get all the files that will be committed/pushed
    file_list = []
    client_folder = op.join(target, 'client')
    for path, dirs, files in os.walk(client_folder):
        for f in files:
            file_list.append(os.path.abspath(op.join(path, f)))
    # Get credentials from the user
    if uname is None:
        uname = getpass.getpass("GitHub user-name? ")
    if not any([upass, token]):
        upass = getpass.getpass("GitHub password (leave blank if using 2FA "
                                "and personal access token)? ")
        if not upass:
            token = getpass.getpass("GitHub personal access token? ")
            print('If prompted again for username and password, use your '
                  'access token as the password.')

    login_uname = uname if token is None else token

    # Create the remote repo on GitHub (use PyGithub)
    g = gh.Github(login_uname, upass)
    u = g.get_user()
    remote = u.create_repo(repo_name)
    # Create the local repo using GitPython:
    r = git.Repo.init(client_folder)
    # Add all of the files to the repo's gh-pages branch
    r.index.add(file_list)
    r.index.commit("Commit everything")
    # Add a .nojekyll file
    f = open(op.join(client_folder, '.nojekyll'), 'w')
    f.close()
    r.index.add([os.path.abspath(f.name)])
    r.index.commit("Add nojekyll file")
    # Push to GitHub
    branch = r.create_head("gh-pages")
    branch.checkout()
    o = r.create_remote("origin", remote.clone_url)
    assert o.exists()

    o.push("gh-pages")

{'fraction_non_alphanumeric': 0.10360565951620265, 'fraction_numerical': 0.0006846188954815153, 'mean_word_length': 2.6223140495867767, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3356350', 'n_tokens_mistral': 1387, 'n_tokens_neox': 1340, 'n_words': 443}