# 背景：在使用 Python 进行《我是动物饲养员》这个游戏的开发过程中，有一个代码片段要求定义
# 动物园、动物、猫、狗四个类。 -- Done

# 这个类可以使用如下形式为动物园增加一只猫：
# if __name__ == '__main__':
#     # 实例化动物园
#     z = Zoo('时间动物园')
#     # 实例化一只猫，属性包括名字、类型、体型、性格
#     cat1 = Cat('大花猫 1', '食肉', '小', '温顺')
#     # 增加一只猫到动物园
#     z.add_animal(cat1)
#     # 动物园是否有猫这种动物
#     have_cat = hasattr(z, 'Cat')

# 具体要求：
# 定义“动物”、“猫”、“狗”、“动物园”四个类 -- Done
#   动物类不允许被实例化。 -- Done
# 动物类要求定义“类型”、“体型”、“性格”、“是否属于凶猛动物”四个属性，-- Done
#   是否属于凶猛动物的判断标准是：
#       “体型 >= 中等”并且是“食肉类型”同时“性格凶猛”。 -- Done
# 猫类要求有“叫声”、“是否适合作为宠物”以及“名字”三个属性，
#   其中“叫声”作为类属性，除凶猛动物外都适合作为宠物，
#   猫类继承自动物类。狗类属性与猫类相同，继承自动物类。
# 动物园类要求有“名字”属性和“添加动物”的方法，
#   “添加动物”方法要实现同一只动物（同一个动物实例）不能被重复添加的功能。

from abc import ABCMeta,abstractmethod

def shifouxiongmeng(leixing,tixing,xingge):
    if leixing == '食肉' and tixing >= 10 and xingge == '凶猛': # tixing 仅为假设值
        return True
    else:
        return False

class Zoo(object):
    def __init__(self,ZooName):
        self.ZooName =ZooName

    def add_animal(self,animals_obj):
        if animals_obj in self.__dict__.keys():
            print('动物已经存在')
            return

class animal(metaclass=ABCMeta):
    def __init__(self,leixing,tixing,xingge,shifouxiongmengFunc):
        self.leixing = leixing
        self.tixing = tixing
        self.xingge = xingge
        self.shifouxiongmengFunc = shifouxiongmengFunc

    # @property
    # def is_feetInHome(self):
    #     if self.shifouxiongmengFunc:
    #         return False # 不适合做宠物
    #     else:
    #         return True # 适合做宠物

class Cat(animal):
    def __init__(self,animal_name,leixing,tixing,xingge,shifouxiongmengFunc):
        super().__init__(leixing,tixing,xingge,shifouxiongmengFunc)
        self.animal_name = animal_name
        self.catSpeak = 'miao'
        self.Notpet = shifouxiongmengFunc # True 为凶猛，不适合当宠物



class Dog(animal):
    def __init__(self,animal_name,leixing,tixing,xingge,shifouxiongmengFunc):
        super().__init__(leixing,tixing,xingge,shifouxiongmengFunc)
        self.animal_name = animal_name
        self.catSpeak = 'miao'
        self.Notpet = shifouxiongmengFunc # True 为凶猛，不适合当宠物

if __name__ == '__main__':
# 实例化动物园
    z = Zoo('时间动物园')
    # 实例化一只猫，属性包括名字、类型、体型、性格
    cat1 = Cat('大花猫 1', '食肉', 9, '温顺',shifouxiongmengFunc=shifouxiongmeng(leixing='食肉',tixing=9,xingge='温顺'))
    # 增加一只猫到动物园
    z.add_animal(cat1)
    # 动物园是否有猫这种动物
    have_cat = hasattr(z, 'Cat')
890bba3a8571e98401aad487bd3713af74d45f41
<mask token>


class Zoo(object):

    def __init__(self, ZooName):
        self.ZooName = ZooName
    <mask token>


class animal(metaclass=ABCMeta):

    def __init__(self, leixing, tixing, xingge, shifouxiongmengFunc):
        self.leixing = leixing
        self.tixing = tixing
        self.xingge = xingge
        self.shifouxiongmengFunc = shifouxiongmengFunc


