class_docstr: The :class:`GitIgnoreSpec` class extends :class:`pathspec.pathspec.PathSpec` to
  replicate *.gitignore* behavior.
class_docstr_tok: ["The",":","class",":","`","GitIgnoreSpec","`","class","extends",":","class",":","`","pathspec.pathspec.PathSpec","`","to","replicate","*",".gitignore","*","behavior","."]
docstr: Compiles the pattern lines.
  
  *lines* (:class:`~collections.abc.Iterable`) yields each uncompiled
  pattern (:class:`str`). This simply has to yield each line so it can
  be a :class:`io.TextIOBase` (e.g., from :func:`open` or
  :class:`io.StringIO`) or the result from :meth:`str.splitlines`.
  
  *pattern_factory* can be :data:`None`, the name of a registered
  pattern factory (:class:`str`), or a :class:`~collections.abc.Callable`
  used to compile patterns. The callable must accept an uncompiled
  pattern (:class:`str`) and return the compiled pattern
  (:class:`pathspec.pattern.Pattern`).
  Default is :data:`None` for :class:`.GitWildMatchPattern`).
  
  Returns the :class:`GitIgnoreSpec` instance.
docstr_tok: ["Compiles","the","pattern","lines",".","*","lines","*","(",":","class",":","`","~collections.abc.Iterable","`",")","yields","each","uncompiled","pattern","(",":","class",":","`","str","`",")",".","This","simply","has","to","yield","each","line","so","it","can","be","a",":","class",":","`","io.TextIOBase","`","(","e.g.",",","from",":","func",":","`","open","`","or",":","class",":","`","io.StringIO","`",")","or","the","result","from",":","meth",":","`","str.splitlines","`",".","*","pattern_factory","*","can","be",":","data",":","`","None","`",",","the","name","of","a","registered","pattern","factory","(",":","class",":","`","str","`",")",",","or","a",":","class",":","`","~collections.abc.Callable","`","used","to","compile","patterns",".","The","callable","must","accept","an","uncompiled","pattern","(",":","class",":","`","str","`",")","and","return","the","compiled","pattern","(",":","class",":","`","pathspec.pattern.Pattern","`",")",".","Default","is",":","data",":","`","None","`","for",":","class",":","`",".GitWildMatchPattern","`",")",".","Returns","the",":","class",":","`","GitIgnoreSpec","`","instance","."]
code: def from_lines(
      cls: Type[Self],
      lines: Iterable[AnyStr],
      pattern_factory: Union[
          str, Callable[[AnyStr], Pattern], None
      ] = None,
  ) -> Self:
      """
      Compiles the pattern lines.
  
      *lines* (:class:`~collections.abc.Iterable`) yields each uncompiled
      pattern (:class:`str`). This simply has to yield each line so it can
      be a :class:`io.TextIOBase` (e.g., from :func:`open` or
      :class:`io.StringIO`) or the result from :meth:`str.splitlines`.
  
      *pattern_factory* can be :data:`None`, the name of a registered
      pattern factory (:class:`str`), or a :class:`~collections.abc.Callable`
      used to compile patterns. The callable must accept an uncompiled
      pattern (:class:`str`) and return the compiled pattern
      (:class:`pathspec.pattern.Pattern`).
      Default is :data:`None` for :class:`.GitWildMatchPattern`).
  
      Returns the :class:`GitIgnoreSpec` instance.
      """
      if pattern_factory is None:
          pattern_factory = GitWildMatchPattern
  
      elif (
          isinstance(lines, (str, bytes)) or callable(lines)
      ) and _is_iterable(pattern_factory):
          # Support reversed order of arguments from PathSpec.
          pattern_factory, lines = lines, pattern_factory
  
      self = super().from_lines(pattern_factory, lines)
      return cast(Self, self)
  
file_path: catboost/contrib/python/pathspec/pathspec/gitignore.py
imports: from typing import AnyStr, Callable, Iterable, Optional, Tuple, Type, TypeVar, Union, cast, overload
  from .pathspec import PathSpec
  from .pattern import Pattern
  from .patterns.gitwildmatch import GitWildMatchPattern, _DIR_MARK
  from .util import _is_iterable
label_desc: Use image node_id 4 for calling the GitIgnoreSpec obj's underlying member method code with example usage: obj.from_lines(cls, lines, pattern_factory) and returns: cast