How to use the ltk.actions.rm_action.RmAction function in ltk

To help you get started, we’ve selected a few ltk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Lingotek / filesystem-connector / tests / test_actions / test_download.py View on Github external
def tearDown(self):
        self.rm_action = RmAction(os.getcwd())
        for curr_file in self.files:
            self.rm_action.rm_action([curr_file], remote=True, force=True)
        self.clean_action.clean_action(False, False, None)
        for dl_file in self.downloaded_files:
            if os.path.exists(dl_file):
                os.remove(dl_file)
        self.rm_action.close()
        self.clean_action.close()
        self.action.close()
github Lingotek / filesystem-connector / tests / test_actions / test_clone.py View on Github external
def setUp(self):
        self.action = CloneAction(os.getcwd())
        self.add_action = AddAction(os.getcwd())
        self.added_directories = []
        self.config_action = ConfigAction(os.getcwd())
        self.rm_action = RmAction(os.getcwd())
        self.dir_path1 = os.path.join(os.getcwd(), 'dir1')
        self.added_directories.append(self.dir_path1)
        create_directory(self.dir_path1)
        self.dir_path2 = os.path.join(os.getcwd(), 'dir2')
        self.added_directories.append(self.dir_path2)
        create_directory(self.dir_path2)
        self.dir_path3 = os.path.join(os.getcwd(), 'dir1','dir3')
        self.added_directories.append(self.dir_path3)
        create_directory(self.dir_path3)
        self.delete_directory(os.path.join(os.getcwd(), 'ja-JP'))
        self.delete_directory(os.path.join(os.getcwd(), 'es-MX'))
        self.delete_directory(os.path.join(os.getcwd(), 'downloads'))
github Lingotek / filesystem-connector / tests / test_actions / test_push.py View on Github external
def setUp(self):
        create_config()
        self.downloaded = []
        self.add_action = AddAction(os.getcwd())
        self.action = PushAction(self.add_action,os.getcwd())
        self.clean_action = CleanAction(os.getcwd())
        self.rm_action = RmAction(os.getcwd())
        self.download_action = DownloadAction(os.getcwd())
        self.clean_action.clean_action(True, False, None)
        self.files = ['sample.txt', 'sample1.txt', 'sample2.txt']
        for fn in self.files:
            create_txt_file(fn)
        os.system('ltk add sample*.txt -o') # Let the command line handle parsing the file pattern
        self.doc_ids = self.action.doc_manager.get_doc_ids()
        for doc_id in self.doc_ids:
            assert poll_doc(self.action, doc_id)
github Lingotek / filesystem-connector / tests / test_actions / test_watch.py View on Github external
def setUp(self):
        self.action = WatchAction(os.getcwd())
        self.clean_action = CleanAction(os.getcwd())
        self.add_action = AddAction(os.getcwd())
        self.rm_action = RmAction(os.getcwd())
        self.clean_action.clean_action(False, False, None)
        # self.action.open()
        self.downloaded = []
        self.files = []
        self.dir_name = "dir1"
        create_directory(self.dir_name)
        self.add_action.add_action([self.dir_name], force=True)
        # todo current problem: watchdog does not seem to detect changes in daemon
        # but not daemonizing watch causes tests to hang..
        watch_thread = Thread(target=self.action.watch_action, args=('.', (), None))
        watch_thread.daemon = True
        watch_thread.start()
github Lingotek / filesystem-connector / tests / test_actions / test_mv.py View on Github external
def setUp(self):
        self.action = MoveAction(os.getcwd())
        self.rm_action = RmAction(os.getcwd())
        self.add_action = AddAction(os.getcwd())
        self.list_action = ListAction(os.getcwd())
        self.added_dirs = {#dictionary of directory names to directory paths
            'full': 'full',
            'empty': 'empty',
            'hassub': 'hassub',
            'issub': 'hassub'+os.sep+'issub'
        }
        create_directory(os.path.join(os.getcwd(), self.added_dirs['hassub']))
        create_directory(os.path.join(os.getcwd(), self.added_dirs['issub']))
        create_directory(os.path.join(os.getcwd(), self.added_dirs['full']))
        create_directory(os.path.join(os.getcwd(), self.added_dirs['empty']))
        self.added_files = {#dictionary of file names to file paths
            'fileA.txt': 'fileA.txt',
            'fileB.txt': os.path.join(self.added_dirs['full'], 'fileB.txt'),
            'fileC.txt': os.path.join(self.added_dirs['hassub'], 'fileC.txt'), #untracked
github Lingotek / filesystem-connector / tests / test_actions / test_status.py View on Github external
def setUp(self):
        create_config()
        self.action = StatusAction(os.getcwd())
        self.clean_action = CleanAction(os.getcwd())
        self.add_action = AddAction(os.getcwd())
        self.rm_action = RmAction(os.getcwd())
        self.clean_action.clean_action(True, False, None)
        self.file_name = 'sample.txt'
        self.file_path = create_txt_file(self.file_name)
        self.add_action.add_action([self.file_name], overwrite=True)
        self.doc_id = self.action.doc_manager.get_doc_ids()[0]
        assert poll_doc(self.action, self.doc_id)
        self.targets = ['ja-JP', 'de-DE']
github Lingotek / filesystem-connector / tests / test_actions / test_add.py View on Github external
def tearDown(self):
        self.rm_action = RmAction(os.getcwd())
        for fn in self.added_files:
            self.rm_action.rm_action(fn, remote=True, force=True)

        not_empty = True
        while not_empty:
            not_empty = False
            for d in self.added_directories:
                if os.path.exists(d) and os.path.isdir(d):
                    if len(os.listdir(d)):
                        self.rm_action.rm_action(d, remote=True, force=True)
                        not_empty = True
                    else:
                        self.rm_action.rm_action(d, remote=True, force=True)
                        delete_directory(d)

        self.clean_action.clean_action(False, False, None)
github Lingotek / filesystem-connector / tests / test_actions / test_import.py View on Github external
def tearDown(self):
        self.rm_action = RmAction(os.getcwd())
        for doc_id in self.doc_ids:
            self.rm_action.rm_action(doc_id, id=True, remote=True)
        for doc_id in self.imported:
            self.rm_action.rm_action(doc_id, id=True, remote=True)
        self.clean_action.clean_action(True, False, None)
        self.rm_action.close()
        self.action.close()
github Lingotek / filesystem-connector / tests / test_actions / test_clean.py View on Github external
def tearDown(self):
        self.rm_action = RmAction(os.getcwd())
        for curr_file in self.files:
            if curr_file in self.forced:
                continue
            self.rm_action.rm_action(curr_file, force=True)
        self.action.clean_action(True, False, None)
        self.action.close()
github Lingotek / filesystem-connector / tests / test_actions / test_list.py View on Github external
def setUp(self):
        self.action = ListAction(os.getcwd())
        self.clean_action = CleanAction(os.getcwd())
        self.add_action = AddAction(os.getcwd())
        self.clean_action.clean_action(True, False, None)
        self.rm_action = RmAction(os.getcwd())