diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bd6e02b..1b4ca59 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.10 - 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$ @@ -43,7 +43,7 @@ repos: - id: check-toml - repo: https://github.com/adrienverge/yamllint - rev: v1.32.0 + rev: v1.33.0 hooks: - id: yamllint args: diff --git a/edc_metadata/metadata/metadata_getter.py b/edc_metadata/metadata/metadata_getter.py index ce9149b..caed22a 100644 --- a/edc_metadata/metadata/metadata_getter.py +++ b/edc_metadata/metadata/metadata_getter.py @@ -82,7 +82,6 @@ def model_cls_registered_with_admin_site(model_cls: Any) -> bool: class MetadataGetter: - """A class that gets a filtered queryset of metadata -- `metadata_objects`. diff --git a/edc_metadata/metadata_handler.py b/edc_metadata/metadata_handler.py index caf8264..ec45548 100644 --- a/edc_metadata/metadata_handler.py +++ b/edc_metadata/metadata_handler.py @@ -29,7 +29,6 @@ class MetadataObjectDoesNotExist(Exception): class MetadataHandler: - """A class to get or create a CRF metadata model instance.""" creator_cls = Creator diff --git a/edc_metadata/metadata_helper/metadata_helper_mixin.py b/edc_metadata/metadata_helper/metadata_helper_mixin.py index 43b16a2..b0eb847 100644 --- a/edc_metadata/metadata_helper/metadata_helper_mixin.py +++ b/edc_metadata/metadata_helper/metadata_helper_mixin.py @@ -12,8 +12,7 @@ from ..models import CrfMetadata, RequisitionMetadata else: - class VisitScheduleFieldsProtocol: - ... + class VisitScheduleFieldsProtocol: ... class MetadataHelperMixin(VisitScheduleFieldsProtocol): diff --git a/edc_metadata/metadata_inspector.py b/edc_metadata/metadata_inspector.py index aba97cd..2dcb11e 100644 --- a/edc_metadata/metadata_inspector.py +++ b/edc_metadata/metadata_inspector.py @@ -3,7 +3,6 @@ class MetaDataInspector: - """Inspects for the given timepoint and form.""" metadata_model_cls = CrfMetadata diff --git a/edc_metadata/metadata_rules/logic.py b/edc_metadata/metadata_rules/logic.py index f9624a7..63f9985 100644 --- a/edc_metadata/metadata_rules/logic.py +++ b/edc_metadata/metadata_rules/logic.py @@ -19,7 +19,6 @@ class RuleLogicError(Exception): class Logic: - """A class that serves as a container for the logic attribute of a rule, the predicate, and the outcomes (result) of that rule; consequence and alternative. diff --git a/edc_metadata/metadata_rules/metadata_rule_evaluator.py b/edc_metadata/metadata_rules/metadata_rule_evaluator.py index df20bbf..8c01caa 100644 --- a/edc_metadata/metadata_rules/metadata_rule_evaluator.py +++ b/edc_metadata/metadata_rules/metadata_rule_evaluator.py @@ -11,7 +11,6 @@ class MetadataRuleEvaluator: - """Main class to evaluate rules. Used by model mixin. diff --git a/edc_metadata/metadata_rules/predicate.py b/edc_metadata/metadata_rules/predicate.py index bc312ba..c8a2aaa 100644 --- a/edc_metadata/metadata_rules/predicate.py +++ b/edc_metadata/metadata_rules/predicate.py @@ -52,7 +52,6 @@ def get_value(attr: str = None, source_model: str | None = None, **kwargs) -> An class P(BasePredicate): - """ Simple predicate class. diff --git a/edc_metadata/metadata_rules/rule_evaluator.py b/edc_metadata/metadata_rules/rule_evaluator.py index fcbcd10..83fe495 100644 --- a/edc_metadata/metadata_rules/rule_evaluator.py +++ b/edc_metadata/metadata_rules/rule_evaluator.py @@ -31,7 +31,6 @@ class RuleEvaluatorRegisterSubjectError(Exception): class RuleEvaluator: - """A class to evaluate a rule. Sets `self.result` to REQUIRED, NOT_REQUIRED or None. diff --git a/edc_metadata/metadata_rules/rule_group.py b/edc_metadata/metadata_rules/rule_group.py index 9c873e8..e811733 100644 --- a/edc_metadata/metadata_rules/rule_group.py +++ b/edc_metadata/metadata_rules/rule_group.py @@ -16,7 +16,6 @@ class TargetModelConflict(Exception): class RuleGroup: - """Base class for CRF and Requisition rule groups.""" @classmethod diff --git a/edc_metadata/metadata_rules/site.py b/edc_metadata/metadata_rules/site.py index 942a133..491b038 100644 --- a/edc_metadata/metadata_rules/site.py +++ b/edc_metadata/metadata_rules/site.py @@ -18,7 +18,6 @@ class SiteMetadataNoRulesError(Exception): class SiteMetadataRules: - """Main controller of :class:`MetadataRules` objects.""" def __init__(self) -> None: diff --git a/edc_metadata/metadata_wrappers/metadata_wrapper.py b/edc_metadata/metadata_wrappers/metadata_wrapper.py index 3283890..2203d34 100644 --- a/edc_metadata/metadata_wrappers/metadata_wrapper.py +++ b/edc_metadata/metadata_wrappers/metadata_wrapper.py @@ -17,7 +17,6 @@ class MetadataWrapperError(Exception): class MetadataWrapper: - """A class that wraps the corresponding model instance, or not, for the given metadata object and sets it to itself along with other attributes like the visit, model class, metadata_obj, etc. diff --git a/edc_metadata/metadata_wrappers/metadata_wrappers.py b/edc_metadata/metadata_wrappers/metadata_wrappers.py index a733b37..af0ab33 100644 --- a/edc_metadata/metadata_wrappers/metadata_wrappers.py +++ b/edc_metadata/metadata_wrappers/metadata_wrappers.py @@ -9,7 +9,6 @@ class MetadataWrappers: - """A class that generates a collection of MetadataWrapper objects, e.g. CRF or REQUISITION, from a queryset of metadata objects. diff --git a/edc_metadata/model_mixins/creates/creates_metadata_model_mixin.py b/edc_metadata/model_mixins/creates/creates_metadata_model_mixin.py index a813f2c..5043fa7 100644 --- a/edc_metadata/model_mixins/creates/creates_metadata_model_mixin.py +++ b/edc_metadata/model_mixins/creates/creates_metadata_model_mixin.py @@ -19,8 +19,7 @@ from edc_visit_tracking.typing_stubs import RelatedVisitProtocol else: - class RelatedVisitProtocol: - ... + class RelatedVisitProtocol: ... class CreatesMetadataModelMixin(RelatedVisitProtocol, models.Model): diff --git a/edc_metadata/models/crf_metadata_model_mixin.py b/edc_metadata/models/crf_metadata_model_mixin.py index 9f3e3a1..35fee7a 100644 --- a/edc_metadata/models/crf_metadata_model_mixin.py +++ b/edc_metadata/models/crf_metadata_model_mixin.py @@ -27,7 +27,6 @@ class CrfMetadataModelMixin( VisitScheduleFieldsModelMixin, models.Model, ): - """Mixin for CrfMetadata and RequisitionMetadata models.""" visit_code = models.CharField(max_length=25) diff --git a/edc_metadata/requisition/requisition_metadata_handler.py b/edc_metadata/requisition/requisition_metadata_handler.py index c20db04..f0c286a 100644 --- a/edc_metadata/requisition/requisition_metadata_handler.py +++ b/edc_metadata/requisition/requisition_metadata_handler.py @@ -13,7 +13,6 @@ class RequisitionMetadataHandler(MetadataHandler): - """A class to get or create a requisition metadata model instance. """ diff --git a/edc_metadata/requisition/requisition_metadata_updater.py b/edc_metadata/requisition/requisition_metadata_updater.py index 02155bc..05e3d95 100644 --- a/edc_metadata/requisition/requisition_metadata_updater.py +++ b/edc_metadata/requisition/requisition_metadata_updater.py @@ -15,7 +15,6 @@ class RequisitionMetadataError(Exception): class RequisitionMetadataUpdater(MetadataUpdater): - """A class to update a subject's requisition metadata given the visit, target model name, panel and desired entry status. """ diff --git a/edc_metadata/stubs.py b/edc_metadata/stubs.py index cf218e0..4061513 100644 --- a/edc_metadata/stubs.py +++ b/edc_metadata/stubs.py @@ -27,8 +27,7 @@ class VisitModel(Protocol): visit_schedule_name: str _meta: ModelMetaStub - def visit_schedule(self) -> VisitSchedule: - ... + def visit_schedule(self) -> VisitSchedule: ... class CrfMetadataModelStub(Protocol): @@ -45,17 +44,13 @@ class CrfMetadataModelStub(Protocol): visit: VisitModel _meta: ModelMetaStub - def save(self, *args, **kwargs) -> None: - ... + def save(self, *args, **kwargs) -> None: ... - def delete(self) -> int: - ... + def delete(self) -> int: ... - def metadata_visit_object(self) -> Visit: - ... + def metadata_visit_object(self) -> Visit: ... - def refresh_from_db(self) -> None: - ... + def refresh_from_db(self) -> None: ... class PanelStub(Protocol): @@ -77,17 +72,13 @@ class RequisitionMetadataModelStub(Protocol): visit: VisitModel _meta: ModelMetaStub - def save(self, *args, **kwargs) -> None: - ... + def save(self, *args, **kwargs) -> None: ... - def delete(self) -> int: - ... + def delete(self) -> int: ... - def metadata_visit_object(self) -> Visit: - ... + def metadata_visit_object(self) -> Visit: ... - def metadata_updater_cls(self, **opts: dict): - ... + def metadata_updater_cls(self, **opts: dict): ... class MetadataGetterStub(Protocol): @@ -95,16 +86,13 @@ class MetadataGetterStub(Protocol): visit: RelatedVisitModelStub | None -class CrfMetadataUpdaterStub(Protocol): - ... +class CrfMetadataUpdaterStub(Protocol): ... -class RequisitionMetadataUpdaterStub(Protocol): - ... +class RequisitionMetadataUpdaterStub(Protocol): ... -class RequisitionMetadataGetterStub(MetadataGetterStub, Protocol): - ... +class RequisitionMetadataGetterStub(MetadataGetterStub, Protocol): ... class MetadataWrapperStub(Protocol): @@ -114,11 +102,9 @@ class MetadataWrapperStub(Protocol): ... -class RequisitionMetadataWrapperStub(MetadataWrapperStub, Protocol): - ... +class RequisitionMetadataWrapperStub(MetadataWrapperStub, Protocol): ... class Predicate(Protocol): @staticmethod - def get_value(self) -> Any: - ... + def get_value(self) -> Any: ... diff --git a/edc_metadata/tests/crf_test_helper.py b/edc_metadata/tests/crf_test_helper.py index 596f959..c7e76c4 100644 --- a/edc_metadata/tests/crf_test_helper.py +++ b/edc_metadata/tests/crf_test_helper.py @@ -5,7 +5,6 @@ class CrfTestHelper: - """A test class to help create CRFs and manipulate metadata. """ diff --git a/setup.cfg b/setup.cfg index be14b46..4aa6d88 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,7 +36,7 @@ exclude = effect_metadata.tests* [flake8] -ignore = E226,W503,E203 +ignore = E226,W503,E203,E701,E704 max-line-length = 95 max-complexity = 12 exclude = */migrations/*,.tox,.git,__pycache__,build,dist,.eggs,_version.py