From f087ea8d27c87abfed4ddbb99e4b1989d19ee6c8 Mon Sep 17 00:00:00 2001 From: Kyle McCormick Date: Sat, 17 Jun 2023 10:22:48 -0400 Subject: [PATCH] feat!: remove `validate_labels` Part of: https://github.com/openedx/openedx-webhooks/issues/218 --- CHANGELOG.rst | 11 ++++++-- repo_tools_data_schema/__init__.py | 4 +-- .../repo_tools_data_schema.py | 28 ------------------- 3 files changed, 11 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index fa2a011..fde4b51 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,8 +10,15 @@ Change Log This project adheres to Semantic Versioning (https://semver.org/). -2023-05-30 -~~~~~~~~~~ +2.0 (2023-06-20) +~~~~~~~~~~~~~~~~ + +* Delete ``validate_labels``, since ``labels.yaml`` is not longer used by + openedx-webhooks. + + +1.1 (2023-05-30) +~~~~~~~~~~~~~~~~ * Make it valid for ORGS, LABELS, and PEOPLE to be empty. This was prompted because we actually want LABELS to be empty as an intermediate step towards diff --git a/repo_tools_data_schema/__init__.py b/repo_tools_data_schema/__init__.py index 1e9a929..26ba2cd 100644 --- a/repo_tools_data_schema/__init__.py +++ b/repo_tools_data_schema/__init__.py @@ -2,6 +2,6 @@ Schema for repo-tools-data. """ -__version__ = '1.1' +__version__ = '2.0' -from .repo_tools_data_schema import validate_labels, validate_orgs, validate_people, validate_salesforce_export +from .repo_tools_data_schema import validate_orgs, validate_people, validate_salesforce_export diff --git a/repo_tools_data_schema/repo_tools_data_schema.py b/repo_tools_data_schema/repo_tools_data_schema.py index 4459db6..cee52a8 100644 --- a/repo_tools_data_schema/repo_tools_data_schema.py +++ b/repo_tools_data_schema/repo_tools_data_schema.py @@ -199,26 +199,6 @@ def color(s): return re.match(r"^[a-fA-F0-9]{6}$", s) -LABELS_SCHEMA = Schema( - Or( - { - str: Or( - # A label we don't want: - { - "delete": True, - }, - # A label we want: - { - "color": color, - Optional("description"): str, - }, - ), - }, - {}, - ), -) - - # Prevent duplicate keys in YAML. # Adapted from https://gist.github.com/pypt/94d747fe5180851196eb # from https://bitbucket.org/xi/pyyaml/issues/9/ignore-duplicate-keys-and-send-warning-or @@ -243,14 +223,6 @@ def mapping_constructor(loader, node, deep=False): # The public functions. -def validate_labels(filename): - """ - Validate that `filename` conforms to our labels.yaml schema. - """ - with open(filename) as f: - labels = yaml.safe_load(f) - LABELS_SCHEMA.validate(labels) - def validate_orgs(filename): """