Skip to content

Commit

Permalink
fix: use postponed evaluation (#124)
Browse files Browse the repository at this point in the history
* 6899ae1 switched list[... to List[... for compat with python 3.8
* instead, opt into postponed evaluation per suggestion
* use CI matrix to test python 3.8 - 3.11
  • Loading branch information
wpbonelli authored Sep 12, 2023
1 parent 6899ae1 commit 7219b2b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/ex-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.8

- name: Print python version
run: |
Expand Down Expand Up @@ -89,6 +89,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: [3.8, 3.9, "3.10", "3.11"]
env:
script-directory: scripts
etc-directory: etc
Expand Down Expand Up @@ -118,7 +120,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: ${{ matrix.python }}

- name: Install Python packages
run: |
Expand Down Expand Up @@ -147,11 +149,13 @@ jobs:
working-directory: ${{env.etc-directory}}

- name: Run processing script
if: matrix.python == '3.9'
run: |
python process-scripts.py
working-directory: ${{env.script-directory}}

- name: Build mf6examples LaTeX document
if: matrix.python == '3.9'
shell: python
run: |
import sys
Expand Down Expand Up @@ -182,12 +186,14 @@ jobs:
print(stderr)
- name: Rename and move the LaTeX document
if: matrix.python == '3.9'
run: |
ls -l ./doc/
mv ./doc/mf6examples.pdf mf6examples.pdf
ls -l ./
- name: Upload build artifacts for current release
if: matrix.python == '3.9'
uses: actions/upload-artifact@v3
with:
name: current
Expand Down
2 changes: 2 additions & 0 deletions common/DisvGridMerger.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from math import sqrt
import copy

Expand Down
11 changes: 6 additions & 5 deletions common/DisvPropertyContainer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import copy
from itertools import cycle
from typing import List

import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -104,10 +105,10 @@ class DisvPropertyContainer:
nlay: int
ncpl: int
nvert: int
vertices: List[list] # [[iv, xv, yv], ...]
cell2d: List[list] # [[ic, xc, yc, ncvert, icvert], ...]
vertices: list[list] # [[iv, xv, yv], ...]
cell2d: list[list] # [[ic, xc, yc, ncvert, icvert], ...]
top: np.ndarray
botm: List[np.ndarray]
botm: list[np.ndarray]
origin_x: float
origin_y: float
rotation: float
Expand Down Expand Up @@ -541,7 +542,7 @@ def plot_grid(
plot_time = -1.0

if not isinstance(grid_color, tuple):
grid_color = (grid_color, )
grid_color = (grid_color,)

ColorCycler = grid_color
if plot_time > 0.0 and grid_color == ("grey",):
Expand Down

0 comments on commit 7219b2b

Please sign in to comment.