From 63f5191f023ec26d4abc5575e11dcc54064acc6c Mon Sep 17 00:00:00 2001 From: boukeversteegh Date: Sun, 14 Jun 2020 16:54:34 +0200 Subject: [PATCH] Shorten list selectors --- betterproto/compile/importing.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/betterproto/compile/importing.py b/betterproto/compile/importing.py index 69cca91..6890b35 100644 --- a/betterproto/compile/importing.py +++ b/betterproto/compile/importing.py @@ -70,10 +70,10 @@ def get_ref_type( if py_package == current_package: return import_sibling(py_type) - if py_package[0 : len(current_package)] == current_package: + if py_package[: len(current_package)] == current_package: return import_descendent(current_package, imports, py_package, py_type) - if current_package[0 : len(py_package)] == py_package: + if current_package[: len(py_package)] == py_package: return import_ancestor(current_package, imports, py_package, py_type) return import_cousin(current_package, imports, py_package, py_type) @@ -109,7 +109,7 @@ def import_descendent(current_package, imports, py_package, py_type): name = foo.bar.Baz """ importing_descendent = py_package[len(current_package) :] - string_from = ".".join(importing_descendent[0:-1]) + string_from = ".".join(importing_descendent[:-1]) string_import = importing_descendent[-1] if string_from: string_alias = "_".join(importing_descendent)