From 52ad4f2695daae214377ae244f7e1ed5b764f03b Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 9 Aug 2023 11:03:09 -0400 Subject: [PATCH 1/4] feat!: remove validation of people.yaml https://github.com/openedx/openedx-webhooks/pull/251 removes people.yaml from the OSPR bot, so we no longer need to validate it. --- CHANGELOG.rst | 6 + repo_tools_data_schema/__init__.py | 2 +- .../repo_tools_data_schema.py | 166 +----------------- requirements/base.in | 2 - 4 files changed, 8 insertions(+), 168 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2e56b12..8f0c278 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,6 +10,12 @@ Change Log This project adheres to Semantic Versioning (https://semver.org/). +2023-08-09 +~~~~~~~~~~ + +* Removed validation of people.yaml files. The OSPR bot no longer reads + people.yaml, so that file will be deleted. + 2023-07-25 ~~~~~~~~~~ diff --git a/repo_tools_data_schema/__init__.py b/repo_tools_data_schema/__init__.py index 7cf2631..54cb240 100644 --- a/repo_tools_data_schema/__init__.py +++ b/repo_tools_data_schema/__init__.py @@ -4,4 +4,4 @@ __version__ = '1.1' -from .repo_tools_data_schema import validate_orgs, validate_people, validate_salesforce_export +from .repo_tools_data_schema import validate_orgs, 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 2f11254..412d01c 100644 --- a/repo_tools_data_schema/repo_tools_data_schema.py +++ b/repo_tools_data_schema/repo_tools_data_schema.py @@ -4,25 +4,13 @@ import collections import csv -import datetime import difflib -import functools -import os -import pathlib import re -import backoff -import requests import yaml +from schema import Optional, Or, Schema from yaml.constructor import ConstructorError -from schema import And, Optional, Or, Schema, SchemaError - - -def valid_agreement(s): - """Is this a valid "agreement" value?""" - return s in ['institution', 'individual', 'none'] - def valid_email(s): """Is this a valid email?""" @@ -33,64 +21,11 @@ def valid_email(s): ) -@functools.lru_cache(maxsize=None) -@backoff.on_exception(backoff.expo, SchemaError, max_time=60) -def github_repo_exists(full_name): - """ - Determine if a GitHub repo exists. - - Returns True, or raises an exception with details. - """ - headers = None - if (token := os.environ.get("GITHUB_TOKEN")): - headers = {"authorization": f"Bearer {token}"} - - resp = requests.get(f"https://api.github.com/repos/{full_name}", headers=headers, timeout=60) - if resp.status_code != 200: - raise SchemaError(f"GitHub responded with {resp.status_code} for repo {full_name}") - repo_actual_name = resp.json()["full_name"] - if repo_actual_name != full_name: - raise SchemaError(f"Repo {full_name} is actually at {repo_actual_name}") - return True - - -def valid_org(s): - """Is this a valid GitHub org?""" - return isinstance(s, str) and re.match(r"^[^/]+$", s) - - -def valid_repo(s): - """Is this a valid repo?""" - return ( - isinstance(s, str) and - re.match(r"^[^/]+/[^/]+$", s) and - github_repo_exists(s) - ) - - -def existing_person(s): - """Is this an existing person in people.yaml?""" - return isinstance(s, str) and s in ALL_PEOPLE - - def not_empty_string(s): """A string that can't be empty.""" return isinstance(s, str) and len(s) > 0 -def check_institution(d): - """If the agreement is institution, then we have to have an institution.""" - if "agreement" in d: - if d['agreement'] == 'institution': - if 'institution' in d: - if d['institution'] not in ALL_ORGS: - raise SchemaError("Institution {!r} isn't in orgs.yaml: {}".format(d['institution'], d)) - if d['agreement'] == 'none': - if 'institution' in d: - raise SchemaError("No-agreement should have no institution") - return True - - def github_username(s): """Is this a valid GitHub username?""" # Usernames can have "[bot]" at the end for bots. @@ -104,77 +39,6 @@ def github_username(s): return re.match(r"^[a-zA-Z0-9_-]+\*?$", s) -def not_data_key(s): - """Make sure the GitHub name is not a data line at the wrong indent.""" - return s not in [ - 'name', 'email', 'agreement', 'institution', 'jira', - 'comments', 'other_emails', 'before', 'beta', 'committer', 'email_ok', - ] - - -def one_of_keys(*keys): - """Checks that at least one key is present (not exclusive OR)""" - def _check(d): - if sum(k in d for k in keys) > 0: - return True - raise SchemaError("Must have at least one of {}".format(keys)) - return _check - - -COMMITTER_SCHEMA = Schema( - Or( - # "committer: false" means this person is not a committer. - False, - # or explain where they are a committer: - And( - { - Optional('orgs'): [valid_org], - Optional('repos'): [valid_repo], - Optional('champions'): [existing_person], - Optional('branches'): [not_empty_string], - }, - # You have to specify at least one of orgs, repos, or branches: - one_of_keys("orgs", "repos", "branches"), - ), - ), -) - -PEOPLE_SCHEMA = Schema( - Or( - { - And(github_username, not_data_key): And( - { - 'name': not_empty_string, - 'email': valid_email, - 'agreement': valid_agreement, - Optional('institution'): not_empty_string, - Optional('is_robot'): True, - Optional('jira'): not_empty_string, - Optional('comments'): [str], - Optional('other_emails'): [valid_email], - Optional('before'): { - datetime.date: And( - { - Optional('agreement'): valid_agreement, - Optional('institution'): not_empty_string, - Optional('comments'): [str], - Optional('committer'): COMMITTER_SCHEMA, - }, - check_institution, - ), - }, - Optional('beta'): bool, - Optional('contractor'): bool, - Optional('committer'): COMMITTER_SCHEMA, - Optional('email_ok'): bool, - }, - check_institution, - ), - }, - {}, - ), -) - ORGS_SCHEMA = Schema( Or( { @@ -230,34 +94,6 @@ def validate_orgs(filename): assert_sorted(orgs, "Keys in {}".format(filename)) -ALL_ORGS = set() -ALL_PEOPLE = set() - - -def validate_people(filename): - """ - Validate that `filename` conforms to our people.yaml schema. - Supporting files are found in the same directory as `filename`. - """ - with open(filename) as f: - people = yaml.safe_load(f) - - global ALL_ORGS, ALL_PEOPLE - with open(pathlib.Path(filename).parent / "orgs.yaml") as orgsf: - org_data = yaml.safe_load(orgsf) - ALL_ORGS = set(org_data) - for orgd in org_data.values(): - name = orgd.get("name") - if name: - ALL_ORGS.add(name) - - ALL_PEOPLE = set(people) - - PEOPLE_SCHEMA.validate(people) - # keys should be sorted. - assert_sorted(people, "Keys in {}".format(filename)) - - def validate_salesforce_export(filename, encoding="cp1252"): """ Validate that `filename` is a Salesforce export we expect. diff --git a/requirements/base.in b/requirements/base.in index f92c6d6..1e086f2 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -2,6 +2,4 @@ -c constraints.txt PyYAML -requests schema -backoff From f1c9576823b43d92f313bd44a5e773358facc8ff Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 9 Aug 2023 11:09:54 -0400 Subject: [PATCH 2/4] chore: make upgrade --- requirements/base.txt | 14 +---- requirements/ci.txt | 12 ++--- requirements/common_constraints.txt | 5 -- requirements/dev.txt | 81 +++++++++++------------------ requirements/doc.txt | 67 +++++++++--------------- requirements/pip-tools.txt | 13 +++-- requirements/pip.txt | 6 +-- requirements/quality.txt | 64 +++++++---------------- requirements/test.txt | 36 +++---------- 9 files changed, 99 insertions(+), 199 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index 7845be8..61cfa61 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -4,21 +4,9 @@ # # make upgrade # -backoff==2.2.1 - # via -r requirements/base.in -certifi==2022.12.7 - # via requests -charset-normalizer==3.0.1 - # via requests contextlib2==21.6.0 # via schema -idna==3.4 - # via requests -pyyaml==6.0 - # via -r requirements/base.in -requests==2.28.2 +pyyaml==6.0.1 # via -r requirements/base.in schema==0.7.5 # via -r requirements/base.in -urllib3==1.26.14 - # via requests diff --git a/requirements/ci.txt b/requirements/ci.txt index 807e179..805dd1c 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -4,17 +4,17 @@ # # make upgrade # -distlib==0.3.6 +distlib==0.3.7 # via virtualenv -filelock==3.9.0 +filelock==3.12.2 # via # tox # virtualenv -packaging==23.0 +packaging==23.1 # via tox -platformdirs==3.0.0 +platformdirs==3.10.0 # via virtualenv -pluggy==1.0.0 +pluggy==1.2.0 # via tox py==1.11.0 # via tox @@ -26,5 +26,5 @@ tox==3.28.0 # via # -c requirements/common_constraints.txt # -r requirements/ci.in -virtualenv==20.19.0 +virtualenv==20.24.2 # via tox diff --git a/requirements/common_constraints.txt b/requirements/common_constraints.txt index 7e39123..afe6aa8 100644 --- a/requirements/common_constraints.txt +++ b/requirements/common_constraints.txt @@ -25,8 +25,3 @@ django-simple-history==3.0.0 # tox>4.0.0 isn't yet compatible with many tox plugins, causing CI failures in almost all repos. # Details can be found in this discussion: https://github.com/tox-dev/tox/discussions/1810 tox<4.0.0 - -# edx-sphinx-theme is not compatible with latest Sphinx==6.0.0 version -# Pinning Sphinx version unless the compatibility issue gets resolved -# For details, see issue https://github.com/openedx/edx-sphinx-theme/issues/197 -sphinx<6.0.0 diff --git a/requirements/dev.txt b/requirements/dev.txt index 6e97942..acd1881 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -4,32 +4,18 @@ # # make upgrade # -astroid==2.14.2 +astroid==2.15.6 # via # -r requirements/quality.txt # pylint # pylint-celery -attrs==22.2.0 - # via - # -r requirements/quality.txt - # pytest -backoff==2.2.1 - # via -r requirements/quality.txt build==0.10.0 # via # -r requirements/pip-tools.txt # pip-tools -certifi==2022.12.7 - # via - # -r requirements/quality.txt - # requests -chardet==5.1.0 +chardet==5.2.0 # via diff-cover -charset-normalizer==3.0.1 - # via - # -r requirements/quality.txt - # requests -click==8.1.3 +click==8.1.6 # via # -r requirements/pip-tools.txt # -r requirements/quality.txt @@ -41,7 +27,7 @@ click-log==0.4.0 # via # -r requirements/quality.txt # edx-lint -code-annotations==1.3.0 +code-annotations==1.5.0 # via # -r requirements/quality.txt # edx-lint @@ -49,35 +35,31 @@ contextlib2==21.6.0 # via # -r requirements/quality.txt # schema -coverage[toml]==7.2.1 +coverage[toml]==7.2.7 # via # -r requirements/quality.txt # pytest-cov -diff-cover==7.5.0 +diff-cover==7.7.0 # via -r requirements/dev.in -dill==0.3.6 +dill==0.3.7 # via # -r requirements/quality.txt # pylint -distlib==0.3.6 +distlib==0.3.7 # via # -r requirements/ci.txt # virtualenv -edx-lint==5.3.2 +edx-lint==5.3.4 # via -r requirements/quality.txt -exceptiongroup==1.1.0 +exceptiongroup==1.1.2 # via # -r requirements/quality.txt # pytest -filelock==3.9.0 +filelock==3.12.2 # via # -r requirements/ci.txt # tox # virtualenv -idna==3.4 - # via - # -r requirements/quality.txt - # requests iniconfig==2.0.0 # via # -r requirements/quality.txt @@ -95,7 +77,7 @@ lazy-object-proxy==1.9.0 # via # -r requirements/quality.txt # astroid -markupsafe==2.1.2 +markupsafe==2.1.3 # via # -r requirements/quality.txt # jinja2 @@ -103,7 +85,7 @@ mccabe==0.7.0 # via # -r requirements/quality.txt # pylint -packaging==23.0 +packaging==23.1 # via # -r requirements/ci.txt # -r requirements/pip-tools.txt @@ -115,15 +97,15 @@ pbr==5.11.1 # via # -r requirements/quality.txt # stevedore -pip-tools==6.12.2 +pip-tools==7.3.0 # via -r requirements/pip-tools.txt -platformdirs==3.0.0 +platformdirs==3.10.0 # via # -r requirements/ci.txt # -r requirements/quality.txt # pylint # virtualenv -pluggy==1.0.0 +pluggy==1.2.0 # via # -r requirements/ci.txt # -r requirements/quality.txt @@ -134,11 +116,11 @@ py==1.11.0 # via # -r requirements/ci.txt # tox -pycodestyle==2.10.0 +pycodestyle==2.11.0 # via -r requirements/quality.txt -pygments==2.14.0 +pygments==2.16.1 # via diff-cover -pylint==2.16.2 +pylint==2.17.5 # via # -r requirements/quality.txt # edx-lint @@ -153,7 +135,7 @@ pylint-django==2.5.3 # via # -r requirements/quality.txt # edx-lint -pylint-plugin-utils==0.7 +pylint-plugin-utils==0.8.2 # via # -r requirements/quality.txt # pylint-celery @@ -162,22 +144,20 @@ pyproject-hooks==1.0.0 # via # -r requirements/pip-tools.txt # build -pytest==7.2.1 +pytest==7.4.0 # via # -r requirements/quality.txt # pytest-cov -pytest-cov==4.0.0 +pytest-cov==4.1.0 # via -r requirements/quality.txt python-slugify==8.0.1 # via # -r requirements/quality.txt # code-annotations -pyyaml==6.0 +pyyaml==6.0.1 # via # -r requirements/quality.txt # code-annotations -requests==2.28.2 - # via -r requirements/quality.txt schema==0.7.5 # via -r requirements/quality.txt six==1.16.0 @@ -186,7 +166,7 @@ six==1.16.0 # -r requirements/quality.txt # edx-lint # tox -stevedore==5.0.0 +stevedore==5.1.0 # via # -r requirements/quality.txt # code-annotations @@ -201,11 +181,12 @@ tomli==2.0.1 # -r requirements/quality.txt # build # coverage + # pip-tools # pylint # pyproject-hooks # pytest # tox -tomlkit==0.11.6 +tomlkit==0.12.1 # via # -r requirements/quality.txt # pylint @@ -216,20 +197,16 @@ tox==3.28.0 # tox-battery tox-battery==0.6.1 # via -r requirements/dev.in -typing-extensions==4.5.0 +typing-extensions==4.7.1 # via # -r requirements/quality.txt # astroid # pylint -urllib3==1.26.14 - # via - # -r requirements/quality.txt - # requests -virtualenv==20.19.0 +virtualenv==20.24.2 # via # -r requirements/ci.txt # tox -wheel==0.38.4 +wheel==0.41.1 # via # -r requirements/pip-tools.txt # pip-tools diff --git a/requirements/doc.txt b/requirements/doc.txt index 3e349d6..89539e1 100644 --- a/requirements/doc.txt +++ b/requirements/doc.txt @@ -8,33 +8,23 @@ accessible-pygments==0.0.4 # via pydata-sphinx-theme alabaster==0.7.13 # via sphinx -attrs==22.2.0 - # via - # -r requirements/test.txt - # pytest babel==2.12.1 # via # pydata-sphinx-theme # sphinx -backoff==2.2.1 - # via -r requirements/test.txt beautifulsoup4==4.12.2 # via pydata-sphinx-theme bleach==6.0.0 # via readme-renderer -certifi==2022.12.7 - # via - # -r requirements/test.txt - # requests -charset-normalizer==3.0.1 - # via - # -r requirements/test.txt - # requests +certifi==2023.7.22 + # via requests +charset-normalizer==3.2.0 + # via requests contextlib2==21.6.0 # via # -r requirements/test.txt # schema -coverage[toml]==7.2.1 +coverage[toml]==7.2.7 # via # -r requirements/test.txt # pytest-cov @@ -47,17 +37,15 @@ docutils==0.19 # readme-renderer # restructuredtext-lint # sphinx -exceptiongroup==1.1.0 +exceptiongroup==1.1.2 # via # -r requirements/test.txt # pytest idna==3.4 - # via - # -r requirements/test.txt - # requests + # via requests imagesize==1.4.1 # via sphinx -importlib-metadata==6.0.0 +importlib-metadata==6.8.0 # via sphinx iniconfig==2.0.0 # via @@ -65,9 +53,9 @@ iniconfig==2.0.0 # pytest jinja2==3.1.2 # via sphinx -markupsafe==2.1.2 +markupsafe==2.1.3 # via jinja2 -packaging==23.0 +packaging==23.1 # via # -r requirements/test.txt # pydata-sphinx-theme @@ -75,35 +63,33 @@ packaging==23.0 # sphinx pbr==5.11.1 # via stevedore -pluggy==1.0.0 +pluggy==1.2.0 # via # -r requirements/test.txt # pytest pydata-sphinx-theme==0.13.3 # via sphinx-book-theme -pygments==2.14.0 +pygments==2.16.1 # via # accessible-pygments # doc8 # pydata-sphinx-theme # readme-renderer # sphinx -pytest==7.2.1 +pytest==7.4.0 # via # -r requirements/test.txt # pytest-cov -pytest-cov==4.0.0 +pytest-cov==4.1.0 # via -r requirements/test.txt -pytz==2022.7.1 +pytz==2023.3 # via babel -pyyaml==6.0 +pyyaml==6.0.1 # via -r requirements/test.txt -readme-renderer==37.3 +readme-renderer==40.0 # via -r requirements/doc.in -requests==2.28.2 - # via - # -r requirements/test.txt - # sphinx +requests==2.31.0 + # via sphinx restructuredtext-lint==1.4.0 # via doc8 schema==0.7.5 @@ -114,9 +100,8 @@ snowballstemmer==2.2.0 # via sphinx soupsieve==2.4.1 # via beautifulsoup4 -sphinx==5.3.0 +sphinx==6.2.1 # via - # -c requirements/common_constraints.txt # -r requirements/doc.in # pydata-sphinx-theme # sphinx-book-theme @@ -134,7 +119,7 @@ sphinxcontrib-qthelp==1.0.3 # via sphinx sphinxcontrib-serializinghtml==1.1.5 # via sphinx -stevedore==5.0.0 +stevedore==5.1.0 # via doc8 tomli==2.0.1 # via @@ -142,13 +127,11 @@ tomli==2.0.1 # coverage # doc8 # pytest -typing-extensions==4.5.0 +typing-extensions==4.7.1 # via pydata-sphinx-theme -urllib3==1.26.14 - # via - # -r requirements/test.txt - # requests +urllib3==2.0.4 + # via requests webencodings==0.5.1 # via bleach -zipp==3.15.0 +zipp==3.16.2 # via importlib-metadata diff --git a/requirements/pip-tools.txt b/requirements/pip-tools.txt index e40369c..07c0707 100644 --- a/requirements/pip-tools.txt +++ b/requirements/pip-tools.txt @@ -6,17 +6,20 @@ # build==0.10.0 # via pip-tools -click==8.1.3 +click==8.1.6 # via pip-tools -packaging==23.0 +packaging==23.1 # via build -pip-tools==6.12.2 +pip-tools==7.3.0 # via -r requirements/pip-tools.in pyproject-hooks==1.0.0 # via build tomli==2.0.1 - # via build -wheel==0.38.4 + # via + # build + # pip-tools + # pyproject-hooks +wheel==0.41.1 # via pip-tools # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/pip.txt b/requirements/pip.txt index 97b1eb9..5e2f760 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -4,11 +4,11 @@ # # make upgrade # -wheel==0.38.4 +wheel==0.41.1 # via -r requirements/pip.in # The following packages are considered to be unsafe in a requirements file: -pip==23.0.1 +pip==23.2.1 # via -r requirements/pip.in -setuptools==67.4.0 +setuptools==68.0.0 # via -r requirements/pip.in diff --git a/requirements/quality.txt b/requirements/quality.txt index 646ee28..87d47b2 100644 --- a/requirements/quality.txt +++ b/requirements/quality.txt @@ -4,53 +4,35 @@ # # make upgrade # -astroid==2.14.2 +astroid==2.15.6 # via # pylint # pylint-celery -attrs==22.2.0 - # via - # -r requirements/test.txt - # pytest -backoff==2.2.1 - # via -r requirements/test.txt -certifi==2022.12.7 - # via - # -r requirements/test.txt - # requests -charset-normalizer==3.0.1 - # via - # -r requirements/test.txt - # requests -click==8.1.3 +click==8.1.6 # via # click-log # code-annotations # edx-lint click-log==0.4.0 # via edx-lint -code-annotations==1.3.0 +code-annotations==1.5.0 # via edx-lint contextlib2==21.6.0 # via # -r requirements/test.txt # schema -coverage[toml]==7.2.1 +coverage[toml]==7.2.7 # via # -r requirements/test.txt # pytest-cov -dill==0.3.6 +dill==0.3.7 # via pylint -edx-lint==5.3.2 +edx-lint==5.3.4 # via -r requirements/quality.in -exceptiongroup==1.1.0 +exceptiongroup==1.1.2 # via # -r requirements/test.txt # pytest -idna==3.4 - # via - # -r requirements/test.txt - # requests iniconfig==2.0.0 # via # -r requirements/test.txt @@ -63,25 +45,25 @@ jinja2==3.1.2 # via code-annotations lazy-object-proxy==1.9.0 # via astroid -markupsafe==2.1.2 +markupsafe==2.1.3 # via jinja2 mccabe==0.7.0 # via pylint -packaging==23.0 +packaging==23.1 # via # -r requirements/test.txt # pytest pbr==5.11.1 # via stevedore -platformdirs==3.0.0 +platformdirs==3.10.0 # via pylint -pluggy==1.0.0 +pluggy==1.2.0 # via # -r requirements/test.txt # pytest -pycodestyle==2.10.0 +pycodestyle==2.11.0 # via -r requirements/quality.in -pylint==2.16.2 +pylint==2.17.5 # via # edx-lint # pylint-celery @@ -91,29 +73,27 @@ pylint-celery==0.3 # via edx-lint pylint-django==2.5.3 # via edx-lint -pylint-plugin-utils==0.7 +pylint-plugin-utils==0.8.2 # via # pylint-celery # pylint-django -pytest==7.2.1 +pytest==7.4.0 # via # -r requirements/test.txt # pytest-cov -pytest-cov==4.0.0 +pytest-cov==4.1.0 # via -r requirements/test.txt python-slugify==8.0.1 # via code-annotations -pyyaml==6.0 +pyyaml==6.0.1 # via # -r requirements/test.txt # code-annotations -requests==2.28.2 - # via -r requirements/test.txt schema==0.7.5 # via -r requirements/test.txt six==1.16.0 # via edx-lint -stevedore==5.0.0 +stevedore==5.1.0 # via code-annotations text-unidecode==1.3 # via python-slugify @@ -123,15 +103,11 @@ tomli==2.0.1 # coverage # pylint # pytest -tomlkit==0.11.6 +tomlkit==0.12.1 # via pylint -typing-extensions==4.5.0 +typing-extensions==4.7.1 # via # astroid # pylint -urllib3==1.26.14 - # via - # -r requirements/test.txt - # requests wrapt==1.15.0 # via astroid diff --git a/requirements/test.txt b/requirements/test.txt index 5ce7842..692b323 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -4,43 +4,25 @@ # # make upgrade # -attrs==22.2.0 - # via pytest -backoff==2.2.1 - # via -r requirements/base.txt -certifi==2022.12.7 - # via - # -r requirements/base.txt - # requests -charset-normalizer==3.0.1 - # via - # -r requirements/base.txt - # requests contextlib2==21.6.0 # via # -r requirements/base.txt # schema -coverage[toml]==7.2.1 +coverage[toml]==7.2.7 # via pytest-cov -exceptiongroup==1.1.0 +exceptiongroup==1.1.2 # via pytest -idna==3.4 - # via - # -r requirements/base.txt - # requests iniconfig==2.0.0 # via pytest -packaging==23.0 +packaging==23.1 # via pytest -pluggy==1.0.0 +pluggy==1.2.0 # via pytest -pytest==7.2.1 +pytest==7.4.0 # via pytest-cov -pytest-cov==4.0.0 +pytest-cov==4.1.0 # via -r requirements/test.in -pyyaml==6.0 - # via -r requirements/base.txt -requests==2.28.2 +pyyaml==6.0.1 # via -r requirements/base.txt schema==0.7.5 # via -r requirements/base.txt @@ -48,7 +30,3 @@ tomli==2.0.1 # via # coverage # pytest -urllib3==1.26.14 - # via - # -r requirements/base.txt - # requests From c9ec39f14ffdcea44b71b29425273c2f5d4ad3c7 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 9 Aug 2023 11:10:04 -0400 Subject: [PATCH 3/4] chore: edx_lint write pylintrc --- pylintrc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pylintrc b/pylintrc index da1ff93..d01ab4a 100644 --- a/pylintrc +++ b/pylintrc @@ -64,7 +64,7 @@ # SERIOUSLY. # # ------------------------------ -# Generated by edx-lint version: 5.2.5 +# Generated by edx-lint version: 5.3.4 # ------------------------------ [MASTER] ignore = migrations @@ -259,6 +259,7 @@ enable = useless-suppression, disable = bad-indentation, + broad-exception-raised, consider-using-f-string, duplicate-code, file-ignored, @@ -380,6 +381,6 @@ ext-import-graph = int-import-graph = [EXCEPTIONS] -overgeneral-exceptions = Exception +overgeneral-exceptions = builtins.Exception -# afac0308552b9baa632c39eb574d26e9725303f1 +# 69626f4a89ab0a7387bf870b30a5bbcd72e11ce1 From 542342c0a10b9d3f9ce145839b8b023cd7de92a0 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 9 Aug 2023 11:39:57 -0400 Subject: [PATCH 4/4] feat: assert the salesforce fields are as expected --- repo_tools_data_schema/repo_tools_data_schema.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/repo_tools_data_schema/repo_tools_data_schema.py b/repo_tools_data_schema/repo_tools_data_schema.py index 412d01c..73fd837 100644 --- a/repo_tools_data_schema/repo_tools_data_schema.py +++ b/repo_tools_data_schema/repo_tools_data_schema.py @@ -100,9 +100,10 @@ def validate_salesforce_export(filename, encoding="cp1252"): """ with open(filename, encoding=encoding) as fcsv: reader = csv.DictReader(fcsv) - # fields are: - # "First Name","Last Name","Number of Active Ind. CLA Contracts", - # "Title","Account Name","Number of Active Entity CLA Contracts","GitHub Username" + assert reader.fieldnames == [ + "First Name", "Last Name", "Number of Active Ind. CLA Contracts", + "Title", "Account Name", "Number of Active Entity CLA Contracts", "GitHub Username", + ] for row in reader: acct = row["Account Name"] if acct == "Opfocus Test":