Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pyam-imports prior to pyam v2.0 #277

Merged
merged 2 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions nomenclature/code.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import json
import re
import pyam
import pycountry
from keyword import iskeyword
from pathlib import Path
from typing import Any, Dict, List, Optional, Set, Union

from pydantic import BaseModel, Field, validator

from pyam.utils import to_list


class Code(BaseModel):
"""A simple class for a mapping of a "code" to its attributes"""
Expand Down Expand Up @@ -230,7 +230,7 @@ def check_iso3_codes(cls, v, values) -> List[str]:
"""Verifies that each ISO3 code is valid according to pycountry library."""
if invalid_iso3_codes := [
iso3_code
for iso3_code in pyam.to_list(v)
for iso3_code in to_list(v)
if pycountry.countries.get(alpha_3=iso3_code) is None
]:
raise ValueError(
Expand Down
3 changes: 2 additions & 1 deletion nomenclature/validation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
from pyam import IamDataFrame, to_list
from pyam import IamDataFrame
from pyam.utils import to_list

# define logger for this script at logging level INFO
logger = logging.getLogger(__name__)
Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import pytest
import shutil
import pandas as pd
from pyam import IamDataFrame, IAMC_IDX
from pyam import IamDataFrame
from pyam.utils import IAMC_IDX
from nomenclature import DataStructureDefinition


Expand Down
3 changes: 2 additions & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from nomenclature.core import process
from nomenclature.definition import DataStructureDefinition
from nomenclature.processor.region import RegionProcessor
from pyam import IAMC_IDX, IamDataFrame, assert_iamframe_equal
from pyam import IamDataFrame, assert_iamframe_equal
from pyam.utils import IAMC_IDX

from conftest import TEST_DATA_DIR, add_meta

Expand Down
3 changes: 2 additions & 1 deletion tests/test_region_aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
process,
)
from nomenclature.error.region import RegionAggregationMappingParsingError
from pyam import IAMC_IDX, IamDataFrame
from pyam import IamDataFrame
from pyam.utils import IAMC_IDX

from conftest import TEST_DATA_DIR, clean_up_external_repos

Expand Down
Loading