class_docstr: Base class for project-specific Wikimedia datasets. See:
  
  * :class:`Wikipedia`
  * :class:`Wikinews`
code: def __iter__(self):
      if not self.filepath:
          raise OSError(
              f"{self.project} database dump file '{self.filepath}' not found; "
              "has the dataset been downloaded yet?"
          )
  
      is_bad_category = is_bad_category_funcs.get(self.project, {}).get(
          self.lang
      )
      bad_wl_starts = _bad_wiki_link_starts.get(self.project, {}).get(
          self.lang, tuple()
      )
  
      lines = tio.read_json(self.filepath, mode="rb", lines=True)
      for index, source in itertoolz.partition(2, lines):
          if source.get("namespace") != self.namespace:
              continue
          # split opening text from main body text, if available
          opening_text = source.get("opening_text")
          text = source.get("text")
          if opening_text and text and text.startswith(opening_text):
              text = (
                  opening_text
                  + "\n\n"
                  + text[len(opening_text) :].strip()
              )
          # do minimal cleaning of categories and wiki links, if available
          if is_bad_category:
              categories = tuple(
                  cat
                  for cat in source.get("category", [])
                  if not is_bad_category(cat)
              )
          else:
              categories = tuple(source.get("category", []))
          wiki_links = tuple(
              wl
              for wl in source.get("outgoing_link", [])
              if not any(wl.startswith(bwls) for bwls in bad_wl_starts)
          )
          yield {
              "page_id": index["index"]["_id"],
              "title": source["title"],
              "text": text,
              "headings": tuple(source.get("heading", [])),
              "wiki_links": wiki_links,
              "ext_links": tuple(
                  urllib.parse.unquote_plus(el)
                  for el in source.get("external_link", [])
              ),
              "categories": categories,
              "dt_created": source.get("create_timestamp"),
              "n_incoming_links": source.get("incoming_links"),
              "popularity_score": source.get("popularity_score"),
          }
  
imports: from __future__ import annotations
  import datetime
  import itertools
  import logging
  import os
  import re
  import urllib.parse
  from typing import Iterable, Optional
  import requests
  from cytoolz import itertoolz
  from ..None import constants
  from ..None import io
  from ..None import types, utils
  from .base import Dataset
label_desc: Use image node_id 5 for calling the Wikimedia obj's underlying member method code with example usage: obj.__iter__() without return types