diff --git a/Makefile b/Makefile index 21977aa6..9f6fdb78 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,5 @@ upgrade: $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with pip-compile --upgrade -o requirements/development.txt requirements/development.in for fextra in edx_repo_tools/*/extra.in; do pip-compile --upgrade -o $${fextra%.in}.txt $$fextra; done -lint: ## run pep8 and pylint - pep8 || true - pylint *.py edx_repo_tools tests || true +lint: ## run pylint + pylint *.py edx_repo_tools tests diff --git a/barcalendar.py b/barcalendar.py index 0fe7f66c..aac70763 100644 --- a/barcalendar.py +++ b/barcalendar.py @@ -139,14 +139,14 @@ def years_months(self): for (m = 0; m < 12; m++) {{ sheet.getRange({monthrow}, {iyear}+m).setValue("JFMAMJJASOND"[m]); }} - """); + """) print(f"""\ sheet.getRange({yearrow}, 1, 1, {self.width}) .setFontWeight("bold") .setHorizontalAlignment("center"); sheet.getRange({monthrow}, 1, 1, {self.width}) .setHorizontalAlignment("center"); - """); + """) print(f"""\ var rules = sheet.getConditionalFormatRules(); rules.push( @@ -275,7 +275,7 @@ def get_defaults_from_tutor(): def parse_version_number(line): """ Get version number in line from YAML file. - Note that this only captures major and minor version (not patch number). + Note that this only captures major and minor version (not patch number). e.g. "docker.io/elasticsearch:7.17.9" -> "7.17" """ match = re.search(r'(?P\d+(\.\d+)?)', line) diff --git a/edx_repo_tools/conventional_commits/commitstats.py b/edx_repo_tools/conventional_commits/commitstats.py index 179531e1..2faef389 100644 --- a/edx_repo_tools/conventional_commits/commitstats.py +++ b/edx_repo_tools/conventional_commits/commitstats.py @@ -3,7 +3,6 @@ """ import csv -import datetime import fnmatch import os import os.path @@ -56,7 +55,7 @@ def load_commits(db, repo_name): commit_table = db["commits"] log = get_cmd_output(GITLOG) - for i, commit in enumerate(log.split(SEP + "\n")): + for commit in log.split(SEP + "\n"): if re.match(r"fatal: your current branch '\w+' does not have any commits yet", commit): # Project-only or uninitialized repos are like this. continue diff --git a/edx_repo_tools/find_dependencies/README.rst b/edx_repo_tools/find_dependencies/README.rst index 3755b9a8..734c55f0 100644 --- a/edx_repo_tools/find_dependencies/README.rst +++ b/edx_repo_tools/find_dependencies/README.rst @@ -24,7 +24,7 @@ Run it with a list of local repo directories. It will traverse into each direct - second_party_urls.txt is the subset of repo_urls.txt that come from organizations close enough to the Open edX project, that the repos might need to be moved into the openedx organization. -I run it in a tree of all repos, with these commands to example all the repos branched for Olive:: +I run it in a tree of all repos, with these commands to examine all the repos branched for Olive:: $ export OLIVE_DIRS=$(gittreeif origin/open-release/olive.master -q pwd) $ find_dependencies $OLIVE_DIRS diff --git a/edx_repo_tools/find_dependencies/find_dependencies.py b/edx_repo_tools/find_dependencies/find_dependencies.py index 46366ae7..dcfbbf42 100644 --- a/edx_repo_tools/find_dependencies/find_dependencies.py +++ b/edx_repo_tools/find_dependencies/find_dependencies.py @@ -278,7 +278,7 @@ def find_py_reqs(): if possible_req.exists(): return possible_req if any(Path(ind).exists() for ind in PY_INDICATORS): - print(f"WARNING: {repo_name} is likely a Python package, but we can't find its dependencies.") + print(f"WARNING: {os.getcwd()} is likely a Python package, but we can't find its dependencies.") return None diff --git a/edx_repo_tools/repo_access_scraper/repo_access_scraper.py b/edx_repo_tools/repo_access_scraper/repo_access_scraper.py index 2c844f12..66ef7e5b 100644 --- a/edx_repo_tools/repo_access_scraper/repo_access_scraper.py +++ b/edx_repo_tools/repo_access_scraper/repo_access_scraper.py @@ -55,10 +55,10 @@ def screenshot_pages(page, url, image_prefix): page.screenshot(path=f"{IMAGES_DIR}/{image_prefix}-{imgnum}.png", full_page=True) # If there's a next page, visit it. - next = page.locator("a.next_page") - if next.count(): + next_page = page.locator("a.next_page") + if next_page.count(): with page.expect_navigation(): - next.click() + next_page.click() else: # No next page, we're done here. break @@ -72,7 +72,7 @@ def request_list(url): """ data = [] while url: - resp = requests.get(url, headers=HEADERS) + resp = requests.get(url, headers=HEADERS, timeout=60) data.extend(resp.json()) url = None if "link" in resp.headers: @@ -84,7 +84,7 @@ def request_list(url): def request_dict(url): """Get dict data from a GitHub URL.""" - return requests.get(url, headers=HEADERS).json() + return requests.get(url, headers=HEADERS, timeout=60).json() def counted(things: list, thing_name: str) -> str: """ diff --git a/edx_repo_tools/repo_checks/repo_checks.py b/edx_repo_tools/repo_checks/repo_checks.py index a83d6af8..8eaaa8e8 100644 --- a/edx_repo_tools/repo_checks/repo_checks.py +++ b/edx_repo_tools/repo_checks/repo_checks.py @@ -817,9 +817,9 @@ def _update_branch_protection(self, params): "https://api.github.com" + self.api.repos.update_branch_protection.path.format(**params) ) - resp = requests.put( + resp = requests.put( # pylint: disable=missing-timeout url, headers=headers, json=params - ) # pylint: disable=missing-timeout + ) resp.raise_for_status() diff --git a/requirements/development.in b/requirements/development.in index d29c2191..7d4291e1 100644 --- a/requirements/development.in +++ b/requirements/development.in @@ -2,7 +2,6 @@ -r base.txt edx-lint -pep8 pip-tools pytest pytest-mock diff --git a/requirements/development.txt b/requirements/development.txt index 431edaf1..30f3839b 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -200,8 +200,6 @@ path-py==12.5.0 # via -r requirements/base.txt pbr==5.11.1 # via stevedore -pep8==1.7.1 - # via -r requirements/development.in pip-tools==7.0.0 # via -r requirements/development.in platformdirs==3.9.1 diff --git a/setup.py b/setup.py index f808d8c6..3c39d47b 100644 --- a/setup.py +++ b/setup.py @@ -58,7 +58,7 @@ def is_requirement(line): # To run tests & linting across the entire repo, we need to install the union # of *all* extra requirements lists *plus* the dev-specific requirements. # If this list contains conflicting pins, then installing it will fail; -# that is intentional. +# that is intentional. EXTRAS_REQUIRE["dev"] = sorted({ *load_requirements("requirements/development.txt"), *(extra_pin for extra_reqs in EXTRAS_REQUIRE.values() for extra_pin in extra_reqs),