-
Notifications
You must be signed in to change notification settings - Fork 3
Minimal type checking changes #365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lispandfound
wants to merge
13
commits into
testing_infra_refactor
Choose a base branch
from
type_checking
base: testing_infra_refactor
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
82a3ca6
feat: minimal type checking changes
lispandfound 5d1fb25
fix: use ... in overloads
lispandfound ff4b2d2
fix: truncated_log_normal return type
lispandfound 057f6b0
fix(distributions): more robust floating point returns
lispandfound f53dce6
fix(geo): overload `path_from_corners`
lispandfound f530645
fix(xyts): remove duplicate data definitions
lispandfound 8268746
tests: remove unused imports
lispandfound f0ae08e
fix(distributions): truncated log normal takes size argument
lispandfound 129f9e5
fix(distributions): crash when size=1 for rand_shyp
lispandfound e833340
fix(constants): short-circuitted logic in is_substring
lispandfound 3caa69f
fix(formats): correct return type
lispandfound e384afc
Merge branch 'type_checking' of github.com:ucgmsim/qcore into type_ch…
lispandfound 534579f
ci: run type checker on all PRs
lispandfound File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| name: Type Check | ||
|
|
||
| on: [pull_request] | ||
|
|
||
| jobs: | ||
| typecheck: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.13" | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
| with: | ||
| enable-cache: true | ||
|
|
||
| - name: Install project with types | ||
| run: uv sync --all-extras --dev | ||
|
|
||
| - name: Run type checking with ty | ||
| run: uv run ty check |
This file contains hidden or 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 hidden or 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,27 +1,61 @@ | ||
| """ | ||
| Gives access to the folder structure of archived cybershake directories | ||
| """ | ||
|
|
||
| from pathlib import Path | ||
|
|
||
| from .simulation_structure import get_fault_from_realisation | ||
|
|
||
|
|
||
| def get_fault_source_dir(fault_dir: Path): | ||
| """Gets the Source directory for the given fault directory""" | ||
| def get_fault_source_dir(fault_dir: Path) -> Path: | ||
| """ | ||
| Get the Source directory for a given fault directory. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| fault_dir : Path | ||
| Path to the fault directory. | ||
|
|
||
| Returns | ||
| ------- | ||
| Path | ||
| Path to the Source directory within the given fault directory. | ||
| """ | ||
| return fault_dir / "Source" | ||
|
|
||
|
|
||
| def get_fault_im_dir(fault_dir: Path): | ||
| """Gets the IM directory for the given fault directory""" | ||
| def get_fault_im_dir(fault_dir: Path) -> Path: | ||
| """ | ||
| Get the IM directory for a given fault directory. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| fault_dir : Path | ||
| Path to the fault directory. | ||
|
|
||
| Returns | ||
| ------- | ||
| Path | ||
| Path to the IM directory within the given fault directory. | ||
| """ | ||
| return fault_dir / "IM" | ||
|
|
||
|
|
||
| def get_fault_bb_dir(fault_dir: Path): | ||
| """Gets the BB directory for the given fault directory""" | ||
| return fault_dir / "BB" | ||
| def get_IM_csv_from_root(archive_root: Path, realisation: str) -> Path: # noqa: N802 | ||
| """ | ||
| Get the full path to the IM CSV file given the archive root and realisation name. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| archive_root : Path | ||
| Path to the root directory of the Cybershake archive. | ||
| realisation : str | ||
| Name of the realisation to locate. | ||
|
|
||
| def get_IM_csv_from_root(archive_root: Path, realisation: str): | ||
| """Gets the full path to the im_csv file given the archive root dir and the realistion name""" | ||
| Returns | ||
| ------- | ||
| Path | ||
| Full path to the IM CSV file for the specified realisation. | ||
| """ | ||
| fault_name = get_fault_from_realisation(realisation) | ||
| return get_fault_im_dir(archive_root / fault_name) / f"{realisation}.csv" |
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.