diff options
| author | Ján Jančár | 2024-06-20 15:05:27 +0200 |
|---|---|---|
| committer | GitHub | 2024-06-20 15:05:27 +0200 |
| commit | 2bbb3fb6bfc529498f324ca13a169b26817f084f (patch) | |
| tree | fb8e85950f4dcc858237fdac1f71dfb73d3c8b5d | |
| parent | 394755d3ea36fc8af7b3d236425f409a3eca14b8 (diff) | |
| parent | 3c0392f60033a9fd8b33f48891c2b48ec8a791b0 (diff) | |
| download | sec-certs-2bbb3fb6bfc529498f324ca13a169b26817f084f.tar.gz sec-certs-2bbb3fb6bfc529498f324ca13a169b26817f084f.tar.zst sec-certs-2bbb3fb6bfc529498f324ca13a169b26817f084f.zip | |
Merge pull request #417 from crocs-muni/fix/fips-alg-nums
Fix FIPS pipeline for new certs.
| -rw-r--r-- | .github/workflows/docs.yml | 5 | ||||
| -rw-r--r-- | .github/workflows/pre-commit.yml | 13 | ||||
| -rw-r--r-- | .github/workflows/release.yml | 2 | ||||
| -rw-r--r-- | .github/workflows/tests.yml | 2 | ||||
| -rw-r--r-- | src/sec_certs/model/references_nlp/annotator.py | 2 | ||||
| -rw-r--r-- | src/sec_certs/sample/fips.py | 2 | ||||
| -rw-r--r-- | src/sec_certs/utils/pandas.py | 2 |
7 files changed, 13 insertions, 15 deletions
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6de98b07..2af0f6f0 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -11,9 +11,12 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.10" + cache: "pip" + cache-dependency-path: | + requirements/dev_requirements.txt - name: apt-get update run: sudo apt-get update - name: Install external dependencies diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 6855dc63..3e93bc7d 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -7,14 +7,9 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.10" - - name: apt-get update - run: sudo apt-get update - - name: Install dependencies - run: | - sudo apt-get install build-essential libpoppler-cpp-dev pkg-config python3-dev -y - pip install -r requirements/dev_requirements.txt - - name: Run pre-commit - run: pre-commit run --all-files + - uses: pre-commit/action@v3.0.1 + with: + extra_args: --all-files diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9fed59f7..7921456f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: with: fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" - name: apt-get update diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a8ae7d6c..5b3353fa 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,7 @@ jobs: run: sudo apt-get install -y build-essential libpoppler-cpp-dev pkg-config python3-dev - uses: actions/checkout@v4 - name: Setup python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" cache: "pip" diff --git a/src/sec_certs/model/references_nlp/annotator.py b/src/sec_certs/model/references_nlp/annotator.py index 1cc816f5..dab6665f 100644 --- a/src/sec_certs/model/references_nlp/annotator.py +++ b/src/sec_certs/model/references_nlp/annotator.py @@ -96,6 +96,6 @@ class ReferenceAnnotator: df_new["y_proba"] = y_proba df_new["y_pred"] = self.predict(df_new.segments) df_new["correct"] = df_new.apply( - lambda row: row["y_pred"] == row["label"] if not pd.isnull(row["label"]) else np.NaN, axis=1 + lambda row: row["y_pred"] == row["label"] if not pd.isnull(row["label"]) else np.nan, axis=1 ) return df_new diff --git a/src/sec_certs/sample/fips.py b/src/sec_certs/sample/fips.py index cee8cb9d..ce2e6907 100644 --- a/src/sec_certs/sample/fips.py +++ b/src/sec_certs/sample/fips.py @@ -459,7 +459,7 @@ class FIPSCertificate( def alg_to_number(alg: str) -> str: return "".join([x for x in alg.split("#")[1] if x.isdigit()]) - return {alg_to_number(x) for x in self.algorithms} + return {alg_to_number(x) for x in self.algorithms if "#" in x} @property def dgst(self) -> str: diff --git a/src/sec_certs/utils/pandas.py b/src/sec_certs/utils/pandas.py index 661b669c..890cce99 100644 --- a/src/sec_certs/utils/pandas.py +++ b/src/sec_certs/utils/pandas.py @@ -173,7 +173,7 @@ def compute_cve_correlations( spearmanr = functools.partial(stats.spearmanr, nan_policy="omit", alternative="less") df_sar.eal = df_sar.eal.cat.codes - df_sar.eal = df_sar.eal.map(lambda x: np.NaN if x == -1 else x) + df_sar.eal = df_sar.eal.map(lambda x: np.nan if x == -1 else x) n_cves_eal_corr, n_cves_eal_pvalue = spearmanr(df_sar.eal, df_sar.n_cves) n_cves_corrs = [n_cves_eal_corr] |
