Skip to content

Commit

Permalink
Revert linting changes to backend/plan
Browse files Browse the repository at this point in the history
  • Loading branch information
AaDalal committed Mar 27, 2024
1 parent 005462f commit f680d52
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 33 deletions.
14 changes: 3 additions & 11 deletions backend/plan/management/commands/recommendcourses.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@ def vectorize_user(user, curr_course_vectors_dict, past_course_vectors_dict):
)
past_courses = past_courses - curr_courses
return vectorize_user_by_courses(
list(curr_courses),
list(past_courses),
curr_course_vectors_dict,
past_course_vectors_dict,
list(curr_courses), list(past_courses), curr_course_vectors_dict, past_course_vectors_dict
)


Expand All @@ -126,8 +123,7 @@ def best_recommendations(
recs = [
(c.full_code, rec_course_to_score[c.full_code])
for c in Course.objects.filter(
semester=get_current_semester(),
full_code__in=list(rec_course_to_score.keys()),
semester=get_current_semester(), full_code__in=list(rec_course_to_score.keys())
)
] # only recommend currently offered courses
if n_recommendations > len(recs):
Expand Down Expand Up @@ -258,10 +254,6 @@ def handle(self, *args, **kwargs):

print(
recommend_courses(
curr_course_vectors_dict,
cluster_centroids,
clusters,
user_vector,
user_courses,
curr_course_vectors_dict, cluster_centroids, clusters, user_vector, user_courses
)
)
7 changes: 1 addition & 6 deletions backend/plan/management/commands/trainrecommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,7 @@ def generate_course_clusters(courses_data, n_per_cluster=100, preloaded_descript
sum(course_vectors_dict_curr[course] for course in cluster) / len(cluster)
for cluster in clusters
]
return (
cluster_centroids,
clusters,
course_vectors_dict_curr,
course_vectors_dict_past,
)
return cluster_centroids, clusters, course_vectors_dict_curr, course_vectors_dict_past


def train_recommender(
Expand Down
8 changes: 2 additions & 6 deletions backend/plan/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ class Migration(migrations.Migration):
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
("semester", models.CharField(max_length=5)),
Expand All @@ -34,8 +31,7 @@ class Migration(migrations.Migration):
(
"person",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
),
),
("sections", models.ManyToManyField(to="courses.Section")),
Expand Down
5 changes: 1 addition & 4 deletions backend/plan/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@

class ScheduleSerializer(serializers.ModelSerializer):
sections = SectionDetailSerializer(
many=True,
read_only=False,
help_text="The sections in the schedule.",
required=True,
many=True, read_only=False, help_text="The sections in the schedule.", required=True
)
id = serializers.IntegerField(
read_only=False, required=False, help_text="The id of the schedule."
Expand Down
8 changes: 2 additions & 6 deletions backend/plan/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@
override_response_schema={
"recommend-courses": {
"POST": {
200: {
"type": "array",
"items": {"$ref": "#/components/schemas/CourseList"},
}
200: {"type": "array", "items": {"$ref": "#/components/schemas/CourseList"}}
}
}
},
Expand Down Expand Up @@ -589,8 +586,7 @@ def create(self, request, *args, **kwargs):
)
schedule.sections.set(sections)
return Response(
{"message": "success", "id": schedule.id},
status=status.HTTP_201_CREATED,
{"message": "success", "id": schedule.id}, status=status.HTTP_201_CREATED
)
except IntegrityError as e:
return Response(
Expand Down

0 comments on commit f680d52

Please sign in to comment.