# Path: aisikl/app.py
# def assert_ops(operations, *expected_methods):
#     '''Ensures the list of collected operations contains the methods we expect.
# 
#     This is a helper method you can use after calling
#     :meth:`~Application.collect_operations`. It just looks at each operation's
#     :attr:`~Operation.method` and checks if they match.
# 
#     :param operations: The collected operations.
#     :param \*expected_methods: A list of method names.
#     Raises:
#         ~aisikl.exceptions.AISBehaviorError: Raised if the methods don't match.
#     '''
#     real_methods = [op.method for op in operations]
#     expected_methods = list(expected_methods)
#     if real_methods != expected_methods:
#         raise AISBehaviorError(
#             "We expected %r but AIS did something different: %r" %
#                 (expected_methods, operations),
#             expected_methods=expected_methods,
#             operations=operations)
# 
# Path: fladgejt/helpers.py
# class CantOpenApplication(Exception):
#     '''AIS didn't open the application we wanted.
# 
#     Thrown from ``_open_...`` methods if AIS refuses to open the application
#     (e.g. the menu item is disabled for this user). The caller should catch
#     this and show a message to the user. This is only used when we know it can
#     happen -- unknown AIS behavior will cause an AISBehaviorError.
#     '''
# 
# def find_row(objects, **conditions):
#     '''Searches the list of objects for one that matches all given conditions.
# 
#     ``obj['foo'] == bar`` must be true for all ``foo=bar`` keyword arguments
#     for ``obj`` to match. The index of the first matching object is returned.
#     This is useful for table rows and similar mapping-like objects.
# 
#     :param objects: List of objects.
#     :param \*\*conditions: The conditions that the object must match.
#     Returns:
#         The index of the first object that had all the given keys and values.
#     Raises:
#         KeyError: Raised if no such object is found.
#     '''
#     for index, obj in enumerate(objects):
#         if all(obj[key] == value for key, value in conditions.items()):
#             return index
#     raise KeyError("Object not found: {!r}".format(conditions))
# 
# def find_option(objects, **conditions):
#     '''Searches the list of objects for one that matches all given conditions.
# 
#     ``obj.foo == bar`` must be true for all ``foo=bar`` keyword arguments for
#     ``obj`` to match. The index of the first matching object is returned. This
#     is useful for combo box options and similar objects.
# 
#     :param objects: List of objects.
#     :param \*\*conditions: The conditions that the object must match.
#     Returns:
#         The index of the first object that had all the given keys and values.
#     Raises:
#         KeyError: Raised if no such object is found.
#     '''
#     for index, obj in enumerate(objects):
#         if all(getattr(obj, key) == value for key, value in conditions.items()):
#             return index
#     raise KeyError("Object not found: {!r}".format(conditions))
# 
# def decode_key(string):
#     '''Decode the output of :func:`encode_key` back into a tuple of strings.
# 
#     See :func:`keyed_namedtuple` for the rationale.
# 
#     Args:
#         string: A string created with :func:`encode_key`.
#     Returns:
#         The tuple of strings that was originally given to :func:`encode_key`.
#     '''
#     result = []
#     for part in string.split('.'):
#         part = part.encode('ascii')
#         part += b'=' * (-len(part) % 4)
#         part = urlsafe_b64decode(part)
#         part = part.decode('utf8')
#         result.append(part)
#     return tuple(result)
# 
# Path: fladgejt/structures.py



from aisikl.app import assert_ops
from fladgejt.helpers import (
    CantOpenApplication, find_row, find_option, decode_key)
from fladgejt.structures import ZapisPredmet, ZapisVlastnost
            typ_vyucby for typ_vyucby, skratka in dvojice_typ_vyucby_skratka))

        for typ_vyucby in typy_vyucby:
            # Oznacime dany vrchol stromu.
            id = 'nR/' + cast + '/' + typ_vyucby
            app.d.castiZapisnehoListuTree.select(id)

            # Stlacime "Pridat predmet zo studijneho planu".
            with app.collect_operations() as ops:
                app.d.pridatPredmetAction.execute()

            # Mozno vyskoci chyba.
            if len(ops) == 1 and ops[0].method == 'messageBox':
                return ops[0].args[0]

            # Otvori sa novy dialog.
            app.awaited_open_dialog(ops)

            # Skusime, ci uz teraz vidime vsetky hladane predmety.
            found_all = True
            for typ_vyucby_predmetu, skratka in dvojice_typ_vyucby_skratka:
                if typ_vyucby != typ_vyucby_predmetu: continue
                try:
                    find_row(
                        app.d.predmetyTable.all_rows(), skratkaPredmet=skratka)
                except KeyError:
                    found_all = False

            if not found_all:
                # Ak nevidime, zrusime filter podla odporucaneho rocniku.

