@@ -353,7 +353,7 @@ def rgbcolor(c, space='rgb'):
353353
354354
355355class Color :
356- def __init__ (self , r = '#0000ff' , g = None , b = None , space = 'rgb' ):
356+ def __init__ (self , r = '#0000ff' , g = None , b = None , space = 'rgb' ) -> None :
357357 """
358358 A Red-Green-Blue (RGB) color model color object. For most
359359 consumer-grade devices (e.g., CRTs, LCDs, and printers), as
@@ -400,7 +400,7 @@ def __init__(self, r='#0000ff', g=None, b=None, space='rgb'):
400400 else :
401401 self ._rgb = rgbcolor ((r , g , b ), space = space )
402402
403- def __repr__ (self ):
403+ def __repr__ (self ) -> str :
404404 """
405405 Return a string representation of this color.
406406
@@ -415,7 +415,7 @@ def __repr__(self):
415415 """
416416 return f"RGB color { self ._rgb } "
417417
418- def __lt__ (self , right ):
418+ def __lt__ (self , right ) -> bool :
419419 """
420420 Check whether a :class:`Color` object is less than some other
421421 object. This doesn't make sense, and so we conclude that it is
@@ -438,7 +438,7 @@ def __lt__(self, right):
438438 """
439439 return False
440440
441- def __le__ (self , right ):
441+ def __le__ (self , right ) -> bool :
442442 """
443443 Check whether a :class:`Color` object is less than or equal to
444444 some other object. It wouldn't make sense for it to be less than
@@ -462,7 +462,7 @@ def __le__(self, right):
462462 """
463463 return self == right
464464
465- def __eq__ (self , right ):
465+ def __eq__ (self , right ) -> bool :
466466 """
467467 Compare two :class:`Color` objects to determine whether
468468 they refer to the same color.
@@ -489,7 +489,7 @@ def __eq__(self, right):
489489 return self ._rgb == right ._rgb
490490 return False
491491
492- def __ne__ (self , right ):
492+ def __ne__ (self , right ) -> bool :
493493 """
494494 Compare two :class:`Color` objects to determine whether
495495 they refer to different colors.
@@ -516,7 +516,7 @@ def __ne__(self, right):
516516 """
517517 return not (self == right )
518518
519- def __gt__ (self , right ):
519+ def __gt__ (self , right ) -> bool :
520520 """
521521 Check whether a :class:`Color` object is greater than some other
522522 object. This doesn't make sense, and so we conclude that it is
@@ -539,7 +539,7 @@ def __gt__(self, right):
539539 """
540540 return False
541541
542- def __ge__ (self , right ):
542+ def __ge__ (self , right ) -> bool :
543543 """
544544 Check whether a :class:`Color` object is greater than or equal
545545 to some other object. It wouldn't make sense for it to be
@@ -563,7 +563,7 @@ def __ge__(self, right):
563563 """
564564 return self == right
565565
566- def __hash__ (self ):
566+ def __hash__ (self ) -> int :
567567 """
568568 Return the hash value of a color.
569569 Equal colors return equal hash values.
@@ -1004,7 +1004,7 @@ class ColorsDict(dict):
10041004 sage: sorted(colors)
10051005 ['aliceblue', 'antiquewhite', 'aqua', 'aquamarine', ...]
10061006 """
1007- def __init__ (self ):
1007+ def __init__ (self ) -> None :
10081008 """
10091009 Construct a dict-like collection of colors. The keys are the
10101010 color names (i.e., strings) and the values are RGB 3-tuples of
@@ -1364,7 +1364,7 @@ class Colormaps(MutableMapping):
13641364 sage: sorted(colormaps)
13651365 ['Accent', ...]
13661366 """
1367- def __init__ (self ):
1367+ def __init__ (self ) -> None :
13681368 """
13691369 Construct an empty mutable collection of color maps.
13701370
@@ -1418,7 +1418,7 @@ def __dir__(self):
14181418 '__setitem__' , '__delitem__' ]
14191419 return dir (super ()) + methods + sorted (self )
14201420
1421- def __len__ (self ):
1421+ def __len__ (self ) -> int :
14221422 """
14231423 Return the number of color maps.
14241424
@@ -1452,7 +1452,7 @@ def __iter__(self):
14521452 self .load_maps ()
14531453 return iter (self .maps )
14541454
1455- def __contains__ (self , name ):
1455+ def __contains__ (self , name ) -> bool :
14561456 """
14571457 Return whether a map is in the color maps collection.
14581458
@@ -1536,7 +1536,7 @@ def __getattr__(self, name):
15361536 except KeyError :
15371537 raise AttributeError ("'{}' has no attribute or colormap {}" .format (type (self ).__name__ , name ))
15381538
1539- def __repr__ (self ):
1539+ def __repr__ (self ) -> str :
15401540 """
15411541 Return a string representation of the color map collection.
15421542
0 commit comments