From ae59a2c7ea7fa49a7eda18816c2b9942bd80c71d Mon Sep 17 00:00:00 2001 From: Pushyami Gundala Date: Fri, 17 Nov 2023 13:38:51 -0500 Subject: [PATCH] Fixing the Codacy errors --- .github/workflows/main.yml | 3 +-- dashboard/cron.py | 8 ++------ dashboard/graphql/view.py | 2 +- dashboard/management/commands/course.py | 2 +- dashboard/management/commands/term.py | 2 +- dashboard/models.py | 2 +- 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dc4048a8..ee8e0469 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,6 @@ on: branches: - master - '[0-9][0-9][0-9][0-9].[0-9][0-9].*' # 2021.01.01 - - i1544_backend_dependencies env: IMAGE_TAG: latest @@ -15,7 +14,7 @@ env: jobs: build: # to test a feature, change the repo name to your github id - if: github.repository_owner == 'pushyamig' + if: github.repository_owner == 'tl-its-umich-edu' runs-on: ubuntu-latest steps: diff --git a/dashboard/cron.py b/dashboard/cron.py index 8f03e655..20f2a9bd 100644 --- a/dashboard/cron.py +++ b/dashboard/cron.py @@ -2,10 +2,10 @@ import logging from collections import namedtuple from typing import Any, Dict, List, Union +from zoneinfo import ZoneInfo import hjson import pandas as pd -from zoneinfo import ZoneInfo import pangres from django.conf import settings @@ -504,16 +504,12 @@ def submission(self): df.to_sql(con=engine, name='submission', if_exists='append', index=False) except Exception as e: - logger.exception('Error running sql on table submission', e) + logger.exception('Error running sql on table submission', str(e)) raise status+=f"{str(df.shape[0])} submission: {query_params}\n" # returns the row size of dataframe return status - - - - return status def weight_consideration(self): # load the assignment weight consider information with in a course. Some assignments don't have weight consideration diff --git a/dashboard/graphql/view.py b/dashboard/graphql/view.py index 0367f6ed..6e238c53 100644 --- a/dashboard/graphql/view.py +++ b/dashboard/graphql/view.py @@ -1,5 +1,6 @@ from graphene_django.views import GraphQLView from django.contrib.auth.mixins import LoginRequiredMixin +from graphql_core_promise import PromiseExecutionContext from dashboard.common.db_util import canvas_id_to_incremented_id from dashboard.graphql.loaders import AssignmentsByCourseIdLoader, \ SubmissionsByAssignmentIdLoader, SubmissionByAssignmentIdAndUserIdLoader, \ @@ -8,7 +9,6 @@ AssignmentGroupByCourseIdAndIdLoader, AssignmentWeightConsiderationByCourseIdLoader, \ UserDefaultSelectionsByCourseIdAndUserLoader, UserDefaultSelectionByCourseIdAndUserAndViewTypeLoader, \ AcademicTermByIdLoader -from graphql_core_promise import PromiseExecutionContext from django.db.models import Q from dashboard.models import User from pinax.eventlog.models import log as eventlog diff --git a/dashboard/management/commands/course.py b/dashboard/management/commands/course.py index 97184a9d..881e9974 100644 --- a/dashboard/management/commands/course.py +++ b/dashboard/management/commands/course.py @@ -2,7 +2,7 @@ from dashboard.models import Course, CourseViewOption, AcademicTerms from dashboard.common.db_util import canvas_id_to_incremented_id from datetime import datetime -from zoneinfo import ZoneInfo +from zoneinfo import ZoneInfo class Command(BaseCommand): def add_arguments(self, parser): diff --git a/dashboard/management/commands/term.py b/dashboard/management/commands/term.py index ba9ffd7d..a9e08c64 100644 --- a/dashboard/management/commands/term.py +++ b/dashboard/management/commands/term.py @@ -2,7 +2,7 @@ from dashboard.models import AcademicTerms from dashboard.common.db_util import canvas_id_to_incremented_id from datetime import datetime -from zoneinfo import ZoneInfo +from zoneinfo import ZoneInfo class Command(BaseCommand): def add_arguments(self, parser): diff --git a/dashboard/models.py b/dashboard/models.py index 39b3fb39..e669d876 100644 --- a/dashboard/models.py +++ b/dashboard/models.py @@ -11,7 +11,7 @@ from datetime import datetime, timedelta from typing import Optional, Union -from zoneinfo import ZoneInfo +from zoneinfo import ZoneInfo from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.db import models