Skip to content

Commit 82bda67

Browse files
pylint
1 parent 0cbc13d commit 82bda67

File tree

18 files changed

+1506
-1057
lines changed

18 files changed

+1506
-1057
lines changed

ClientAdvisor/App/.pylintrc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,17 @@ ignore=tests ; Ignore the tests folder globally.
44
[MESSAGES CONTROL]
55
disable=
66
invalid-name, # C0103: Ignore naming style errors
7-
line-too-long, # C0301: Ignore long lines
87
missing-function-docstring, # C0116: Ignore missing function docstrings
98
missing-class-docstring, # C0115: Ignore missing class docstrings
109
missing-module-docstring, # C0114: Ignore missing module docstrings
11-
redefined-outer-name, # W0621: Ignore redefined variables warnings
1210
broad-exception-raised, # W0719: Ignore broad exception raised warnings
1311
broad-exception-caught, # W0718: Ignore broad exception caught warnings
1412
too-many-arguments, # R0913: Ignore too many arguments
1513
too-many-locals, # R0914: Ignore too many local variables
1614
too-many-return-statements, # R0911: Ignore too many return statements
15+
too-many-statements, # R0915: Ignore too many statements in a function
1716
too-many-branches, # R0912: Ignore too many branches
18-
unused-argument, # W0613: Ignore unused arguments
1917
unspecified-encoding, # W1514: Ignore unspecified encoding in open()
20-
logging-fstring-interpolation, # W1203: Ignore lazy f-string interpolation
2118
missing-timeout, # W3101: Ignore missing timeout in requests.get
2219
no-else-return, # R1705: Ignore unnecessary 'else' after return
2320
redefined-builtin, # W0622: Ignore redefining built-ins
@@ -26,16 +23,18 @@ disable=
2623
no-member, # E1101: Ignore module has no 'member'
2724
pointless-string-statement, # W0105: Ignore pointless string statements
2825
unnecessary-comprehension, # R1721: Ignore unnecessary comprehensions
29-
fixme, # W0511: Ignore TODO comments
26+
simplifiable-if-expression, # R1719: Ignore simplifiable if expressions
27+
dangerous-default-value, # W0102: Ignore mutable default arguments
28+
consider-using-with, # R1732: Ignore using 'with' for resource management
3029
too-many-instance-attributes, # R0902: Ignore too many attributes in class
3130
too-many-positional-arguments, # R0917: Ignore too many positional arguments
3231
raise-missing-from, # W0707: Ignore re-raising without 'raise from'
3332
import-outside-toplevel, # C0415: Ignore imports outside top-level
34-
no-value-for-parameter # E1120: Ignore missing arguments in function calls
33+
no-value-for-parameter, # E1120: Ignore missing arguments in function calls
3534

3635
[TYPECHECK]
3736
generated-members=get_bearer_token_provider
3837

3938
[FORMAT]
40-
max-module-lines=1700 # Allow large modules up to 1700 lines
39+
max-module-lines=1700 # Allow modules up to 1700 lines
4140
max-line-length=160 # Allow lines up to 160 characters

ClientAdvisor/App/app.py

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,31 @@
88

99
import httpx
1010
import requests
11-
from azure.identity.aio import (DefaultAzureCredential,
12-
get_bearer_token_provider)
11+
from azure.identity.aio import DefaultAzureCredential, get_bearer_token_provider
12+
from backend.auth.auth_utils import get_authenticated_user_details, get_tenantid
13+
from backend.history.cosmosdbservice import CosmosConversationClient
14+
from backend.utils import (
15+
convert_to_pf_format,
16+
format_as_ndjson,
17+
format_pf_non_streaming_response,
18+
format_stream_response,
19+
generateFilterString,
20+
parse_multi_columns,
21+
)
22+
from db import get_connection
1323
from dotenv import load_dotenv
24+
1425
# from quart.sessions import SecureCookieSessionInterface
1526
from openai import AsyncAzureOpenAI
16-
from quart import (Blueprint, Quart, jsonify, make_response, render_template,
17-
request, send_from_directory)
18-
19-
from backend.auth.auth_utils import (get_authenticated_user_details,
20-
get_tenantid)
21-
from backend.history.cosmosdbservice import CosmosConversationClient
22-
from backend.utils import (convert_to_pf_format, format_as_ndjson,
23-
format_pf_non_streaming_response,
24-
format_stream_response, generateFilterString,
25-
parse_multi_columns)
26-
from db import get_connection
27+
from quart import (
28+
Blueprint,
29+
Quart,
30+
jsonify,
31+
make_response,
32+
render_template,
33+
request,
34+
send_from_directory,
35+
)
2736

