@@ -29,7 +29,7 @@ class Dataset(dict[str, HFDataset]):
2929 label_feature = "label"
3030 utterance_feature = "utterance"
3131
32- def __init__ (self , * args : Any , intents : list [Intent ], ** kwargs : Any ) -> None :
32+ def __init__ (self , * args : Any , intents : list [Intent ], ** kwargs : Any ) -> None : # noqa: ANN401
3333 super ().__init__ (* args , ** kwargs )
3434
3535 self .intents = intents
@@ -51,11 +51,13 @@ def n_classes(self) -> int:
5151 @classmethod
5252 def from_json (cls , filepath : str | Path ) -> "Dataset" :
5353 from .reader import JsonReader
54+
5455 return JsonReader ().read (filepath )
5556
5657 @classmethod
5758 def from_dict (cls , mapping : dict [str , Any ]) -> "Dataset" :
5859 from .reader import DictReader
60+
5961 return DictReader ().read (mapping )
6062
6163 @classmethod
@@ -82,7 +84,7 @@ def to_multilabel(self) -> Self:
8284 self [split_name ] = split .map (self ._to_multilabel )
8385 return self
8486
85- def push_to_hub (self , repo_id : str )-> None :
87+ def push_to_hub (self , repo_id : str ) -> None :
8688 for split_name , split in self .items ():
8789 split .push_to_hub (repo_id , split = split_name )
8890
@@ -95,10 +97,7 @@ def get_tags(self) -> list[Tag]:
9597 for intent in self .intents :
9698 for tag in intent .tags :
9799 tag_mapping [tag ].append (intent .id )
98- return [
99- Tag (name = tag , intent_ids = intent_ids )
100- for tag , intent_ids in tag_mapping .items ()
101- ]
100+ return [Tag (name = tag , intent_ids = intent_ids ) for tag , intent_ids in tag_mapping .items ()]
102101
103102 def get_n_classes (self , split : str ) -> int :
104103 classes = set ()
0 commit comments