def __init__(self, game):
        self.offerings = {}
        self.resources = {}
        self.issues = []

        total_yaml_errors = 0
        def add_infos(key, item):
            num_errors = len(item.errors)
            if num_errors > 0 or len(item.warnings) > 0:
                self.issues.append((key, {
                    'errors': item.errors,
                    'warnings': item.warnings
                }))
            return num_errors

        yaml_path = unicode(get_absolute_path(join_path(game.path, 'storeitems.yaml')))
        if path_exists(yaml_path):
            try:
                with open(yaml_path, 'r') as f:
                    items_meta = yaml.load(f)

                    resource_keys = set()
                    offering_keys = set()
                    if isinstance(items_meta, list):
                        for index, m in enumerate(items_meta):
                            resource = StoreResource(game, m, resource_keys)
                            resource.index = index

                            total_yaml_errors += add_infos(resource.key, resource)
                            self.resources[resource.key] = resource

                        index = 0
                        items_meta_end = len(items_meta) - 1
                        for m in items_meta:
                            try:
                                m['output'] = {m['key']: 1}
                            except KeyError:
                                raise StoreError('Store item YAML item missing key')

                            offering = StoreOffering(game, m, offering_keys, resource_keys)
                            # put unavailable items at the end
                            if offering.available:
                                offering.index = index
                                index += 1
                            else:
                                offering.index = items_meta_end
                                items_meta_end -= 1

                            total_yaml_errors += add_infos(offering.key, offering)
                            self.offerings[offering.key] = offering

                    elif isinstance(items_meta, dict):
                        resource_meta = items_meta.get('resources')
                        if not isinstance(resource_meta, list):
                            raise StoreError('Store items YAML file must contain "resources"')

                        for index, m in enumerate(resource_meta):
                            resource = StoreResource(game, m, resource_keys)
                            resource.index = index

                            total_yaml_errors += add_infos(resource.key, resource)
                            self.resources[resource.key] = resource

                        offerings_meta = items_meta.get('offerings')
                        if not isinstance(offerings_meta, list):
                            raise StoreError('Store items YAML file must contain "offerings"')

                        index = 0
                        items_meta_end = len(offerings_meta) - 1
                        for m in offerings_meta:
                            offering = StoreOffering(game, m, offering_keys, resource_keys)
                            # put unavailable items at the end
                            if offering.available:
                                offering.index = index
                                index += 1
                            else:
                                offering.index = items_meta_end
                                items_meta_end -= 1


                            total_yaml_errors += add_infos(offering.key, offering)
                            self.offerings[offering.key] = offering

                    else:
                        raise StoreError('Store items YAML file must be a dictionary or list')
            except (IOError, yaml.YAMLError) as e:
                LOG.error('Failed loading store items: %s', str(e))
                raise StoreError('Failed loading storeitems.yaml file: %s' % str(e))
        else:
            raise StoreUnsupported()

        if total_yaml_errors > 0:
            raise ValidationException(self.issues)

        self.store_users = StoreUserList(game, self)
dataset/ETHPy150Open turbulenz/turbulenz_local/turbulenz_local/models/apiv1/store.py/GameStoreItems.__init__/original