-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Summary**: added `mypy --strict` to CI and fixed all type errors (~900 total) found by it. This also found and fixed some _logical_ errors in the code. **Demo**: ![Screenshot 2024-09-03 at 13 53 11](https://github.com/user-attachments/assets/d68c2828-644f-4fa3-a7d6-3e683da94ff3) [Passing CI](https://github.com/cmu-db/dbgym/actions/runs/10687793830/job/29626172277) **Details**: * Readability is much better now that everything is typed. * `mypy` found that we were using a feature from torch 2.4.0 so I upgraded torch from 2.0.0 -> 2.4.0. * Some type errors were because of dead code. These were removed. * Some type errors showed places where we were using the wrong type. * Many asserts were added for `Optional[...]` types. * Fixed a previously confusing situation around mixing `psycopg.Connection` and `sqlalchemy.Connection` in `pg.py:create_conn()`.
- Loading branch information
1 parent
ef24dc1
commit ac849f8
Showing
83 changed files
with
1,372 additions
and
1,144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
__pycache__/ | ||
.mypy_cache/ | ||
.conda/ | ||
.idea/ | ||
test_clean_scratchspace/ | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
from pathlib import Path | ||
from typing import Optional | ||
|
||
|
||
class LoadInfoBaseClass: | ||
""" | ||
A base class for providing info for DBMSs to load the data of a benchmark | ||
When copying these functions to a specific benchmark's load_info.py file, don't | ||
copy the comments or type annotations or else they might become out of sync. | ||
""" | ||
|
||
def get_schema_fpath(self) -> str: | ||
def get_schema_fpath(self) -> Path: | ||
raise NotImplemented | ||
|
||
def get_tables_and_fpaths(self) -> list[(str, str)]: | ||
def get_tables_and_fpaths(self) -> list[tuple[str, Path]]: | ||
raise NotImplemented | ||
|
||
# If the subclassing benchmark does not have constraints, you can return None here | ||
def get_constraints_fpath(self) -> str | None: | ||
def get_constraints_fpath(self) -> Optional[Path]: | ||
raise NotImplemented |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.