Skip to content

Commit 0c27e87

Browse files
committed
refactor code
1 parent 76b7064 commit 0c27e87

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
@@ -1287,6 +1287,19 @@ def _update_changelog_for_library(
12871287
_write_text_file(changelog_dest, updated_content)
12881288

12891289

1290+
def _is_generated_library(repo: str) -> bool:
1291+
"""Determines if a library is generated or handwritten.
1292+
1293+
Args:
1294+
repo(str): This directory will contain all directories that make up a
1295+
library, the .librarian folder, and any global file declared in
1296+
the config.yaml.
1297+
1298+
Returns: True if the library is generated, False otherwise.
1299+
"""
1300+
return Path(f"{repo}/packages").exists()
1301+
1302+
12901303
def handle_release_init(
12911304
librarian: str = LIBRARIAN_DIR, repo: str = REPO_DIR, output: str = OUTPUT_DIR
12921305
):
@@ -1315,7 +1328,7 @@ def handle_release_init(
13151328
librarian directory cannot be read.
13161329
"""
13171330
try:
1318-
is_generated = Path(f"{repo}/packages").exists()
1331+
is_generated = _is_generated_library(repo)
13191332

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

0 commit comments

Comments
 (0)