<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import glob
import itertools
import os
import sys

from . import Command
from .server import main
from odoo.modules.module import get_module_root, MANIFEST_NAMES
from odoo.service.db import _create_empty_database, DatabaseExists


class Start(Command):
    """Quick start the Odoo server for your project"""

    def get_module_list(self, path):
        mods = itertools.chain.from_iterable(
            glob.glob(os.path.join(path, '*/%s' % mname))
            for mname in MANIFEST_NAMES
        )
        return [mod.split(os.path.sep)[-2] for mod in mods]

    def run(self, cmdargs):
        parser = argparse.ArgumentParser(
            prog="%s start" % sys.argv[0].split(os.path.sep)[-1],
            description=self.__doc__
        )
        parser.add_argument('--path', default=".",
            help="Directory where your project's modules are stored (will autodetect from current dir)")
        parser.add_argument("-d", "--database", dest="db_name", default=None,
                         help="Specify the database name (default to project's directory name")


        args, unknown = parser.parse_known_args(args=cmdargs)

        project_path = os.path.abspath(os.path.expanduser(os.path.expandvars(args.path)))<commit_msg>[IMP] cli: extract the project's path from active virtualenv (closes: #16512)<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import glob
import itertools
import os
import sys

from . import Command
from .server import main
from odoo.modules.module import get_module_root, MANIFEST_NAMES
from odoo.service.db import _create_empty_database, DatabaseExists


class Start(Command):
    """Quick start the Odoo server for your project"""

    def get_module_list(self, path):
        mods = itertools.chain.from_iterable(
            glob.glob(os.path.join(path, '*/%s' % mname))
            for mname in MANIFEST_NAMES
        )
        return [mod.split(os.path.sep)[-2] for mod in mods]

    def run(self, cmdargs):
        parser = argparse.ArgumentParser(
            prog="%s start" % sys.argv[0].split(os.path.sep)[-1],
            description=self.__doc__
        )
        parser.add_argument('--path', default=".",
            help="Directory where your project's modules are stored (will autodetect from current dir)")
        parser.add_argument("-d", "--database", dest="db_name", default=None,
                         help="Specify the database name (default to project's directory name")


        args, unknown = parser.parse_known_args(args=cmdargs)

        # When in a virtualenv, by default use it's path rather than the cwd
        if args.path == '.' and os.environ.get('VIRTUAL_ENV'):
            args.path = os.environ.get('VIRTUAL_ENV')
        project_path = os.path.abspath(os.path.expanduser(os.path.expandvars(args.path)))
{'fraction_non_alphanumeric': 0.11894882434301521, 'fraction_numerical': 0.004495159059474412, 'mean_word_length': 2.914749661705007, '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': '3346406', 'n_tokens_mistral': 896, 'n_tokens_neox': 866, 'n_words': 228}