<commit_before># -*- coding: utf-8 -*-

import os
import shlex
import subprocess
import threading

import sublime
import sublime_plugin


PACKAGE_NAME = "SimpleSync"
PACKAGE_SETTINGS = PACKAGE_NAME + ".sublime-settings"


class SyncCommand(object):

    def sync_paste_path(self):
        file_path = ''
        def on_done(file_path):
            # print(file_path)
            if not file_path: return
            self.sync_file(file_path)
        self.window.show_input_panel('[%s] Copy and paste local file path :' % (PACKAGE_NAME), file_path, on_done, None, None)


class SimpleSyncCommand(sublime_plugin.EventListener):
    @property
    def settings(self):
        return sublime.load_settings(PACKAGE_SETTINGS)

    def on_post_save_async(self, view):
        if not view:
            return

        local = self.settings.get("local")
        remote = self.settings.get("remote")

        local_path = view.file_name()
        if not local_path or not local_path.startswith(local):
            return
        remote_path = remote + local_path.replace(local, "")

        path = self.settings.get("path", "")
        path = ":".join((os.path.expanduser(path), os.environ.get("PATH")))
        print("{}: PATH".format(PACKAGE_NAME), path)

        timeout = self.settings.get("timeout", 10)

        command = self.settings.get("command")
        cmd = command.format(local_path, remote_path)
        print("{}: Execute".format(PACKAGE_NAME), cmd)

        Command(cmd).run(timeout, env=dict(PATH=path))


class Command(object):
    def __init__(self, cmd):<commit_msg>Add support for multiple commands<commit_after># -*- coding: utf-8 -*-

import os
import shlex
import subprocess
import threading

import sublime
import sublime_plugin


PACKAGE_NAME = "SimpleSync"
PACKAGE_SETTINGS = PACKAGE_NAME + ".sublime-settings"


class SyncCommand(object):

    def sync_paste_path(self):
        file_path = ''
        def on_done(file_path):
            # print(file_path)
            if not file_path: return
            self.sync_file(file_path)
        self.window.show_input_panel('[%s] Copy and paste local file path :' % (PACKAGE_NAME), file_path, on_done, None, None)


class SimpleSyncCommand(sublime_plugin.EventListener):
    @property
    def settings(self):
        return sublime.load_settings(PACKAGE_SETTINGS)

    def on_post_save_async(self, view):
        if not view:
            return

        local = self.settings.get("local")
        remote = self.settings.get("remote")

        local_path = view.file_name()
        if not local_path or not local_path.startswith(local):
            return
        remote_path = remote + local_path.replace(local, "")

        path = self.settings.get("path", "")
        path = ":".join((os.path.expanduser(path), os.environ.get("PATH")))
        print("{}: PATH".format(PACKAGE_NAME), path)

        timeout = self.settings.get("timeout", 10)

        commands = self.settings.get("commands") or filter(None, [self.settings.get("command")])
        for cmd in commands:
            cmd = cmd.format(local=local_path, remote=remote_path)
            print("{}: EXEC".format(PACKAGE_NAME), cmd)
            Command(cmd).run(timeout, env=dict(PATH=path))


class Command(object):
    def __init__(self, cmd):
{'fraction_non_alphanumeric': 0.12178702570379436, 'fraction_numerical': 0.0018359853121175031, 'mean_word_length': 2.9433051869722555, 'pattern_counts': {'":': 2, '<': 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': '2676779', 'n_tokens_mistral': 1022, 'n_tokens_neox': 990, 'n_words': 212}