Skip to content

Commit

Permalink
Revert "Add three mypy-checked projects from CPython (#97)"
Browse files Browse the repository at this point in the history
This reverts commit d18d8ef.
  • Loading branch information
hauntsaninja committed Sep 1, 2023
1 parent d18d8ef commit 3fe90cf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 39 deletions.
20 changes: 7 additions & 13 deletions mypy_primer/git_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
RevisionLike = Union[str, None, Callable[[Path], Awaitable[str]]]


# repo_source could be a URL *or* a local path
async def clone(repo_source: str, *, repo_dir: Path, cwd: Path, shallow: bool = False) -> None:
if os.path.exists(repo_source):
repo_source = os.path.abspath(repo_source)
cmd = ["git", "clone", "--recurse-submodules", repo_source, str(repo_dir)]
async def clone(repo_url: str, cwd: Path, shallow: bool = False) -> None:
if os.path.exists(repo_url):
repo_url = os.path.abspath(repo_url)
cmd = ["git", "clone", "--recurse-submodules", repo_url]
if shallow:
cmd += ["--depth", "1"]
await run(cmd, cwd=cwd)
Expand Down Expand Up @@ -47,17 +46,12 @@ async def get_revision_for_revision_or_date(revision: str, repo_dir: Path) -> st
return revision


async def ensure_repo_at_revision(
repo_url: str, cwd: Path, revision_like: RevisionLike, *, name_override: str | None = None
) -> Path:
if name_override:
repo_dir = cwd / name_override
else:
repo_dir = cwd / Path(repo_url).name
async def ensure_repo_at_revision(repo_url: str, cwd: Path, revision_like: RevisionLike) -> Path:
repo_dir = cwd / Path(repo_url).name
if repo_dir.is_dir():
await refresh(repo_dir)
else:
await clone(repo_url, repo_dir=repo_dir, cwd=cwd, shallow=revision_like is None)
await clone(repo_url, cwd, shallow=revision_like is None)
assert repo_dir.is_dir(), f"{repo_dir} is not a directory"

if revision_like is None:
Expand Down
11 changes: 1 addition & 10 deletions mypy_primer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class Project:
pyright_cmd: str | None = None
expected_pyright_success: bool = False

name_override: str | None = None

# custom __repr__ that omits defaults.
def __repr__(self) -> str:
result = f"Project(location={self.location!r}, mypy_cmd={self.mypy_cmd!r}"
Expand All @@ -56,15 +54,11 @@ def __repr__(self) -> str:
result += f", revision={self.revision!r}"
if self.min_python_version:
result += f", min_python_version={self.min_python_version!r}"
if self.name_override:
result += f", name_override={self.name_override!r}"
result += ")"
return result

@property
def name(self) -> str:
if self.name_override is not None:
return self.name_override
return Path(self.location).name

@property
Expand Down Expand Up @@ -94,10 +88,7 @@ async def setup(self) -> None:
else:
# usually projects are something clonable
repo_dir = await ensure_repo_at_revision(
self.location,
ctx.get().projects_dir,
self.revision,
name_override=self.name_override,
self.location, ctx.get().projects_dir, self.revision
)
assert repo_dir == ctx.get().projects_dir / self.name
if self.pip_cmd:
Expand Down
16 changes: 0 additions & 16 deletions mypy_primer/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,22 +859,6 @@ def get_projects() -> list[Project]:
pyright_cmd="{pyright}",
pip_cmd="{pip} install koda",
),
Project(
location="https://github.com/python/cpython",
mypy_cmd="{mypy} --config-file Tools/clinic/mypy.ini",
name_override="CPython (Argument Clinic)",
),
Project(
location="https://github.com/python/cpython",
mypy_cmd="{mypy} --config-file Tools/cases_generator/mypy.ini",
name_override="CPython (cases_generator)",
),
Project(
location="https://github.com/python/cpython",
mypy_cmd="{mypy} --config-file Tools/peg_generator/mypy.ini",
pip_cmd="{pip} install types-setuptools types-psutil",
name_override="CPython (peg_generator)",
),
]
assert len(projects) == len({p.name for p in projects})
return projects

0 comments on commit 3fe90cf

Please sign in to comment.