class_docstr: Class to read RuBQ datasets
class_docstr_tok: ["Class","to","read","RuBQ","datasets"]
code: def read(
      self,
      data_path: str,
      version: str = "2.0",
      question_types: List[str] = ["all"],
      not_include_question_types: List[str] = None,
      num_samples: int = -1,
  ):
      dataset = super().read(data_path)
      for data_type in ["valid", "test"]:
          samples = dataset[data_type]
          samples = [
              sample
              for sample in samples
              if float(sample["RuBQ_version"]) <= float(version)
              and (
                  any(tp in sample["tags"] for tp in question_types)
                  or question_types == ["all"]
              )
          ]
          if not_include_question_types:
              samples = [
                  sample
                  for sample in samples
                  if all(
                      [
                          tp not in sample["tags"]
                          for tp in not_include_question_types
                      ]
                  )
              ]
          samples = [self.preprocess(sample) for sample in samples]
          if num_samples > 0:
              samples = samples[:num_samples]
          dataset[data_type] = samples
      return dataset
  
file_path: DeepPavlov/deeppavlov/dataset_readers/sq_reader.py
imports: import json
  import pickle
  from typing import List
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.data.dataset_reader import DatasetReader
  from deeppavlov.core.common.file import load_pickle
  from deeppavlov.core.common.file import read_json
label_desc: Use image node_id 1 for calling the RuBQReader obj's underlying member method code with example usage: obj.read(data_path, version, question_types, not_include_question_types, num_samples) and returns: dataset