New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding __hash__'s where there are __eq__'s #365

Merged
merged 1 commit into from Mar 31, 2014
File filter...
Filter file types
Jump to file or symbol
Failed to load files and symbols.
+648 −0
Diff settings

Always

Just for now

@@ -196,6 +196,15 @@ def __eq__(self, expr):

### PUBLIC PROPERTIES ###

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(CodeBlock, self).__hash__()

@property
def hide(self):
r'''Is true when code block should hide.
@@ -95,6 +95,15 @@ def __getslice__(self, start_index, stop_index):
result = [self[n] for n in range(start_index, stop_index)]
return tuple(result)

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(CyclicTuple, self).__hash__()

def __str__(self):
r'''String representation of cyclic tuple.
@@ -259,6 +259,15 @@ def __getstate__(self):
'''
return vars(self)

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(PayloadTree, self).__hash__()

def __len__(self):
r'''Number of children in payload tree.
@@ -42,6 +42,15 @@ def __eq__(self, expr):

### PUBLIC PROPERTIES ###

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(StatalServer, self).__hash__()

@property
def cyclic_tree(self):
r'''Statal server cyclic tree.
@@ -123,6 +123,15 @@ def __eq__(self, expr):

### PRIVATE METHODS ###

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(StatalServerCursor, self).__hash__()

def _get_manifest_payload_of_next_n_nodes_at_level(self, n=1, level=-1):
result = []
#print
@@ -61,6 +61,15 @@ def __getstate__(self):
state[name] = getattr(self, name)
return state

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(TreeNode, self).__hash__()

def __ne__(self, expr):
r'''Is true when tree node does not equal `expr`. Otherwise false.
@@ -67,6 +67,15 @@ def __getnewargs__(self):
'''
return (self._collection, self.item_class)

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(TypedCollection, self).__hash__()

def __iter__(self):
r'''Iterates typed collection.
@@ -78,6 +78,15 @@ def __eq__(self, arg):

### PRIVATE PROPERTIES ###

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(Annotation, self).__hash__()

@property
def _repr_specification(self):
return new(
@@ -61,6 +61,15 @@ def __eq__(self, expr):

### PRIVATE PROPERTIES ###

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(Arpeggio, self).__hash__()

@property
def _lilypond_format(self):
return r'\arpeggio'
@@ -203,6 +203,15 @@ def __format__(self, format_specification=''):
return self._lilypond_format
return str(self)

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(Articulation, self).__hash__()

def __illustrate__(self):
r'''Illustrates articulation.
@@ -68,6 +68,15 @@ def __eq__(self, arg):

### PRIVATE PROPERTIES ###

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(BarLine, self).__hash__()

@property
def _contents_repr_string(self):
return repr(self.abbreviation)
@@ -56,6 +56,15 @@ def __eq__(self, expr):
return True
return False

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(BendAfter, self).__hash__()

def __str__(self):
r'''String representation of bend after.
@@ -175,6 +175,15 @@ def __format__(self, format_specification=''):
superclass = super(Clef, self)
return superclass.__format__(format_specification=format_specification)

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(Clef, self).__hash__()

def __ne__(self, arg):
r'''Is true when clef of `arg` does not equal clef name of clef.
Otherwise false.
@@ -148,6 +148,15 @@ def __eq__(self, expr):

### PRIVATE PROPERTIES ###

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(Dynamic, self).__hash__()

@property
def _contents_repr_string(self):
return repr(self._name)
@@ -67,6 +67,15 @@ def __eq__(self, arg):
return True
return False

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(IndicatorExpression, self).__hash__()

def __repr__(self):
'''Gets interpreter representation of indicator expression.
@@ -77,6 +77,15 @@ def __eq__(self, expr):

### PRIVATE PROPERTIES ###

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(KeyCluster, self).__hash__()

@property
def _lilypond_format_bundle(self):
from abjad.tools import markuptools
@@ -65,6 +65,15 @@ def __eq__(self, expr):
return True
return False

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(KeySignature, self).__hash__()

def __str__(self):
r'''String representation of key signature.
@@ -41,6 +41,15 @@ def __eq__(self, expr):
'''
return isinstance(expr, type(self))

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(LaissezVibrer, self).__hash__()

def __str__(self):
r'''String representation of laissez vibrer.
@@ -121,6 +121,15 @@ def __format__(self, format_specification=''):

### PRIVATE PROPERTIES ###

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(LilyPondCommand, self).__hash__()

@property
def _contents_repr_string(self):
return repr(self.name)
@@ -81,6 +81,15 @@ def __eq__(self, expr):
return self._contents_string == expr._contents_string
return False

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(LilyPondComment, self).__hash__()

def __str__(self):
r'''Gets string format of LilyPond comment.
@@ -78,6 +78,15 @@ def __eq__(self, expr):
return self.staff is expr.staff
return False

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(StaffChange, self).__hash__()

def __str__(self):
r'''Gets string format of staff change.
@@ -127,6 +127,15 @@ def __format__(self, format_specification=''):
return systemtools.StorageFormatManager.get_storage_format(self)
return str(self)

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(StemTremolo, self).__hash__()

def __str__(self):
r'''String representation of stem tremolo.
@@ -191,6 +191,15 @@ def __format__(self, format_specification=''):
return self._lilypond_format
return str(self)

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(Tempo, self).__hash__()

def __lt__(self, arg):
r'''Is true when `arg` is a tempo with quarters per minute greater than
that of this tempo. Otherwise false.
@@ -172,6 +172,15 @@ def __gt__(self, arg):
else:
raise TypeError

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(TimeSignature, self).__hash__()

def __le__(self, arg):
r'''Is true when duration of time signature is less than duration of
`arg`. Otherwise false.
@@ -86,6 +86,15 @@ def __eq__(self, expr):

### PRIVATE PROPERTIES ###

def __hash__(self):
r'''Hashes my class.
Required to be explicitely re-defined on Python 3 if __eq__ changes.
Returns integer.
'''
return super(SpacingIndication, self).__hash__()

@property
def _repr_specification(self):
return new(
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.