<commit_before>import sublime_plugin
import sublime
import subprocess
from platform import system
from os import path, makedirs
from ..setting.setting import get_setting
from ..setting.setting import SettingObject


class ScanOpenTabCommand(sublime_plugin.TextCommand):

    def run(self, edit):
        """Command to scan open tab RF file and create db table

        Purpose of the command is scan and create the db table
        from the currently open tab.
        """
        log_file = get_setting(SettingObject.log_file)
        python_binary = get_setting(SettingObject.python_binary)
        table_dir = get_setting(SettingObject.table_dir)
        makedirs(path.dirname(log_file), exist_ok=True)
        open_tab = self.view.file_name()
        if self.file_in_workspace(open_tab):
            file_ = open(log_file, 'w')
            sublime.set_timeout_async(self.run_single_scan(
                    python_binary,
                    table_dir,
                    file_
                ), 0)
            file_.close()
            file_.close()
        else:
            message = 'Not able to scan file: {0}'.format(open_tab)
            sublime.status_message(message)

    def run_single_scan(self, python_binary, db_path, log_file):
        open_tab = self.view.file_name()
        startupinfo = None
        if system() == 'Windows':
            startupinfo = subprocess.STARTUPINFO()
            startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
        p = subprocess.Popen(
                [
                    python_binary,
                    get_setting(SettingObject.scanner_runner),
                    'single',
                    '--path_to_file',
                    open_tab,
                    '--db_path',
                    db_path,<commit_msg>Removed the seconds file close<commit_after>import sublime_plugin
import sublime
import subprocess
from platform import system
from os import path, makedirs
from ..setting.setting import get_setting
from ..setting.setting import SettingObject


class ScanOpenTabCommand(sublime_plugin.TextCommand):

    def run(self, edit):
        """Command to scan open tab RF file and create db table

        Purpose of the command is scan and create the db table
        from the currently open tab.
        """
        log_file = get_setting(SettingObject.log_file)
        python_binary = get_setting(SettingObject.python_binary)
        table_dir = get_setting(SettingObject.table_dir)
        makedirs(path.dirname(log_file), exist_ok=True)
        open_tab = self.view.file_name()
        if self.file_in_workspace(open_tab):
            file_ = open(log_file, 'w')
            sublime.set_timeout_async(self.run_single_scan(
                    python_binary,
                    table_dir,
                    file_
                ), 0)
            file_.close()
        else:
            message = 'Not able to scan file: {0}'.format(open_tab)
            sublime.status_message(message)

    def run_single_scan(self, python_binary, db_path, log_file):
        open_tab = self.view.file_name()
        startupinfo = None
        if system() == 'Windows':
            startupinfo = subprocess.STARTUPINFO()
            startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
        p = subprocess.Popen(
                [
                    python_binary,
                    get_setting(SettingObject.scanner_runner),
                    'single',
                    '--path_to_file',
                    open_tab,
                    '--db_path',
                    db_path,
{'fraction_non_alphanumeric': 0.07657784011220196, 'fraction_numerical': 0.0011220196353436186, 'mean_word_length': 1.9062754686226568, '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': '7117116', 'n_tokens_mistral': 990, 'n_tokens_neox': 955, 'n_words': 224}