图片解析应用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
413 B

  1. class Document:
  2. """
  3. Represents a single document in a result set
  4. """
  5. def __init__(self, id, payload=None, **fields):
  6. self.id = id
  7. self.payload = payload
  8. for k, v in fields.items():
  9. setattr(self, k, v)
  10. def __repr__(self):
  11. return f"Document {self.__dict__}"
  12. def __getitem__(self, item):
  13. value = getattr(self, item)
  14. return value