# Path: core/ezdxf/lldxf/tags.py
# COMMENT_CODE = 999
# def write_tags(stream, tags):
# def text2tags(text):
#     def __init__(self):
#     def DWGCODEPAGE(self, value):
#     def ACADVER(self, value):
#     def HANDSEED(self, value):
# def dxf_info(stream):
#     def write(self, stream):
#     def from_text(cls, text):
#     def __copy__(self):
#     def get_handle(self):
#     def replace_handle(self, new_handle):
#     def dxftype(self):
#     def has_tag(self, code):
#     def find_first(self, code, default=ValueError):
#     def get_first_tag(self, code, default=ValueError):
#     def find_all(self, code):
#     def tag_index(self, code, start=0, end=None):
#     def update(self, code, value):
#     def set_first(self, code, value):
#     def remove_tags(self, codes):
#     def collect_consecutive_tags(self, codes, start=0, end=None):
#     def __init__(self, tags, splitcode=0):
#     def _build_groups(self, tags, splitcode):
#         def append(tag):  # first do nothing, skip tags in front of the first split tag
#     def get_name(self, index):
#     def from_text(cls, text, splitcode=0):
# def strip_tags(tags, codes):
#     def __init__(self, code, tags):
#     def __getitem__(self, item):
#     def decompress(self):
#     def write(self, stream):
# class DXFInfo(object):
# class Tags(list):
# class TagGroups(list):
# class CompressedTags(object):


from itertools import islice
from ..lldxf.tags import TagGroups, DXFStructureError, write_tags, Tags
    name = 'acdsdata'

    def __init__(self, tags, drawing):
        self.entities = []  # stores AcDsData objects
        self.section_info = []
        self.drawing = drawing
        if tags is not None:
            self._build(tags)

    @property
    def dxffactory(self):
        return self.drawing.dxffactory

    @property
    def entitydb(self):
        return self.drawing.entitydb

    def _build(self, tags):
        if tags[0] != (0, 'SECTION') or tags[1] != (2, self.name.upper()) or tags[-1] != (0, 'ENDSEC'):
            raise DXFStructureError("Critical structure error in {} section.".format(self.name.upper()))

        if len(tags) == 3:  # empty entities section
            return

        start_index = 2
        while tags[start_index].code != 0:
            self.section_info.append(tags[start_index])
            start_index += 1

        for group in TagGroups(islice(tags, start_index, len(tags)-1)):

# Path: core/ezdxf/lldxf/tags.py
# COMMENT_CODE = 999
# def write_tags(stream, tags):
# def text2tags(text):
#     def __init__(self):
#     def DWGCODEPAGE(self, value):
#     def ACADVER(self, value):
#     def HANDSEED(self, value):
# def dxf_info(stream):
#     def write(self, stream):
#     def from_text(cls, text):
#     def __copy__(self):
#     def get_handle(self):
#     def replace_handle(self, new_handle):
#     def dxftype(self):
#     def has_tag(self, code):
#     def find_first(self, code, default=ValueError):
#     def get_first_tag(self, code, default=ValueError):
#     def find_all(self, code):
#     def tag_index(self, code, start=0, end=None):
#     def update(self, code, value):
#     def set_first(self, code, value):
#     def remove_tags(self, codes):
#     def collect_consecutive_tags(self, codes, start=0, end=None):
#     def __init__(self, tags, splitcode=0):
#     def _build_groups(self, tags, splitcode):
#         def append(tag):  # first do nothing, skip tags in front of the first split tag
#     def get_name(self, index):
#     def from_text(cls, text, splitcode=0):
# def strip_tags(tags, codes):
#     def __init__(self, code, tags):
#     def __getitem__(self, item):
#     def decompress(self):
#     def write(self, stream):
# class DXFInfo(object):
# class Tags(list):
# class TagGroups(list):
# class CompressedTags(object):


# Path: core/ezdxf/sections/acdsdata.py
from itertools import islice
from ..lldxf.tags import TagGroups, DXFStructureError, write_tags, Tags

    name = 'acdsdata'

    def __init__(self, tags, drawing):
        self.entities = []  # stores AcDsData objects
        self.section_info = []
        self.drawing = drawing
        if tags is not None:
            self._build(tags)

    @property
    def dxffactory(self):
        return self.drawing.dxffactory

    @property
    def entitydb(self):
        return self.drawing.entitydb

    def _build(self, tags):
        if tags[0] != (0, 'SECTION') or tags[1] != (2, self.name.upper()) or tags[-1] != (0, 'ENDSEC'):
            raise DXFStructureError("Critical structure error in {} section.".format(self.name.upper()))

        if len(tags) == 3:  # empty entities section
            return

        start_index = 2
        while tags[start_index].code != 0:
            self.section_info.append(tags[start_index])
            start_index += 1

        for group in TagGroups(islice(tags, start_index, len(tags)-1)):

            self._append_entity(AcDsData(Tags(group)))  # tags have no subclasses