# Path: aisikl/app.py
# def assert_ops(operations, *expected_methods):
#     '''Ensures the list of collected operations contains the methods we expect.
# 
#     This is a helper method you can use after calling
#     :meth:`~Application.collect_operations`. It just looks at each operation's
#     :attr:`~Operation.method` and checks if they match.
# 
#     :param operations: The collected operations.
#     :param \*expected_methods: A list of method names.
#     Raises:
#         ~aisikl.exceptions.AISBehaviorError: Raised if the methods don't match.
#     '''
#     real_methods = [op.method for op in operations]
#     expected_methods = list(expected_methods)
#     if real_methods != expected_methods:
#         raise AISBehaviorError(
#             "We expected %r but AIS did something different: %r" %
#                 (expected_methods, operations),
#             expected_methods=expected_methods,
#             operations=operations)
# 
# Path: fladgejt/helpers.py
# class CantOpenApplication(Exception):
#     '''AIS didn't open the application we wanted.
# 
#     Thrown from ``_open_...`` methods if AIS refuses to open the application
#     (e.g. the menu item is disabled for this user). The caller should catch
#     this and show a message to the user. This is only used when we know it can
#     happen -- unknown AIS behavior will cause an AISBehaviorError.
#     '''
# 
# def find_row(objects, **conditions):
#     '''Searches the list of objects for one that matches all given conditions.
# 
#     ``obj['foo'] == bar`` must be true for all ``foo=bar`` keyword arguments
#     for ``obj`` to match. The index of the first matching object is returned.
#     This is useful for table rows and similar mapping-like objects.
# 
#     :param objects: List of objects.
#     :param \*\*conditions: The conditions that the object must match.
#     Returns:
#         The index of the first object that had all the given keys and values.
#     Raises:
#         KeyError: Raised if no such object is found.
#     '''
#     for index, obj in enumerate(objects):
#         if all(obj[key] == value for key, value in conditions.items()):
#             return index
#     raise KeyError("Object not found: {!r}".format(conditions))
# 
# def find_option(objects, **conditions):
#     '''Searches the list of objects for one that matches all given conditions.
# 
#     ``obj.foo == bar`` must be true for all ``foo=bar`` keyword arguments for
#     ``obj`` to match. The index of the first matching object is returned. This
#     is useful for combo box options and similar objects.
# 
#     :param objects: List of objects.
#     :param \*\*conditions: The conditions that the object must match.
#     Returns:
#         The index of the first object that had all the given keys and values.
#     Raises:
#         KeyError: Raised if no such object is found.
#     '''
#     for index, obj in enumerate(objects):
#         if all(getattr(obj, key) == value for key, value in conditions.items()):
#             return index
#     raise KeyError("Object not found: {!r}".format(conditions))
# 
# def decode_key(string):
#     '''Decode the output of :func:`encode_key` back into a tuple of strings.
# 
#     See :func:`keyed_namedtuple` for the rationale.
# 
#     Args:
#         string: A string created with :func:`encode_key`.
#     Returns:
#         The tuple of strings that was originally given to :func:`encode_key`.
#     '''
#     result = []
#     for part in string.split('.'):
#         part = part.encode('ascii')
#         part += b'=' * (-len(part) % 4)
#         part = urlsafe_b64decode(part)
#         part = part.decode('utf8')
#         result.append(part)
#     return tuple(result)
# 
# Path: fladgejt/structures.py



# Path: fladgejt/webui/zapis.py
from aisikl.app import assert_ops
from fladgejt.helpers import (
    CantOpenApplication, find_row, find_option, decode_key)
from fladgejt.structures import ZapisPredmet, ZapisVlastnost

            typ_vyucby for typ_vyucby, skratka in dvojice_typ_vyucby_skratka))

        for typ_vyucby in typy_vyucby:
            # Oznacime dany vrchol stromu.
            id = 'nR/' + cast + '/' + typ_vyucby
            app.d.castiZapisnehoListuTree.select(id)

            # Stlacime "Pridat predmet zo studijneho planu".
            with app.collect_operations() as ops:
                app.d.pridatPredmetAction.execute()

            # Mozno vyskoci chyba.
            if len(ops) == 1 and ops[0].method == 'messageBox':
                return ops[0].args[0]

            # Otvori sa novy dialog.
            app.awaited_open_dialog(ops)

            # Skusime, ci uz teraz vidime vsetky hladane predmety.
            found_all = True
            for typ_vyucby_predmetu, skratka in dvojice_typ_vyucby_skratka:
                if typ_vyucby != typ_vyucby_predmetu: continue
                try:
                    find_row(
                        app.d.predmetyTable.all_rows(), skratkaPredmet=skratka)
                except KeyError:
                    found_all = False

            if not found_all:
                # Ak nevidime, zrusime filter podla odporucaneho rocniku.

                index = find_option(app.d.rocnikComboBox.options, title='')