2837
bp = Blueprint("routes", __name__, static_folder="static", template_folder="static")
2938

@@ -472,9 +481,7 @@ def get_configured_data_source():
472481
else []
473482
),
474483
},
475-
"in_scope": (
476-
AZURE_SEARCH_ENABLE_IN_DOMAIN.lower() == "true"
477-
),
484+
"in_scope": (AZURE_SEARCH_ENABLE_IN_DOMAIN.lower() == "true"),
478485
"top_n_documents": (
479486
int(AZURE_SEARCH_TOP_K) if AZURE_SEARCH_TOP_K else int(SEARCH_TOP_K)
480487
),
@@ -588,9 +595,7 @@ def get_configured_data_source():
588595
else []
589596
),
590597
},
591-
"in_scope": (
592-
ELASTICSEARCH_ENABLE_IN_DOMAIN.lower() == "true"
593-
),
598+
"in_scope": (ELASTICSEARCH_ENABLE_IN_DOMAIN.lower() == "true"),
594599
"top_n_documents": (
595600
int(ELASTICSEARCH_TOP_K)
596601
if ELASTICSEARCH_TOP_K
@@ -640,9 +645,7 @@ def get_configured_data_source():
640645
else []
641646
),
642647
},
643-
"in_scope": (
644-
AZURE_MLINDEX_ENABLE_IN_DOMAIN.lower() == "true"
645-
),
648+
"in_scope": (AZURE_MLINDEX_ENABLE_IN_DOMAIN.lower() == "true"),
646649
"top_n_documents": (
647650
int(AZURE_MLINDEX_TOP_K)
648651
if AZURE_MLINDEX_TOP_K
@@ -685,9 +688,7 @@ def get_configured_data_source():
685688
else []
686689
),
687690
},
688-
"in_scope": (
689-
PINECONE_ENABLE_IN_DOMAIN.lower() == "true"
690-
),
691+
"in_scope": (PINECONE_ENABLE_IN_DOMAIN.lower() == "true"),
691692
"top_n_documents": (
692693
int(PINECONE_TOP_K) if PINECONE_TOP_K else int(SEARCH_TOP_K)
693694
),

ClientAdvisor/App/tests/backend/auth/test_auth.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
import json
33
from unittest.mock import patch
44

5-
from backend.auth.auth_utils import (get_authenticated_user_details,
6-
get_tenantid)
5+
from backend.auth.auth_utils import get_authenticated_user_details, get_tenantid
76

87

98
def test_get_authenticated_user_details_no_principal_id():

ClientAdvisor/App/tests/backend/history/test_cosmosdb_service.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import pytest
44
from azure.cosmos import exceptions
5-
65
from backend.history.cosmosdbservice import CosmosConversationClient
76

87

ClientAdvisor/App/tests/backend/test_utils.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@
33
from unittest.mock import MagicMock, patch
44

55
import pytest
6-
7-
from backend.utils import (JSONEncoder, convert_to_pf_format, fetchUserGroups,
8-
format_as_ndjson, format_non_streaming_response,
9-
format_pf_non_streaming_response,
10-
format_stream_response, generateFilterString,
11-
parse_multi_columns)
6+
from backend.utils import (
7+
JSONEncoder,
8+
convert_to_pf_format,
9+
fetchUserGroups,
10+
format_as_ndjson,
11+
format_non_streaming_response,
12+
format_pf_non_streaming_response,
13+
format_stream_response,
14+
generateFilterString,
15+
parse_multi_columns,
16+
)
1217

1318

1419
@dataclasses.dataclass

ClientAdvisor/App/tests/test_app.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
from unittest.mock import AsyncMock, MagicMock, patch
33

44
import pytest
5-
6-
from app import (create_app, delete_all_conversations, generate_title,
7-
init_cosmosdb_client, init_openai_client, stream_chat_request)
5+
from app import (
6+
create_app,
7+
delete_all_conversations,
8+
generate_title,
9+
init_cosmosdb_client,
10+
init_openai_client,
11+
stream_chat_request,
12+
)
813

914
# Constants for testing
1015
INVALID_API_VERSION = "2022-01-01"

ClientAdvisor/App/tools/data_collection.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
import os
44
import sys
55

6-
from dotenv import load_dotenv
7-
86
import app
7+
from dotenv import load_dotenv
98

109
# import the app.py module to gain access to the methods to construct payloads and
1110
# call the API through the sdk

0 commit comments

Comments
 (0)