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 @@
cdef class Action:
cdef perform(self, token_stream, text)
cpdef same_as(self, other)
cdef class Return(Action):
cdef object value
cdef perform(self, token_stream, text)
cpdef same_as(self, other)
cdef class Call(Action):
cdef object function
cdef perform(self, token_stream, text)
cpdef same_as(self, other)
cdef class Method(Action):
cdef str name
......@@ -21,7 +18,6 @@ cdef class Method(Action):
cdef class Begin(Action):
cdef object state_name
cdef perform(self, token_stream, text)
cpdef same_as(self, other)
cdef class Ignore(Action):
cdef perform(self, token_stream, text)
......
......@@ -6,14 +6,10 @@ Python Lexical Analyser
Actions for use in token specifications
"""
class Action(object):
def perform(self, token_stream, text):
pass # abstract
def same_as(self, other):
return self is other
def __copy__(self):
return self # immutable, no need to copy
......@@ -33,9 +29,6 @@ class Return(Action):
def perform(self, token_stream, text):
return self.value
def same_as(self, other):
return isinstance(other, Return) and self.value == other.value
def __repr__(self):
return "Return(%r)" % self.value
......@@ -54,9 +47,6 @@ class Call(Action):
def __repr__(self):
return "Call(%s)" % self.function.__name__
def same_as(self, other):
return isinstance(other, Call) and self.function is other.function
class Method(Action):
"""
......@@ -79,9 +69,6 @@ class Method(Action):
if self.kwargs is not None else '')
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):
"""
......@@ -99,9 +86,6 @@ class Begin(Action):
def __repr__(self):
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):
"""
......
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