mirror of
https://github.com/wassname/simpeg.git
synced 2026-07-05 18:31:59 +08:00
Clean up init file in examples.
This commit is contained in:
@@ -29,16 +29,17 @@ if __name__ == '__main__':
|
||||
from SimPEG import Examples
|
||||
|
||||
# Create the examples dir in the docs folder.
|
||||
docExamplesDir = os.path.sep.join(os.path.realpath(__file__).split(os.path.sep)[:-3] + ['docs', 'examples'])
|
||||
fName = os.path.realpath(__file__)
|
||||
docExamplesDir = os.path.sep.join(fName.split(os.path.sep)[:-3] + ['docs', 'examples'])
|
||||
shutil.rmtree(docExamplesDir)
|
||||
os.makedirs(docExamplesDir)
|
||||
|
||||
# Get all the python examples in this folder
|
||||
thispath = os.path.sep.join(__file__.split(os.path.sep)[:-1])
|
||||
thispath = os.path.sep.join(fName.split(os.path.sep)[:-1])
|
||||
exfiles = [f[:-3] for f in os.listdir(thispath) if os.path.isfile(os.path.join(thispath, f)) and f.endswith('.py') and not f.startswith('_')]
|
||||
|
||||
# Add the imports to the top in the AUTOIMPORTS section
|
||||
f = file(__file__, 'r')
|
||||
f = file(fName, 'r')
|
||||
inimports = False
|
||||
out = ''
|
||||
for line in f:
|
||||
@@ -53,7 +54,7 @@ if __name__ == '__main__':
|
||||
out += '\n##### AUTOIMPORTS #####\n'
|
||||
f.close()
|
||||
|
||||
f = file(__file__, 'w')
|
||||
f = file(fName, 'w')
|
||||
f.write(out)
|
||||
f.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user