From 4adedef11267947d5ceebec1bbeed4d45b5dc9db Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Fri, 2 Feb 2024 23:28:54 +0000 Subject: [PATCH 1/4] Bump pre-commit repos, run through Black 24.1.1 Black changes witnessed (mainly) include: - addition of blank line between module docstrings and imports - removal of blank lines between class declarations and docstrings - prefer splitting assignment statements on right-hand side - wrap conditional expressions that span multiple lines in parens - put `...` in stubs on same line - add E701 and E704 to flake8 ignore list, see: - https://github.com/psf/black/blob/main/docs/guides/using_black_with_other_tools.md#e701--e704 - https://github.com/psf/black/issues/3887 (E704) - https://github.com/psf/black/issues/4173 (E701) --- .pre-commit-config.yaml | 12 ++++++------ edc_model/models/base_model.py | 1 - edc_model/models/fields/date_estimated.py | 2 -- edc_model/models/fields/identity_type_field.py | 1 - edc_model/stubs.py | 9 +++------ edc_model/widgets/slider_widget.py | 1 - setup.cfg | 2 +- 7 files changed, 10 insertions(+), 18 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6f3af91..3fa7253 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,32 +3,32 @@ exclude: tests/etc/user-* repos: - repo: https://github.com/PyCQA/bandit - rev: 1.7.5 + rev: 1.7.7 hooks: - id: bandit args: - "-x *test*.py" - repo: https://github.com/psf/black - rev: 23.9.1 + rev: 24.1.1 hooks: - id: black language_version: python3.11 - repo: https://github.com/pycqa/flake8 - rev: 6.1.0 + rev: 7.0.0 hooks: - id: flake8 args: - "--config=setup.cfg" - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: requirements-txt-fixer files: requirements/.*\.txt$ @@ -42,7 +42,7 @@ repos: - id: detect-private-key - repo: https://github.com/adrienverge/yamllint - rev: v1.32.0 + rev: v1.33.0 hooks: - id: yamllint args: diff --git a/edc_model/models/base_model.py b/edc_model/models/base_model.py index 000f25c..c6805da 100644 --- a/edc_model/models/base_model.py +++ b/edc_model/models/base_model.py @@ -5,7 +5,6 @@ class BaseModel(UrlModelMixin, AuditModelMixin, models.Model): - """Base model class for all EDC models. Adds created and modified' values for user, date and hostname (computer). """ diff --git a/edc_model/models/fields/date_estimated.py b/edc_model/models/fields/date_estimated.py index 8d2c657..5b14b8a 100644 --- a/edc_model/models/fields/date_estimated.py +++ b/edc_model/models/fields/date_estimated.py @@ -5,7 +5,6 @@ class IsDateEstimatedField(CharField): - """field to question if date is estimated""" description = _("Custom field to question if date is estimated") @@ -28,7 +27,6 @@ def get_internal_type(self): class IsDateEstimatedFieldNa(CharField): - """field to question if date is estimated""" description = _("Custom field to question if date is estimated") diff --git a/edc_model/models/fields/identity_type_field.py b/edc_model/models/fields/identity_type_field.py index f8648ba..6a0bdda 100644 --- a/edc_model/models/fields/identity_type_field.py +++ b/edc_model/models/fields/identity_type_field.py @@ -4,7 +4,6 @@ class IdentityTypeField(CharField): - """ have IdentityTypeField immediately follow an identity field: diff --git a/edc_model/stubs.py b/edc_model/stubs.py index e154e95..8c1b9f3 100644 --- a/edc_model/stubs.py +++ b/edc_model/stubs.py @@ -13,8 +13,7 @@ class ModelMetaStub(Protocol): app_label: str model_name: str - def get_fields(self) -> list: - ... + def get_fields(self) -> list: ... class BaseUuidModelStub(AuditModelStub, Protocol): @@ -22,8 +21,7 @@ class BaseUuidModelStub(AuditModelStub, Protocol): admin_url_name: str admin_site_name: str - def get_absolute_url(self) -> str: - ... + def get_absolute_url(self) -> str: ... objects: models.Manager _meta: ModelMetaStub @@ -39,8 +37,7 @@ class BaseUuidHistoryModelStub(AuditModelStub, Protocol): admin_url_name: str admin_site_name: str - def get_absolute_url(self) -> str: - ... + def get_absolute_url(self) -> str: ... objects: models.Manager history: models.Manager diff --git a/edc_model/widgets/slider_widget.py b/edc_model/widgets/slider_widget.py index ccaf33d..c6a57d3 100644 --- a/edc_model/widgets/slider_widget.py +++ b/edc_model/widgets/slider_widget.py @@ -2,7 +2,6 @@ class SliderWidget(Input): - """ class HtnMedicationAdherenceForm(CrfModelFormMixin, forms.ModelForm): form_validator_cls = HtnMedicationAdherenceFormValidator diff --git a/setup.cfg b/setup.cfg index 66f498e..de2df7d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,7 +35,7 @@ exclude = edc_ltfu.tests* [flake8] -ignore = E226,W503,E203 +ignore = E226,W503,E203,E701,E704 max-line-length = 95 max-complexity = 10 exclude = */migrations/*,.tox,.git,__pycache__,build,dist,.eggs From e691bacabbedf72d737263d35837eddbb13c3c45 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Tue, 6 Feb 2024 09:07:21 +0000 Subject: [PATCH 2/4] Update GH actions to versions running Node.js 20 Fixes warnings: "Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20" See also: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/ --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4ec2681..59f4d55 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,9 +36,9 @@ jobs: sudo apt-get -y update sudo apt-get install libcups2-dev wamerican - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -48,7 +48,7 @@ jobs: echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT - name: Cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.pip-cache.outputs.dir }} key: From aa6286f16a419267b671ef43908737fac5e702a0 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Tue, 13 Feb 2024 13:32:09 +0000 Subject: [PATCH 3/4] Bump pre-commit repos (Black 24.2.0, yamllint 1.34.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3fa7253..a32918b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: - "-x *test*.py" - repo: https://github.com/psf/black - rev: 24.1.1 + rev: 24.2.0 hooks: - id: black language_version: python3.11 @@ -42,7 +42,7 @@ repos: - id: detect-private-key - repo: https://github.com/adrienverge/yamllint - rev: v1.33.0 + rev: v1.34.0 hooks: - id: yamllint args: From 66069bf2ee69c8ec8d618070a990d5bcdc278754 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Tue, 13 Feb 2024 20:19:42 +0000 Subject: [PATCH 4/4] Fix/unify GH actions build status badge --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index f862da9..f85b3d4 100644 --- a/README.rst +++ b/README.rst @@ -60,8 +60,8 @@ User created and modified fields behave as follows: .. |pypi| image:: https://img.shields.io/pypi/v/edc-model.svg :target: https://pypi.python.org/pypi/edc-model -.. |actions| image:: https://github.com/clinicedc/edc-model/workflows/build/badge.svg?branch=develop - :target: https://github.com/clinicedc/edc-model/actions?query=workflow:build +.. |actions| image:: https://github.com/clinicedc/edc-model/actions/workflows/build.yml/badge.svg + :target: https://github.com/clinicedc/edc-model/actions/workflows/build.yml .. |codecov| image:: https://codecov.io/gh/clinicedc/edc-model/branch/develop/graph/badge.svg :target: https://codecov.io/gh/clinicedc/edc-model