def test_splitterRemovesBacktickApostropheQuotationsThatSpanMultipleWords( self): """Test that words quoted in `this style', across multiple words appear individually without any quotation marks""" test_string = "hello `world, goodbye' cruel world." words = splitter.Splitter().line_split(test_string) self.assertEqual(words, ["hello", "world", "goodbye", "cruel", "world"])
def main(filename): if filename is not None: pass with open(filename, "rU") as text_file: text_string = text_file.read() generator = ConcordanceGenerator(splitter=splitter.Splitter()) output = generator.concordance_for_string(text_string) for entry in output.all_entries(): print entry
def process(folders, output, fixed_columns, merge_columns, ignore_columns, remove_content, custom_headers, custom_columns, expect_new_columns, new_columns_regex, separator=u','): ed = editor.Editor() sp = splitter.Splitter(separator) mg = merger.Merger(separator=separator, fixed_columns=fixed_columns, ignore_columns=ignore_columns, merge_columns=merge_columns, expect_new_columns=expect_new_columns, new_columns_regex=new_columns_regex) ed.remove_content_in_processing(remove_content) ed.remove_empty_columns_in_processing() ed.trim_in_processing() ed.expand_rows_in_processing() ed.skip_files_in_processing(output) ed.set_headers_in_processing(custom_headers) for column in custom_columns: ed.add_columns_in_processing(*column) ed.collapse_headers_in_processing(fixed_columns, merge_columns, ignore_columns) for folder in folders: csvs = sp.split_folder(folder) ed.process(folder) mg.merge_folder(folder, output) for files in csvs: easyio.remove(csvs[files])
def main(): print('Starting splitter') user = keyring.get_password(KEYRING_SERVICE, "user") password = '' # if credentials already saved in keyring... if user: password = keyring.get_password(KEYRING_SERVICE, "password") else: user, password = cli.save_credentials(KEYRING_SERVICE) print("Logging in...") try: mint = mintapi.Mint(email=user, password=password, mfa_method='sms', headless=True, session_path=path.abspath("./session"), wait_for_sync=False) except: print( "Failed to login to mint/open new chrome session. Ensure your current chrome session is closed" ) exit() print("Logged in!") splitter = mint_splitter.Splitter(mint) accounts = splitter.get_filtered_accounts() selected_accounts = cli.get_selected_accounts(accounts) splitter.split_transactions(selected_accounts, start_date=cli.get_start_date()) mint.close() sys.exit()
import pusher import scraper import parameters import time import importer import splitter MESSAGES = parameters.MESSAGES() SOURCE_STATUS = parameters.SOURCE_STATUS() if __name__ == "__main__": #Run the batch importer.Importer().importFile() splitter.Splitter().splitFile() status = pusher.Status() scraper = scraper.Scraper() start_time = time.time() print(MESSAGES.START_BATCH) status.changeSourceStatus(SOURCE_STATUS.REBUILD) scraper.pushAllDocs() status.changeSourceStatus(SOURCE_STATUS.IDLE) elapsed_time = round(time.time() - start_time, 2) print(MESSAGES.END_BATCH, elapsed_time, MESSAGES.BATCH_TIME_UNIT)
def test_splitterRemovesMultipbleBacktickApostropheQuotationsOnTheSameLine( self): """Test that words quoted in `this' style appear without any quotation marks even when there's more than one on a line""" test_string = "`hello' `world'" words = splitter.Splitter().line_split(test_string) self.assertEqual(words, ["hello", "world"])
def test_canSplitTwoWords(self): """Test that we can split two words into an array with two elements""" test_string = "hello world" words = splitter.Splitter().line_split(test_string) self.assertEqual(len(words), 2)
def test_splitterRemovesBacktickApostrophesWhenUsedAsQuotationMarks(self): """Test that words quoted in `this' style appear without any quotation marks""" test_string = "hello `world'" words = splitter.Splitter().line_split(test_string) self.assertEqual(words, ["hello", "world"])
def test_splitIntoLinesIgnoresEmptyLines(self): """There can be no words on empty lines, so it doesn't make sense to return them.""" test_string = "hello \n\n world\n how are you?" lines = splitter.Splitter().lines_for_string(test_string) self.assertEqual(len(lines), 3)
def test_splitterCanProduceAnArrayOfAllTheLinesInAMultilineString(self): """Test that we can get an array with the correct number of lines from a multiline string""" test_string = "hello world\n how's it going today" lines = splitter.Splitter().lines_for_string(test_string) self.assertEqual(len(lines), 2)
def test_splitterRemovesUnpermittedPunctuation(self): """Test that unpermitted punctuation is removed in split""" test_string = "(t'was: the +best, and worst.*)" words = splitter.Splitter().line_split(test_string) self.assertEqual(words, ["t'was", "the", "best", "and", "worst"])
def test_allWordsInSplitArePresentInInput(self): """Test that all of the split-out words are returned""" test_string = "hello world" words = splitter.Splitter().line_split(test_string) for word in words: self.assertTrue(word in test_string)
def test_line_splitWhenGivenAnEmptyStringReturnsAnEmptyArray(self): """Test that we return empty array from our split on an empty string""" test_string = "" words = splitter.Splitter().line_split(test_string) self.assertFalse(words)