Skip to content

Commit 59e8dd1

Browse files
committed
revert changes to regions and test
1 parent 3d92b96 commit 59e8dd1

File tree

2 files changed

+5
-50
lines changed

2 files changed

+5
-50
lines changed

common/regions.py

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2025 Google LLC
1+
# Copyright 2021 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -20,22 +20,15 @@
2020
import argparse
2121

2222
REGION_LIST = (
23-
"asia-northeast1",
2423
"asia-south1",
2524
"asia-southeast1",
2625
"australia-southeast1",
27-
"eu",
2826
"europe",
29-
"europe-west12",
3027
"europe-west2",
3128
"europe-west3",
3229
"europe-west6",
33-
"europe-west9",
34-
"me-central1",
3530
"me-central2",
3631
"me-west1",
37-
"northamerica-northeast2",
38-
"southamerica-east1",
3932
"us",
4033
)
4134

@@ -58,21 +51,3 @@ def url(base_url: str, region: str) -> str:
5851
if region != "us":
5952
base_url = base_url.replace("https://", f"https://{region}-")
6053
return base_url
61-
62-
63-
def url_always_prepend_region(base_url: str, region: str) -> str:
64-
"""Returns a regionalized URL.
65-
66-
Args:
67-
base_url: URL pointing to Chronicle API
68-
region: region in which the target project is located
69-
70-
Returns:
71-
A string containing a regionalized URL. Unlike the url() function,
72-
this function always prepends region; this function also checks whether
73-
the URL already has the region prefix, and if so, returns the URL unchanged.
74-
v1alpha samples should use this function.
75-
"""
76-
if not base_url.startswith(f"https://{region}-"):
77-
base_url = base_url.replace("https://", f"https://{region}-")
78-
return base_url

common/regions_test.py

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2025 Google LLC
1+
# Copyright 2021 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
1616

1717
import unittest
1818

19-
import regions
19+
from . import regions
2020

2121

2222
class RegionsTest(unittest.TestCase):
@@ -26,33 +26,13 @@ def test_url_asia_southeast1(self):
2626
regions.url("https://test", "asia-southeast1"),
2727
"https://asia-southeast1-test")
2828

29-
def test_url_eu(self):
29+
def test_url_europe(self):
3030
self.assertEqual(
31-
regions.url("https://test", "eu"), "https://eu-test")
31+
regions.url("https://test", "europe"), "https://europe-test")
3232

3333
def test_url_us(self):
3434
self.assertEqual(regions.url("https://test", "us"), "https://test")
3535

36-
def test_url_always_prepend_region_us(self):
37-
self.assertEqual(
38-
regions.url_always_prepend_region("https://test", "us"),
39-
"https://us-test",
40-
)
41-
42-
def test_url_always_prepend_region_e(self):
43-
self.assertEqual(
44-
regions.url_always_prepend_region("https://test", "eu"),
45-
"https://eu-test",
46-
)
47-
48-
def test_url_always_prepend_region_twice(self):
49-
url_once = regions.url_always_prepend_region("https://test", "eu")
50-
url_twice = regions.url_always_prepend_region(url_once, "eu")
51-
self.assertEqual(
52-
"https://eu-test",
53-
url_twice,
54-
)
55-
5636

5737
if __name__ == "__main__":
5838
unittest.main()

0 commit comments

Comments
 (0)