diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bace820..5cb5a4a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ exclude: tests/etc/user-* repos: - repo: https://github.com/PyCQA/bandit - rev: 1.7.10 + rev: 1.8.0 hooks: - id: bandit args: diff --git a/edc_qareports/modeladmin_mixins/qa_report_modeladmin_mixin.py b/edc_qareports/modeladmin_mixins/qa_report_modeladmin_mixin.py index 40fa89c..b0813f1 100644 --- a/edc_qareports/modeladmin_mixins/qa_report_modeladmin_mixin.py +++ b/edc_qareports/modeladmin_mixins/qa_report_modeladmin_mixin.py @@ -5,9 +5,9 @@ from django.urls import reverse from django.utils.translation import gettext as _ from edc_constants.constants import NEW +from edc_utils import truncate_string from ..models import QaReportLog -from ..utils import truncate_string from .list_filters import NoteStatusListFilter diff --git a/edc_qareports/utils.py b/edc_qareports/utils.py index 64b9643..d3fb16a 100644 --- a/edc_qareports/utils.py +++ b/edc_qareports/utils.py @@ -34,16 +34,6 @@ def read_unmanaged_model_sql( return sql.replace("uuid()", uuid_func) -def truncate_string(string: str, max_length: int) -> str: - """Strips string of leading/trailing whitespace and truncates - if > `max_length`. - """ - string = string.strip() - if len(string) > max_length: - return string[: max_length - 1].strip() + "…" - return string - - def get_qareports_codenames(app_name: str, *note_models: str) -> list[str]: warn("This function has been deprecated. Use get_app_codenames.", DeprecationWarning, 2) return get_app_codenames(app_name)