Skip to content

Commit b80b583

Browse files
mariosaskoalbertvillanova
authored andcommitted
Fix Parquet loading with columns (#6160)
* Fix Parquet loading with `columns` * Style
1 parent 1de8527 commit b80b583

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/datasets/metric.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def _release(self):
6565
# lists - summarize long lists similarly to NumPy
6666
# arrays/tensors - let the frameworks control formatting
6767
def summarize_if_long_list(obj):
68-
if not type(obj) == list or len(obj) <= 6:
68+
if not type(obj) == list or len(obj) <= 6: # noqa: E721
6969
return f"{obj}"
7070

7171
def format_chunk(chunk):

src/datasets/packaged_modules/parquet/parquet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _split_generators(self, dl_manager):
5151
with open(file, "rb") as f:
5252
features = datasets.Features.from_arrow_schema(pq.read_schema(f))
5353
if self.config.columns is not None:
54-
self.info.features = datasets.Features(
54+
features = datasets.Features(
5555
{col: feat for col, feat in features.items() if col in self.config.columns}
5656
)
5757
self.info.features = features

src/datasets/utils/py_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ def save_function(pickler, obj):
11411141
state_dict["__module__"] = obj.__module__
11421142

11431143
state = obj.__dict__
1144-
if type(state) is not dict:
1144+
if type(state) is not dict: # noqa: E721
11451145
state_dict["__dict__"] = state
11461146
state = None
11471147
if state_dict:
@@ -1303,7 +1303,7 @@ def save_function(pickler, obj):
13031303
state_dict["__module__"] = obj.__module__
13041304

13051305
state = obj.__dict__
1306-
if type(state) is not dict:
1306+
if type(state) is not dict: # noqa: E721
13071307
state_dict["__dict__"] = state
13081308
state = None
13091309
if state_dict:

0 commit comments

Comments
 (0)