コード例 #1
0
ファイル: __init__.py プロジェクト: pescortell/qifqif
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
コード例 #2
0
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
コード例 #3
0
 def test_unrulify__noop(self):
     for d in ({"payee": r"\balice\b"}, "alice"):
         self.assertEqual(tags.unrulify(d), d)
コード例 #4
0
 def test_unrulify__basic_ruler(self):
     self.assertEqual(tags.unrulify({"PAYEE": r"\balice\b"}), "alice")
コード例 #5
0
 def test_unrulify__noop(self):
     for d in ({'payee': r'\balice\b'}, 'alice'):
         self.assertEqual(tags.unrulify(d), d)
コード例 #6
0
 def test_unrulify__basic_ruler(self):
     self.assertEqual(tags.unrulify({'PAYEE': r'\balice\b'}), 'alice')
コード例 #7
0
ファイル: test_tags.py プロジェクト: pescortell/qifqif
 def test_unrulify__noop(self):
     for d in ({'payee': r'\balice\b'}, 'alice'):
         self.assertEqual(tags.unrulify(d), d)
コード例 #8
0
ファイル: test_tags.py プロジェクト: pescortell/qifqif
 def test_unrulify__basic_ruler(self):
     self.assertEqual(tags.unrulify({'PAYEE': r'\balice\b'}), 'alice')