Commit 7e50d961 authored by da-woods's avatar da-woods Committed by GitHub

Removed `same_as` methods from Plex.Actions.Action (GH-3847)

It seems to be unused and it looked like the existing implementation was faulty.
parent 8708b746
...@@ -2,17 +2,14 @@ ...@@ -2,17 +2,14 @@
cdef class Action: cdef class Action:
cdef perform(self, token_stream, text) cdef perform(self, token_stream, text)
cpdef same_as(self, other)
cdef class Return(Action): cdef class Return(Action):
cdef object value cdef object value
cdef perform(self, token_stream, text) cdef perform(self, token_stream, text)
cpdef same_as(self, other)
cdef class Call(Action): cdef class Call(Action):
cdef object function cdef object function
cdef perform(self, token_stream, text) cdef perform(self, token_stream, text)
cpdef same_as(self, other)
cdef class Method(Action): cdef class Method(Action):
cdef str name cdef str name
...@@ -21,7 +18,6 @@ cdef class Method(Action): ...@@ -21,7 +18,6 @@ cdef class Method(Action):
cdef class Begin(Action): cdef class Begin(Action):
cdef object state_name cdef object state_name
cdef perform(self, token_stream, text) cdef perform(self, token_stream, text)
cpdef same_as(self, other)
cdef class Ignore(Action): cdef class Ignore(Action):
cdef perform(self, token_stream, text) cdef perform(self, token_stream, text)
......
...@@ -6,14 +6,10 @@ Python Lexical Analyser ...@@ -6,14 +6,10 @@ Python Lexical Analyser
Actions for use in token specifications Actions for use in token specifications
""" """
class Action(object): class Action(object):
def perform(self, token_stream, text): def perform(self, token_stream, text):
pass # abstract pass # abstract
def same_as(self, other):
return self is other
def __copy__(self): def __copy__(self):
return self # immutable, no need to copy return self # immutable, no need to copy
...@@ -33,9 +29,6 @@ class Return(Action): ...@@ -33,9 +29,6 @@ class Return(Action):
def perform(self, token_stream, text): def perform(self, token_stream, text):
return self.value return self.value
def same_as(self, other):
return isinstance(other, Return) and self.value == other.value
def __repr__(self): def __repr__(self):
return "Return(%r)" % self.value return "Return(%r)" % self.value
...@@ -54,9 +47,6 @@ class Call(Action): ...@@ -54,9 +47,6 @@ class Call(Action):
def __repr__(self): def __repr__(self):
return "Call(%s)" % self.function.__name__ return "Call(%s)" % self.function.__name__
def same_as(self, other):
return isinstance(other, Call) and self.function is other.function
class Method(Action): class Method(Action):
""" """
...@@ -79,9 +69,6 @@ class Method(Action): ...@@ -79,9 +69,6 @@ class Method(Action):
if self.kwargs is not None else '') if self.kwargs is not None else '')
return "Method(%s%s%s)" % (self.name, ', ' if kwargs else '', kwargs) return "Method(%s%s%s)" % (self.name, ', ' if kwargs else '', kwargs)
def same_as(self, other):
return isinstance(other, Method) and self.name == other.name and self.kwargs == other.kwargs
class Begin(Action): class Begin(Action):
""" """
...@@ -99,9 +86,6 @@ class Begin(Action): ...@@ -99,9 +86,6 @@ class Begin(Action):
def __repr__(self): def __repr__(self):
return "Begin(%s)" % self.state_name return "Begin(%s)" % self.state_name
def same_as(self, other):
return isinstance(other, Begin) and self.state_name == other.state_name
class Ignore(Action): class Ignore(Action):
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment