Skip to content

Commit a92648d

Browse files
committed
update banner
1 parent 0269d04 commit a92648d

File tree

3 files changed

+28
-22
lines changed

3 files changed

+28
-22
lines changed

mapillary_tools/authenticate.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def _verify_user_auth(user_items: types.UserItem) -> types.UserItem:
168168
"""
169169
Verify that the user access token is valid
170170
"""
171-
if constants._DISABLE_AUTH_VERIFICATION:
171+
if constants._AUTH_VERIFICATION_DISABLED:
172172
return user_items
173173

174174
try:
@@ -351,11 +351,12 @@ def _welcome():
351351
_echo(
352352
"""
353353
================================================================================
354-
Welcome to Mapillary!
354+
Welcome to Mapillary!
355355
================================================================================
356-
If you haven't registered yet, please visit the following link to sign up first:
357-
https://www.mapillary.com/signup
358-
After the registration, proceed here to sign in.
356+
If you haven't registered yet, please visit https://www.mapillary.com/signup
357+
to create your account first.
358+
359+
Once registered, proceed here to sign in.
359360
================================================================================
360-
""".strip()
361+
"""
361362
)

mapillary_tools/constants.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55

66
_ENV_PREFIX = "MAPILLARY_TOOLS_"
77

8+
9+
def _yes_or_no(val: str) -> bool:
10+
return val.strip().upper() in [
11+
"1",
12+
"TRUE",
13+
"YES",
14+
]
15+
16+
817
# In meters
918
CUTOFF_DISTANCE = float(os.getenv(_ENV_PREFIX + "CUTOFF_DISTANCE", 600))
1019
# In seconds
@@ -56,16 +65,8 @@
5665
# Max number of pixels per sequence (sum of image pixels in the sequence)
5766
MAX_SEQUENCE_PIXELS: str = os.getenv(_ENV_PREFIX + "MAX_SEQUENCE_PIXELS", "6G")
5867

59-
PROMPT_DISABLED: bool = os.getenv(_ENV_PREFIX + "PROMPT_DISABLED", "NO").upper() in [
60-
"1",
61-
"TRUE",
62-
"YES",
63-
]
68+
PROMPT_DISABLED: bool = _yes_or_no(os.getenv(_ENV_PREFIX + "PROMPT_DISABLED", "NO"))
6469

65-
_DISABLE_AUTH_VERIFICATION = os.getenv(
66-
_ENV_PREFIX + "_DISABLE_AUTH_VERIFICATION", "NO"
67-
).upper() in [
68-
"1",
69-
"TRUE",
70-
"YES",
71-
]
70+
_AUTH_VERIFICATION_DISABLED: bool = _yes_or_no(
71+
os.getenv(_ENV_PREFIX + "_AUTH_VERIFICATION_DISABLED", "NO")
72+
)

tests/integration/fixtures.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
def setup_config(tmpdir: py.path.local):
2929
config_path = tmpdir.mkdir("configs").join("CLIENT_ID")
3030
os.environ["MAPILLARY_CONFIG_PATH"] = str(config_path)
31-
os.environ["MAPILLARY_TOOLS__DISABLE_AUTH_VERIFICATION"] = "YES"
31+
os.environ["MAPILLARY_TOOLS_PROMPT_DISABLED"] = "YES"
32+
os.environ["MAPILLARY_TOOLS__AUTH_VERIFICATION_DISABLED"] = "YES"
3233
x = subprocess.run(
3334
f"{EXECUTABLE} authenticate --user_name {USERNAME} --jwt test_user_token",
3435
shell=True,
@@ -38,7 +39,8 @@ def setup_config(tmpdir: py.path.local):
3839
if tmpdir.check():
3940
tmpdir.remove(ignore_errors=True)
4041
os.environ.pop("MAPILLARY_CONFIG_PATH", None)
41-
os.environ.pop("MAPILLARY_TOOLS__DISABLE_AUTH_VERIFICATION", None)
42+
os.environ.pop("MAPILLARY_TOOLS_PROMPT_DISABLED", None)
43+
os.environ.pop("MAPILLARY_TOOLS__AUTH_VERIFICATION_DISABLED", None)
4244

4345

4446
@pytest.fixture
@@ -55,7 +57,8 @@ def setup_data(tmpdir: py.path.local):
5557
def setup_upload(tmpdir: py.path.local):
5658
upload_dir = tmpdir.mkdir("mapillary_public_uploads")
5759
os.environ["MAPILLARY_UPLOAD_PATH"] = str(upload_dir)
58-
os.environ["MAPILLARY_TOOLS__DISABLE_AUTH_VERIFICATION"] = "YES"
60+
os.environ["MAPILLARY_TOOLS__AUTH_VERIFICATION_DISABLED"] = "YES"
61+
os.environ["MAPILLARY_TOOLS_PROMPT_DISABLED"] = "YES"
5962
os.environ["MAPILLARY__ENABLE_UPLOAD_HISTORY_FOR_DRY_RUN"] = "YES"
6063
history_path = tmpdir.join("history")
6164
os.environ["MAPILLARY_UPLOAD_HISTORY_PATH"] = str(history_path)
@@ -64,7 +67,8 @@ def setup_upload(tmpdir: py.path.local):
6467
tmpdir.remove(ignore_errors=True)
6568
os.environ.pop("MAPILLARY_UPLOAD_PATH", None)
6669
os.environ.pop("MAPILLARY_UPLOAD_HISTORY_PATH", None)
67-
os.environ.pop("MAPILLARY_TOOLS__DISABLE_AUTH_VERIFICATION", None)
70+
os.environ.pop("MAPILLARY_TOOLS__AUTH_VERIFICATION_DISABLED", None)
71+
os.environ.pop("MAPILLARY_TOOLS_PROMPT_DISABLED", None)
6872
os.environ.pop("MAPILLARY__ENABLE_UPLOAD_HISTORY_FOR_DRY_RUN", None)
6973

7074

0 commit comments

Comments
 (0)