Skip to content

Commit

Permalink
type checking fix for Python 2.7?
Browse files Browse the repository at this point in the history
  • Loading branch information
MinchinWeb committed Jul 20, 2015
1 parent aef5c8a commit f181ebe
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions colourettu/_colour.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ def _luminance(mycolour):
\\[ lum = \\sqrt{0.299 r^2 + 0.587 g^2 + 0.114 b^2} \\]
'''

if type(mycolour) is colour:
colour_for_type = colour()
if type(mycolour) is type(colour_for_type):
mycolour2 = mycolour
else:
try:
Expand Down Expand Up @@ -318,15 +319,16 @@ def _contrast(colour1, colour2):
any quantitative research to this effect.
'''

if type(colour1) is colour:
colour_for_type = colour()
if type(colour1) is type(colour_for_type):
mycolour1 = colour1
else:
try:
mycolour1 = colour(colour1)
except:
raise TypeError("colour1 must be a colourettu.colour")

if type(colour2) is colour:
if type(colour2) is type(colour_for_type):
mycolour2 = colour2
else:
try:
Expand Down

0 comments on commit f181ebe

Please sign in to comment.