def __enter__(self): TerminalQueryContext.__enter__(self) # try getting the rgb value for color 0 to decide whether to # bother trying to query any more colors. self.do_query = (self.do_query and self.get_indexed_color(0, self.timeout*2)) if self.color_level >= 1: stdout.write(self.reset) return self