Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/pathspec/__init__.py: 87%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

15 statements  

1""" 

2The *pathspec* package provides pattern matching for file paths. So far this 

3only includes Git's *gitignore* patterns. 

4 

5The following classes are exposed from the root of the `pathspec` package: 

6 

7- :class:`pathspec.gitignore.GitIgnoreSpec` 

8 

9- :class:`pathspec.pathspec.PathSpec` 

10 

11- :class:`pathspec.pattern.Pattern` 

12 

13- :class:`pathspec.pattern.RegexPattern` 

14 

15- :class:`pathspec.util.RecursivePathError` 

16 

17The following functions are also exposed: 

18 

19- :func:`pathspec.util.lookup_pattern` 

20 

21The following deprecated classes are exposed to maintain backward 

22compatibility: 

23 

24- `pathspec.util.RecursionError` 

25 

26The following deprecated functions are also exposed to maintain backward 

27compatibility: 

28 

29- :func:`pathspec.util.iter_tree` 

30 

31- :func:`pathspec.util.match_files` 

32""" 

33 

34import warnings 

35 

36from .gitignore import ( 

37 GitIgnoreSpec) 

38from .pathspec import ( 

39 PathSpec) 

40from .pattern import ( 

41 Pattern, 

42 RegexPattern) 

43from .util import ( 

44 RecursivePathError, 

45 iter_tree, # Deprecated since 0.10.0. 

46 lookup_pattern, 

47 match_files) # Deprecated since 0.10.0. 

48 

49from ._meta import ( 

50 __author__, 

51 __copyright__, 

52 __credits__, 

53 __license__) 

54from ._version import ( 

55 __version__) 

56 

57# Load pattern implementations. 

58from . import patterns 

59 

60# Declare private imports as part of the public interface. Deprecated imports 

61# are deliberately excluded. 

62__all__ = [ 

63 'GitIgnoreSpec', 

64 'PathSpec', 

65 'Pattern', 

66 'RecursivePathError', 

67 'RegexPattern', 

68 '__author__', 

69 '__copyright__', 

70 '__credits__', 

71 '__license__', 

72 '__version__', 

73 'lookup_pattern', 

74] 

75 

76 

77def __getattr__(name: str): 

78 """ 

79 Look up a deprecated module-level attribute. 

80 """ 

81 if name == 'RecursionError': 

82 # Deprecated since 1.2.0. It conflicts with Python 3.5's built-in 

83 # RecursionError. 

84 warnings.warn(( 

85 "pathspec.util.RecursionError is deprecated, use RecursivePathError " 

86 "instead." 

87 ), DeprecationWarning, stacklevel=2) 

88 return RecursivePathError 

89 

90 raise AttributeError(f"module {__name__!r} has no attribute {name!r}")