class Cat(animal):

    def __init__(self, animal_name, leixing, tixing, xingge,
        shifouxiongmengFunc):
        super().__init__(leixing, tixing, xingge, shifouxiongmengFunc)
        self.animal_name = animal_name
        self.catSpeak = 'miao'
        self.Notpet = shifouxiongmengFunc


class Dog(animal):

    def __init__(self, animal_name, leixing, tixing, xingge,
        shifouxiongmengFunc):
        super().__init__(leixing, tixing, xingge, shifouxiongmengFunc)
        self.animal_name = animal_name
        self.catSpeak = 'miao'
        self.Notpet = shifouxiongmengFunc


<mask token>

<mask token>


class Zoo(object):

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

    def add_animal(self, animals_obj):
        if animals_obj in self.__dict__.keys():
            print('动物已经存在')
            return


class animal(metaclass=ABCMeta):

    def __init__(self, leixing, tixing, xingge, shifouxiongmengFunc):
        self.leixing = leixing
        self.tixing = tixing
        self.xingge = xingge
        self.shifouxiongmengFunc = shifouxiongmengFunc


class Cat(animal):

    def __init__(self, animal_name, leixing, tixing, xingge,
        shifouxiongmengFunc):
        super().__init__(leixing, tixing, xingge, shifouxiongmengFunc)
        self.animal_name = animal_name
        self.catSpeak = 'miao'
        self.Notpet = shifouxiongmengFunc


class Dog(animal):

    def __init__(self, animal_name, leixing, tixing, xingge,
        shifouxiongmengFunc):
        super().__init__(leixing, tixing, xingge, shifouxiongmengFunc)
        self.animal_name = animal_name
        self.catSpeak = 'miao'
        self.Notpet = shifouxiongmengFunc


<mask token>

<mask token>


def shifouxiongmeng(leixing, tixing, xingge):
    if leixing == '食肉' and tixing >= 10 and xingge == '凶猛':
        return True
    else:
        return False


class Zoo(object):

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

    def add_animal(self, animals_obj):
        if animals_obj in self.__dict__.keys():
            print('动物已经存在')
            return


class animal(metaclass=ABCMeta):

    def __init__(self, leixing, tixing, xingge, shifouxiongmengFunc):
        self.leixing = leixing
        self.tixing = tixing
        self.xingge = xingge
        self.shifouxiongmengFunc = shifouxiongmengFunc


class Cat(animal):

    def __init__(self, animal_name, leixing, tixing, xingge,
        shifouxiongmengFunc):
        super().__init__(leixing, tixing, xingge, shifouxiongmengFunc)
        self.animal_name = animal_name
        self.catSpeak = 'miao'
        self.Notpet = shifouxiongmengFunc


class Dog(animal):

    def __init__(self, animal_name, leixing, tixing, xingge,
        shifouxiongmengFunc):
        super().__init__(leixing, tixing, xingge, shifouxiongmengFunc)
        self.animal_name = animal_name
        self.catSpeak = 'miao'
        self.Notpet = shifouxiongmengFunc


<mask token>

<mask token>


def shifouxiongmeng(leixing, tixing, xingge):
    if leixing == '食肉' and tixing >= 10 and xingge == '凶猛':
        return True
    else:
        return False


class Zoo(object):

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

    def add_animal(self, animals_obj):
        if animals_obj in self.__dict__.keys():
            print('动物已经存在')
            return


class animal(metaclass=ABCMeta):

    def __init__(self, leixing, tixing, xingge, shifouxiongmengFunc):
        self.leixing = leixing
        self.tixing = tixing
        self.xingge = xingge
        self.shifouxiongmengFunc = shifouxiongmengFunc


class Cat(animal):

    def __init__(self, animal_name, leixing, tixing, xingge,
        shifouxiongmengFunc):
        super().__init__(leixing, tixing, xingge, shifouxiongmengFunc)
        self.animal_name = animal_name
        self.catSpeak = 'miao'
        self.Notpet = shifouxiongmengFunc


class Dog(animal):

    def __init__(self, animal_name, leixing, tixing, xingge,
        shifouxiongmengFunc):
        super().__init__(leixing, tixing, xingge, shifouxiongmengFunc)
        self.animal_name = animal_name
        self.catSpeak = 'miao'
        self.Notpet = shifouxiongmengFunc


