From 3655c8d30df9e22ebde14ccebfc3cbb6fddeb3d4 Mon Sep 17 00:00:00 2001 From: joocer Date: Tue, 7 Nov 2023 22:05:09 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=B2=20remove=20semgrep=20#1249?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/static_analysis.yaml | 12 ------------ opteryx/__init__.py | 2 +- opteryx/functions/other_functions.py | 2 +- opteryx/third_party/pyarrow_ops/helpers.py | 2 +- tests/misc/perftest_inner_hash.py | 4 ++-- 5 files changed, 5 insertions(+), 17 deletions(-) diff --git a/.github/workflows/static_analysis.yaml b/.github/workflows/static_analysis.yaml index 9027bba6c..6bc0a5aa4 100644 --- a/.github/workflows/static_analysis.yaml +++ b/.github/workflows/static_analysis.yaml @@ -25,18 +25,6 @@ jobs: - name: Execute Test run: bandit -r mabel - semgrep: - runs-on: ubuntu-latest - name: SemGrep - steps: - - uses: actions/checkout@v1 - - name: Semgrep - id: semgrep - uses: returntocorp/semgrep-action@v1 - with: - config: p/r2c - - mypy: name: Type Checks runs-on: ubuntu-latest diff --git a/opteryx/__init__.py b/opteryx/__init__.py index 56a2c948a..100718e30 100644 --- a/opteryx/__init__.py +++ b/opteryx/__init__.py @@ -37,7 +37,7 @@ _env_path = Path(".") / ".env" # deepcode ignore PythonSameEvalBinaryExpressiontrue: false +ve, values can be different -if _env_path.exists() and (dotenv is None): # pragma: no cover # nosemgrep +if _env_path.exists() and (dotenv is None): # pragma: no cover # using a logger here will tie us in knots print(f"{datetime.datetime.now()} [LOADER] `.env` file exists but `dotEnv` not installed.") elif dotenv is not None: # pragma: no cover variables from `.env`") diff --git a/opteryx/functions/other_functions.py b/opteryx/functions/other_functions.py index fa95cab5b..0e19da7ad 100644 --- a/opteryx/functions/other_functions.py +++ b/opteryx/functions/other_functions.py @@ -112,7 +112,7 @@ def iif(mask, true_values, false_values): def if_null(values, replacement): response = values for index, value in enumerate(values): - if value is None or value != value: # nosec # nosemgrep + if value is None or value != value: # nosec response[index] = replacement[index] return response diff --git a/opteryx/third_party/pyarrow_ops/helpers.py b/opteryx/third_party/pyarrow_ops/helpers.py index 87762d574..31ffc22d4 100644 --- a/opteryx/third_party/pyarrow_ops/helpers.py +++ b/opteryx/third_party/pyarrow_ops/helpers.py @@ -26,7 +26,7 @@ def _hash_value(val, nan=numpy.nan): if isinstance(val, (list, numpy.ndarray, tuple)): # XOR is faster however, x ^ x == y ^ y but x != y, so we don't use it return functools.reduce(lambda x, y: _hash_value(f"{y}:{x}", 0), val, APOLLO_11_DURATION) - if val != val or val is None: # nosemgrep + if val != val or val is None: # nan is a float, but hash is an int, sometimes we need this to be an int return nan return hash(val) diff --git a/tests/misc/perftest_inner_hash.py b/tests/misc/perftest_inner_hash.py index 72e517500..9b701af63 100644 --- a/tests/misc/perftest_inner_hash.py +++ b/tests/misc/perftest_inner_hash.py @@ -19,7 +19,7 @@ def _hash_value(vals, nan=numpy.nan): ret.append( functools.reduce(lambda x, y: _hash_value(f"{y}:{x}", 0), val, APOLLO_11_DURATION) ) - elif val != val or val is None: # nosemgrep + elif val != val or val is None: # nan is a float, but hash is an int, sometimes we need this to be an int ret.append(nan) else: @@ -39,7 +39,7 @@ def _hash_value_new(vals, nan=numpy.nan): ret.append(CityHash64("".join(val.values()))) elif isinstance(val, (list, tuple)): ret.append(CityHash64(numpy.array(val))) - elif val != val or val is None: # nosemgrep + elif val != val or val is None: # nan is a float, but hash is an int, sometimes we need this to be an int ret.append(nan) else: