class_docstr: The :class:`PathSpec` class is a wrapper around a list of compiled
  :class:`.Pattern` instances.
class_docstr_tok: ["The",":","class",":","`","PathSpec","`","class","is","a","wrapper","around","a","list","of","compiled",":","class",":","`",".Pattern","`","instances","."]
docstr: Compiles the pattern lines.
  
  *pattern_factory* can be either the name of a registered pattern factory
  (:class:`str`), or a :class:`~collections.abc.Callable` used to compile
  patterns. It must accept an uncompiled pattern (:class:`str`) and return the
  compiled pattern (:class:`.Pattern`).
  
  *lines* (:class:`~collections.abc.Iterable`) yields each uncompiled pattern
  (:class:`str`). This simply has to yield each line so that it can be a
  :class:`io.TextIOBase` (e.g., from :func:`open` or :class:`io.StringIO`) or
  the result from :meth:`str.splitlines`.
  
  Returns the :class:`PathSpec` instance.
docstr_tok: ["Compiles","the","pattern","lines",".","*","pattern_factory","*","can","be","either","the","name","of","a","registered","pattern","factory","(",":","class",":","`","str","`",")",",","or","a",":","class",":","`","~collections.abc.Callable","`","used","to","compile","patterns",".","It","must","accept","an","uncompiled","pattern","(",":","class",":","`","str","`",")","and","return","the","compiled","pattern","(",":","class",":","`",".Pattern","`",")",".","*","lines","*","(",":","class",":","`","~collections.abc.Iterable","`",")","yields","each","uncompiled","pattern","(",":","class",":","`","str","`",")",".","This","simply","has","to","yield","each","line","so","that","it","can","be","a",":","class",":","`","io.TextIOBase","`","(","e.g.",",","from",":","func",":","`","open","`","or",":","class",":","`","io.StringIO","`",")","or","the","result","from",":","meth",":","`","str.splitlines","`",".","Returns","the",":","class",":","`","PathSpec","`","instance","."]
code: def from_lines(
      cls: Type[Self],
      pattern_factory: Union[str, Callable[[AnyStr], Pattern]],
      lines: Iterable[AnyStr],
  ) -> Self:
      """
      Compiles the pattern lines.
  
      *pattern_factory* can be either the name of a registered pattern factory
      (:class:`str`), or a :class:`~collections.abc.Callable` used to compile
      patterns. It must accept an uncompiled pattern (:class:`str`) and return the
      compiled pattern (:class:`.Pattern`).
  
      *lines* (:class:`~collections.abc.Iterable`) yields each uncompiled pattern
      (:class:`str`). This simply has to yield each line so that it can be a
      :class:`io.TextIOBase` (e.g., from :func:`open` or :class:`io.StringIO`) or
      the result from :meth:`str.splitlines`.
  
      Returns the :class:`PathSpec` instance.
      """
      if isinstance(pattern_factory, str):
          pattern_factory = util.lookup_pattern(pattern_factory)
  
      if not callable(pattern_factory):
          raise TypeError(
              f"pattern_factory:{pattern_factory!r} is not callable."
          )
  
      if not _is_iterable(lines):
          raise TypeError(f"lines:{lines!r} is not an iterable.")
  
      patterns = [pattern_factory(line) for line in lines if line]
      return cls(patterns)
  
imports: from collections.abc import Collection
  from itertools import zip_longest
  from typing import AnyStr, Callable, Collection, Iterable, Iterator, Optional, Type, TypeVar, Union
  from .None import util
  from .pattern import Pattern
  from .util import CheckResult, StrPath, TStrPath, TreeEntry, _filter_check_patterns, _is_iterable, normalize_file
label_desc: Use image node_id 9 for calling the PathSpec obj's underlying member method code with example usage: obj.from_lines(cls, pattern_factory, lines) and returns: cls