Skip to content
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
2 changes: 1 addition & 1 deletion src/datasets/formatting/tf_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class TFFormatter(TensorFormatter[Mapping, "tf.Tensor", Mapping]):
def __init__(self, features=None, **tf_tensor_kwargs):
super().__init__(features=features)
self.tf_tensor_kwargs = tf_tensor_kwargs
import tensorflow as tf # noqa: import tf at initialization
import tensorflow as tf # noqa: F401 - import tf at initialization

def _consolidate(self, column):
import tensorflow as tf
Expand Down
10 changes: 5 additions & 5 deletions src/datasets/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ def dataset_module_factory(
token=download_config.token,
timeout=100.0,
)
except Exception as e: # noqa: catch any exception of hf_hub and consider that the dataset doesn't exist
except Exception as e: # noqa catch any exception of hf_hub and consider that the dataset doesn't exist
if isinstance(
e,
(
Expand Down Expand Up @@ -1213,10 +1213,10 @@ def dataset_module_factory(
).get_module()
except (
Exception
) as e1: # noqa: all the attempts failed, before raising the error we should check if the module is already cached.
) as e1: # noqa all the attempts failed, before raising the error we should check if the module is already cached.
try:
return CachedDatasetModuleFactory(path, dynamic_modules_path=dynamic_modules_path).get_module()
except Exception as e2: # noqa: if it's not in the cache, then it doesn't exist.
except Exception: # noqa if it's not in the cache, then it doesn't exist.
if isinstance(e1, OfflineModeIsEnabled):
raise ConnectionError(f"Couldn't reach the Hugging Face Hub for dataset '{path}': {e1}") from None
if isinstance(e1, EmptyDatasetError):
Expand Down Expand Up @@ -1318,10 +1318,10 @@ def metric_module_factory(
).get_module()
except (
Exception
) as e1: # noqa: all the attempts failed, before raising the error we should check if the module is already cached.
) as e1: # noqa all the attempts failed, before raising the error we should check if the module is already cached.
try:
return CachedMetricModuleFactory(path, dynamic_modules_path=dynamic_modules_path).get_module()
except Exception as e2: # noqa: if it's not in the cache, then it doesn't exist.
except Exception: # noqa if it's not in the cache, then it doesn't exist.
if not isinstance(e1, FileNotFoundError):
raise e1 from None
raise FileNotFoundError(
Expand Down
2 changes: 1 addition & 1 deletion src/datasets/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def __init__(
host = host or "localhost"
port = port or 9200

import elasticsearch.helpers # noqa: need this to properly load all the es features
import elasticsearch.helpers # noqa: F401 - need this to properly load all the es features
from elasticsearch import Elasticsearch # noqa: F811

self.es_client = es_client if es_client is not None else Elasticsearch([{"host": host, "port": str(port)}])
Expand Down
14 changes: 7 additions & 7 deletions tests/_test_patching.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

# This is the module that test_patching.py uses to test patch_submodule()

import os # noqa: this is just for tests
import os as renamed_os # noqa: this is just for tests
from os import path # noqa: this is just for tests
from os import path as renamed_path # noqa: this is just for tests
from os.path import join # noqa: this is just for tests
from os.path import join as renamed_join # noqa: this is just for tests
import os # noqa: F401 - this is just for tests
import os as renamed_os # noqa: F401 - this is just for tests
from os import path # noqa: F401 - this is just for tests
from os import path as renamed_path # noqa: F401 - this is just for tests
from os.path import join # noqa: F401 - this is just for tests
from os.path import join as renamed_join # noqa: F401 - this is just for tests


open = open # noqa: we just need to have a builtin inside this module to test it properly
open = open # noqa we just need to have a builtin inside this module to test it properly