class_docstr: Filter out duplicate log messages.
  
  A context window of default 5 messages is used to determine if a message is a
  duplicate. This is because some Ghostscript messages are word wrapped.
class_docstr_tok: ["Filter","out","duplicate","log","messages",".","A","context","window","of","default","5","messages","is","used","to","determine","if","a","message","is","a","duplicate",".","This","is","because","some","Ghostscript","messages","are","word","wrapped","."]
code: def __init__(self, logger: logging.Logger, context_window=5):
      self.window: deque[str] = deque([], maxlen=context_window)
      self.logger = logger
      self.levelno = logging.DEBUG
      self.count = 0
  
imports: from __future__ import annotations
  import logging
  import os
  import re
  from collections import deque
  from io import BytesIO
  from os import fspath
  from pathlib import Path
  from subprocess import PIPE, CalledProcessError
  from packaging.version import Version
  from PIL import Image, UnidentifiedImageError
  from ocrmypdf.exceptions import ColorConversionNeededError, SubprocessOutputError
  from ocrmypdf.helpers import Resolution
  from ocrmypdf.subprocess import get_version, run, run_polling_stderr
label_desc: Use image node_id 1 to create a new DuplicateFilter object from inherited base classes: logging with example: obj = DuplicateFilter(logger, context_window)