| 1 |
# pyright: strict |
| 2 |
|
| 3 |
from pathspec import ( |
| 4 |
PathSpec, |
| 5 |
GitIgnoreSpec) |
| 6 |
from pathspec.patterns.gitignore.basic import ( |
| 7 |
GitIgnoreBasicPattern) |
| 8 |
|
| 9 |
|
| 10 |
def check_gi_1(): |
| 11 |
spec = GitIgnoreSpec.from_lines(['**']) |
| 12 |
return spec |
| 13 |
|
| 14 |
|
| 15 |
def check_gi_2(): |
| 16 |
pattern = 'gitignore' |
| 17 |
spec = GitIgnoreSpec.from_lines(pattern, ['**']) |
| 18 |
return spec |
| 19 |
|
| 20 |
|
| 21 |
def check_gi_3(): |
| 22 |
pattern = 'gitignore' |
| 23 |
spec = GitIgnoreSpec.from_lines(['**'], pattern) |
| 24 |
return spec |
| 25 |
|
| 26 |
|
| 27 |
def check_ps_1(): |
| 28 |
spec = PathSpec.from_lines('gitignore', ['**']) |
| 29 |
return spec |
| 30 |
|
| 31 |
|
| 32 |
def check_ps_2(): |
| 33 |
pat_type = 'gitignore' |
| 34 |
spec = PathSpec.from_lines(pat_type, ['**']) |
| 35 |
return spec |
| 36 |
|
| 37 |
|
| 38 |
def check_ps_3(): |
| 39 |
spec = PathSpec.from_lines(GitIgnoreBasicPattern, ['**']) |
| 40 |
return spec |
| 41 |
|
| 42 |
|
| 43 |
def check_ps_4(): |
| 44 |
from typing import AnyStr |
| 45 |
def pattern_factory(pattern: AnyStr) -> GitIgnoreBasicPattern: |
| 46 |
return GitIgnoreBasicPattern(pattern) |
| 47 |
|
| 48 |
spec = PathSpec.from_lines(pattern_factory, ['**']) |
| 49 |
return spec |