From 2c360a55f2878b09a3e0bed190a4fa4ca82324ff Mon Sep 17 00:00:00 2001 From: boukeversteegh Date: Sun, 14 Jun 2020 16:51:52 +0200 Subject: [PATCH] Readability for generating init_files --- betterproto/plugin.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/betterproto/plugin.py b/betterproto/plugin.py index 33890af..aeef919 100755 --- a/betterproto/plugin.py +++ b/betterproto/plugin.py @@ -359,8 +359,14 @@ def generate_code(request, response): # Make each output directory a package with __init__ file output_paths = set(pathlib.Path(path) for path in output_map.keys()) - output_dirs = [directory for path in output_paths for directory in path.parents] - init_files = set(d.joinpath("__init__.py") for d in output_dirs) - output_paths + init_files = ( + set( + directory.joinpath("__init__.py") + for path in output_paths + for directory in path.parents + ) + - output_paths + ) for init_file in init_files: init = response.file.add()