diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index f078a24..bde5b80 100755 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -3,7 +3,7 @@ on: [push, pull_request] jobs: formatting-check: name: Formatting Check - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - name: Run clang-format style check for C/C++/Protobuf programs. diff --git a/.github/workflows/cmake_build.yaml b/.github/workflows/cmake_build.yaml index 518b16f..a5cb813 100644 --- a/.github/workflows/cmake_build.yaml +++ b/.github/workflows/cmake_build.yaml @@ -7,7 +7,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest] # [ubuntu-latest, macos-latest] + os: [ubuntu-24.04] # [ubuntu-latest, macos-latest] compiler: [g++, clang++] runs-on: ${{ matrix.os }} permissions: @@ -30,11 +30,16 @@ jobs: cxx-compiler: ${{ matrix.compiler }} - name: Build tests run: cd build && pwd && make -j + - name: Install Python 3.10 + run: | + sudo add-apt-repository -y ppa:deadsnakes/ppa + sudo apt update -y + sudo apt install -y python3.10 python3.10-venv python3.10-dev + sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 - name: Install test dependencies run: | - sudo apt-get install -y python3.10-full \ - && pip install --upgrade pip \ - && pip install wheel yapf cpplint zarr xarray + python3.10 -m pip install --upgrade pip setuptools wheel --no-input + python3.10 -m pip install yapf cpplint zarr xarray --no-input - name: Run tests run: | cd build/mdio/ \ diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 3a99126..762aa92 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest] # [ubuntu-latest, macos-latest] + os: [ubuntu-24.04] # [ubuntu-latest, macos-latest] compiler: [g++] runs-on: ${{ matrix.os }} permissions: diff --git a/mdio/acceptance_test.cc b/mdio/acceptance_test.cc index 6555858..188a65b 100644 --- a/mdio/acceptance_test.cc +++ b/mdio/acceptance_test.cc @@ -461,8 +461,6 @@ TEST(Variable, optionalAttrs) { ASSERT_TRUE(f8.status().ok()) << f8.status(); ASSERT_TRUE(voided.status().ok()) << voided.status(); - std::cout << i2.value().GetAttributes().dump(4) << std::endl; - EXPECT_EQ(i2.value().GetAttributes()["attributes"]["foo"], "bar") << i2.value().GetAttributes(); EXPECT_EQ(i4.value().GetAttributes()["attributes"]["foo"], "bar") diff --git a/mdio/variable.h b/mdio/variable.h index def24c0..34d16b2 100644 --- a/mdio/variable.h +++ b/mdio/variable.h @@ -641,31 +641,24 @@ Future> OpenVariable(const nlohmann::json& json_store, // specifies a different chunkGrid, it will not be used and should // actually fail here. nlohmann::json correctedSuppliedAttrs = suppliedAttributes; - if (correctedSuppliedAttrs["attributes"].contains("metadata")) { - if (correctedSuppliedAttrs["attributes"]["metadata"].contains( - "chunkGrid")) { - correctedSuppliedAttrs["attributes"]["metadata"].erase("chunkGrid"); + if (correctedSuppliedAttrs.contains("attributes")) { + if (correctedSuppliedAttrs["attributes"].contains("metadata")) { + if (correctedSuppliedAttrs["attributes"]["metadata"].contains( + "chunkGrid")) { + correctedSuppliedAttrs["attributes"]["metadata"].erase("chunkGrid"); + } } - for (auto& item : - correctedSuppliedAttrs["attributes"]["metadata"].items()) { - correctedSuppliedAttrs["attributes"][item.key()] = - std::move(item.value()); + auto savedAttrs = correctedSuppliedAttrs["attributes"]; + correctedSuppliedAttrs.erase("attributes"); + for (auto& item : savedAttrs.items()) { + correctedSuppliedAttrs[item.key()] = std::move(item.value()); } - correctedSuppliedAttrs["attributes"].erase("metadata"); } // BFS to make sure supplied attributes match stored attributes nlohmann::json searchableMetadata = new_metadata; - if (searchableMetadata["attributes"].contains("variable_name")) { + if (searchableMetadata.contains("variable_name")) { // Since we don't actually want to have to specify the variable name - searchableMetadata["attributes"].erase("variable_name"); - } - if (searchableMetadata["attributes"].contains("metadata")) { - for (auto& item : - searchableMetadata["attributes"]["metadata"].items()) { - searchableMetadata["attributes"][item.key()] = - std::move(item.value()); - } - searchableMetadata["attributes"].erase("metadata"); + searchableMetadata.erase("variable_name"); } std::queue> queue; queue.push({searchableMetadata, correctedSuppliedAttrs});