Skip to content

Commit

Permalink
remove setter
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeWang1127 committed May 15, 2024
1 parent 958ef5a commit efa3efa
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions library_generation/model/generation_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def __init__(
self.libraries = libraries
self.grpc_version = grpc_version
self.protoc_version = protoc_version
self.__contains_common_protos = self.__set_contains_common_protos()
# explicit set to None so that we can compute the
# value in getter.
self.__contains_common_protos = None
self.__validate()

def get_proto_path_to_library_name(self) -> dict[str, str]:
Expand All @@ -64,14 +66,13 @@ def is_monorepo(self) -> bool:
return len(self.libraries) > 1

def contains_common_protos(self) -> bool:
if self.__contains_common_protos is None:
self.__contains_common_protos = False
for library in self.libraries:
if library.get_library_name() == COMMON_PROTOS:
self.__contains_common_protos = True
return self.__contains_common_protos

def __set_contains_common_protos(self) -> bool:
for library in self.libraries:
if library.get_library_name() == COMMON_PROTOS:
return True
return False

def __validate(self) -> None:
seen_library_names = dict()
for library in self.libraries:
Expand Down

0 comments on commit efa3efa

Please sign in to comment.