Guest User

Untitled

a guest
May 23rd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. class CursorKind(object):
  2. """
  3. A CursorKind describes the kind of entity that a cursor points to.
  4. """
  5.  
  6. # The unique kind objects, indexed by id.
  7. _kinds = {}
  8. _name_map = None
  9.  
  10. def __init__(self, value):
  11. if value is in CursorKind._kinds:
  12. raise ValueError,'CursorKind already loaded'
  13. self.value = value
  14. CursorKind._kinds[value] = self
  15. CursorKind._name_map = None
  16.  
  17. def from_param(self):
  18. return self.value
  19.  
  20. @property
  21. def name(self):
  22. """Get the enumeration name of this cursor kind."""
  23. if self._name_map is None:
  24. self._name_map = {}
  25. for key,value in CursorKind._kinds.items():
  26. self._name_map[value] = key
  27. return self._name_map[self]
Add Comment
Please, Sign In to add comment