From e783c4c169ca910a0892d4b5cb830186d7eda142 Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Tue, 1 Oct 2024 14:22:49 -0400 Subject: [PATCH 1/9] Add test of #1069 --- fipy/variables/operatorVariable.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fipy/variables/operatorVariable.py b/fipy/variables/operatorVariable.py index bf30f0bf9c..4fec03064e 100644 --- a/fipy/variables/operatorVariable.py +++ b/fipy/variables/operatorVariable.py @@ -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 binOp 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)), ...)) """ pass From 49afa8b18530e38d1cba5571ef5dfc059becbb9a Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Tue, 1 Oct 2024 14:40:51 -0400 Subject: [PATCH 2/9] Ensure function arguments are all in repr form --- fipy/variables/operatorVariable.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fipy/variables/operatorVariable.py b/fipy/variables/operatorVariable.py index 4fec03064e..80d5c01602 100644 --- a/fipy/variables/operatorVariable.py +++ b/fipy/variables/operatorVariable.py @@ -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 @@ -1262,7 +1262,7 @@ def _testBinOp(self): >>> 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)), ...)) + [1, 2, 3]]), mesh=UniformGrid2D(dx=1.0, nx=3, dy=1.0, ny=1)), index)) """ pass From ae84214f453feb68dd949220e4cd723031211987 Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Tue, 1 Oct 2024 14:41:31 -0400 Subject: [PATCH 3/9] Reverse order of pop'd arguments Successive pops reverses, so reverse back --- fipy/variables/operatorVariable.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fipy/variables/operatorVariable.py b/fipy/variables/operatorVariable.py index 80d5c01602..e34af599ab 100644 --- a/fipy/variables/operatorVariable.py +++ b/fipy/variables/operatorVariable.py @@ -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 From 88121ceb4115c215931c84beadb583ea22a563db Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Tue, 1 Oct 2024 15:11:11 -0400 Subject: [PATCH 4/9] Fix spelling --- fipy/variables/operatorVariable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fipy/variables/operatorVariable.py b/fipy/variables/operatorVariable.py index e34af599ab..4a2342d7a2 100644 --- a/fipy/variables/operatorVariable.py +++ b/fipy/variables/operatorVariable.py @@ -1257,7 +1257,7 @@ def _testBinOp(self): [[ 0 1 2 3 4 5 6 7 8] [ 0 -1 -2 -3 -4 -5 -6 -7 -8]] - Test binOp with unusual index argument + Test operator variable with unusual index argument >>> vcv.dot(vcv) # doctest: +ELLIPSIS (...MeshVariable._dot(CellVariable(value=array([[0, 1, 2], From e259b2e0b64d0aea3fa9f48c8d2ba92dd95f97f5 Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Wed, 2 Oct 2024 15:37:54 -0400 Subject: [PATCH 5/9] Debug chown --- .azure/templates/install.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.azure/templates/install.yml b/.azure/templates/install.yml index 4e3bdd7b3f..5b05a802de 100644 --- a/.azure/templates/install.yml +++ b/.azure/templates/install.yml @@ -20,7 +20,11 @@ steps: # On Hosted macOS, the agent user doesn't have ownership of Miniconda's installation directory/ # We need to take ownership if we want to update conda or install packages globally - - bash: sudo chown -R $USER $CONDA + - bash: | + echo USER $USER + echo CONDA $CONDA + echo sudo chown -R $USER $CONDA + sudo chown -R $USER $CONDA displayName: Take ownership of conda installation condition: startsWith(variables.image, 'macos') From 4a72b0657f055a826cc6085b7f052ac17ea65e91 Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Wed, 2 Oct 2024 15:48:24 -0400 Subject: [PATCH 6/9] Debug $CONDA --- .azure/templates/install.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.azure/templates/install.yml b/.azure/templates/install.yml index 5b05a802de..c7497ba285 100644 --- a/.azure/templates/install.yml +++ b/.azure/templates/install.yml @@ -10,7 +10,9 @@ parameters: default: scipy steps: - - bash: echo "##vso[task.prependpath]$CONDA/bin" + - bash: | + echo "# # vso [task.prependpath]$CONDA/bin" + echo "##vso[task.prependpath]$CONDA/bin" displayName: Add conda to PATH condition: or(startsWith(variables.image, 'macos'), startsWith(variables.image, 'ubuntu')) From 07ec7cbde846497bfa04b08d89bfb4db79c93415 Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Thu, 3 Oct 2024 13:08:20 -0400 Subject: [PATCH 7/9] Install miniconda on macos Grrr --- .azure/templates/install.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.azure/templates/install.yml b/.azure/templates/install.yml index c7497ba285..a7e94b97a0 100644 --- a/.azure/templates/install.yml +++ b/.azure/templates/install.yml @@ -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" echo "##vso[task.prependpath]$CONDA/bin" From c5c884a42b5a4427458f1f63c04addae81e4e4e5 Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Thu, 3 Oct 2024 13:41:33 -0400 Subject: [PATCH 8/9] Revert "Debug chown" This reverts commit e259b2e0b64d0aea3fa9f48c8d2ba92dd95f97f5. --- .azure/templates/install.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.azure/templates/install.yml b/.azure/templates/install.yml index a7e94b97a0..73d290e566 100644 --- a/.azure/templates/install.yml +++ b/.azure/templates/install.yml @@ -33,11 +33,7 @@ steps: # On Hosted macOS, the agent user doesn't have ownership of Miniconda's installation directory/ # We need to take ownership if we want to update conda or install packages globally - - bash: | - echo USER $USER - echo CONDA $CONDA - echo sudo chown -R $USER $CONDA - sudo chown -R $USER $CONDA + - bash: sudo chown -R $USER $CONDA displayName: Take ownership of conda installation condition: startsWith(variables.image, 'macos') From 843522462bda37629da984e64f0b6136756840da Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Thu, 3 Oct 2024 13:42:34 -0400 Subject: [PATCH 9/9] Revert "Debug $CONDA" This reverts commit 4a72b0657f055a826cc6085b7f052ac17ea65e91. --- .azure/templates/install.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.azure/templates/install.yml b/.azure/templates/install.yml index 73d290e566..c5796e5b83 100644 --- a/.azure/templates/install.yml +++ b/.azure/templates/install.yml @@ -21,9 +21,7 @@ steps: displayName: Install miniconda condition: startsWith(variables.image, 'macos') - - bash: | - echo "# # vso [task.prependpath]$CONDA/bin" - echo "##vso[task.prependpath]$CONDA/bin" + - bash: echo "##vso[task.prependpath]$CONDA/bin" displayName: Add conda to PATH condition: or(startsWith(variables.image, 'macos'), startsWith(variables.image, 'ubuntu'))