class_docstr: Typed namedtuple with utility functions for glob ignore rules.
docstr: Build an ignore rule from the supplied glob pattern and log a useful warning if it is invalid.
code: def compile(
      pattern: str, _, definition_file: Path
  ) -> _IgnoreRule | None:
      """Build an ignore rule from the supplied glob pattern and log a useful warning if it is invalid."""
      relative_to: Path | None = None
      if pattern.strip() == "/":
          # "/" doesn't match anything in gitignore
          log.warning(
              "Ignoring no-op glob pattern '/' from %s", definition_file
          )
          return None
      if pattern.startswith("/") or "/" in pattern.rstrip("/"):
          # See https://git-scm.com/docs/gitignore
          # > If there is a separator at the beginning or middle (or both) of the pattern, then the
          # > pattern is relative to the directory level of the particular .gitignore file itself.
          # > Otherwise the pattern may also match at any level below the .gitignore level.
          relative_to = definition_file.parent
      ignore_pattern = GitWildMatchPattern(pattern)
      return _GlobIgnoreRule(
          ignore_pattern.regex,
          pattern,
          ignore_pattern.include,
          relative_to,
      )
  
imports: from __future__ import annotations
  import ast
  import logging
  import os
  import zipfile
  from io import TextIOWrapper
  from pathlib import Path
  from typing import Generator, NamedTuple, Pattern, Protocol, overload
  import re2
  from pathspec.patterns import GitWildMatchPattern
  from airflow.configuration import conf
  from airflow.exceptions import RemovedInAirflow3Warning
label_desc: Use image node_id 1 for calling the _GlobIgnoreRule obj's underlying member method code with example usage: obj.compile(pattern, _, definition_file) and returns: _GlobIgnoreRule, None