<commit_before>import os, sublime, sublime_plugin

class ConEmuOpenCommand():
    def get_project(self):
        has_project = 0
        if self.window.project_file_name(): # try project file name first
            project_dir, project_name = os.path.split(self.window.project_file_name())
            project_name, ext = os.path.splitext('st:' + project_name)
            project_dir = self.window.folders()[0]
            has_project = 1
        elif self.window.folders(): # if no project, use the top folder
            project_dir = self.window.folders()[0]
            project_name = project_dir
        elif self.window.active_view().file_name(): # if no folder, use current file's folder
            project_dir, _ = os.path.split(self.window.active_view().file_name())
            project_name = project_dir
        else: #then exit
            return (None, None)
        return (project_name, project_dir, has_project)

    def open_conemu(self, dirname, title):
        command= "start conemu.exe /Single /Dir "+dirname+" /cmdlist cmd -new_console:t:\""+title+"\""
        os.system(command)
        
# open project folder
class OpenConemuProjectCommand(sublime_plugin.WindowCommand, ConEmuOpenCommand):
    def run(self):
        project_name, project_dir, has_project = self.get_project()
        if not project_name:
            return
            
        self.open_conemu(project_dir, project_name)
        
# open "here" folder
class OpenConemuHereCommand(sublime_plugin.WindowCommand, ConEmuOpenCommand):
    def run(self, paths=[]):
        project_name, project_dir, has_project = self.get_project()
        if not project_name:
            return<commit_msg>fix empty window return<commit_after>import os, sublime, sublime_plugin

class ConEmuOpenCommand():
    def get_project(self):
        has_project = 0
        if self.window.project_file_name(): # try project file name first
            project_dir, project_name = os.path.split(self.window.project_file_name())
            project_name, ext = os.path.splitext('st:' + project_name)
            project_dir = self.window.folders()[0]
            has_project = 1
        elif self.window.folders(): # if no project, use the top folder
            project_dir = self.window.folders()[0]
            project_name = project_dir
        elif self.window.active_view().file_name(): # if no folder, use current file's folder
            project_dir, _ = os.path.split(self.window.active_view().file_name())
            project_name = project_dir
        else: #then exit
            return (None, None, 0)
        return (project_name, project_dir, has_project)

    def open_conemu(self, dirname, title):
        command= "start conemu.exe /Single /Dir "+dirname+" /cmdlist cmd -new_console:t:\""+title+"\""
        os.system(command)
        
# open project folder
class OpenConemuProjectCommand(sublime_plugin.WindowCommand, ConEmuOpenCommand):
    def run(self):
        project_name, project_dir, has_project = self.get_project()
        if not project_name:
            return
            
        self.open_conemu(project_dir, project_name)
        
# open "here" folder
class OpenConemuHereCommand(sublime_plugin.WindowCommand, ConEmuOpenCommand):
    def run(self, paths=[]):
        project_name, project_dir, has_project = self.get_project()
        if not project_name:
            return
{'fraction_non_alphanumeric': 0.0993181144381856, 'fraction_numerical': 0.0026682478505781204, 'mean_word_length': 2.7281767955801106, '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': '859427', 'n_tokens_mistral': 991, 'n_tokens_neox': 975, 'n_words': 229}