# 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

        if not self._select_text_ciselnik(
                app, stredisko, 'strediskoSkratkaTextField',
                app.d.zmazatStrediskoAction.component_ids[0],
                app.d.vybratStrediskoAction.component_ids[0], 'skratka'):
            return "Stredisko neexistuje."

        app.d.zobrazitPredmetyAction.execute()

        while not app.d.predmetyTable.is_end_of_data:
            app.d.predmetyTable.scroll_down(10)

        return None

    def zapis_ponuka_vyhladaj(self, zapisny_list_key, fakulta, stredisko,
                              filter_skratka, filter_nazov):
        try:
            app = self._open_zapis_predmetov_app(zapisny_list_key)
        except CantOpenApplication:
            return [[], UNAVAILABLE]

        # Otvorime ponuku predmetov a vyhladame predmety.
        message = self.__query_ponuka_predmetov(
            app, fakulta, stredisko, filter_skratka, filter_nazov)
        if message:
            return [[], message]

        if app.d.predmetyTable.truncated:
            message = "Neboli načítané všetky dáta. Upresnite kritériá vyhľadávania."


# 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


        if not self._select_text_ciselnik(
                app, stredisko, 'strediskoSkratkaTextField',
                app.d.zmazatStrediskoAction.component_ids[0],
                app.d.vybratStrediskoAction.component_ids[0], 'skratka'):
            return "Stredisko neexistuje."

        app.d.zobrazitPredmetyAction.execute()

        while not app.d.predmetyTable.is_end_of_data:
            app.d.predmetyTable.scroll_down(10)

        return None

    def zapis_ponuka_vyhladaj(self, zapisny_list_key, fakulta, stredisko,
                              filter_skratka, filter_nazov):
        try:
            app = self._open_zapis_predmetov_app(zapisny_list_key)
        except CantOpenApplication:
            return [[], UNAVAILABLE]

        # Otvorime ponuku predmetov a vyhladame predmety.
        message = self.__query_ponuka_predmetov(
            app, fakulta, stredisko, filter_skratka, filter_nazov)
        if message:
            return [[], message]

        if app.d.predmetyTable.truncated:
            message = "Neboli načítané všetky dáta. Upresnite kritériá vyhľadávania."


        result = [ZapisPredmet(skratka=row['skratkaPredmet'],