def __init__(self, data=None, name=None):
    self.name = None
    self.base = []
    self.description = None
    self.version = None
    self.resources = []
    self.data_types = []
    self.ownership = []
    self.sla = []
    self.license = None
    self.categories = []
    self.tags = []
    self.security = None
    self.community = None

    if data is not None:
      if name is not None:
        raise APIDescriptionException('name attribute must be None when the '
                                      'data field is provided')
      else:
        init_field(self, data, NAME, True)
        init_field(self, data, DESCRIPTION)
        init_field(self, data, BASE)
        init_field(self, data, CATEGORIES)
        init_field(self, data, TAGS)
        init_field(self, data, LICENSE)
        init_field(self, data, COMMUNITY)
        if data.has_key(RESOURCES):
          for resource in data[RESOURCES]:
            self.resources.append(Resource(data=resource))
        if data.has_key(DATA_TYPES):
          for data_type in data[DATA_TYPES]:
            self.data_types.append(NamedTypeDef(data=data_type))
        if data.has_key(OWNERSHIP):
          for owner in data[OWNERSHIP]:
            self.ownership.append(Owner(data=owner))
        if data.has_key(SLA):
          for sla in data[SLA]:
            self.sla.append(SLADef(data=sla))
        if data.has_key(VERSION):
          self.version = Version(data=data[VERSION])
        self.validate()
    else:
      if name is None:
        raise APIDescriptionException('name attribute must not be None when '
                                      'the data field is not provided')
      else:
        self.name = name
Creates a new API instance using the provided input data. This constructor
dataset/ETHPy150Open hiranya911/rest-coder/python-lib/api.py/API.__init__