From 5a671cd824110f0422c8ab2a6c599b358258faed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Berland?= Date: Mon, 28 Dec 2020 11:08:31 +0100 Subject: [PATCH 1/2] Adapt for pandas 1.2.0 --- pyscal/factory.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pyscal/factory.py b/pyscal/factory.py index 2542febd..f4bffafd 100644 --- a/pyscal/factory.py +++ b/pyscal/factory.py @@ -1068,13 +1068,15 @@ def infer_tabular_file_format(filename): try: pd.read_excel(filename, engine="openpyxl") return "xlsx" - except openpyxl.utils.exceptions.InvalidFileException: - # We get here for both CSV and XLS files. + except (ValueError, OSError, openpyxl.utils.exceptions.InvalidFileException): + # < Pandas 1.2, we get InvalidFileException from openpyxl + # >= Pandas 1.2.0: CSV gives ValueError, + # XLS gives OSError pass try: pd.read_excel(filename, engine="xlrd") return "xls" - except xlrd.biffh.XLRDError: + except (ValueError, xlrd.biffh.XLRDError): # We get here for both CSV and XLSX files. pass try: From 79ab2b05f443884fe434ba056c2d2b52683f15dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Berland?= Date: Mon, 28 Dec 2020 11:10:16 +0100 Subject: [PATCH 2/2] Avoid commits to master --- .pre-commit-config.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 681e3dc1..783bd065 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,6 +2,8 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v3.4.0 hooks: + - id: no-commit-to-branch + args: ['--branch', 'master'] - id: check-yaml - id: debug-statements - id: end-of-file-fixer