mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
2d20a1c0fb
* Decentralize Automation Generator Code * Lint
16 lines
349 B
Python
16 lines
349 B
Python
class Registry(dict):
|
|
def register(self, name):
|
|
def decorator(fun):
|
|
self[name] = fun
|
|
return fun
|
|
|
|
return decorator
|
|
|
|
|
|
class ServiceRegistry(dict):
|
|
def register(self, name, validator):
|
|
def decorator(fun):
|
|
self[name] = (validator, fun)
|
|
return fun
|
|
|
|
return decorator
|