<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''gig

A .gitignore template generator.

Usage:
  gig list [--global]
  gig <language> ... [--append --force --verbose --global]
  gig Python Ruby Clojure ...

Options:
  -h --help             Show this screen.
  --version             Show version.
  list                  List available languages. NOTE: Languages are case-sensitive.
  -a --append           If .gitignore already exists, append to it.
  -f --force            If .gitignore already exists, overwrite it.
  -g --global           Creates or appends to a global gitignore file in ~/.gitignore_global.
  -v --verbose          Toggle verbose output.
'''

import os
import sys
import logging
import subprocess
from docopt import docopt
import requests

__version__ = "0.2.0"
__author__ = "<NAME>"
__license__ = "MIT"

API_URL = "https://api.github.com/gitignore/templates"
GLOBAL_URL = 'https://api.github.com/repos/github/gitignore/contents/Global/'
TEMPLATE_URL = 'https://raw.github.com/github/gitignore/master'
HEADER = "########## Generated by gig {0} ###########\n".format(__version__)
GLOBAL_GITIGNORE = os.path.expanduser(os.path.join("~", ".gitignore_global"))

def generate_gitignore(languages, global_=False):
    '''Return the .gitignore (a string) given a list of languages.'''
    gitignore = ''
    session = requests.Session()
    for language in languages:
        base_url = (TEMPLATE_URL + "/Global") if global_ else TEMPLATE_URL
        url = base_url + "/" + language + '.gitignore'
        res = session.get(url)
        if res.status_code == requests.codes.ok:
            content = res.text  # The gitignore template
            gitignore = '\n'.join([gitignore,<commit_msg>Don't include version in header<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''gig

A .gitignore template generator.

Usage:
  gig list [--global]
  gig <language> ... [--append --force --verbose --global]
  gig Python Ruby Clojure ...

Options:
  -h --help             Show this screen.
  --version             Show version.
  list                  List available languages. NOTE: Languages are case-sensitive.
  -a --append           If .gitignore already exists, append to it.
  -f --force            If .gitignore already exists, overwrite it.
  -g --global           Creates or appends to a global gitignore file in ~/.gitignore_global.
  -v --verbose          Toggle verbose output.
'''

import os
import sys
import logging
import subprocess
from docopt import docopt
import requests

__version__ = "0.2.0"
__author__ = "<NAME>"
__license__ = "MIT"

API_URL = "https://api.github.com/gitignore/templates"
GLOBAL_URL = 'https://api.github.com/repos/github/gitignore/contents/Global/'
TEMPLATE_URL = 'https://raw.github.com/github/gitignore/master'
HEADER = "########## Generated by gig ###########\n"
GLOBAL_GITIGNORE = os.path.expanduser(os.path.join("~", ".gitignore_global"))

def generate_gitignore(languages, global_=False):
    '''Return the .gitignore (a string) given a list of languages.'''
    gitignore = ''
    session = requests.Session()
    for language in languages:
        base_url = (TEMPLATE_URL + "/Global") if global_ else TEMPLATE_URL
        url = base_url + "/" + language + '.gitignore'
        res = session.get(url)
        if res.status_code == requests.codes.ok:
            content = res.text  # The gitignore template
            gitignore = '\n'.join([gitignore,
{'fraction_non_alphanumeric': 0.13736903376018628, 'fraction_numerical': 0.002619324796274738, 'mean_word_length': 2.6996770721205596, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 6, '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': '2151066', 'n_tokens_mistral': 1040, 'n_tokens_neox': 1030, 'n_words': 306}