Skip to content

Commit 3f044f8

Browse files
committed
chore: apply codacy fixes (generated)
algolia/api-clients-automation#3935 Co-authored-by: algolia-bot <[email protected]>
1 parent 50153be commit 3f044f8

File tree

9 files changed

+45
-18
lines changed

9 files changed

+45
-18
lines changed

algoliasearch/abtesting/config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ def __init__(
1717

1818
user_agent = UserAgent().add("Abtesting")
1919

20-
assert app_id, "`app_id` is missing."
21-
assert api_key, "`api_key` is missing."
20+
if app_id is None or not app_id:
21+
raise ValueError("`app_id` is missing.")
22+
23+
if api_key is None or not api_key:
24+
raise ValueError("`api_key` is missing.")
2225

2326
self.headers = {
2427
"x-algolia-application-id": app_id,

algoliasearch/analytics/config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ def __init__(
1717

1818
user_agent = UserAgent().add("Analytics")
1919

20-
assert app_id, "`app_id` is missing."
21-
assert api_key, "`api_key` is missing."
20+
if app_id is None or not app_id:
21+
raise ValueError("`app_id` is missing.")
22+
23+
if api_key is None or not api_key:
24+
raise ValueError("`api_key` is missing.")
2225

2326
self.headers = {
2427
"x-algolia-application-id": app_id,

algoliasearch/ingestion/config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ def __init__(
1414

1515
user_agent = UserAgent().add("Ingestion")
1616

17-
assert app_id, "`app_id` is missing."
18-
assert api_key, "`api_key` is missing."
17+
if app_id is None or not app_id:
18+
raise ValueError("`app_id` is missing.")
19+
20+
if api_key is None or not api_key:
21+
raise ValueError("`api_key` is missing.")
1922

2023
self.headers = {
2124
"x-algolia-application-id": app_id,

algoliasearch/insights/config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ def __init__(
1717

1818
user_agent = UserAgent().add("Insights")
1919

20-
assert app_id, "`app_id` is missing."
21-
assert api_key, "`api_key` is missing."
20+
if app_id is None or not app_id:
21+
raise ValueError("`app_id` is missing.")
22+
23+
if api_key is None or not api_key:
24+
raise ValueError("`api_key` is missing.")
2225

2326
self.headers = {
2427
"x-algolia-application-id": app_id,

algoliasearch/monitoring/config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ def __init__(self, app_id: Optional[str], api_key: Optional[str]) -> None:
1212

1313
user_agent = UserAgent().add("Monitoring")
1414

15-
assert app_id, "`app_id` is missing."
16-
assert api_key, "`api_key` is missing."
15+
if app_id is None or not app_id:
16+
raise ValueError("`app_id` is missing.")
17+
18+
if api_key is None or not api_key:
19+
raise ValueError("`api_key` is missing.")
1720

1821
self.headers = {
1922
"x-algolia-application-id": app_id,

algoliasearch/personalization/config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ def __init__(
1414

1515
user_agent = UserAgent().add("Personalization")
1616

17-
assert app_id, "`app_id` is missing."
18-
assert api_key, "`api_key` is missing."
17+
if app_id is None or not app_id:
18+
raise ValueError("`app_id` is missing.")
19+
20+
if api_key is None or not api_key:
21+
raise ValueError("`api_key` is missing.")
1922

2023
self.headers = {
2124
"x-algolia-application-id": app_id,

algoliasearch/query_suggestions/config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ def __init__(
1414

1515
user_agent = UserAgent().add("QuerySuggestions")
1616

17-
assert app_id, "`app_id` is missing."
18-
assert api_key, "`api_key` is missing."
17+
if app_id is None or not app_id:
18+
raise ValueError("`app_id` is missing.")
19+
20+
if api_key is None or not api_key:
21+
raise ValueError("`api_key` is missing.")
1922

2023
self.headers = {
2124
"x-algolia-application-id": app_id,

algoliasearch/recommend/config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ def __init__(self, app_id: Optional[str], api_key: Optional[str]) -> None:
1212

1313
user_agent = UserAgent().add("Recommend")
1414

15-
assert app_id, "`app_id` is missing."
16-
assert api_key, "`api_key` is missing."
15+
if app_id is None or not app_id:
16+
raise ValueError("`app_id` is missing.")
17+
18+
if api_key is None or not api_key:
19+
raise ValueError("`api_key` is missing.")
1720

1821
self.headers = {
1922
"x-algolia-application-id": app_id,

algoliasearch/search/config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ def __init__(self, app_id: Optional[str], api_key: Optional[str]) -> None:
1212

1313
user_agent = UserAgent().add("Search")
1414

15-
assert app_id, "`app_id` is missing."
16-
assert api_key, "`api_key` is missing."
15+
if app_id is None or not app_id:
16+
raise ValueError("`app_id` is missing.")
17+
18+
if api_key is None or not api_key:
19+
raise ValueError("`api_key` is missing.")
1720

1821
self.headers = {
1922
"x-algolia-application-id": app_id,

0 commit comments

Comments
 (0)