コード例 #1
0
ファイル: test_filetools.py プロジェクト: akeshet/Odysseus
 def test_get_files_in_dir_args(self):
     curdirlist = filetools.get_files_in_dir(os.curdir, ext="py", globexpr="*.py", sort=False)
     assert isinstance(curdirlist, list)
コード例 #2
0
ファイル: example_filetools.py プロジェクト: akeshet/Odysseus
import odysseus.filetools as filetools

dirname = 'datafiles'

# get all the names of files with extension .TIF, by default sorted by date
imgnames = filetools.get_files_in_dir(dirname)
print imgnames

# get all the names of python files
pythonnames = filetools.get_files_in_dir('..', globexpr='*.py', sort=False)
# sort files by date, newest first
pythonnames_sorted = filetools.sort_files_by_date(pythonnames,
                                                  newestfirst=True)

for pyname in pythonnames_sorted:
    print pyname
コード例 #3
0
ファイル: test_filetools.py プロジェクト: akeshet/Odysseus
 def test_get_files_in_dir_returntype(self):
     curdirlist = filetools.get_files_in_dir(os.curdir)
     assert isinstance(curdirlist, list)
コード例 #4
0
ファイル: run_examples.py プロジェクト: MaxParsons/Odysseus
#!/usr/bin/env python
"""Run all examples in the example directory

If an example fails, an error is raised. This is useful when checking if
everything still works the way it is supposed to.

"""

import subprocess

import odysseus.filetools as filetools


dirname = '.'

# get all the names of python files
examples = filetools.get_files_in_dir('.', globexpr='example_*.py')

for example in examples:
    print '\n', 'running ', example
    retcode = subprocess.call(['python', example])

    if retcode:
        print '\n', 'An error occurred while running: '.upper(), example, '\n'
        raise RuntimeError





コード例 #5
0
#!/usr/bin/env python
"""Run all examples in the example directory

If an example fails, an error is raised. This is useful when checking if
everything still works the way it is supposed to.

"""

import subprocess

import odysseus.filetools as filetools

dirname = '.'

# get all the names of python files
examples = filetools.get_files_in_dir('.', globexpr='example_*.py')

for example in examples:
    print '\n', 'running ', example
    retcode = subprocess.call(['python', example])

    if retcode:
        print '\n', 'An error occurred while running: '.upper(), example, '\n'
        raise RuntimeError
コード例 #6
0
ファイル: test_filetools.py プロジェクト: akeshet/Odysseus
 def test_get_files_in_dir_args(self):
     curdirlist = filetools.get_files_in_dir(os.curdir, ext='py',
                                             globexpr='*.py', sort=False)
     assert isinstance(curdirlist, list)
コード例 #7
0
ファイル: test_filetools.py プロジェクト: akeshet/Odysseus
 def test_get_files_in_dir_returntype(self):
     curdirlist = filetools.get_files_in_dir(os.curdir)
     assert isinstance(curdirlist, list)
コード例 #8
0
import odysseus.filetools as filetools


dirname = 'datafiles'

# get all the names of files with extension .TIF, by default sorted by date
imgnames = filetools.get_files_in_dir(dirname)
print imgnames

# get all the names of python files
pythonnames = filetools.get_files_in_dir('..', globexpr='*.py', sort=False)
# sort files by date, newest first
pythonnames_sorted = filetools.sort_files_by_date(pythonnames, newestfirst=True)

for pyname in pythonnames_sorted:
    print pyname