#------------------------------------------------------------------
class SourceDescriptor:
+ """
+ A SourceDescriptor should be considered immutable.
+ """
def __str__(self):
assert False # To catch all places where a descriptor is used directly as a filename
def get_filenametable_entry(self):
return self.filename
+ def __eq__(self, other):
+ return isinstance(other, FileSourceDescriptor) and self.filename == other.filename
+
+ def __hash__(self):
+ return hash(self.filename)
+
def __repr__(self):
return "<FileSourceDescriptor:%s>" % self.filename
def get_filenametable_entry(self):
return "stringsource"
+ def __hash__(self):
+ return hash(self.name)
+
+ def __eq__(self, other):
+ return isinstance(other, StringSourceDescriptor) and self.name == other.name
+
def __repr__(self):
return "<StringSourceDescriptor:%s>" % self.name