Skip to content
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

Fix representation of dotted variables (and other method calls) #1074

Merged
merged 9 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .azure/templates/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ parameters:
default: scipy

steps:
- bash: |
# laggards on Azure/GHA team dropped miniconda on macos images
# https://github.com/actions/runner-images/issues/9262
mkdir -p ~/miniconda3
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm ~/miniconda3/miniconda.sh
echo "##vso[task.setvariable variable=CONDA;]${HOME}/miniconda3"
displayName: Install miniconda
condition: startsWith(variables.image, 'macos')

- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add conda to PATH
condition: or(startsWith(variables.image, 'macos'), startsWith(variables.image, 'ubuntu'))
Expand Down
12 changes: 9 additions & 3 deletions fipy/variables/operatorVariable.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def _py3kInstructions(self, op, style, argDict, id, freshen):
stack.append(stack.pop() + "(" + ", ".join(args + kwargs) + ")")
elif ins.opname == 'LOAD_DEREF':
# Changed in Python 3.11
stack.append(op.__closure__[ins.arg-1].cell_contents)
stack.append(ins.argrepr)
elif ins.opname == 'RESUME':
# New in Python 3.11
pass
Expand All @@ -250,8 +250,8 @@ def _py3kInstructions(self, op, style, argDict, id, freshen):
pass
elif ins.opname == 'CALL':
# New in Python 3.11
kwargs = [kw + "=" + str(stack.pop()) for kw in kws]
positionals = [stack.pop() for _ in range(ins.argval - len(kws))]
kwargs = [kw + "=" + str(stack.pop()) for kw in kws][::-1]
positionals = [stack.pop() for _ in range(ins.argval - len(kws))][::-1]
callable = stack.pop()
if len(stack) > 0:
call_self = callable
Expand Down Expand Up @@ -1257,6 +1257,12 @@ def _testBinOp(self):
[[ 0 1 2 3 4 5 6 7 8]
[ 0 -1 -2 -3 -4 -5 -6 -7 -8]]

Test operator variable with unusual index argument

>>> vcv.dot(vcv) # doctest: +ELLIPSIS
(...MeshVariable._dot(CellVariable(value=array([[0, 1, 2],
[1, 2, 3]]), mesh=UniformGrid2D(dx=1.0, nx=3, dy=1.0, ny=1)), CellVariable(value=array([[0, 1, 2],
[1, 2, 3]]), mesh=UniformGrid2D(dx=1.0, nx=3, dy=1.0, ny=1)), index))
"""
pass

Expand Down
Loading