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

Add support for Python 3.9 #1036

Merged
merged 4 commits into from
Jun 28, 2022
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
6 changes: 4 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ jobs:
python-version:
- '3.7'
- '3.8'
# - '3.9'
- '3.9'
# - '3.10'
os:
- linux
- win64
Expand Down Expand Up @@ -125,7 +126,8 @@ jobs:
python-version:
- '3.7'
- '3.8'
# - '3.9'
- '3.9'
# - '3.10'
steps:
- uses: actions/checkout@v2
- name: Set up Conda
Expand Down
1 change: 1 addition & 0 deletions .pylint/foqus_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def emit(self, *args):
PYQTSIGNAL_ATTRIBUTE_NAMES = frozenset(
[
"currentIndexChanged",
"valueChanged",
]
)

Expand Down
4 changes: 2 additions & 2 deletions docs/source/chapt_install/install_python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Install Python
--------------

Python version 3.7 up through 3.8 is required to run FOQUS.
Python version 3.7 up through 3.9 is required to run FOQUS.

We recommend using either the `Miniconda <https://docs.conda.io/en/latest/miniconda.html>`_ or
`Anaconda <https://www.anaconda.com/download/>`_ Python distribution and package management
Expand All @@ -17,7 +17,7 @@ ability to create self-contained python environments without any need for admini
privileges. These separate environments can have different set of packages, isolating version
dependencies when working with multiple python projects.

If you have a working version of Python 3.7 through 3.8, which you prefer over Anaconda, you can
If you have a working version of Python 3.7 through 3.9, which you prefer over Anaconda, you can
skip these steps.

Anaconda or Miniconda Install and Setup
Expand Down
2 changes: 1 addition & 1 deletion foqus_lib/framework/graph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ def runListAsThread(
else:
newGr.res_re = resubs
else:
raise ("Must supply runList or jobIds")
raise ValueError("Must supply runList or jobIds")
newGr.status = {
"unfinished": len(newGr.res),
"finished": 0,
Expand Down
4 changes: 4 additions & 0 deletions foqus_lib/framework/listen/listen.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ def run(self):
self.gt.join()
ret = []
stat = []
# WHY pylint infers `res` as an unsubscriptable object
# (possibly because of None default value?)
# pylint: disable=unsubscriptable-object
for res in self.gt.res:
self.dat.flowsheet.results.addFromSavedValues(
self.resStoreSet, "res_{0}".format(self.runid), None, res
Expand All @@ -203,6 +206,7 @@ def run(self):
for i in range(len(r)):
r[i] = self.failValue
ret.append(r)
# pylint: enable=unsubscriptable-object
conn.send(["result", stat, ret])
elif msg[0] == "save":
# Save the flow sheet
Expand Down
3 changes: 3 additions & 0 deletions foqus_lib/framework/sdoe/irsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ def criterion(cand, args, nr, nd, mode="maximin", hist=None, test=False):
PV_tuple = ()
for key in PV:
if len(PV[key].shape) == 1:
# WHY: causes `modified-iterating-dict` in pylint 2.14.1
# pylint: disable=modified-iterating-dict
PV[key] = np.expand_dims(PV[key], axis=0)
# pylint: enable=modified-iterating-dict
PV_tuple += (PV[key],)
PV_arr = np.concatenate(PV_tuple, axis=0)
PV_df = pd.DataFrame(data=PV_arr, columns=["Best Input", "Best Response"])
Expand Down
4 changes: 4 additions & 0 deletions foqus_lib/framework/sim/turbineConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ def __init__(self, path="turbine.cfg"):
self.aspenVersion = 2
self.dat = None
self.tldb = None
# WHY: setting these directly in makeCopy without defining them as attributes here
# triggers no-member errors in pylint 2.14.1
self.configExt = None
self.subDir = None

@property
def notification(self):
Expand Down
4 changes: 2 additions & 2 deletions foqus_lib/framework/uq/Model.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
Gets the filename of the driver or emulator
"""

import collections.abc
import numbers, json
import numpy

Expand Down Expand Up @@ -272,9 +273,8 @@ def getEmulatorOutputStatus(self):
return self.emulatorOutputStatus

def setEmulatorOutputStatus(self, outputIds, value):
import collections

if isinstance(outputIds, collections.Sequence): # Check if list or tuple
if isinstance(outputIds, collections.abc.Sequence): # Check if list or tuple
for outputId in outputIds:
self.emulatorOutputStatus[outputId] = value
else:
Expand Down
2 changes: 1 addition & 1 deletion foqus_lib/gui/model/dmfUploadDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def browseSinter(self):
self.files[1] = ["model", m_path]
self.updateFileTable()
self.appEdit.setText(a)
except:
except Exception as e:
QMessageBox.information(self, "Error", str(e))
logging.getLogger("foqus." + __name__).exception(
"Error reading sinter config"
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

# These will override requirements picked up from setup.py below:
# pinning the pylint version to ensure reproducible behavior and defaults
pylint==2.6.0
pylint==2.14.1
# also pinning the version for astroid (used by pylint to analyze the AST)
# since there can be significant differences between (non-major) versions,
# both in terms of behavior and performance
astroid==2.4.2
astroid==2.11.6
pytest
### coverage
coverage
Expand Down