MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / __init__

Method __init__

example_code/item_081.py:95–99  ·  view source on GitHub ↗
(self, max_rating)

Source from the content-addressed store, hash-verified

93
94class Rating:
95 def __init__(self, max_rating):
96 if not (max_rating > 0):
97 raise RatingError("Invalid max_rating")
98 self.max_rating = max_rating
99 self.ratings = []
100
101 def rate(self, rating):
102 if not (0 < rating <= self.max_rating):

Callers

nothing calls this directly

Calls 1

RatingErrorClass · 0.85

Tested by

no test coverage detected