From 81782383a987c4e441cd6cf6448ffb9151640770 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Mon, 9 Aug 2021 08:35:54 -0700 Subject: [PATCH] Use regular path.join when constructing glob patterns. I don't like the idea of having an intermediate Path object that isn't a real path. --- voussoirkit/pathclass.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/voussoirkit/pathclass.py b/voussoirkit/pathclass.py index 789c230..0f1b30d 100644 --- a/voussoirkit/pathclass.py +++ b/voussoirkit/pathclass.py @@ -42,7 +42,6 @@ class NotFile(PathclassException): class NotLink(PathclassException): pass - class Extension: def __init__(self, ext): if isinstance(ext, Extension): @@ -82,7 +81,6 @@ class Extension: return '' return '.' + self.ext - class Path: ''' I started to use pathlib.Path, but it was too much of a pain. @@ -208,8 +206,8 @@ class Path: # If the user wants to glob names in a different path, they should # create a Pathclass for that directory first and do it normally. raise TypeError('glob pattern should not have path separators') - pattern = self.with_child(pattern) - children = winglob.glob(pattern.absolute_path) + pattern = os.path.join(self.absolute_path, pattern) + children = winglob.glob(pattern) children = [self.with_child(child) for child in children] return children @@ -337,7 +335,6 @@ class Path: def with_child(self, basename): return self.join(os.path.basename(basename)) - def common_path(paths, fallback): ''' Given a list of file paths, determine the deepest path which all