def query_ruler(t): """Prompt user to enter a valid matching ruler for transaction. First prompt is used to enter a basic ruler aka successive words to look for on payee line. This prompt can be skipped by pressing <Enter> to have access to guru ruler prompt, where ruler is a list of field/match to validate. """ with TERM.fullscreen(): extras = {'category': '? Category'} ok = False ruler = {} while True: print(TERM.move_y(0)) print_transaction(t, extras=extras) if ok: break ruler = query_basic_ruler(t, tags.unrulify(ruler)) or \ query_guru_ruler(t) ok, extras = check_ruler(ruler, t) return ruler
def query_ruler(t): """Prompt user to enter a valid matching ruler for transaction. First prompt is used to enter a basic ruler aka successive words to look for on payee line. This prompt can be skipped by pressing <Enter> to have access to guru ruler prompt, where ruler is a list of field/match to validate. """ with TERM.fullscreen(): extras = {} ok = False ruler = {} while True: print(TERM.move_y(0)) print_transaction(t, extras=extras) if ok: break ruler = query_basic_ruler(t, tags.unrulify(ruler)) or query_guru_ruler(t) ok, extras = check_ruler(ruler, t) return ruler
def test_unrulify__noop(self): for d in ({"payee": r"\balice\b"}, "alice"): self.assertEqual(tags.unrulify(d), d)
def test_unrulify__basic_ruler(self): self.assertEqual(tags.unrulify({"PAYEE": r"\balice\b"}), "alice")
def test_unrulify__noop(self): for d in ({'payee': r'\balice\b'}, 'alice'): self.assertEqual(tags.unrulify(d), d)
def test_unrulify__basic_ruler(self): self.assertEqual(tags.unrulify({'PAYEE': r'\balice\b'}), 'alice')
def test_unrulify__noop(self): for d in ({'payee': r'\balice\b'}, 'alice'): self.assertEqual(tags.unrulify(d), d)
def test_unrulify__basic_ruler(self): self.assertEqual(tags.unrulify({'PAYEE': r'\balice\b'}), 'alice')