Skip to content

Commit 80545c6

Browse files
committed
do: fix pylint warnings
1 parent 440a6e2 commit 80545c6

File tree

6 files changed

+25
-22
lines changed

6 files changed

+25
-22
lines changed

engine/data_pipelines/common/auth/gcloud.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
def get_auth_token() -> str:
99
"""Retrieve a Google Cloud SDK authentication token.
1010
11-
Returns: Authentication token.
11+
Returns:
12+
str: Authentication token.
1213
1314
Raises:
14-
subprocess.CalledProcessError: If authentication fails.
15-
15+
subprocess.CalledProcessError: If authentication fails.
1616
"""
1717
try:
1818
result = subprocess.run( # nosec
@@ -28,9 +28,9 @@ def get_auth_token() -> str:
2828
if token:
2929
LOGGER.info("Successfully authenticated with Google Cloud SDK.")
3030
return token
31-
else:
32-
LOGGER.error("No token returned during authentication.")
33-
raise subprocess.CalledProcessError(returncode=1, cmd=result.args, stderr="No token returned")
31+
32+
LOGGER.error("No token returned during authentication.")
33+
raise subprocess.CalledProcessError(returncode=1, cmd=result.args, stderr="No token returned")
3434

3535
except subprocess.CalledProcessError as e:
3636
msgs = e.stderr.split("\n")

engine/data_pipelines/microservices/google_analytics_pipeline/main_pipeline.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Main pipeline module for google_analytics_pipeline."""
22

33
import os
4-
from google.cloud import bigquery
54
from google.auth import default
65
from engine.data_pipelines.microservices.google_analytics_pipeline import RENAMER_SESSIONS_HITS, QUERY_SESSIONS_HITS
76
from engine.data_pipelines.common.logging import LOGGER
@@ -26,16 +25,13 @@ def main():
2625
"Cloud Run has the correct permissions."
2726
) from e
2827
LOGGER.info("Using GOOGLE_APPLICATION_CREDENTIALS for authentication.")
29-
credentials = None # Automatically handled by the environment
30-
31-
# Initialize BigQuery client
32-
client = bigquery.Client(credentials=credentials, project=project)
28+
credentials = None # Automatically handled by the environment*
3329

3430
LOGGER.info("Extract data.")
3531
df = read_from_bigquery(
3632
query=QUERY_SESSIONS_HITS,
3733
project_id=project,
38-
credentials=client._credentials, # Pass client credentials
34+
credentials=credentials, # Pass client credentials
3935
)
4036

4137
LOGGER.info("Transform - Staging")

pyproject.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.black]
2-
line-length=119
2+
line-length = 119
33

44
[tool.flake8]
55
max-line-length = 119
@@ -9,4 +9,11 @@ ignore = ["E203"]
99
max-line-length = 119
1010

1111
[tool.pylint.design]
12-
max-args = 10 # Maximum number of arguments for a func
12+
max-args = 10 # Maximum number of arguments for a function
13+
14+
[tool.pylint.messages_control]
15+
disable = [
16+
"logging-fstring-interpolation", # Ignore logging f-string interpolation warnings
17+
"too-many-positional-arguments", # Disable positional arguments limit warning
18+
"broad-exception-caught" # Disable board exception warnings
19+
]

services/public_apis/fastAPI_hello_world/main.py renamed to services/public_apis/fast_api_hello_world/main.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ async def read_user(user_id: int):
3838
class ModelName(str, Enum):
3939
"""Enumeration for machine learning models."""
4040

41-
alexnet = "alexnet"
42-
resnet = "resnet"
43-
lenet = "lenet"
41+
ALEXNET = "alexnet"
42+
RESNET = "resnet"
43+
LENET = "lenet"
4444

4545

4646
@app.get("/models/{model_name}")
@@ -53,7 +53,7 @@ async def get_model(model_name: ModelName):
5353
Returns:
5454
dict: Details about the selected model.
5555
"""
56-
if model_name is ModelName.alexnet:
56+
if model_name is ModelName.ALEXNET:
5757
return {"model_name": model_name, "message": "Deep Learning FTW!"}
5858

5959
if model_name.value == "lenet":
@@ -178,11 +178,11 @@ async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 10
178178
return {"q": q, "skip": skip, "limit": limit}
179179

180180

181-
commonDeps = Annotated[dict, Depends(common_parameters)]
181+
CommonDeps = Annotated[dict, Depends(common_parameters)]
182182

183183

184184
@app.get("/shmushes/")
185-
async def read_smushes(commons: commonDeps):
185+
async def read_smushes(commons: CommonDeps):
186186
"""Read shmushes with common parameters.
187187
188188
Args:
@@ -195,7 +195,7 @@ async def read_smushes(commons: commonDeps):
195195

196196

197197
@app.get("/shmooleys/")
198-
async def read_shmooleys(commons: commonDeps):
198+
async def read_shmooleys(commons: CommonDeps):
199199
"""Read shmooleys with common parameters.
200200
201201
Args:

services/public_apis/ga_aggs/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ def get_agg_data():
2727

2828
if __name__ == "__main__":
2929
# Serve the FastAPI app on the port provided by the environment variable
30-
port = int(os.getenv("PORT", 8000))
30+
port = int(os.getenv("PORT", "8000"))
3131
uvicorn.run(app, host="0.0.0.0", port=port) # nosec

0 commit comments

Comments
 (0)