First of all, great work!
I wondered if the verbosity of the code could be further reduced by allowing the factory function to be used without arguments. In that case, the argument to factory should be derived from the type annotation. E.g.
@dataclass(kw_only=True)
class GenerateCodeFn(Entity):
post_process_source_code_fn: PostProcessSourceCodeFn = factory
Of course, this is only a minor improvement, but still potentially a useful one.
By the way, it seems that the following alternative has a drawback (for me), since vscode fails to detect the type of post_process_source_code_fn and therefore symbol lookup doesn't work.
@dataclass(kw_only=True)
class GenerateCodeFn(Entity):
post_process_source_code_fn = factory(PostProcessSourceCodeFn)
First of all, great work!
I wondered if the verbosity of the code could be further reduced by allowing the factory function to be used without arguments. In that case, the argument to
factoryshould be derived from the type annotation. E.g.Of course, this is only a minor improvement, but still potentially a useful one.
By the way, it seems that the following alternative has a drawback (for me), since vscode fails to detect the type of
post_process_source_code_fnand therefore symbol lookup doesn't work.