[BD-21] Fix grouping of safelisted annotations

Description

Annotation grouping was based on the filename and line number. Unfortunately,
this fails when the annotation comes from the safelist, where the filename is
the safelist, and the line number is 0. This was causing issues in pii
annotation parsing on edx-platform. To address this, we group annotations by
line number and extra[model_id] fields.

*Description:* Describe in a couple of sentence what this PR adds

*JIRA:* Link to JIRA ticket

*Dependencies:* dependencies on other outstanding PRs, issues, etc.

*Merge deadline:* List merge deadline (if any)

*Installation instructions:* List any non-trivial installation
instructions.

*Testing instructions:*

The following command was triggering errors for all safelisted annotations:

```
DJANGO_SETTINGS_MODULE=lms.envs.test code_annotations django_find_annotations --config_file .pii_annotations.yml --app_name lms --lint
```

It now reports only the following errors:

```
Search failed due to linting errors!
4 errors:
---------------------------------
celery_utils.FailedTask is annotated, but also in the safelist.
/home/regis/venvs/openedx/lib/python3.8/site-packages/edx_proctoring/models.py::edx_proctoring.ProctoredExamSoftwareSecureReview: "to_be_implemented" is not a valid choice for ".. pii_retirement:". Expected one of ['retained', 'local_api', 'consumer_api', 'third_party'].
/home/regis/venvs/openedx/lib/python3.8/site-packages/edx_proctoring/models.py::edx_proctoring.ProctoredExamSoftwareSecureComment: "to_be_implemented" is not a valid choice for ".. pii_retirement:". Expected one of ['retained', 'local_api', 'consumer_api', 'third_party'].
/home/regis/venvs/openedx/lib/python3.8/site-packages/edx_proctoring/models.py::edx_proctoring.ProctoredExamSoftwareSecureReviewHistory: "to_be_implemented" is not a valid choice for ".. pii_retirement:". Expected one of ['retained', 'local_api', 'consumer_api', 'third_party'].
```

*Reviewers:*

  • [ ] @robrap

  • [ ] @bmedx

*Merge checklist:*

  • [x] All reviewers approved

  • [x] CI build is green

  • [x] Version bumped

  • [x] Changelog record added

  • [ ] Documentation updated (not only docstrings)

  • [x] Commits are squashed

*Post merge:*

  • [x] Create a tag

  • [x] Check new version is pushed to PyPi after tag-triggered build is
    finished.

  • [x] Delete working branch (if not needed anymore)

Done

Assignee

Unassigned

Reporter

Open Source Pull Request Bot

Labels

Github Latest Action by edX

None

Github PR Last Updated At

None

Github PR Last Updated By

None

Github Organization

None

Customer

None

PR Number

59

Repo

edx/code-annotations

Contributor Name

Régis Behmo

Github Latest Action

None

Platform Map Area (Levels 1 & 2)

None

Platform Map Area (Levels 3 & 4)

None

Blended Project Status Page

None

Github Lines Added

15

Github Lines Deleted

5

Priority

Unset