Skip to content

Commit bcc4f13

Browse files
committed
refactor code
1 parent 7d9ed41 commit bcc4f13

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

.generator/cli.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,6 +1334,19 @@ def _update_changelog_for_library(
13341334
_write_text_file(changelog_dest, updated_content)
13351335

13361336

1337+
def _is_generated_library(repo: str) -> bool:
1338+
"""Determines if a library is generated or handwritten.
1339+
1340+
Args:
1341+
repo(str): This directory will contain all directories that make up a
1342+
library, the .librarian folder, and any global file declared in
1343+
the config.yaml.
1344+
1345+
Returns: True if the library is generated, False otherwise.
1346+
"""
1347+
return Path(f"{repo}/packages").exists()
1348+
1349+
13371350
def handle_release_init(
13381351
librarian: str = LIBRARIAN_DIR, repo: str = REPO_DIR, output: str = OUTPUT_DIR
13391352
):
@@ -1362,7 +1375,7 @@ def handle_release_init(
13621375
librarian directory cannot be read.
13631376
"""
13641377
try:
1365-
is_generated = Path(f"{repo}/packages").exists()
1378+
is_generated = _is_generated_library(repo)
13661379

13671380
# Read a release-init-request.json file
13681381
request_data = _read_json_file(f"{librarian}/{RELEASE_INIT_REQUEST_FILE}")

0 commit comments

Comments
 (0)