@@ -158,7 +158,7 @@ def __hash__(self) -> int:
158
158
return self ._hash
159
159
160
160
def __eq__ (self , other : Any ) -> bool :
161
- if type (other ) == ItemSet :
161
+ if type (other ) is ItemSet :
162
162
return self ._kernel .keys () == other ._kernel .keys ()
163
163
else :
164
164
return NotImplemented
@@ -589,7 +589,7 @@ def __repr__(self) -> str:
589
589
conflict = "XXX"
590
590
break
591
591
592
- if type (action ) == ShiftAction :
592
+ if type (action ) is ShiftAction :
593
593
lines .append (
594
594
"%s %15r : %-6s %d [%s]"
595
595
% (
@@ -601,7 +601,7 @@ def __repr__(self) -> str:
601
601
)
602
602
)
603
603
else :
604
- assert type (action ) == ReduceAction
604
+ assert type (action ) is ReduceAction
605
605
lines .append (
606
606
"%s %15r : %-6s %r"
607
607
% (conflict , sym , "reduce" , action .production )
@@ -1715,16 +1715,16 @@ def _resolve(
1715
1715
) -> ConflictResolution :
1716
1716
ret : ConflictResolution
1717
1717
1718
- if type (oldAct ) == ShiftAction :
1718
+ if type (oldAct ) is ShiftAction :
1719
1719
oldPrec = sym .prec
1720
- elif type (oldAct ) == ReduceAction :
1720
+ elif type (oldAct ) is ReduceAction :
1721
1721
oldPrec = oldAct .production .prec
1722
1722
else :
1723
1723
assert False
1724
1724
1725
- if type (newAct ) == ShiftAction :
1725
+ if type (newAct ) is ShiftAction :
1726
1726
newPrec = sym .prec
1727
- elif type (newAct ) == ReduceAction :
1727
+ elif type (newAct ) is ReduceAction :
1728
1728
newPrec = newAct .production .prec
1729
1729
else :
1730
1730
assert False
@@ -1740,9 +1740,9 @@ def _resolve(
1740
1740
1741
1741
if oldPrec .assoc == "split" or newPrec .assoc == "split" :
1742
1742
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
1746
1746
# Fatal reduce/reduce conflict.
1747
1747
ret = "err"
1748
1748
else :
@@ -1765,16 +1765,16 @@ def _resolve(
1765
1765
if assoc == "fail" :
1766
1766
ret = "err"
1767
1767
elif assoc == "left" :
1768
- if type (oldAct ) == ShiftAction :
1768
+ if type (oldAct ) is ShiftAction :
1769
1769
ret = "new"
1770
1770
else :
1771
- assert type (newAct ) == ShiftAction
1771
+ assert type (newAct ) is ShiftAction
1772
1772
ret = "old"
1773
1773
elif assoc == "right" :
1774
- if type (oldAct ) == ShiftAction :
1774
+ if type (oldAct ) is ShiftAction :
1775
1775
ret = "old"
1776
1776
else :
1777
- assert type (newAct ) == ShiftAction
1777
+ assert type (newAct ) is ShiftAction
1778
1778
ret = "new"
1779
1779
elif assoc == "nonassoc" :
1780
1780
ret = "neither"
0 commit comments