Exemple #1
0
    def __init__(self,
                 query=None,
                 name=None,
                 gender=None,
                 is_animate=None,
                 attributes=None,
                 kind=None,
                 rel2xxx=None,
                 carrying=None):
        if attributes is None:
            attributes = []
        if rel2xxx is None:
            rel2xxx = {}
        if carrying is None:
            carrying = []

        self.query = query
        if self.query:
            assert Query.is_valid(self.query)

        self.name = name
        if self.name is not None:
            assert self.name
            assert isinstance(self.name, tuple)

        self.gender = gender
        if self.gender:
            assert Gender.is_valid(self.gender)

        self.is_animate = is_animate
        if self.is_animate:
            assert isinstance(self.is_animate, bool)

        self.attributes = attributes
        assert isinstance(self.attributes, list)
        for s in self.attributes:
            assert s
            assert isinstance(s, basestring)

        self.kind = kind
        if self.kind:
            assert isinstance(self.kind, basestring)

        self.rel2xxx = rel2xxx
        for rel, xxx in self.rel2xxx.iteritems():
            assert Relation.is_valid(rel)
            assert isinstance(xxx, list)
            for xx in xxx:
                assert isinstance(xx, list)
                for x in xx:
                    assert isinstance(x, int)

        self.carrying = carrying
        for x in self.carrying:
            assert isinstance(x, int)

        self.location_history = LocationHistory()