From 738bb8b43814c14b1b8a1f1f60397c1520c5ef4a Mon Sep 17 00:00:00 2001 From: anjakefala Date: Sun, 2 Jun 2024 19:58:36 -0700 Subject: [PATCH 1/2] [dev] drop support for Python 3.7 #2231 --- .github/workflows/main.yml | 2 +- setup.py | 2 +- visidata/aggregators.py | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index afeb42202..94cc499a9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: - python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] + python-version: [3.8, 3.9, "3.10", "3.11"] runs-on: ubuntu-latest timeout-minutes: 20 diff --git a/setup.py b/setup.py index b431b1c3c..2e9a378a6 100755 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ long_description=open("README.md").read(), long_description_content_type="text/markdown", author="Saul Pwanson", - python_requires=">=3.7", + python_requires=">=3.8", author_email="visidata@saul.pw", url="https://visidata.org", download_url="https://github.com/saulpw/visidata/tarball/" + __version__, diff --git a/visidata/aggregators.py b/visidata/aggregators.py index 51e0d9d12..88b77c4ab 100644 --- a/visidata/aggregators.py +++ b/visidata/aggregators.py @@ -105,12 +105,9 @@ def mean(vals): if vals: return float(sum(vals))/len(vals) -def _vsum(vals): +def vsum(vals): return sum(vals, start=type(vals[0] if len(vals) else 0)()) #1996 -# start parameter in sum() added in Python 3.8 -vsum = _vsum if sys.version_info[:2] >= (3, 8) else sum - # http://code.activestate.com/recipes/511478-finding-the-percentile-of-the-values/ def _percentile(N, percent, key=lambda x:x): """ From 3e7ded5182cdf79637d1ba7facc74ac692b4ffe8 Mon Sep 17 00:00:00 2001 From: anjakefala Date: Sun, 2 Jun 2024 20:01:57 -0700 Subject: [PATCH 2/2] [shell] ensure add-col shell is properly quoted #2415 Thanks @frosencrantz for suggestion of fix. --- dev/checklists/manual-tests.md | 1 + visidata/shell.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/checklists/manual-tests.md b/dev/checklists/manual-tests.md index c4a173188..9a5455208 100644 --- a/dev/checklists/manual-tests.md +++ b/dev/checklists/manual-tests.md @@ -95,3 +95,4 @@ 23. That DirSheet requires a commit-sheet before changes on filesystem 24. Test adding multiple aggregators via palette (+) 25. time vd -p tests/quit-nosave.vdj - note down the time. compare to PR #2369 +26. Use the z; command. Then type in a command line like echo "| Ceci n'est pas une pipe" diff --git a/visidata/shell.py b/visidata/shell.py index ff74b5723..be81acb34 100644 --- a/visidata/shell.py +++ b/visidata/shell.py @@ -79,7 +79,7 @@ def calcValue(self, row): else: args.append(arg) - p = subprocess.Popen([os.getenv('SHELL', 'bash'), '-c', ' '.join(args)], + p = subprocess.Popen([os.getenv('SHELL', 'bash'), '-c', shlex.join(args)], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return p.communicate() except Exception as e: