@@ -158,7 +158,7 @@ def __hash__(self) -> int:
158158 return self ._hash
159159
160160 def __eq__ (self , other : Any ) -> bool :
161- if type (other ) == ItemSet :
161+ if type (other ) is ItemSet :
162162 return self ._kernel .keys () == other ._kernel .keys ()
163163 else :
164164 return NotImplemented
@@ -589,7 +589,7 @@ def __repr__(self) -> str:
589589 conflict = "XXX"
590590 break
591591
592- if type (action ) == ShiftAction :
592+ if type (action ) is ShiftAction :
593593 lines .append (
594594 "%s %15r : %-6s %d [%s]"
595595 % (
@@ -601,7 +601,7 @@ def __repr__(self) -> str:
601601 )
602602 )
603603 else :
604- assert type (action ) == ReduceAction
604+ assert type (action ) is ReduceAction
605605 lines .append (
606606 "%s %15r : %-6s %r"
607607 % (conflict , sym , "reduce" , action .production )
@@ -1715,16 +1715,16 @@ def _resolve(
17151715 ) -> ConflictResolution :
17161716 ret : ConflictResolution
17171717
1718- if type (oldAct ) == ShiftAction :
1718+ if type (oldAct ) is ShiftAction :
17191719 oldPrec = sym .prec
1720- elif type (oldAct ) == ReduceAction :
1720+ elif type (oldAct ) is ReduceAction :
17211721 oldPrec = oldAct .production .prec
17221722 else :
17231723 assert False
17241724
1725- if type (newAct ) == ShiftAction :
1725+ if type (newAct ) is ShiftAction :
17261726 newPrec = sym .prec
1727- elif type (newAct ) == ReduceAction :
1727+ elif type (newAct ) is ReduceAction :
17281728 newPrec = newAct .production .prec
17291729 else :
17301730 assert False
@@ -1740,9 +1740,9 @@ def _resolve(
17401740
17411741 if oldPrec .assoc == "split" or newPrec .assoc == "split" :
17421742 ret = "both"
1743- elif type (newAct ) == type (oldAct ):
1744- assert type (newAct ) == ReduceAction
1745- assert type (oldAct ) == ReduceAction
1743+ elif type (newAct ) is type (oldAct ):
1744+ assert type (newAct ) is ReduceAction
1745+ assert type (oldAct ) is ReduceAction
17461746 # Fatal reduce/reduce conflict.
17471747 ret = "err"
17481748 else :
@@ -1765,16 +1765,16 @@ def _resolve(
17651765 if assoc == "fail" :
17661766 ret = "err"
17671767 elif assoc == "left" :
1768- if type (oldAct ) == ShiftAction :
1768+ if type (oldAct ) is ShiftAction :
17691769 ret = "new"
17701770 else :
1771- assert type (newAct ) == ShiftAction
1771+ assert type (newAct ) is ShiftAction
17721772 ret = "old"
17731773 elif assoc == "right" :
1774- if type (oldAct ) == ShiftAction :
1774+ if type (oldAct ) is ShiftAction :
17751775 ret = "old"
17761776 else :
1777- assert type (newAct ) == ShiftAction
1777+ assert type (newAct ) is ShiftAction
17781778 ret = "new"
17791779 elif assoc == "nonassoc" :
17801780 ret = "neither"
0 commit comments