<commit_before>import subprocess

from . import settings


class PyTabCmd(object):
    def __init__(self, *args, **kwargs):
        self.tabcmd = kwargs.get('tabcmd',
                                 settings.get_cfg_setting('TABCMD_EXE_PATH'))
        self.username = kwargs.get(
            'username', settings.get_cfg_setting('TABLEAU_ONLINE_USERNAME'))

        # Default value: Tableau Online
        self.server = kwargs.get('server', settings.TABLEAU_ONLINE_URL)

        self.linux = kwargs.get('linux', False) is True

    def _execute_command(self, command):
        # In Tableau 9.2 we have to append --no-certcheck for linux connections
        # More info here: https://community.tableau.com/message/450517#450517
        command = command + ["--no-certcheck"] if self.linux else command
        subprocess.call(command)

    def login(self, site, password=None):
        pwd = password or settings.get_cfg_setting('TABLEAU_ONLINE_PASSWORD'),
        command = [
            self.tabcmd,
            'login',
            "-u", "%s" % self.username,
            "-p", "%s" % pwd,
            "-s", "%s" % self.server,
            "-t", "%s" % site,
        ]
        self._execute_command(command)

    def create_project(self, name, description=None):
        command = [
            self.tabcmd,
            'createproject',
            "-n", "%s" % name,
        ]
        if description is not None:
            command += ["-d", description]
        self._execute_command(command)

    def delete_project(self, name):
        command = [
            self.tabcmd,
            'deleteproject',
            name
        ]
        self._execute_command(command)<commit_msg>Return call value<commit_after>import subprocess

from . import settings


class PyTabCmd(object):
    def __init__(self, *args, **kwargs):
        self.tabcmd = kwargs.get('tabcmd',
                                 settings.get_cfg_setting('TABCMD_EXE_PATH'))
        self.username = kwargs.get(
            'username', settings.get_cfg_setting('TABLEAU_ONLINE_USERNAME'))

        # Default value: Tableau Online
        self.server = kwargs.get('server', settings.TABLEAU_ONLINE_URL)

        self.linux = kwargs.get('linux', False) is True

    def _execute_command(self, command):
        # In Tableau 9.2 we have to append --no-certcheck for linux connections
        # More info here: https://community.tableau.com/message/450517#450517
        command = command + ["--no-certcheck"] if self.linux else command
        return subprocess.call(command)

    def login(self, site, password=<PASSWORD>):
        pwd = password or settings.get_cfg_setting('TABLEAU_ONLINE_PASSWORD'),
        command = [
            self.tabcmd,
            'login',
            "-u", "%s" % self.username,
            "-p", "%s" % pwd,
            "-s", "%s" % self.server,
            "-t", "%s" % site,
        ]
        return self._execute_command(command)

    def create_project(self, name, description=None):
        command = [
            self.tabcmd,
            'createproject',
            "-n", "%s" % name,
        ]
        if description is not None:
            command += ["-d", description]
        return self._execute_command(command)

    def delete_project(self, name):
        command = [
            self.tabcmd,
            'deleteproject',
            name
        ]
        return self._execute_command(command)
{'fraction_non_alphanumeric': 0.1201641266119578, 'fraction_numerical': 0.008206330597889801, 'mean_word_length': 2.0070484581497796, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2717253', 'n_tokens_mistral': 992, 'n_tokens_neox': 962, 'n_words': 219}