Skip to content

Commit 36cdbce

Browse files
Kamal Sai DevarapalliKamal Sai Devarapalli
authored andcommitted
fix: move imports to top level to resolve linting issues
- Move mask_request_headers import to top level in create_task.py - Move jsonify import to top level in all service __init__.py files - Move threading import to top level in notification.py - Move mask_ip_address import to top level in auth/__init__.py Fixes 'import-outside-toplevel' pylint warnings.
1 parent 9dba1bc commit 36cdbce

File tree

6 files changed

+6
-9
lines changed

6 files changed

+6
-9
lines changed

services/auth/app/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from common.pyportal_common.db_handlers.db_conn_manager import (
1010
DataBaseConnectionHandler
1111
)
12+
from common.pyportal_common.utils import mask_ip_address
1213
from app.models.token_model import Base
1314

1415
try:
@@ -221,7 +222,6 @@
221222
usermanager_app.config["USER_MANAGEMENT_GRPC_SERVER_IP"] + ":" +
222223
usermanager_app.config["USER_MANAGEMENT_GRPC_SERVER_PORT"]
223224
)
224-
from common.pyportal_common.utils import mask_ip_address
225225
grpc_ip = usermanager_app.config['USER_MANAGEMENT_GRPC_SERVER_IP']
226226
masked_grpc_ip = mask_ip_address(grpc_ip)
227227
user_management_logger.info(

services/notification/app/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
import sys
44
from logging import Logger
5-
from flask import Flask, Blueprint
5+
from flask import Flask, Blueprint, jsonify
66

77
# Add parent directory to path for common imports
88
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../..'))
@@ -40,7 +40,6 @@
4040
@notification_app.route('/health', methods=['GET'])
4141
def health():
4242
"""Health check endpoint"""
43-
from flask import jsonify
4443
return jsonify({
4544
'status': 'healthy',
4645
'service': 'notification'

services/notification/app/notification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
It initializes the server, configures settings, and starts Kafka consumer.
77
"""
88
import sys
9+
import threading
910
from app import (
1011
notification_app,
1112
notification_logger,
@@ -28,7 +29,6 @@
2829

2930
# Start Kafka consumer in background thread
3031
if kafka_consumer:
31-
import threading
3232
consumer_thread = threading.Thread(
3333
target=kafka_consumer.start_consuming,
3434
daemon=True

services/taskprocessing/app/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
import concurrent.futures
55
from logging import Logger
6-
from flask import Flask, Blueprint
6+
from flask import Flask, Blueprint, jsonify
77

88
# Add parent directory to path for common imports
99
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../..'))
@@ -50,7 +50,6 @@
5050
@taskprocessing_app.route('/health', methods=['GET'])
5151
def health():
5252
"""Health check endpoint"""
53-
from flask import jsonify
5453
return jsonify({
5554
'status': 'healthy',
5655
'service': 'taskprocessing'

services/taskprocessing/app/views/create_task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from common.pyportal_common.error_handlers.internal_server_error_handler import (
1919
send_internal_server_error_to_client,
2020
)
21+
from common.pyportal_common.utils import mask_request_headers
2122

2223

2324
def create_task():
@@ -31,7 +32,6 @@ def create_task():
3132
)
3233

3334
if request.method == "POST":
34-
from common.pyportal_common.utils import mask_request_headers
3535
rec_req_headers = dict(request.headers)
3636
masked_headers = mask_request_headers(rec_req_headers)
3737
taskprocessing_logger.info(

services/usermanagement/app/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
import sys
44
from logging import Logger
5-
from flask import Flask, Blueprint
5+
from flask import Flask, Blueprint, jsonify
66

77
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../..'))
88

@@ -99,7 +99,6 @@
9999
@usermanager_app.route('/health', methods=['GET'])
100100
def health():
101101
"""Health check endpoint"""
102-
from flask import jsonify
103102
return jsonify({
104103
'status': 'healthy',
105104
'service': 'usermanagement'

0 commit comments

Comments
 (0)