<commit_before>""" manifests for tsrc """

import operator
import os
from typing import cast, Any, Dict, List, NewType, Optional, Tuple  # noqa

from path import Path
import schema

import tsrc


class RepoNotFound(tsrc.Error):
    def __init__(self, src: str) -> None:
        super().__init__("No repo found in '%s'" % src)


class Manifest:
    def __init__(self) -> None:
        self._repos = []  # type: List[tsrc.Repo]
        self.copyfiles = []  # type: List[Tuple[str, str]]
        self.group_list = None  # type:  Optional[tsrc.GroupList[str]]
        self.gitlab_url = None  # type Optional[str]
        self.github_enterprise_url = None  # type: Optional[str]

    def apply_config(self, config: Any) -> None:
        """ Apply config coming form the yaml file """
        # Note: we cannot just serialize the yaml file into the class,
        # because we need to convert the plain old dicts into
        # higher-level classes.
        self.copyfiles = []
        repos_config = config["repos"]
        for repo_config in repos_config:
            self._handle_repo(repo_config)
            self._handle_copies(repo_config)

        groups_config = config.get("groups")
        self._handle_groups(groups_config)

        for key in ["github_enterprise", "gitlab"]:
            service_config = config.get(key)
            if service_config:
                url = service_config["url"]
                setattr(self, key + "_url", url)

    def _handle_repo(self, repo_config: Any) -> None:<commit_msg>Fix type annotation in tsrc/manifest.py<commit_after>""" manifests for tsrc """

import operator
import os
from typing import cast, Any, Dict, List, NewType, Optional, Tuple  # noqa

from path import Path
import schema

import tsrc


class RepoNotFound(tsrc.Error):
    def __init__(self, src: str) -> None:
        super().__init__("No repo found in '%s'" % src)


class Manifest:
    def __init__(self) -> None:
        self._repos = []  # type: List[tsrc.Repo]
        self.copyfiles = []  # type: List[Tuple[str, str]]
        self.group_list = None  # type:  Optional[tsrc.GroupList[str]]
        self.gitlab_url = None  # type: Optional[str]
        self.github_enterprise_url = None  # type: Optional[str]

    def apply_config(self, config: Any) -> None:
        """ Apply config coming form the yaml file """
        # Note: we cannot just serialize the yaml file into the class,
        # because we need to convert the plain old dicts into
        # higher-level classes.
        self.copyfiles = []
        repos_config = config["repos"]
        for repo_config in repos_config:
            self._handle_repo(repo_config)
            self._handle_copies(repo_config)

        groups_config = config.get("groups")
        self._handle_groups(groups_config)

        for key in ["github_enterprise", "gitlab"]:
            service_config = config.get(key)
            if service_config:
                url = service_config["url"]
                setattr(self, key + "_url", url)

    def _handle_repo(self, repo_config: Any) -> None:
{'fraction_non_alphanumeric': 0.10617445279320484, 'fraction_numerical': 0.0, 'mean_word_length': 2.5812865497076025, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '1255046', 'n_tokens_mistral': 927, 'n_tokens_neox': 896, 'n_words': 267}