<commit_before>from fabric.decorators import task
from fabric.operations import local

from daimaduan.models.syntax import Syntax


syntax_list = [
    "CSS",
    "JavaScript",
    "Objective-C",
    "Ruby",
    "Bash",
    "CoffeeScript",
    "INI",
    "Makefile",
    "PHP",
    "SQL",
    "C#",
    "Diff",
    "JSON",
    "Perl",
    "C++",
    "HTML",
    "XML",
    "Java",
    "Nginx",
    "Python",
    "Scala",
    "Vim-Script",
    "SCSS",
    "LESS",
    "Dockerfile",
    "Puppet",
    "Lua",
    "Gradle",
    "Go",
    "Dart",
    "Groovy",
    "VBScript",
    "Swift",
    "Access-Log",
    "Text"
]


@task
def seed():
    """Seed syntax data in MongoDB"""
    local('python setup.py install')

    def find_or_create_syntax(name):
        syntax = Syntax.objects(name=name).first()
        if syntax is None:
            print "Seeding syntax: %s" % name
            Syntax(name=name).save()

    for syntax in syntax_list:
        find_or_create_syntax(syntax)<commit_msg>加入Kotlin的支持<commit_after>from fabric.decorators import task
from fabric.operations import local

from daimaduan.models.syntax import Syntax


syntax_list = [
    "CSS",
    "JavaScript",
    "Objective-C",
    "Ruby",
    "Bash",
    "CoffeeScript",
    "INI",
    "Makefile",
    "PHP",
    "SQL",
    "C#",
    "Diff",
    "JSON",
    "Perl",
    "C++",
    "HTML",
    "XML",
    "Java",
    "Nginx",
    "Python",
    "Scala",
    "Vim-Script",
    "SCSS",
    "LESS",
    "Dockerfile",
    "Puppet",
    "Lua",
    "Gradle",
    "Go",
    "Dart",
    "Groovy",
    "VBScript",
    "Swift",
    "Access-Log",
    "Text",
    "Kotlin"
]


@task
def seed():
    """Seed syntax data in MongoDB"""
    local('python setup.py install')

    def find_or_create_syntax(name):
        syntax = Syntax.objects(name=name).first()
        if syntax is None:
            print "Seeding syntax: %s" % name
            Syntax(name=name).save()

    for syntax in syntax_list:
        find_or_create_syntax(syntax)
{'fraction_non_alphanumeric': 0.1629889669007021, 'fraction_numerical': 0.0, 'mean_word_length': 2.249185667752443, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4304698', 'n_tokens_mistral': 769, 'n_tokens_neox': 729, 'n_words': 156}