Improve PEP8 gluon/recfile.py
This commit is contained in:
1 parent
8ac3191e33
commit
d00667e804
1 file changed
+5
@@ -11,6 +11,7 @@ Generates names for cache and session files
|
|||||||
"""
|
"""
|
||||||
import os, uuid
|
import os, uuid
|
||||||
|
|
||||||
|
|
||||||
def generate(filename, depth=2, base=512):
|
def generate(filename, depth=2, base=512):
|
||||||
if os.path.sep in filename:
|
if os.path.sep in filename:
|
||||||
path, filename = os.path.split(filename)
|
path, filename = os.path.split(filename)
|
||||||
@@ -26,6 +27,7 @@ def generate(filename, depth=2, base=512):
|
|||||||
folders.insert(0, path)
|
folders.insert(0, path)
|
||||||
return os.path.join(*folders)
|
return os.path.join(*folders)
|
||||||
|
|
||||||
|
|
||||||
def exists(filename, path=None):
|
def exists(filename, path=None):
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
return True
|
return True
|
||||||
@@ -36,6 +38,7 @@ def exists(filename, path=None):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def remove(filename, path=None):
|
def remove(filename, path=None):
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
return os.unlink(filename)
|
return os.unlink(filename)
|
||||||
@@ -46,6 +49,7 @@ def remove(filename, path=None):
|
|||||||
return os.unlink(fullfilename)
|
return os.unlink(fullfilename)
|
||||||
raise IOError
|
raise IOError
|
||||||
|
|
||||||
|
|
||||||
def open(filename, mode="r", path=None):
|
def open(filename, mode="r", path=None):
|
||||||
if not path:
|
if not path:
|
||||||
path, filename = os.path.split(filename)
|
path, filename = os.path.split(filename)
|
||||||
@@ -60,6 +64,7 @@ def open(filename, mode="r", path=None):
|
|||||||
os.makedirs(os.path.dirname(fullfilename))
|
os.makedirs(os.path.dirname(fullfilename))
|
||||||
return file(fullfilename, mode)
|
return file(fullfilename, mode)
|
||||||
|
|
||||||
|
|
||||||
def test():
|
def test():
|
||||||
if not os.path.exists('tests'):
|
if not os.path.exists('tests'):
|
||||||
os.mkdir('tests')
|
os.mkdir('tests')
|
||||||
|
|||||||
Reference in new issue
Block a user