Skip to content

Commit

Permalink
style: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanttV committed Jan 30, 2024
1 parent c7b5dc7 commit eb6d3d5
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 18 deletions.
94 changes: 94 additions & 0 deletions pii_report/2024-30-01-09-37-16.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
.annotation_safe_list.yml:
- annotation_data: This model has no PII
annotation_token: '.. no_pii:'
extra:
full_comment: '{''.. no_pii:'': ''This model has no PII''}'
object_id: admin.LogEntry
filename: .annotation_safe_list.yml
found_by: safelist
line_number: 0
report_group_id: 1
- annotation_data: This model has no PII
annotation_token: '.. no_pii:'
extra:
full_comment: '{''.. no_pii:'': ''This model has no PII''}'
object_id: auth.Group
filename: .annotation_safe_list.yml
found_by: safelist
line_number: 0
report_group_id: 2
- annotation_data: This model has no PII
annotation_token: '.. no_pii:'
extra:
full_comment: '{''.. no_pii:'': ''This model has no PII''}'
object_id: contenttypes.ContentType
filename: .annotation_safe_list.yml
found_by: safelist
line_number: 0
report_group_id: 3
- annotation_data: This model has no PII
annotation_token: '.. no_pii:'
extra:
full_comment: '{''.. no_pii:'': ''This model has no PII''}'
object_id: auth.Permission
filename: .annotation_safe_list.yml
found_by: safelist
line_number: 0
report_group_id: 4
- annotation_data: This model has no PII
annotation_token: '.. no_pii:'
extra:
full_comment: '{''.. no_pii:'': ''This model has no PII''}'
object_id: sessions.Session
filename: .annotation_safe_list.yml
found_by: safelist
line_number: 0
report_group_id: 5
- annotation_data: This model minimally contains a username, password, and email
annotation_token: .. pii
extra:
full_comment: '{''.. pii'': ''This model minimally contains a username, password,
and email'', ''.. pii_types'': ''username, email_address, password'', ''.. pii_retirement'':
''consumer_api''}'
object_id: auth.User
filename: .annotation_safe_list.yml
found_by: safelist
line_number: 0
report_group_id: 6
- annotation_data: username, email_address, password
annotation_token: .. pii_types
extra:
full_comment: '{''.. pii'': ''This model minimally contains a username, password,
and email'', ''.. pii_types'': ''username, email_address, password'', ''.. pii_retirement'':
''consumer_api''}'
object_id: auth.User
filename: .annotation_safe_list.yml
found_by: safelist
line_number: 0
report_group_id: 6
- annotation_data: consumer_api
annotation_token: .. pii_retirement
extra:
full_comment: '{''.. pii'': ''This model minimally contains a username, password,
and email'', ''.. pii_types'': ''username, email_address, password'', ''.. pii_retirement'':
''consumer_api''}'
object_id: auth.User
filename: .annotation_safe_list.yml
found_by: safelist
line_number: 0
report_group_id: 6
/home/bryanttv/edunext/tutor/nightly/requirements/platform-plugin-turnitin/platform_plugin_turnitin/models.py:
- annotation_data: ''
annotation_token: '.. no_pii:'
extra:
full_comment: "Represents a submission to Turnitin.\n\n Attributes:\n -\
\ user (User): The user who made the submission.\n - turnitin_submission_id\
\ (str): The unique identifier for the submission in Turnitin.\n - turnitin_submission_pdf_id\
\ (str): The unique identifier for the PDF version of the submission in Turnitin.\n\
\ - created_at (datetime): The date and time when the submission was created.\n\
\n .. no_pii:"
object_id: platform_plugin_turnitin.TurnitinSubmission
filename: /home/bryanttv/edunext/tutor/nightly/requirements/platform-plugin-turnitin/platform_plugin_turnitin/models.py
found_by: django
line_number: 11
report_group_id: 7
7 changes: 2 additions & 5 deletions platform_plugin_turnitin/api/utils.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
"""Utility functions for the Turnitin API."""

from typing import Optional, Tuple

from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from rest_framework import status
from rest_framework.response import Response

from platform_plugin_turnitin.edxapp_wrapper import (
CourseInstructorRole,
CourseStaffRole,
get_course_overview_or_none,
)
from platform_plugin_turnitin.edxapp_wrapper import CourseInstructorRole, CourseStaffRole, get_course_overview_or_none


def get_fullname(name: str) -> Tuple[str, str]:
Expand Down
9 changes: 3 additions & 6 deletions platform_plugin_turnitin/api/v1/views.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
""" Views for the Turnitin API. """

from django.conf import settings
from edx_rest_framework_extensions.auth.session.authentication import (
SessionAuthenticationAllowInactiveUser,
)
from edx_rest_framework_extensions.auth.session.authentication import SessionAuthenticationAllowInactiveUser
from requests import Response as RequestsResponse
from rest_framework import permissions, status
from rest_framework.generics import GenericAPIView
from rest_framework.response import Response

from platform_plugin_turnitin.api.utils import api_error, get_fullname, validate_request
from platform_plugin_turnitin.edxapp_wrapper import (
BearerAuthenticationAllowInactiveUser,
)
from platform_plugin_turnitin.edxapp_wrapper import BearerAuthenticationAllowInactiveUser
from platform_plugin_turnitin.models import TurnitinSubmission
from platform_plugin_turnitin.turnitin_client.handlers import (
get_similarity_report_info,
Expand Down
6 changes: 3 additions & 3 deletions platform_plugin_turnitin/turnitin.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ def get_user_data(self):
"user_id": current_user.opt_attrs["edx-platform.user_id"],
"user_email": current_user.emails[0],
"name": full_name[0] if full_name else "no_name",
"last_name": " ".join(full_name[1:])
if len(full_name) > 1
else "no_last_name",
"last_name": (
" ".join(full_name[1:]) if len(full_name) > 1 else "no_last_name"
),
}

def get_django_user(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Handler module for Turnitin API integration"""

from .eula import get_eula_acceptance_by_user, get_eula_page, get_eula_version_info, post_accept_eula_version
from .similarity_reports import (
get_similarity_report_info,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
API handlers for turnitin integration
"""

from typing import Dict, Optional

import requests
Expand Down Expand Up @@ -81,9 +82,9 @@ def turnitin_api_handler(

args = {
"headers": headers,
"json"
if request_method.lower() in ["post", "put", "patch"]
else "params": data,
(
"json" if request_method.lower() in ["post", "put", "patch"] else "params"
): data,
}

response = method_func(f"{TII_API_URL}/api/v1/{url_prefix}", **args)
Expand Down
1 change: 1 addition & 0 deletions platform_plugin_turnitin/turnitin_client/handlers/eula.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
EULA handlers for turnitin xblock
"""

from .api_handler import turnitin_api_handler


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Similarity reports handlers
"""

from .api_handler import turnitin_api_handler


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Submissions hanlders
"""

from .api_handler import turnitin_api_handler


Expand Down
2 changes: 1 addition & 1 deletion platform_plugin_turnitin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

def get_current_datetime() -> str:
"""
Returns the current datetime in ISO 8601 format.
Return the current datetime in ISO 8601 format.
Example:
>>> get_current_datetime()
Expand Down

0 comments on commit eb6d3d5

Please sign in to comment.