From 54a0bd80eee523ceaa66d0dd077969edeec779a5 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 19 May 2021 11:01:33 +0200 Subject: [PATCH] Add a comment about _typeshed to VERSIONS (#5447) --- .github/workflows/mypy_primer.yml | 2 +- stdlib/VERSIONS | 4 ++-- tests/check_consistent.py | 3 ++- tests/mypy_test.py | 26 +++++++++++++------------- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.github/workflows/mypy_primer.yml b/.github/workflows/mypy_primer.yml index 3910ebefa..36bdb154d 100644 --- a/.github/workflows/mypy_primer.yml +++ b/.github/workflows/mypy_primer.yml @@ -44,7 +44,7 @@ jobs: # fail action if exit code isn't zero or one ( mypy_primer \ - --new 551eea3697 --old 551eea3697 \ + --new c605579af8 --old c605579af8 \ --custom-typeshed-repo typeshed_to_test \ --new-typeshed $GITHUB_SHA --old-typeshed upstream_master \ --num-shards 2 --shard-index ${{ matrix.shard-index }} \ diff --git a/stdlib/VERSIONS b/stdlib/VERSIONS index 4ef0d82ca..536c11257 100644 --- a/stdlib/VERSIONS +++ b/stdlib/VERSIONS @@ -1,5 +1,5 @@ # The structure of this file is as follows: -# - Blank lines and lines starting with `#` are ignored. +# - Blank lines and comments starting with `#` are ignored. # - Lines contain the name of a module, followed by a colon, # a space, and a version range (for example: `symbol: 2.7-3.9`). # @@ -48,7 +48,7 @@ _thread: 2.7- _threading_local: 3.6- _tkinter: 2.7- _tracemalloc: 3.6- -_typeshed: 2.7- +_typeshed: 2.7- # not present at runtime, only for type checking _warnings: 2.7- _weakref: 2.7- _weakrefset: 2.7- diff --git a/tests/check_consistent.py b/tests/check_consistent.py index 001e8caa8..e6dc0fff0 100755 --- a/tests/check_consistent.py +++ b/tests/check_consistent.py @@ -107,7 +107,8 @@ def check_versions(): with open("stdlib/VERSIONS") as f: data = f.read().splitlines() for line in data: - if not line or line.lstrip().startswith("#"): + line = line.split("#")[0].strip() + if line == "": continue m = _VERSIONS_RE.match(line) if not m: diff --git a/tests/mypy_test.py b/tests/mypy_test.py index 49f6f4323..8286d850e 100755 --- a/tests/mypy_test.py +++ b/tests/mypy_test.py @@ -75,19 +75,19 @@ _VERSION_LINE_RE = re.compile(r"^([a-zA-Z_][a-zA-Z0-9_.]*): ([23]\.\d{1,2})-([23 def parse_versions(fname): - with open(fname) as f: - data = f.read().splitlines() result = {} - for line in data: - # Allow having some comments or empty lines. - if not line.strip() or line.startswith("#"): - continue - m = _VERSION_LINE_RE.match(line) - assert m, "invalid VERSIONS line :" + line - mod = m.group(1) - min_version = parse_version(m.group(2)) - max_version = parse_version(m.group(3)) if m.group(3) else (99, 99) - result[mod] = min_version, max_version + with open(fname) as f: + for line in f: + # Allow having some comments or empty lines. + line = line.split("#")[0].strip() + if line == "": + continue + m = _VERSION_LINE_RE.match(line) + assert m, "invalid VERSIONS line: " + line + mod = m.group(1) + min_version = parse_version(m.group(2)) + max_version = parse_version(m.group(3)) if m.group(3) else (99, 99) + result[mod] = min_version, max_version return result @@ -96,7 +96,7 @@ _VERSION_RE = re.compile(r"^([23])\.(\d+)$") def parse_version(v_str): m = _VERSION_RE.match(v_str) - assert m, "invalid version :" + v_str + assert m, "invalid version: " + v_str return int(m.group(1)), int(m.group(2))