Skip to content

Commit

Permalink
Fixed linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JusticeV452 committed Jun 27, 2024
1 parent 4e26260 commit 5f6cf67
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 18 deletions.
3 changes: 1 addition & 2 deletions backend/app/analysis/indoor_analysis/courtyard_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ def analyze(photo: Photo):
max_pixel = 0
for row in normalized_grayscale_image:
for pixel in row:
if pixel > max_pixel:
max_pixel = pixel
max_pixel = max(max_pixel, pixel)
dark_threshold = max_pixel * 0.5

# Evaluating the top border of photo by comparing each pixel to dark_threshold
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
"""
resnet18_feature_vectors.py
"""
from pathlib import Path

import torch
from torchvision import models
from torchvision import transforms
from torch.autograd import Variable

from django.conf import settings

from app.models import Photo


Expand Down
3 changes: 0 additions & 3 deletions backend/app/analysis/photo_similarity/similarity_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
Utility functions for each of the photo similarity analyses
"""
from pathlib import Path

import torch

from django.conf import settings

from app.models import Photo, PhotoAnalysisResult


Expand Down
7 changes: 4 additions & 3 deletions backend/app/api_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ def get_corpus_analysis_results(request):
@api_view(['GET'])
def all_analyses(request):
"""
"""
API endpoint to get the names of all analyses run on the photos
"""
photo_analysis_obj = PhotoAnalysisResult.objects.values_list('name').distinct()
return Response([analysis[0] for analysis in photo_analysis_obj])

Expand Down Expand Up @@ -418,11 +419,11 @@ def get_photo_by_similarity(request, map_square_number, folder_number, photo_num

similar_photos = []
for similar_photo in similarity_list:
photo = (Photo.objects.prefetch_related('map_square')
photo_obj = (Photo.objects.prefetch_related('map_square')
.get(number=similar_photo['number'],
map_square__number=similar_photo['map_square_number'],
folder=similar_photo['folder_number']))
similar_photos.append(photo)
similar_photos.append(photo_obj)

serializer = SimplePhotoSerializer(similar_photos, many=True)
return Response(serializer.data)
Expand Down
1 change: 0 additions & 1 deletion backend/app/management/commands/runanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import json

from importlib import import_module
from typing import Callable

from django.core.management.base import BaseCommand

Expand Down
2 changes: 1 addition & 1 deletion backend/app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
get_all_yolo_tags
)

from app.models import Photo, MapSquare
from app.models import Photo
from app.serializers import SimplePhotoSerializer
from .translation_db import translate_tag

Expand Down
2 changes: 1 addition & 1 deletion backend/blog/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BlogPostAdmin(admin.ModelAdmin):
form = BlogPostAdminForm
# TODO: make slug be a link that takes the admin user to the blog page

def formfield_for_dbfield(self, db_field, **kwargs):
def formfield_for_dbfield(self, db_field, _, **kwargs):
if db_field.name == 'content':
return db_field.formfield(widget=TinyMCE(
attrs={'cols': 80, 'rows': 30},
Expand Down
1 change: 0 additions & 1 deletion backend/blog/serializers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from rest_framework import serializers
from django.conf import settings

from .models import (
BlogPost
Expand Down
16 changes: 13 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ asttokens==2.4.1
backcall==0.2.0
cachetools==5.3.2
certifi==2023.7.22
chardet==5.2.0
chardet==3.0.4
charset-normalizer==3.3.2
colorama==0.4.6
contourpy==1.2.0
Expand Down Expand Up @@ -49,9 +49,17 @@ google-auth==2.23.4
google-auth-httplib2==0.1.1
google-auth-oauthlib==1.1.0
googleapis-common-protos==1.61.0
googletrans==3.1.0a0
h11==0.9.0
h2==3.2.0
hpack==3.0.0
hstspreload==2024.6.1
html5lib==1.1
httpcore==0.9.1
httplib2==0.22.0
idna==3.4
httpx==0.13.3
hyperframe==5.2.0
idna==2.10
imageio==2.32.0
imutils==0.5.4
ipython==8.17.2
Expand Down Expand Up @@ -99,14 +107,15 @@ PyYAML==6.0.1
reportlab==4.0.7
requests==2.31.0
requests-oauthlib==1.3.1
rfc3986==2.0.0
rfc3986==1.5.0
rosetta==0.3
rsa==4.9
scikit-image==0.22.0
scikit-learn==1.3.2
scipy==1.11.3
seaborn==0.13.0
six==1.16.0
sniffio==1.3.1
sqlparse==0.4.4
stack-data==0.6.3
svglib==1.5.1
Expand All @@ -118,6 +127,7 @@ torch==2.1.1
torchvision==0.16.1
tqdm==4.66.1
traitlets==5.13.0
translate-po==1.0.13
typing_extensions==4.8.0
tzdata==2023.3
Unidecode==1.3.7
Expand Down

0 comments on commit 5f6cf67

Please sign in to comment.