Skip to content

Commit fdd0070

Browse files
More Pylint Fixes
1 parent 303d0cc commit fdd0070

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

server/djangoapp/models.py

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

66
# Create your models here.
77

8+
89
# Car Make model
910
class CarMake(models.Model):
1011
name = models.CharField(max_length=100) # Car make name
1112
description = models.TextField() # Description of the car make
12-
# Additional fields as needed
13+
1314
created_at = models.DateTimeField(
1415
default=now, editable=False
1516
) # Timestamp for creation
@@ -21,7 +22,9 @@ def __str__(self):
2122
# Car Model model
2223
class CarModel(models.Model):
2324
car_make = models.ForeignKey(
24-
CarMake, on_delete=models.CASCADE, related_name='models'
25+
CarMake,
26+
on_delete=models.CASCADE,
27+
related_name='models'
2528
)
2629
name = models.CharField(max_length=100) # Car model name
2730
dealer_id = models.IntegerField() # Reference to dealer in Cloudant database
@@ -41,16 +44,17 @@ class CarModel(models.Model):
4144
) # Car type
4245

4346
year = models.IntegerField(
44-
validators=[MinValueValidator(2015), MaxValueValidator(2023)],
47+
validators=[
48+
MinValueValidator(2015),
49+
MaxValueValidator(2023)
50+
],
4551
default=2023
4652
) # Year of the car model
4753

4854
description = models.TextField(blank=True, null=True) # Optional description
4955

5056
def __str__(self):
51-
return (
52-
f"{self.car_make.name} {self.name} ({self.type})"
53-
)
57+
return f"{self.car_make.name} {self.name} ({self.type})"
5458

5559

5660
admin.site.register(CarMake)

server/djangoapp/restapis.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ def analyze_review_sentiments(text):
6060
if text:
6161
url = os.getenv(
6262
'SENTIMENT_ANALYZER_URL',
63-
('https://sentianalyzer.1r729rxqpt17.us-south'
64-
'.codeengine.appdomain.cloud/')
63+
(
64+
'https://sentianalyzer.1r729rxqpt17.us-south'
65+
'.codeengine.appdomain.cloud/'
66+
)
6567
)
6668
response = requests.get(
6769
f"{url}analyze/{text}",
68-
headers={
69-
'Content-Type': 'application/json'
70-
}
70+
headers={'Content-Type': 'application/json'}
7171
)
7272

7373
# Handle different response formats

server/djangoapp/views.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
# Create your views here.
1616

17+
1718
@csrf_exempt
1819
def login_user(request):
1920
"""
@@ -22,14 +23,14 @@ def login_user(request):
2223
data = json.loads(request.body)
2324
username = data['userName']
2425
password = data['password']
25-
26+
2627
user = authenticate(username=username, password=password)
2728
response_data = {"userName": username}
2829

2930
if user is not None:
3031
login(request, user)
3132
response_data["status"] = "Authenticated"
32-
33+
3334
return JsonResponse(response_data)
3435

3536

@@ -107,7 +108,7 @@ def get_dealerships(request, state="All"):
107108
"""
108109
endpoint = "/fetchDealers" if state == "All" else f"/fetchDealers/{state}"
109110
dealerships = get_request(endpoint)
110-
111+
111112
return JsonResponse({"status": 200, "dealers": dealerships})
112113

113114

@@ -150,7 +151,8 @@ def get_dealer_details(request, dealer_id):
150151

151152
if not dealership:
152153
return JsonResponse(
153-
{"status": 404, "message": "Dealer not found"}, status=404
154+
{"status": 404, "message": "Dealer not found"},
155+
status=404
154156
)
155157

156158
return JsonResponse({"status": 200, "dealer": dealership}, status=200)

0 commit comments

Comments
 (0)