mirror of
https://github.com/Garmelon/PFERD.git
synced 2026-04-13 07:55:05 +02:00
Added posix glob with pathmatch
This commit is contained in:
parent
b09afd70a4
commit
27ece2ab97
4 changed files with 7 additions and 2 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -8,6 +8,8 @@ build/
|
||||||
.env
|
.env
|
||||||
.vscode
|
.vscode
|
||||||
ilias_cookies.txt
|
ilias_cookies.txt
|
||||||
|
*~
|
||||||
|
PFERD.egg-info/
|
||||||
|
|
||||||
# PyInstaller
|
# PyInstaller
|
||||||
sync_url.spec
|
sync_url.spec
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import os
|
||||||
import re
|
import re
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from pathlib import PurePath
|
from pathlib import PurePath
|
||||||
|
from pathmatch import wildmatch
|
||||||
from typing import Callable, List, Optional, TypeVar
|
from typing import Callable, List, Optional, TypeVar
|
||||||
|
|
||||||
from .utils import PathLike, Regex, to_path, to_pattern
|
from .utils import PathLike, Regex, to_path, to_pattern
|
||||||
|
|
@ -82,7 +83,7 @@ def predicate(pred: Callable[[PurePath], bool]) -> Transform:
|
||||||
return inner
|
return inner
|
||||||
|
|
||||||
def glob(pattern: str) -> Transform:
|
def glob(pattern: str) -> Transform:
|
||||||
return predicate(lambda path: path.match(pattern))
|
return predicate(lambda path: wildmatch.match(pattern, str(path)))
|
||||||
|
|
||||||
def move_dir(source_dir: PathLike, target_dir: PathLike) -> Transform:
|
def move_dir(source_dir: PathLike, target_dir: PathLike) -> Transform:
|
||||||
source_path = to_path(source_dir)
|
source_path = to_path(source_dir)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
requests>=2.21.0
|
requests>=2.21.0
|
||||||
beautifulsoup4>=4.7.1
|
beautifulsoup4>=4.7.1
|
||||||
rich>=2.1.0
|
rich>=2.1.0
|
||||||
keyring>=21.5.0
|
keyring>=21.5.0
|
||||||
|
pathmatch>=0.2.2
|
||||||
|
|
|
||||||
1
setup.py
1
setup.py
|
|
@ -9,6 +9,7 @@ setup(
|
||||||
"beautifulsoup4>=4.7.1",
|
"beautifulsoup4>=4.7.1",
|
||||||
"rich>=2.1.0",
|
"rich>=2.1.0",
|
||||||
"keyring>=21.5.0"
|
"keyring>=21.5.0"
|
||||||
|
"pathmatch>=0.2.2"
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue