Skip to content

Commit 3c05afd

Browse files
Revert "Deprecation warning for using Header as a list"
This reverts commit 6d5fc73.
1 parent ffbd231 commit 3c05afd

2 files changed

Lines changed: 2 additions & 35 deletions

File tree

frictionless/resources/__spec__/table/test_open.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_resource_open_read_rows():
3636
with TableResource(path="data/table.csv") as resource:
3737
headers = resource.header
3838
row1, row2 = resource.read_rows()
39-
assert headers.field_names == ["id", "name"]
39+
assert headers == ["id", "name"]
4040
assert headers.field_numbers == [1, 2]
4141
assert headers.errors == []
4242
assert headers.valid is True

frictionless/table/header.py

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from __future__ import annotations
22

3-
import warnings
43
from functools import cached_property
5-
from typing import Any, Iterator, List, Optional, Tuple
4+
from typing import List, Optional, Tuple
65

76
from .. import errors, helpers, types
87
from ..exception import FrictionlessException
@@ -67,38 +66,6 @@ def __init__(
6766
self.__matching = LabelMatching(labels, self.__fields, ignore_case=ignore_case)
6867
self.__process()
6968

70-
# Deprecated
71-
72-
def __warn_list_usage(self, usage: str) -> None:
73-
warnings.warn(
74-
f"Using a Header as a list ({usage}) is deprecated, as the list "
75-
"ambiguously holds the names of the schema fields. Use "
76-
"`header.field_names` instead, or `header.labels` for the header "
77-
"row as read from the data source.",
78-
DeprecationWarning,
79-
stacklevel=3,
80-
)
81-
82-
def __eq__(self, other: Any) -> bool:
83-
self.__warn_list_usage("==")
84-
return super().__eq__(other)
85-
86-
def __getitem__(self, index: Any) -> Any:
87-
self.__warn_list_usage("[]")
88-
return super().__getitem__(index)
89-
90-
def __iter__(self) -> Iterator[str]:
91-
self.__warn_list_usage("iteration")
92-
return super().__iter__()
93-
94-
def __len__(self) -> int:
95-
self.__warn_list_usage("len()")
96-
return super().__len__()
97-
98-
def __contains__(self, item: Any) -> bool:
99-
self.__warn_list_usage("in")
100-
return super().__contains__(item)
101-
10269
@cached_property
10370
def labels(self):
10471
"""

0 commit comments

Comments
 (0)