code: def split_by_files(self, valid_names:'ItemList')->'ItemLists':
          "Split the data by using the names in `valid_names` for validation."
          if isinstance(self.items[0], Path): return self.split_by_valid_func(lambda o: o.name in valid_names)
          else: return self.split_by_valid_func(lambda o: os.path.basename(o) in valid_namesf split_by_files(self, valid_names:'ItemList')->'ItemLists':
          "Split the data by using the names in `valid_names` for validation."
          if isinstance(self.items[0], Path): return self.split_by_valid_func(lambda o: o.name in valid_names)
          else: return self.split_by_valid_func(lambda o: os.path.basename(o) in valid_names)
docs: Split the data by using the names in `valid_names` for validation.