<commit_before>"""
# Requirements:
    * Generate access token in your Github account, then create environment variable GITHUB_ACCESS_TOKEN.
        - e.g export GITHUB_ACCESS_TOKEN=<PASSWORD>.

    * Generate a service account key for your Google API credentials, then create environment variable GOOGLE_APPLICATION_CREDENTIALS.
        - e.g export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json.

# Environment Variable/s:
    * IS_KOLIBRI_RELEASE = Upload artifacts to the Google Cloud as a release candidate.
    * GITHUB_ACCESS_TOKEN = Personal access token used to authenticate in your Github account via API.
    * BUILDKITE_BUILD_NUMBER = Build identifier for each directory created.
    * BUILDKITE_PULL_REQUEST = Pull request issue or the value is false.
    * BUILDKITE_TAG = Tag identifier if this build was built from a tag.
    * GOOGLE_APPLICATION_CREDENTIALS = Your service account key.
"""
import logging
import os
from os import listdir

import requests
from github3 import login

logging.getLogger().setLevel(logging.INFO)

ACCESS_TOKEN = os.getenv("GITHUB_ACCESS_TOKEN")
REPO_OWNER = "learningequality"
REPO_NAME = "kolibri"
TAG = os.getenv("BUILDKITE_TAG")


RELEASE_DIR = "release"
PROJECT_PATH = os.path.join(os.getcwd())

# Python packages artifact location
DIST_DIR = os.path.join(PROJECT_PATH, "dist")

INSTALLER_CAT = "Installers"

PYTHON_PKG_CAT = "Python packages"

# Manifest of files, keyed by extension
file_manifest = {
    "exe": {
        "extension": "exe",
        "description": "Windows Installer",
        "category": INSTALLER_CAT,
        "content_type": "application/x-ms-dos-executable",
    },
    "pex": {
        "extension": "pex",
        "description": "Pex file",
        "category": PYTHON_PKG_CAT,
        "content_type": "application/octet-stream",
    },
    "whl": {
        "extension": "whl",
        "description": "Whl file",
        "category": PYTHON_PKG_CAT,
        "content_type": "application/zip",
    },
    "gz": {
        "extension": "gz",
        "description": "Tar file",
        "category": PYTHON_PKG_CAT,
        "content_type": "application/gzip",
    },
    # 'apk': {
    #     'extension': 'apk',
    #     'description': 'Android Installer',
    #     'category': INSTALLER_CAT,
    #     'content_type': 'application/vnd.android.package-archive',
    # },
}

gh = login(token=ACCESS_TOKEN)
repository = gh.repository(REPO_OWNER, REPO_NAME)


def collect_local_artifacts():
    """
    Create a dict of the artifact name and the location.
    """

    artifacts_dict = {}

    def create_exe_data(filename, data):
        data_name = "-unsigned"
        if "-signed" in filename:<commit_msg>Removing unneeded specs from the file manifest.<commit_after>"""
# Requirements:
    * Generate access token in your Github account, then create environment variable GITHUB_ACCESS_TOKEN.
        - e.g export GITHUB_ACCESS_TOKEN=<PASSWORD>.

    * Generate a service account key for your Google API credentials, then create environment variable GOOGLE_APPLICATION_CREDENTIALS.
        - e.g export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json.

# Environment Variable/s:
    * IS_KOLIBRI_RELEASE = Upload artifacts to the Google Cloud as a release candidate.
    * GITHUB_ACCESS_TOKEN = Personal access token used to authenticate in your Github account via API.
    * BUILDKITE_BUILD_NUMBER = Build identifier for each directory created.
    * BUILDKITE_PULL_REQUEST = Pull request issue or the value is false.
    * BUILDKITE_TAG = Tag identifier if this build was built from a tag.
    * GOOGLE_APPLICATION_CREDENTIALS = Your service account key.
"""
import logging
import os
from os import listdir

import requests
from github3 import login

logging.getLogger().setLevel(logging.INFO)

ACCESS_TOKEN = os.getenv("GITHUB_ACCESS_TOKEN")
REPO_OWNER = "learningequality"
REPO_NAME = "kolibri"
TAG = os.getenv("BUILDKITE_TAG")


RELEASE_DIR = "release"
PROJECT_PATH = os.path.join(os.getcwd())

# Python packages artifact location
DIST_DIR = os.path.join(PROJECT_PATH, "dist")

# Manifest of files, keyed by extension
file_manifest = {
    "exe": {
        "extension": "exe",
        "description": "Windows Installer",
        "content_type": "application/x-ms-dos-executable",
    },
    "pex": {
        "extension": "pex",
        "description": "Pex file",
        "content_type": "application/octet-stream",
    },
    "whl": {
        "extension": "whl",
        "description": "Whl file",
        "content_type": "application/zip",
    },
    "gz": {
        "extension": "gz",
        "description": "Tar file",
        "content_type": "application/gzip",
    },
    # 'apk': {
    #     'extension': 'apk',
    #     'description': 'Android Installer',
    #     'content_type': 'application/vnd.android.package-archive',
    # },
}

gh = login(token=ACCESS_TOKEN)
repository = gh.repository(REPO_OWNER, REPO_NAME)


def collect_local_artifacts():
    """
    Create a dict of the artifact name and the location.
    """

    artifacts_dict = {}

    def create_exe_data(filename, data):
        data_name = "-unsigned"
        if "-signed" in filename:
{'fraction_non_alphanumeric': 0.11132660977501939, 'fraction_numerical': 0.0003878975950349108, 'mean_word_length': 3.3703389830508477, 'pattern_counts': {'":': 36, '<': 5, '<?xml version=': 0, '>': 5, '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': '1439081', 'n_tokens_mistral': 1665, 'n_tokens_neox': 1593, 'n_words': 422}