Skip to content

Commit

Permalink
Fix type comparison in Python source code.
Browse files Browse the repository at this point in the history
  • Loading branch information
cahirwpz committed Dec 16, 2023
1 parent 535c594 commit 445c236
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions prototypes/c2p/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def __or__(self, bit):
a = self._value
b = bit._value

if type(a) == int:
if isinstance(a, int):
return Bit(a or b, bit._color)
elif type(b) == int:
elif isinstance(b, int):
return Bit(b or a, self._color)
else:
return Bit('?', None)
Expand All @@ -34,9 +34,9 @@ def __and__(self, bit):
a = self._value
b = bit._value

if type(a) == int:
if isinstance(a, int):
return Bit(a and b, bit._color)
elif type(b) == int:
elif isinstance(b, int):
return Bit(b and a, self._color)
else:
return Bit('?', None)
Expand Down Expand Up @@ -68,7 +68,7 @@ def Data(cls, char, width=16, color="0m"):
return cls(Bit.Var(char, i, color) for i in range(width))

def __init__(self, value_or_width):
if type(value_or_width) == int:
if isinstance(value_or_width, int):
self._value = [Bit.Const(0) for i in range(value_or_width)]
self._width = value_or_width
else:
Expand All @@ -79,7 +79,7 @@ def __iter__(self):
return iter(self._value)

def __getitem__(self, index):
if type(index) == slice:
if isinstance(index, slice):
return Word(self._value[index])
else:
return self._value[index]
Expand Down
2 changes: 1 addition & 1 deletion tools/png2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def coerce(name, typ, value):


def convert(name, cast, value, result):
if type(cast) == tuple:
if isinstance(cast, tuple):
names = name.split(',')
values = value.split('x')
if len(names) > 1:
Expand Down

0 comments on commit 445c236

Please sign in to comment.