Fix style errors
This commit is contained in:
@@ -6,20 +6,20 @@ from unittest import TestCase
|
|||||||
import spam
|
import spam
|
||||||
|
|
||||||
|
|
||||||
def path_contains(parent, child):
|
def path_contains(parent, child):
|
||||||
''' returns True if `child` is inside `parent`.
|
''' returns True if `child` is inside `parent`.
|
||||||
|
|
||||||
Works around path-comparison bugs caused by short-paths on Windows e.g.
|
Works around path-comparison bugs caused by short-paths on Windows e.g.
|
||||||
vssadm~1 instead of vssadministrator
|
vssadm~1 instead of vssadministrator
|
||||||
'''
|
'''
|
||||||
parent = os.path.abspath(parent)
|
parent = os.path.abspath(parent)
|
||||||
child = os.path.abspath(child)
|
child = os.path.abspath(child)
|
||||||
|
|
||||||
while child != os.path.dirname(child):
|
while child != os.path.dirname(child):
|
||||||
child = os.path.dirname(child)
|
child = os.path.dirname(child)
|
||||||
if os.stat(parent) == os.stat(child):
|
if os.stat(parent) == os.stat(child):
|
||||||
# parent and child refer to the same directory on the filesystem
|
# parent and child refer to the same directory on the filesystem
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user