diff --git a/ocrd_models/ocrd_models/ocrd_page_generateds.py b/ocrd_models/ocrd_models/ocrd_page_generateds.py index 46af7ebd2..38373410a 100644 --- a/ocrd_models/ocrd_models/ocrd_page_generateds.py +++ b/ocrd_models/ocrd_models/ocrd_page_generateds.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # -# Generated Fri May 29 23:29:23 2020 by generateDS.py version 2.35.20. +# Generated Sat Jun 6 14:44:44 2020 by generateDS.py version 2.35.20. # Python 3.6.9 (default, Apr 18 2020, 01:56:04) [GCC 8.4.0] # # Command line options: @@ -16,7 +16,7 @@ # repo/assets/data/schema/data/2019.xsd # # Command line: -# /home/kba/ocrd_all/venv/bin/generateDS -f --root-element="PcGts" -o "ocrd_models/ocrd_models/ocrd_page_generateds.py" --disable-generatedssuper-lookup --user-methods="ocrd_models/ocrd_page_user_methods.py" repo/assets/data/schema/data/2019.xsd +# /home/kba/env/py3-disht/bin/generateDS -f --root-element="PcGts" -o "ocrd_models/ocrd_models/ocrd_page_generateds.py" --disable-generatedssuper-lookup --user-methods="ocrd_models/ocrd_page_user_methods.py" repo/assets/data/schema/data/2019.xsd # # Current working directory (os.getcwd()): # core @@ -5461,6 +5461,9 @@ def clear_AllIndexed(self): def extend_AllIndexed(self, elements, validate_continuity=False): """ Add all elements in list ``elements``, respecting ``@index`` order. + With ``validate_continuity``, check that all new elements come after all old elements + (or raise an exception). + Otherwise, ensure this condition silently (by increasing ``@index`` accordingly). """ if not isinstance(elements, list): elements = [elements] @@ -5483,7 +5486,6 @@ def extend_AllIndexed(self, elements, validate_continuity=False): elif isinstance(element, UnorderedGroupIndexedType): # pylint: disable=undefined-variable self.add_UnorderedGroupIndexed(element) return self.get_AllIndexed() - # pylint: disable=line-too-long,invalid-name,missing-module-docstring def sort_AllIndexed(self, validate_uniqueness=True): """ @@ -6307,6 +6309,9 @@ def clear_AllIndexed(self): def extend_AllIndexed(self, elements, validate_continuity=False): """ Add all elements in list ``elements``, respecting ``@index`` order. + With ``validate_continuity``, check that all new elements come after all old elements + (or raise an exception). + Otherwise, ensure this condition silently (by increasing ``@index`` accordingly). """ if not isinstance(elements, list): elements = [elements] @@ -6329,7 +6334,6 @@ def extend_AllIndexed(self, elements, validate_continuity=False): elif isinstance(element, UnorderedGroupIndexedType): # pylint: disable=undefined-variable self.add_UnorderedGroupIndexed(element) return self.get_AllIndexed() - # pylint: disable=line-too-long,invalid-name,missing-module-docstring def sort_AllIndexed(self, validate_uniqueness=True): """ diff --git a/ocrd_models/ocrd_page_user_methods.py b/ocrd_models/ocrd_page_user_methods.py index 27714c408..ff39000eb 100644 --- a/ocrd_models/ocrd_page_user_methods.py +++ b/ocrd_models/ocrd_page_user_methods.py @@ -82,12 +82,14 @@ def show(self): # generated superclass file and also section "User Methods" in # the documentation, as well as the examples below. -def _add_method(class_re, method_name): +def _add_method(class_re, method_name, file_name=None): """ Loads a file ./ocrd_page_user_methods/{{ method_name }}.py and defines a MethodSpec applying to class_re """ source = [] - with codecs.open(join(dirname(__file__), 'ocrd_page_user_methods', '%s.py' % method_name)) as f: + if not file_name: + file_name = method_name + with codecs.open(join(dirname(__file__), 'ocrd_page_user_methods', '%s.py' % file_name)) as f: for line in f.readlines(): source.append(' %s' % line if line else line) return MethodSpec(name=method_name, class_names=class_re, source=''.join(source)) @@ -102,7 +104,7 @@ def _add_method(class_re, method_name): _add_method(r'^(OrderedGroupType|OrderedGroupIndexedType)$', 'clear_AllIndexed'), _add_method(r'^(OrderedGroupType|OrderedGroupIndexedType)$', 'extend_AllIndexed'), _add_method(r'^(OrderedGroupType|OrderedGroupIndexedType)$', 'sort_AllIndexed'), - _add_method(r'^(OrderedGroupType|OrderedGroupIndexedType)$', 'exportChildren'), + _add_method(r'^(OrderedGroupType|OrderedGroupIndexedType)$', 'exportChildren', 'exportChildren_GroupType'), _add_method(r'^(UnorderedGroupType|UnorderedGroupIndexedType)$', 'get_UnorderedGroupChildren'), _add_method(r'^(PageType)$', 'get_AllRegions'), ) diff --git a/ocrd_models/ocrd_page_user_methods/exportChildren.py b/ocrd_models/ocrd_page_user_methods/exportChildren_GroupType.py similarity index 100% rename from ocrd_models/ocrd_page_user_methods/exportChildren.py rename to ocrd_models/ocrd_page_user_methods/exportChildren_GroupType.py