On Fri, 2025-10-17 at 11:37 +0200, Nam Cao wrote: > Gabriele Monaco <[email protected]> writes: > > + if any(u in self.env_types.values() for u in ["ns", "us", "ms", > > "s"]): > > + buff.append("#define HA_CLK_NS") > > That any() twisted my brain. Does the following work? > > if not {"ns", "us", "ms", "s"}.isdisjoint(self.env_types.values()) >
Yeah that should do, thanks for the suggestion! > > + match unit: > > + case "us": > > + value *= 1000 > > + case "ms": > > + value *= 1000000 > > + case "s": > > + value *= 1000000000 > > Use 10**9 instead, so that we don't have to count the zeroes. Right, that's not C.. Will fix. Thanks, Gabriele
