mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 00:04:42 +04:00
Simplify prefix a bit
This commit is contained in:
parent
06ee69b3cc
commit
8fb644e7c0
3 changed files with 15 additions and 34 deletions
|
|
@ -5,16 +5,14 @@ import os.path
|
|||
|
||||
class Prefix(object):
|
||||
def __init__(self, prefix_dir):
|
||||
self.prefix_dir = prefix_dir.rstrip(os.sep) + os.sep
|
||||
self.prefix_dir = prefix_dir
|
||||
|
||||
def path(self, *parts):
|
||||
path = os.path.join(self.prefix_dir, *parts)
|
||||
return os.path.normpath(path)
|
||||
return os.path.normpath(os.path.join(self.prefix_dir, *parts))
|
||||
|
||||
def exists(self, *parts):
|
||||
return os.path.exists(self.path(*parts))
|
||||
|
||||
def star(self, end):
|
||||
return tuple(
|
||||
path for path in os.listdir(self.prefix_dir) if path.endswith(end)
|
||||
)
|
||||
paths = os.listdir(self.prefix_dir)
|
||||
return tuple(path for path in paths if path.endswith(end))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue