import abc
from multipledispatch import dispatch
from collections import Iterable


class DrawingObject(metaclass=abc.ABCMeta):
    def __init__(self, idx):
        self.idx = idx

    @abc.abstractmethod
    def print(self): ...


class Text(DrawingObject):

    def __init__(self, idx):
        super(Text, self).__init__(idx)

    def print(self):
        print(f"Text Object {self.idx}")


class Geo(DrawingObject):

    def __init__(self, idx):
        super(Geo, self).__init__(idx)

    def print(self):
        print(f"Geo Object {self.idx}")


class Group(DrawingObject):
    def __init__(self, idx):
        super(Group, self).__init__(idx)
        self.groups = []

    @dispatch(DrawingObject)
    def add(self, obj):
        self.groups.append(obj)

    @dispatch(Iterable)
    def add(self, objs):
        for o in objs:
            self.groups.append(o)

    def print(self):
        print(f"Group Object {self.idx}")
        for o in self.groups:
            o.print()


t = {k: Text(k) for k in range(5)}
g = {k: Geo(k) for k in range(5)}

group_0 = Group(0)
group_1 = Group(1)

for i in range(5):
    group_0.add(t[i])

group_0.add([g[i] for i in range(5)])

group_0.add(group_1)

2aaa2c73e7631cc1610a62e490cb51c67968daaf
<mask token>


class Text(DrawingObject):

    def __init__(self, idx):
        super(Text, self).__init__(idx)

    def print(self):
        print(f'Text Object {self.idx}')


class Geo(DrawingObject):

    def __init__(self, idx):
        super(Geo, self).__init__(idx)

    def print(self):
        print(f'Geo Object {self.idx}')


class Group(DrawingObject):

    def __init__(self, idx):
        super(Group, self).__init__(idx)
        self.groups = []

    @dispatch(DrawingObject)
    def add(self, obj):
        self.groups.append(obj)

    @dispatch(Iterable)
    def add(self, objs):
        for o in objs:
            self.groups.append(o)

    def print(self):
        print(f'Group Object {self.idx}')
        for o in self.groups:
            o.print()


<mask token>

<mask token>


class DrawingObject(metaclass=abc.ABCMeta):
    <mask token>
    <mask token>


class Text(DrawingObject):

    def __init__(self, idx):
        super(Text, self).__init__(idx)

    def print(self):
        print(f'Text Object {self.idx}')


class Geo(DrawingObject):

    def __init__(self, idx):
        super(Geo, self).__init__(idx)

    def print(self):
        print(f'Geo Object {self.idx}')


class Group(DrawingObject):

    def __init__(self, idx):
        super(Group, self).__init__(idx)
        self.groups = []

    @dispatch(DrawingObject)
    def add(self, obj):
        self.groups.append(obj)

    @dispatch(Iterable)
    def add(self, objs):
        for o in objs:
            self.groups.append(o)

    def print(self):
        print(f'Group Object {self.idx}')
        for o in self.groups:
            o.print()


<mask token>

<mask token>


class DrawingObject(metaclass=abc.ABCMeta):

    def __init__(self, idx):
        self.idx = idx

    @abc.abstractmethod
    def print(self):
        ...


class Text(DrawingObject):

    def __init__(self, idx):
        super(Text, self).__init__(idx)

    def print(self):
        print(f'Text Object {self.idx}')


class Geo(DrawingObject):

    def __init__(self, idx):
        super(Geo, self).__init__(idx)

    def print(self):
        print(f'Geo Object {self.idx}')


class Group(DrawingObject):

    def __init__(self, idx):
        super(Group, self).__init__(idx)
        self.groups = []

    @dispatch(DrawingObject)
    def add(self, obj):
        self.groups.append(obj)

    @dispatch(Iterable)
    def add(self, objs):
        for o in objs:
            self.groups.append(o)

    def print(self):
        print(f'Group Object {self.idx}')
        for o in self.groups:
            o.print()


<mask token>
for i in range(5):
    group_0.add(t[i])
group_0.add([g[i] for i in range(5)])
group_0.add(group_1)

<mask token>


class DrawingObject(metaclass=abc.ABCMeta):

    def __init__(self, idx):
        self.idx = idx

    @abc.abstractmethod
    def print(self):
        ...


class Text(DrawingObject):

    def __init__(self, idx):
        super(Text, self).__init__(idx)

    def print(self):
        print(f'Text Object {self.idx}')


class Geo(DrawingObject):

    def __init__(self, idx):
        super(Geo, self).__init__(idx)

    def print(self):
        print(f'Geo Object {self.idx}')


class Group(DrawingObject):

    def __init__(self, idx):
        super(Group, self).__init__(idx)
        self.groups = []

    @dispatch(DrawingObject)
    def add(self, obj):
        self.groups.append(obj)

    @dispatch(Iterable)
    def add(self, objs):
        for o in objs:
            self.groups.append(o)

    def print(self):
        print(f'Group Object {self.idx}')
        for o in self.groups:
            o.print()


t = {k: Text(k) for k in range(5)}
g = {k: Geo(k) for k in range(5)}
group_0 = Group(0)
group_1 = Group(1)
for i in range(5):
    group_0.add(t[i])
group_0.add([g[i] for i in range(5)])
group_0.add(group_1)

import abc
from multipledispatch import dispatch
from collections import Iterable


class DrawingObject(metaclass=abc.ABCMeta):
    def __init__(self, idx):
        self.idx = idx

    @abc.abstractmethod
    def print(self): ...


class Text(DrawingObject):

    def __init__(self, idx):
        super(Text, self).__init__(idx)

    def print(self):
        print(f"Text Object {self.idx}")


class Geo(DrawingObject):

    def __init__(self, idx):
        super(Geo, self).__init__(idx)

    def print(self):
        print(f"Geo Object {self.idx}")


class Group(DrawingObject):
    def __init__(self, idx):
        super(Group, self).__init__(idx)
        self.groups = []

    @dispatch(DrawingObject)
    def add(self, obj):
        self.groups.append(obj)

    @dispatch(Iterable)
    def add(self, objs):
        for o in objs:
            self.groups.append(o)

    def print(self):
        print(f"Group Object {self.idx}")
        for o in self.groups:
            o.print()


t = {k: Text(k) for k in range(5)}
g = {k: Geo(k) for k in range(5)}

group_0 = Group(0)
group_1 = Group(1)

for i in range(5):
    group_0.add(t[i])

group_0.add([g[i] for i in range(5)])

group_0.add(group_1)
