Skip to content

Commit e749d21

Browse files
committed
chore(firestore): improve owlbot.py based on review feedback
1 parent 7ef6fb0 commit e749d21

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

java-firestore/owlbot.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,19 @@
4848
admin_version_path = "google-cloud-firestore-admin/src/main/java/com/google/cloud/firestore/v1/stub/Version.java"
4949
if os.path.exists(admin_version_path):
5050
target_path = "google-cloud-firestore-admin/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreAdminVersion.java"
51-
with open(admin_version_path, 'r') as f:
51+
with open(admin_version_path, 'r', encoding='utf-8') as f:
5252
content = f.read()
5353
content = content.replace("class Version", "class FirestoreAdminVersion")
54-
with open(target_path, 'w') as f:
54+
with open(target_path, 'w', encoding='utf-8') as f:
5555
f.write(content)
5656
os.remove(admin_version_path)
5757

58-
# Replace Version.VERSION with FirestoreAdminVersion.VERSION in FirestoreAdminStubSettings.java
59-
settings_path = "google-cloud-firestore-admin/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreAdminStubSettings.java"
60-
if os.path.exists(settings_path):
61-
with open(settings_path, 'r') as f:
62-
content = f.read()
63-
content = content.replace("Version.VERSION", "FirestoreAdminVersion.VERSION")
64-
with open(settings_path, 'w') as f:
65-
f.write(content)
58+
# Replace Version.VERSION with FirestoreAdminVersion.VERSION in stub files
59+
s.replace(
60+
"google-cloud-firestore-admin/src/main/java/com/google/cloud/firestore/v1/stub/**/*.java",
61+
"Version.VERSION",
62+
"FirestoreAdminVersion.VERSION",
63+
)
6664
s.remove_staging_dirs()
6765
java.common_templates(
6866
monorepo=True,

0 commit comments

Comments
 (0)