if __name__ == '__main__':
    z = Zoo('时间动物园')
    cat1 = Cat('大花猫 1', '食肉', 9, '温顺', shifouxiongmengFunc=shifouxiongmeng(
        leixing='食肉', tixing=9, xingge='温顺'))
    z.add_animal(cat1)
    have_cat = hasattr(z, 'Cat')

# 背景：在使用 Python 进行《我是动物饲养员》这个游戏的开发过程中，有一个代码片段要求定义
# 动物园、动物、猫、狗四个类。 -- Done

# 这个类可以使用如下形式为动物园增加一只猫：
# if __name__ == '__main__':
#     # 实例化动物园
#     z = Zoo('时间动物园')
#     # 实例化一只猫，属性包括名字、类型、体型、性格
#     cat1 = Cat('大花猫 1', '食肉', '小', '温顺')
#     # 增加一只猫到动物园
#     z.add_animal(cat1)
#     # 动物园是否有猫这种动物
#     have_cat = hasattr(z, 'Cat')

# 具体要求：
# 定义“动物”、“猫”、“狗”、“动物园”四个类 -- Done
#   动物类不允许被实例化。 -- Done
# 动物类要求定义“类型”、“体型”、“性格”、“是否属于凶猛动物”四个属性，-- Done
#   是否属于凶猛动物的判断标准是：
#       “体型 >= 中等”并且是“食肉类型”同时“性格凶猛”。 -- Done
# 猫类要求有“叫声”、“是否适合作为宠物”以及“名字”三个属性，
#   其中“叫声”作为类属性，除凶猛动物外都适合作为宠物，
#   猫类继承自动物类。狗类属性与猫类相同，继承自动物类。
# 动物园类要求有“名字”属性和“添加动物”的方法，
#   “添加动物”方法要实现同一只动物（同一个动物实例）不能被重复添加的功能。

from abc import ABCMeta,abstractmethod

def shifouxiongmeng(leixing,tixing,xingge):
    if leixing == '食肉' and tixing >= 10 and xingge == '凶猛': # tixing 仅为假设值
        return True
    else:
        return False

class Zoo(object):
    def __init__(self,ZooName):
        self.ZooName =ZooName

    def add_animal(self,animals_obj):
        if animals_obj in self.__dict__.keys():
            print('动物已经存在')
            return

class animal(metaclass=ABCMeta):
    def __init__(self,leixing,tixing,xingge,shifouxiongmengFunc):
        self.leixing = leixing
        self.tixing = tixing
        self.xingge = xingge
        self.shifouxiongmengFunc = shifouxiongmengFunc

    # @property
    # def is_feetInHome(self):
    #     if self.shifouxiongmengFunc:
    #         return False # 不适合做宠物
    #     else:
    #         return True # 适合做宠物

class Cat(animal):
    def __init__(self,animal_name,leixing,tixing,xingge,shifouxiongmengFunc):
        super().__init__(leixing,tixing,xingge,shifouxiongmengFunc)
        self.animal_name = animal_name
        self.catSpeak = 'miao'
        self.Notpet = shifouxiongmengFunc # True 为凶猛，不适合当宠物



class Dog(animal):
    def __init__(self,animal_name,leixing,tixing,xingge,shifouxiongmengFunc):
        super().__init__(leixing,tixing,xingge,shifouxiongmengFunc)
        self.animal_name = animal_name
        self.catSpeak = 'miao'
        self.Notpet = shifouxiongmengFunc # True 为凶猛，不适合当宠物

if __name__ == '__main__':
# 实例化动物园
    z = Zoo('时间动物园')
    # 实例化一只猫，属性包括名字、类型、体型、性格
    cat1 = Cat('大花猫 1', '食肉', 9, '温顺',shifouxiongmengFunc=shifouxiongmeng(leixing='食肉',tixing=9,xingge='温顺'))
    # 增加一只猫到动物园
    z.add_animal(cat1)
    # 动物园是否有猫这种动物
    have_cat = hasattr(z, 'Cat')