<commit_before>import json
import os
import re

import github3
from IGitt.GitHub.GitHub import GitHub, GitHubToken
from IGitt.GitLab.GitLab import GitLab, GitLabPrivateToken
from errbot import BotPlugin, re_botcmd

from plugins import constants


class LabHub(BotPlugin):
    """GitHub and GitLab utilities"""  # Ignore QuotesBear

    INVITE_SUCCESS = {
        'newcomers': 'Welcome @{}! :tada:\n\nWe\'ve just sent you an invite'
                     ' via email. Please accept it before proceeding forward.'
                     '\nTo get started, please follow our [newcomers guide]'
                     '(https://coala.io/newcomer). Most '
                     'issues will be explained there and in linked pages - it '
                     'will save you a lot of time, just read it. *Really.*\n\n'
                     '*Do not take an issue if you don\'t understand it on '
                     'your own.*Especially if you are new you have to be aware '
                     'that getting started with an open source community is '
                     'not trivial: you will have to work hard and most likely '
                     'become a better coder than you are now just as we all '
                     'did.\n\nDon\'t get us wrong: we are *very* glad to have '
                     'you with us on this journey into open source! We will '
                     'also be there for you at all times to help you with '
                     'actual problems. :)',
        'developers': ' Wow @{}, you are a part of developers team now! :tada: '
                      'Welcome to ourcommunity!',
        'maintainers': ' @{} you seem to be awesome! You are now a maintainer! '
                       ':tada: Please go through '
                       'https://github.com/coala/coala/wiki/Membership'
    }

    GH_ORG_NAME = constants.GH_ORG_NAME
    GL_ORG_NAME = constants.GL_ORG_NAME

    def __init__(self, bot, name=None):
        super().__init__(bot, name)

        teams = dict()
        try:
            gh = github3.login(token=os.environ.get('GH_TOKEN'))
            assert gh is not None
        except AssertionError:
            self.log.error('Cannot create github object, please check GH_TOKEN')
        else:
            self.GH3_ORG = gh.organization(self.GH_ORG_NAME)
            for team in self.GH3_ORG.iter_teams():
                teams[team.name] = team

        self._teams = teams

        self.IGH = GitHub(GitHubToken(os.environ.get('GH_TOKEN')))
        self.IGL = GitLab(GitLabPrivateToken(os.environ.get('GL_TOKEN')))

        self.REPOS = dict()

        try:<commit_msg>labhub: Add newcomer form to developer welcome msg<commit_after>import json
import os
import re

import github3
from IGitt.GitHub.GitHub import GitHub, GitHubToken
from IGitt.GitLab.GitLab import GitLab, GitLabPrivateToken
from errbot import BotPlugin, re_botcmd

from plugins import constants


class LabHub(BotPlugin):
    """GitHub and GitLab utilities"""  # Ignore QuotesBear

    INVITE_SUCCESS = {
        'newcomers': 'Welcome @{}! :tada:\n\nWe\'ve just sent you an invite'
                     ' via email. Please accept it before proceeding forward.'
                     '\nTo get started, please follow our [newcomers guide]'
                     '(https://coala.io/newcomer). Most '
                     'issues will be explained there and in linked pages - it '
                     'will save you a lot of time, just read it. *Really.*\n\n'
                     '*Do not take an issue if you don\'t understand it on '
                     'your own.*Especially if you are new you have to be aware '
                     'that getting started with an open source community is '
                     'not trivial: you will have to work hard and most likely '
                     'become a better coder than you are now just as we all '
                     'did.\n\nDon\'t get us wrong: we are *very* glad to have '
                     'you with us on this journey into open source! We will '
                     'also be there for you at all times to help you with '
                     'actual problems. :)',
        'developers': ' Wow @{}, you are a part of developers team now! :tada: '
                      'Welcome to ourcommunity! You were a newcomer before, '
                      'and we\'d like to know what could\'ve been better, '
                      'please fill http://coala.io/newform',
        'maintainers': ' @{} you seem to be awesome! You are now a maintainer! '
                       ':tada: Please go through '
                       'https://github.com/coala/coala/wiki/Membership'
    }

    GH_ORG_NAME = constants.GH_ORG_NAME
    GL_ORG_NAME = constants.GL_ORG_NAME

    def __init__(self, bot, name=None):
        super().__init__(bot, name)

        teams = dict()
        try:
            gh = github3.login(token=os.environ.get('GH_TOKEN'))
            assert gh is not None
        except AssertionError:
            self.log.error('Cannot create github object, please check GH_TOKEN')
        else:
            self.GH3_ORG = gh.organization(self.GH_ORG_NAME)
            for team in self.GH3_ORG.iter_teams():
                teams[team.name] = team

        self._teams = teams

        self.IGH = GitHub(GitHubToken(os.environ.get('GH_TOKEN')))
        self.IGL = GitLab(GitLabPrivateToken(os.environ.get('GL_TOKEN')))

        self.REPOS = dict()

        try:
{'fraction_non_alphanumeric': 0.08870077291129923, 'fraction_numerical': 0.001472211998527788, 'mean_word_length': 1.8410872974385781, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '1409784', 'n_tokens_mistral': 1606, 'n_tokens_neox': 1478, 'n_words': 521}