You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
culprit code:
File "...dataclasses_json/core.py", line 150, in _decode_dataclass
kvs = {decode_names.get(k, k): v for k, v in kvs.items()}
AttributeError: 'list' object has no attribute 'items'
@dataclass_json@dataclassclassCountry:
""" Represents a country with its details. Attributes: name (str): The name of the country. country_code (str): The country code. capital (str): The capital city of the country. timezones (List[str]): List of timezones in the country. latlng (List[float]): Latitude and longitude of the country. """name: strcountry_code: strcapital: strtimezones: List[str]
latlng: List[float]
@dataclass_json@dataclassclassCountries:
""" Represents a collection of country instances. Attributes: countries (List[Country]): A list of Country instances. """countries: List[Country]
@classmethoddefget_countries_erdem(cls)->'Countries':
""" get Erdem Ozkol's country list """country_json_url="https://gist.githubusercontent.com/erdem/8c7d26765831d0f9a8c62f02782ae00d/raw/248037cd701af0a4957cce340dabb0fd04e38f4c/countries.json"instance=cls.load_from_json_url(country_json_url)
returninstance@classmethoddefget_samples(cls) ->dict[str, "Erdem Ozkol's Country list"]:
""" Returns a dictionary of named samples for 'specification by example' style requirements management. Returns: dict: A dictionary with keys as sample names and values as `Countries` instances. """samples= {"Erdem Ozkol's country list":cls.get_countries_erdem()}
returnsamples
Describe the results you expected
successfully reading in the dataclass or giving a reasonable error message where the problem is
Python version you are using
Python 3.10.13
Environment description
dataclasses-json==0.6.3
The text was updated successfully, but these errors were encountered:
Description
almost the same as #507
culprit code:
File "...dataclasses_json/core.py", line 150, in _decode_dataclass
kvs = {decode_names.get(k, k): v for k, v in kvs.items()}
AttributeError: 'list' object has no attribute 'items'
Code snippet that reproduces the issue
see https://github.com/WolfgangFahl/pyLoDStorage/blob/66cc1f9312d106c2d4c460a76d4757257627f296/lodstorage/sample2.py#L135
Describe the results you expected
successfully reading in the dataclass or giving a reasonable error message where the problem is
Python version you are using
Python 3.10.13
Environment description
dataclasses-json==0.6.3
The text was updated successfully, but these errors were encountered: