mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Temporarily restore python 3.6.0 support
This commit is contained in:
parent
1c641b1c28
commit
081f3028ee
5 changed files with 79 additions and 55 deletions
|
|
@ -6,12 +6,21 @@ from typing import Tuple
|
|||
class Prefix(NamedTuple):
|
||||
prefix_dir: str
|
||||
|
||||
def path(self, *parts: str) -> str:
|
||||
return os.path.normpath(os.path.join(self.prefix_dir, *parts))
|
||||
|
||||
def exists(self, *parts: str) -> bool:
|
||||
return os.path.exists(self.path(*parts))
|
||||
def Prefix_path(self, *parts: str) -> str:
|
||||
return os.path.normpath(os.path.join(self.prefix_dir, *parts))
|
||||
|
||||
def star(self, end: str) -> Tuple[str, ...]:
|
||||
paths = os.listdir(self.prefix_dir)
|
||||
return tuple(path for path in paths if path.endswith(end))
|
||||
|
||||
def Prefix_exists(self, *parts: str) -> bool:
|
||||
return os.path.exists(self.path(*parts))
|
||||
|
||||
|
||||
def Prefix_star(self, end: str) -> Tuple[str, ...]:
|
||||
paths = os.listdir(self.prefix_dir)
|
||||
return tuple(path for path in paths if path.endswith(end))
|
||||
|
||||
|
||||
# python 3.6.0 does not support methods on `typing.NamedTuple`
|
||||
Prefix.path = Prefix_path
|
||||
Prefix.exists = Prefix_exists
|
||||
Prefix.star = Prefix_star
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue