├── doc ├── workflow │ ├── examples │ │ ├── dummy │ │ │ ├── bar │ │ │ └── foo │ │ ├── driver_1.txt │ │ ├── example1.txt │ │ ├── example2.txt │ │ ├── example1a.txt │ │ ├── example1b.txt │ │ ├── example1c.txt │ │ ├── example4.txt │ │ ├── example5.txt │ │ ├── example3.txt │ │ ├── example_plugin.txt │ │ ├── example10.txt │ │ ├── example3a.txt │ │ ├── example8.txt │ │ ├── example9a.txt │ │ ├── example_driver1.txt │ │ ├── example6.txt │ │ ├── example6a.txt │ │ ├── example7.txt │ │ ├── example6.log │ │ ├── example9b.txt │ │ ├── driver_3.sh │ │ ├── driver_2.sh │ │ ├── driver_1.sh │ │ ├── example7a.txt │ │ ├── driver_2.txt │ │ ├── driver1.py │ │ ├── example_driver1.py │ │ ├── driver_3.txt │ │ ├── driver2.py │ │ ├── example1.py │ │ ├── example1a.py │ │ ├── example1c.py │ │ ├── example1b.py │ │ ├── example_plugin.py │ │ ├── example9a.py │ │ ├── example10.py │ │ ├── example2.py │ │ ├── example3.py │ │ ├── example3a.py │ │ ├── example7.py │ │ ├── example7a.py │ │ ├── example4.py │ │ ├── tasks_yz.py │ │ ├── example9b.py │ │ ├── example5.py │ │ ├── test_example.py │ │ ├── example8.py │ │ ├── example6.py │ │ └── example6a.py │ ├── SAND.pdf │ ├── workflow.pdf │ ├── DOEbwlogo.pdf │ ├── snllineblk.pdf │ ├── figures │ │ ├── workflow-example2.pdf │ │ ├── workflow-example3.pdf │ │ ├── workflow-figures.pptx │ │ └── workflow-overview.pdf │ ├── acknow.tex │ ├── macros.tex │ ├── abstract.tex │ ├── Makefile │ ├── example_exec.py │ └── workflow.tex ├── plugin │ ├── pca.pdf │ ├── DOEbwlogo.pdf │ ├── snllineblk.pdf │ ├── figures │ │ ├── definitions.pdf │ │ └── pca-figures.ppt │ ├── Makefile │ ├── macros.tex │ └── pca-disc.tex └── release_notes.txt ├── pyutilib ├── dev │ ├── tests │ │ └── __init__.py │ ├── __init__.py │ ├── entry_point.py │ └── checkCopyright.py ├── misc │ ├── tests │ │ ├── redirect_io2.txt │ │ ├── import_data │ │ │ ├── __init__.py │ │ │ ├── a │ │ │ │ ├── __init__.py │ │ │ │ └── tfile.py │ │ │ ├── b │ │ │ │ ├── __init__.py │ │ │ │ └── tfile.py │ │ │ └── tfile1.0.py │ │ ├── import1.txt │ │ ├── import2.txt │ │ ├── filecmp5.txt │ │ ├── filecmp3.txt │ │ ├── redirect_io1.txt │ │ ├── redirect_io3.txt │ │ ├── archivereader │ │ │ ├── archive_directory │ │ │ │ ├── .junk │ │ │ │ └── directory │ │ │ │ │ ├── .junk │ │ │ │ │ ├── fileA.txt │ │ │ │ │ └── fileB.txt │ │ │ ├── fileC.txt │ │ │ ├── win_archive_directory │ │ │ │ ├── .junk │ │ │ │ └── directory │ │ │ │ │ ├── .junk │ │ │ │ │ ├── fileA.txt │ │ │ │ │ └── fileB.txt │ │ │ ├── archive_flat │ │ │ │ ├── fileA.txt │ │ │ │ └── fileB.txt │ │ │ ├── win_archive_flat │ │ │ │ ├── fileA.txt │ │ │ │ └── fileB.txt │ │ │ ├── fileC.txt.bz2 │ │ │ ├── fileC.txt.gz │ │ │ ├── archive_flat.tgz │ │ │ ├── archive_flat.zip │ │ │ ├── archive_directory.tgz │ │ │ ├── archive_directory.zip │ │ │ ├── archive_flat.tar.gz │ │ │ ├── win_archive_flat.zip │ │ │ ├── archive_directory.tar.gz │ │ │ └── win_archive_directory.zip │ │ ├── filecmp6.txt │ │ ├── filecmp7.txt │ │ ├── filecmp8.txt │ │ ├── jsondata3.jsn │ │ ├── yamldata3.yml │ │ ├── __init__.py │ │ ├── filecmp10.txt │ │ ├── filecmp11.txt │ │ ├── import_main_exception.txt │ │ ├── xmldata3.xml │ │ ├── filecmp1.txt │ │ ├── test1.cfg │ │ ├── filecmp2.txt │ │ ├── test.xml │ │ ├── import_exception.py │ │ ├── jsondata2.jsn.gz │ │ ├── yamldata14.yml.gz │ │ ├── filecmp4.txt │ │ ├── yamldata11.yml │ │ ├── yamldata1.yml │ │ ├── yamldata10.yml │ │ ├── yamldata9.yml │ │ ├── import1.py │ │ ├── yamldata6.yml │ │ ├── yamldata8.yml │ │ ├── yamldata12.yml │ │ ├── yamldata5.yml │ │ ├── yamldata2.yml │ │ ├── yamldata4.txt │ │ ├── yamldata7.yml │ │ ├── import_main_exception.py │ │ ├── jsondata6.jsn │ │ ├── jsondata5.jsn │ │ ├── jsondata1.jsn │ │ ├── jsondata10.jsn │ │ ├── jsondata9.jsn │ │ ├── jsondata8.jsn │ │ ├── jsondata7.jsn │ │ ├── xmldata1.xml │ │ ├── xmldata10.xml │ │ ├── xmldata9.xml │ │ ├── jsondata2.jsn │ │ ├── xmldata11.xml │ │ ├── xmldata6.xml │ │ ├── xmldata2.xml │ │ ├── jsondata4.txt │ │ ├── xmldata5.xml │ │ ├── xmldata8.xml │ │ ├── format_io.txt │ │ ├── xmldata4.txt │ │ ├── xmldata7.xml │ │ ├── xmldata12.xml │ │ ├── import2.py │ │ ├── yamldata13.yml │ │ ├── test_singleton.py │ │ ├── test_method.py │ │ ├── test_hierarchical_timer.py │ │ ├── test_cross.py │ │ └── test_factory.py │ ├── generator.py │ ├── GlobalData.py │ ├── singleton.py │ ├── format_io.py │ ├── method.py │ ├── gc_manager.py │ └── indent_io.py ├── th │ ├── tests │ │ ├── file1.txt │ │ ├── file2.txt │ │ ├── __init__.py │ │ ├── file1.zip │ │ ├── file2.zip │ │ ├── file3.zip │ │ ├── file1.txt.gz │ │ └── file2.txt.gz │ ├── nose_gc.py │ └── __init__.py ├── component │ ├── loader │ │ ├── tests │ │ │ ├── __init__.py │ │ │ ├── eggsrc │ │ │ │ ├── pkg1 │ │ │ │ │ ├── package1 │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ └── main.py │ │ │ │ │ └── setup.py │ │ │ │ ├── pkg2 │ │ │ │ │ ├── package2 │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ └── main.py │ │ │ │ │ └── setup.py │ │ │ │ ├── pkg3 │ │ │ │ │ ├── package3 │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ └── main.py │ │ │ │ │ └── setup.py │ │ │ │ ├── pkg4 │ │ │ │ │ ├── package4 │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ └── main.py │ │ │ │ │ └── setup.py │ │ │ │ ├── pkg5 │ │ │ │ │ ├── package5 │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ └── main.py │ │ │ │ │ └── setup.py │ │ │ │ ├── pkg6 │ │ │ │ │ ├── package6 │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ └── main.py │ │ │ │ │ └── setup.py │ │ │ │ ├── pkg7 │ │ │ │ │ ├── package7 │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ └── main.py │ │ │ │ │ └── setup.py │ │ │ │ ├── README │ │ │ │ └── update │ │ │ ├── plugins2 │ │ │ │ ├── test4.py │ │ │ │ ├── test2.py │ │ │ │ └── test3.py │ │ │ ├── eggs1 │ │ │ │ ├── Package1-0.1-py2.6.egg │ │ │ │ ├── Package1-0.1-py2.7.egg │ │ │ │ ├── Package1-0.1-py3.2.egg │ │ │ │ ├── Package1-0.1-py3.3.egg │ │ │ │ ├── Package1-0.1-py3.4.egg │ │ │ │ ├── Package1-0.1-py3.5.egg │ │ │ │ ├── Package1-0.1-py3.6.egg │ │ │ │ ├── Package1-0.1-py3.7.egg │ │ │ │ ├── Package1-0.1-py3.8.egg │ │ │ │ ├── Package2-0.1-py2.6.egg │ │ │ │ ├── Package2-0.1-py2.7.egg │ │ │ │ ├── Package2-0.1-py3.2.egg │ │ │ │ ├── Package2-0.1-py3.3.egg │ │ │ │ ├── Package2-0.1-py3.4.egg │ │ │ │ ├── Package2-0.1-py3.5.egg │ │ │ │ ├── Package2-0.1-py3.6.egg │ │ │ │ ├── Package2-0.1-py3.7.egg │ │ │ │ └── Package2-0.1-py3.8.egg │ │ │ ├── eggs2 │ │ │ │ ├── Package3-0.1-py2.6.egg │ │ │ │ ├── Package3-0.1-py2.7.egg │ │ │ │ ├── Package3-0.1-py3.2.egg │ │ │ │ ├── Package3-0.1-py3.3.egg │ │ │ │ ├── Package3-0.1-py3.4.egg │ │ │ │ ├── Package3-0.1-py3.5.egg │ │ │ │ ├── Package3-0.1-py3.6.egg │ │ │ │ ├── Package3-0.1-py3.7.egg │ │ │ │ ├── Package3-0.1-py3.8.egg │ │ │ │ ├── Package4-0.1-py2.6.egg │ │ │ │ ├── Package4-0.1-py2.7.egg │ │ │ │ ├── Package4-0.1-py3.2.egg │ │ │ │ ├── Package4-0.1-py3.3.egg │ │ │ │ ├── Package4-0.1-py3.4.egg │ │ │ │ ├── Package4-0.1-py3.5.egg │ │ │ │ ├── Package4-0.1-py3.6.egg │ │ │ │ ├── Package4-0.1-py3.7.egg │ │ │ │ ├── Package4-0.1-py3.8.egg │ │ │ │ ├── Package5-0.1-py2.6.egg │ │ │ │ ├── Package5-0.1-py2.7.egg │ │ │ │ ├── Package5-0.1-py3.2.egg │ │ │ │ ├── Package5-0.1-py3.3.egg │ │ │ │ ├── Package5-0.1-py3.4.egg │ │ │ │ ├── Package5-0.1-py3.5.egg │ │ │ │ ├── Package5-0.1-py3.6.egg │ │ │ │ ├── Package5-0.1-py3.7.egg │ │ │ │ ├── Package5-0.1-py3.8.egg │ │ │ │ ├── Package6-0.1-py2.6.egg │ │ │ │ ├── Package6-0.1-py2.7.egg │ │ │ │ ├── Package6-0.1-py3.2.egg │ │ │ │ ├── Package6-0.1-py3.3.egg │ │ │ │ ├── Package6-0.1-py3.4.egg │ │ │ │ ├── Package6-0.1-py3.5.egg │ │ │ │ ├── Package6-0.1-py3.6.egg │ │ │ │ ├── Package6-0.1-py3.7.egg │ │ │ │ ├── Package6-0.1-py3.8.egg │ │ │ │ ├── Package7-0.1-py2.6.egg │ │ │ │ ├── Package7-0.1-py2.7.egg │ │ │ │ ├── Package7-0.1-py3.2.egg │ │ │ │ ├── Package7-0.1-py3.3.egg │ │ │ │ ├── Package7-0.1-py3.4.egg │ │ │ │ ├── Package7-0.1-py3.5.egg │ │ │ │ ├── Package7-0.1-py3.6.egg │ │ │ │ ├── Package7-0.1-py3.7.egg │ │ │ │ └── Package7-0.1-py3.8.egg │ │ │ ├── plugins1 │ │ │ │ └── test1.py │ │ │ ├── load1a.py │ │ │ ├── load2.py │ │ │ ├── load2a.py │ │ │ ├── load1.py │ │ │ ├── egg1.py │ │ │ └── egg2.py │ │ └── __init__.py │ ├── app │ │ ├── tests │ │ │ ├── __init__.py │ │ │ ├── log1.ini │ │ │ ├── app1b.py │ │ │ ├── app1a.py │ │ │ ├── app2.py │ │ │ ├── app4.py │ │ │ ├── app3.py │ │ │ ├── config1.txt │ │ │ └── test_simple.py │ │ ├── __init__.py │ │ └── simple.py │ ├── config │ │ ├── tests │ │ │ ├── config2.ini │ │ │ ├── config3.ini │ │ │ ├── config1.ini │ │ │ ├── config4.ini │ │ │ ├── log2.txt │ │ │ ├── config1.txt │ │ │ ├── config4.txt │ │ │ └── __init__.py │ │ └── __init__.py │ ├── core │ │ ├── tests │ │ │ ├── __init__.py │ │ │ └── factory.yml │ │ └── __init__.py │ ├── executables │ │ └── __init__.py │ └── __init__.py ├── workflow │ ├── tests │ │ ├── __init__.py │ │ ├── test2.txt │ │ ├── test1.txt │ │ ├── test_doc.py │ │ ├── test3.txt │ │ └── test4.txt │ ├── file.py │ ├── globals.py │ ├── __init__.py │ ├── resource.py │ └── executable.py ├── autotest │ ├── tests │ │ ├── test4.txt │ │ ├── test2.txt │ │ ├── test3.txt │ │ ├── __init__.py │ │ ├── test1.txt │ │ └── example1.yml │ ├── __init__.py │ ├── json_plugin.py │ ├── default_testdriver.py │ ├── yaml_plugin.py │ └── plugins.py ├── excel │ ├── tests │ │ ├── test_data.xls │ │ ├── test_data.xlsx │ │ └── __init__.py │ ├── __init__.py │ └── base.py ├── subprocess │ ├── tests │ │ ├── tee_script.py │ │ └── __init__.py │ ├── GlobalData.py │ └── __init__.py ├── __init__.py ├── math │ ├── tests │ │ ├── __init__.py │ │ └── test_numtypes.py │ ├── __init__.py │ ├── median2.py │ ├── median3.py │ └── numtypes.py ├── ply │ ├── __init__.py │ └── ply.py ├── services │ ├── __init__.py │ └── services.py ├── common │ ├── __init__.py │ └── _exceptions.py ├── factory │ └── __init__.py ├── enum │ └── __init__.py └── pyro │ └── nameserver.py ├── setup.cfg ├── examples ├── autotest │ ├── test_suite1_echo_p1.txt │ ├── test_suite2_echo_p3.txt │ ├── README.txt │ ├── test_suite1_cat_p1.txt │ ├── test_suite2_cat_p1.txt │ ├── test_suite3_cat_p1.txt │ ├── test_suite1_cat2_p1.txt │ ├── test_suite3_catx_p1.txt │ ├── autotest.py │ ├── example1.yml │ ├── example.py │ └── test_suite2_cat2_p2.txt └── pyro │ ├── factor_srvr │ ├── README.txt │ ├── factor.py │ └── factorize ├── .coveragerc ├── AUTHORS.txt ├── .github ├── PULL_REQUEST_TEMPLATE.md └── workflows │ └── release_wheel_creation.yml ├── RELEASE.txt ├── install_jython.sh ├── .gitignore ├── CONTRIBUTING.md └── LICENSE.txt /doc/workflow/examples/dummy/bar: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/workflow/examples/dummy/foo: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pyutilib/dev/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/redirect_io2.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/workflow/examples/driver_1.txt: -------------------------------------------------------------------------------- 1 | z: 7 2 | -------------------------------------------------------------------------------- /doc/workflow/examples/example1.txt: -------------------------------------------------------------------------------- 1 | z: 4 2 | -------------------------------------------------------------------------------- /doc/workflow/examples/example2.txt: -------------------------------------------------------------------------------- 1 | z: 5 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/import_data/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pyutilib/th/tests/file1.txt: -------------------------------------------------------------------------------- 1 | Test file1 2 | -------------------------------------------------------------------------------- /pyutilib/th/tests/file2.txt: -------------------------------------------------------------------------------- 1 | Test file2 2 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal=1 3 | -------------------------------------------------------------------------------- /doc/workflow/examples/example1a.txt: -------------------------------------------------------------------------------- 1 | z: 4 2 | -------------------------------------------------------------------------------- /doc/workflow/examples/example1b.txt: -------------------------------------------------------------------------------- 1 | z: 4 2 | -------------------------------------------------------------------------------- /doc/workflow/examples/example1c.txt: -------------------------------------------------------------------------------- 1 | z: 5 2 | -------------------------------------------------------------------------------- /doc/workflow/examples/example4.txt: -------------------------------------------------------------------------------- 1 | z: 15 2 | -------------------------------------------------------------------------------- /doc/workflow/examples/example5.txt: -------------------------------------------------------------------------------- 1 | z: 1400 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/import1.txt: -------------------------------------------------------------------------------- 1 | import1 b=2 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/import2.txt: -------------------------------------------------------------------------------- 1 | import2 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/import_data/a/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/import_data/b/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/workflow/examples/example3.txt: -------------------------------------------------------------------------------- 1 | W: 4 2 | z: 11 3 | -------------------------------------------------------------------------------- /doc/workflow/examples/example_plugin.txt: -------------------------------------------------------------------------------- 1 | z: 4 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/filecmp5.txt: -------------------------------------------------------------------------------- 1 | abcde 2 | fghij 3 | -------------------------------------------------------------------------------- /pyutilib/th/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # pyutilib.th tests 2 | -------------------------------------------------------------------------------- /doc/workflow/examples/example10.txt: -------------------------------------------------------------------------------- 1 | BUSY 1 2 | x: 1 3 | -------------------------------------------------------------------------------- /doc/workflow/examples/example3a.txt: -------------------------------------------------------------------------------- 1 | W: 104 2 | z: 211 3 | -------------------------------------------------------------------------------- /doc/workflow/examples/example8.txt: -------------------------------------------------------------------------------- 1 | x: -1 2 | x: -2 3 | -------------------------------------------------------------------------------- /doc/workflow/examples/example9a.txt: -------------------------------------------------------------------------------- 1 | z: 101 2 | z: 102 3 | -------------------------------------------------------------------------------- /examples/autotest/test_suite1_echo_p1.txt: -------------------------------------------------------------------------------- 1 | README.txt 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/filecmp3.txt: -------------------------------------------------------------------------------- 1 | this 2 | is 3 | a 4 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/redirect_io1.txt: -------------------------------------------------------------------------------- 1 | HERE 2 | [1,2,3] 3 | -------------------------------------------------------------------------------- /doc/workflow/examples/example_driver1.txt: -------------------------------------------------------------------------------- 1 | z: 7 2 | Z: 12 3 | -------------------------------------------------------------------------------- /examples/autotest/test_suite2_echo_p3.txt: -------------------------------------------------------------------------------- 1 | LoremIpsum1.txt 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/redirect_io3.txt: -------------------------------------------------------------------------------- 1 | THERE 2 | [4, 5, 6] 3 | -------------------------------------------------------------------------------- /doc/workflow/examples/example6.txt: -------------------------------------------------------------------------------- 1 | IGNORE z: {'a': 1, 'A': 2} 2 | -------------------------------------------------------------------------------- /doc/workflow/examples/example6a.txt: -------------------------------------------------------------------------------- 1 | IGNORE z: {'a': 1, 'A': 2} 2 | -------------------------------------------------------------------------------- /doc/workflow/examples/example7.txt: -------------------------------------------------------------------------------- 1 | list: 2 | - 'bar' 3 | - 'foo' 4 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/__init__.py: -------------------------------------------------------------------------------- 1 | """Loading tests""" 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/archive_directory/.junk: -------------------------------------------------------------------------------- 1 | junk 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/fileC.txt: -------------------------------------------------------------------------------- 1 | this is fileC 2 | 3 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/win_archive_directory/.junk: -------------------------------------------------------------------------------- 1 | junk -------------------------------------------------------------------------------- /pyutilib/misc/tests/filecmp6.txt: -------------------------------------------------------------------------------- 1 | this 1e-2 2 | is 3 | a 4 | test 5 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/filecmp7.txt: -------------------------------------------------------------------------------- 1 | this 0.01 2 | is 3 | a 4 | test 5 | -------------------------------------------------------------------------------- /pyutilib/workflow/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # pyutilib.workflow tests 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/filecmp8.txt: -------------------------------------------------------------------------------- 1 | this 0.009 2 | is 3 | a 4 | test 5 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/jsondata3.jsn: -------------------------------------------------------------------------------- 1 | [ 2 | "a", 3 | "b", 4 | "c" 5 | ] 6 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/yamldata3.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - a 3 | - b 4 | - c 5 | ... 6 | -------------------------------------------------------------------------------- /doc/workflow/examples/example6.log: -------------------------------------------------------------------------------- 1 | Options: 2 | z = {'a': 1, 'A': 2} 3 | -------------------------------------------------------------------------------- /pyutilib/component/app/tests/__init__.py: -------------------------------------------------------------------------------- 1 | """Test plugin applications""" 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Unit tests for pyutilib 3 | """ 4 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/archive_directory/directory/.junk: -------------------------------------------------------------------------------- 1 | junk 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/archive_flat/fileA.txt: -------------------------------------------------------------------------------- 1 | this is fileA 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/archive_flat/fileB.txt: -------------------------------------------------------------------------------- 1 | this is fileB 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/win_archive_directory/directory/.junk: -------------------------------------------------------------------------------- 1 | junk -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/win_archive_flat/fileA.txt: -------------------------------------------------------------------------------- 1 | this is fileA 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/filecmp10.txt: -------------------------------------------------------------------------------- 1 | this (0.01, 2) 2 | is 3 | a 4 | test 5 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/filecmp11.txt: -------------------------------------------------------------------------------- 1 | this (1e-2, 2) 2 | is 3 | a 4 | test 5 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/import_data/a/tfile.py: -------------------------------------------------------------------------------- 1 | def f(): 2 | return 'a' 3 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/import_data/b/tfile.py: -------------------------------------------------------------------------------- 1 | def f(): 2 | return 'b' 3 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/import_main_exception.txt: -------------------------------------------------------------------------------- 1 | import_main_exception - main 2 | -------------------------------------------------------------------------------- /doc/workflow/examples/example9b.txt: -------------------------------------------------------------------------------- 1 | Branch a 2 | z: 101 3 | Branch b 4 | z: 98 5 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg1/package1/__init__.py: -------------------------------------------------------------------------------- 1 | """Package1""" 2 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg2/package2/__init__.py: -------------------------------------------------------------------------------- 1 | """Package1""" 2 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg3/package3/__init__.py: -------------------------------------------------------------------------------- 1 | """Package1""" 2 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg4/package4/__init__.py: -------------------------------------------------------------------------------- 1 | """Package4""" 2 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg5/package5/__init__.py: -------------------------------------------------------------------------------- 1 | """Package5""" 2 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg6/package6/__init__.py: -------------------------------------------------------------------------------- 1 | """Package6""" 2 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg7/package7/__init__.py: -------------------------------------------------------------------------------- 1 | """Package7""" 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/win_archive_flat/fileB.txt: -------------------------------------------------------------------------------- 1 | this is fileB 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/import_data/tfile1.0.py: -------------------------------------------------------------------------------- 1 | def f(): 2 | return 'tfile1.0' 3 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/xmldata3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/filecmp1.txt: -------------------------------------------------------------------------------- 1 | this 2 | is 3 | a 4 | test 5 | a 6 | a 7 | a 8 | a 9 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/test1.cfg: -------------------------------------------------------------------------------- 1 | [globals] 2 | help=will be ignored 3 | files=test2.cfg 4 | -------------------------------------------------------------------------------- /doc/plugin/pca.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/doc/plugin/pca.pdf -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/archive_directory/directory/fileA.txt: -------------------------------------------------------------------------------- 1 | this is fileA 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/archive_directory/directory/fileB.txt: -------------------------------------------------------------------------------- 1 | this is fileB 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/win_archive_directory/directory/fileA.txt: -------------------------------------------------------------------------------- 1 | this is fileA 2 | -------------------------------------------------------------------------------- /doc/workflow/SAND.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/doc/workflow/SAND.pdf -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/win_archive_directory/directory/fileB.txt: -------------------------------------------------------------------------------- 1 | this is fileB 2 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/filecmp2.txt: -------------------------------------------------------------------------------- 1 | this 2 | is 3 | a 4 | test 5 | a 6 | a 7 | a 8 | a 9 | -------------------------------------------------------------------------------- /doc/plugin/DOEbwlogo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/doc/plugin/DOEbwlogo.pdf -------------------------------------------------------------------------------- /doc/plugin/snllineblk.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/doc/plugin/snllineblk.pdf -------------------------------------------------------------------------------- /doc/workflow/workflow.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/doc/workflow/workflow.pdf -------------------------------------------------------------------------------- /pyutilib/misc/tests/test.xml: -------------------------------------------------------------------------------- 1 | 2 | a b c 3 | 4 | HERE 5 | 6 | d e f 7 | 8 | -------------------------------------------------------------------------------- /pyutilib/workflow/tests/test2.txt: -------------------------------------------------------------------------------- 1 | {"a": 1, "aa": "here is more", "c": {"y": 2, "x": 1}, "b": [1, 2]} -------------------------------------------------------------------------------- /doc/workflow/DOEbwlogo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/doc/workflow/DOEbwlogo.pdf -------------------------------------------------------------------------------- /doc/workflow/examples/driver_3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @code: 4 | python driver2.py --help 5 | # @:code 6 | -------------------------------------------------------------------------------- /doc/workflow/snllineblk.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/doc/workflow/snllineblk.pdf -------------------------------------------------------------------------------- /pyutilib/misc/tests/import_exception.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | raise RuntimeError("raised during import") 4 | -------------------------------------------------------------------------------- /pyutilib/th/tests/file1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/th/tests/file1.zip -------------------------------------------------------------------------------- /pyutilib/th/tests/file2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/th/tests/file2.zip -------------------------------------------------------------------------------- /pyutilib/th/tests/file3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/th/tests/file3.zip -------------------------------------------------------------------------------- /doc/workflow/examples/driver_2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @code: 4 | python driver2.py TaskZ --help 5 | # @:code 6 | -------------------------------------------------------------------------------- /pyutilib/th/tests/file1.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/th/tests/file1.txt.gz -------------------------------------------------------------------------------- /pyutilib/th/tests/file2.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/th/tests/file2.txt.gz -------------------------------------------------------------------------------- /pyutilib/workflow/tests/test1.txt: -------------------------------------------------------------------------------- 1 | a: 1 2 | aa: here is more 3 | b: [1, 2] 4 | c: 5 | x: 1 6 | y: 2 7 | -------------------------------------------------------------------------------- /doc/workflow/examples/driver_1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @code: 4 | python driver1.py TaskZ --x=3 --y=4 5 | # @:code 6 | -------------------------------------------------------------------------------- /doc/plugin/figures/definitions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/doc/plugin/figures/definitions.pdf -------------------------------------------------------------------------------- /doc/plugin/figures/pca-figures.ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/doc/plugin/figures/pca-figures.ppt -------------------------------------------------------------------------------- /pyutilib/autotest/tests/test4.txt: -------------------------------------------------------------------------------- 1 | 2 | Tests defined in test suite 'suite1': 3 | test_s1_p1 4 | test_s2_p1 5 | 6 | -------------------------------------------------------------------------------- /pyutilib/excel/tests/test_data.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/excel/tests/test_data.xls -------------------------------------------------------------------------------- /pyutilib/excel/tests/test_data.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/excel/tests/test_data.xlsx -------------------------------------------------------------------------------- /pyutilib/component/app/tests/log1.ini: -------------------------------------------------------------------------------- 1 | [logging] 2 | log_file = foo.log 3 | log_level = DEBUG 4 | log_type = file 5 | 6 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/jsondata2.jsn.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/misc/tests/jsondata2.jsn.gz -------------------------------------------------------------------------------- /pyutilib/misc/tests/yamldata14.yml.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/misc/tests/yamldata14.yml.gz -------------------------------------------------------------------------------- /pyutilib/component/config/tests/config2.ini: -------------------------------------------------------------------------------- 1 | # COMMENT 2 | [dummy] 3 | a = 1 4 | b = 'c' 5 | cc = 1,2,3 6 | [a.b] 7 | zz = 4.5 8 | -------------------------------------------------------------------------------- /pyutilib/component/config/tests/config3.ini: -------------------------------------------------------------------------------- 1 | # COMMENT 2 | [globals] 3 | a = 1 4 | b = 'c' 5 | cc = 1,2,3 6 | [a.b] 7 | zz = 4.5 8 | -------------------------------------------------------------------------------- /doc/workflow/figures/workflow-example2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/doc/workflow/figures/workflow-example2.pdf -------------------------------------------------------------------------------- /doc/workflow/figures/workflow-example3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/doc/workflow/figures/workflow-example3.pdf -------------------------------------------------------------------------------- /doc/workflow/figures/workflow-figures.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/doc/workflow/figures/workflow-figures.pptx -------------------------------------------------------------------------------- /doc/workflow/figures/workflow-overview.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/doc/workflow/figures/workflow-overview.pdf -------------------------------------------------------------------------------- /pyutilib/component/config/tests/config1.ini: -------------------------------------------------------------------------------- 1 | # COMMENT 2 | [globals] 3 | a = 1 4 | b = /dev/null 5 | c = 1,2,3 6 | [a.b] 7 | zz = 4.5 8 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/filecmp4.txt: -------------------------------------------------------------------------------- 1 | this 2 | is 3 | b 4 | test 5 | a 6 | a 7 | a 8 | a 9 | a 10 | a 11 | a 12 | a 13 | a 14 | -------------------------------------------------------------------------------- /pyutilib/autotest/tests/test2.txt: -------------------------------------------------------------------------------- 1 | 2 | Test suites defined in 'autotest': 3 | suite1 4 | suite1a 5 | suite2 6 | suite3 7 | 8 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/yamldata11.yml: -------------------------------------------------------------------------------- 1 | - a 2 | - 3 | - b 4 | - c 5 | - 6 | - d 7 | - e 8 | - f 9 | - g 10 | - h 11 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [report] 2 | omit = 3 | */python?.?/* 4 | */site-packages/nose/* 5 | *__init__* 6 | */setup.py 7 | */tests/* 8 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/fileC.txt.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/misc/tests/archivereader/fileC.txt.bz2 -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/fileC.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/misc/tests/archivereader/fileC.txt.gz -------------------------------------------------------------------------------- /pyutilib/misc/tests/yamldata1.yml: -------------------------------------------------------------------------------- 1 | --- 2 | a: 3 | b: 1 4 | c: 1.3 5 | d: 6 | e: the rain in spain 7 | f: is mostly on the plain 8 | ... 9 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/yamldata10.yml: -------------------------------------------------------------------------------- 1 | --- 2 | a: 3 | b: 1 4 | c: 1.4 5 | d: 6 | e: the rain in spain 7 | f: is mostly on the plain 8 | ... 9 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/yamldata9.yml: -------------------------------------------------------------------------------- 1 | --- 2 | a: 3 | b: 1 4 | c: 1.3 5 | x: 6 | e: the rain in spain 7 | f: is mostly on the plain 8 | ... 9 | -------------------------------------------------------------------------------- /pyutilib/component/config/tests/config4.ini: -------------------------------------------------------------------------------- 1 | # COMMENT 2 | [globals] 3 | a = XX 1 4 | b = /dev/null 5 | c = XX 1,2,3 6 | [globals:more] 7 | xx = 4.5 8 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/archive_flat.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/misc/tests/archivereader/archive_flat.tgz -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/archive_flat.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/misc/tests/archivereader/archive_flat.zip -------------------------------------------------------------------------------- /pyutilib/misc/tests/import1.py: -------------------------------------------------------------------------------- 1 | def a(): 2 | pass 3 | 4 | 5 | b = 2 6 | 7 | if __name__ == "__main__": 8 | print("import1 b=" + str(b)) 9 | -------------------------------------------------------------------------------- /doc/workflow/examples/example7a.txt: -------------------------------------------------------------------------------- 1 | Running... /bin/ls /home/coopr/src/python/src/pyutilib/doc/workflow/examples/dummy 2 | list: 3 | - 'bar' 4 | - 'foo' 5 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/yamldata6.yml: -------------------------------------------------------------------------------- 1 | --- 2 | a: 3 | - 1 4 | - 5 | c: ccc 6 | d: ddd 7 | e: eee 8 | - 1.3 9 | g: again 10 | ... 11 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/yamldata8.yml: -------------------------------------------------------------------------------- 1 | --- 2 | a: 3 | - 1 4 | - c: ccc 5 | d: ddd 6 | e: eee 7 | - 1.3 8 | - y 9 | g: again 10 | ... 11 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/archive_directory.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/misc/tests/archivereader/archive_directory.tgz -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/archive_directory.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/misc/tests/archivereader/archive_directory.zip -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/archive_flat.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/misc/tests/archivereader/archive_flat.tar.gz -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/win_archive_flat.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/misc/tests/archivereader/win_archive_flat.zip -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/plugins2/test4.py: -------------------------------------------------------------------------------- 1 | # 2 | # This generates a load error 3 | # 4 | 5 | 6 | class test4_foo(Plugin): 7 | 8 | abc = Option("x1") 9 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/yamldata12.yml: -------------------------------------------------------------------------------- 1 | - a 2 | - 3 | X: 4 | - b 5 | - 6 | - d 7 | - e 8 | - f 9 | - g 10 | Y: FOO 11 | - h 12 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/yamldata5.yml: -------------------------------------------------------------------------------- 1 | --- 2 | a: 3 | - b 4 | - 1 5 | - 6 | c: ccc 7 | d: ddd 8 | e: eee 9 | - 1.3 10 | g: again 11 | ... 12 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package1-0.1-py2.6.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package1-0.1-py2.6.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package1-0.1-py2.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package1-0.1-py2.7.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package1-0.1-py3.2.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package1-0.1-py3.2.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package1-0.1-py3.3.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package1-0.1-py3.3.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package1-0.1-py3.4.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package1-0.1-py3.4.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package1-0.1-py3.5.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package1-0.1-py3.5.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package1-0.1-py3.6.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package1-0.1-py3.6.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package1-0.1-py3.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package1-0.1-py3.7.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package1-0.1-py3.8.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package1-0.1-py3.8.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package2-0.1-py2.6.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package2-0.1-py2.6.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package2-0.1-py2.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package2-0.1-py2.7.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package2-0.1-py3.2.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package2-0.1-py3.2.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package2-0.1-py3.3.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package2-0.1-py3.3.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package2-0.1-py3.4.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package2-0.1-py3.4.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package2-0.1-py3.5.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package2-0.1-py3.5.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package2-0.1-py3.6.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package2-0.1-py3.6.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package2-0.1-py3.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package2-0.1-py3.7.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs1/Package2-0.1-py3.8.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs1/Package2-0.1-py3.8.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package3-0.1-py2.6.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package3-0.1-py2.6.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package3-0.1-py2.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package3-0.1-py2.7.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package3-0.1-py3.2.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package3-0.1-py3.2.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package3-0.1-py3.3.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package3-0.1-py3.3.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package3-0.1-py3.4.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package3-0.1-py3.4.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package3-0.1-py3.5.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package3-0.1-py3.5.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package3-0.1-py3.6.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package3-0.1-py3.6.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package3-0.1-py3.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package3-0.1-py3.7.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package3-0.1-py3.8.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package3-0.1-py3.8.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package4-0.1-py2.6.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package4-0.1-py2.6.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package4-0.1-py2.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package4-0.1-py2.7.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package4-0.1-py3.2.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package4-0.1-py3.2.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package4-0.1-py3.3.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package4-0.1-py3.3.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package4-0.1-py3.4.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package4-0.1-py3.4.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package4-0.1-py3.5.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package4-0.1-py3.5.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package4-0.1-py3.6.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package4-0.1-py3.6.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package4-0.1-py3.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package4-0.1-py3.7.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package4-0.1-py3.8.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package4-0.1-py3.8.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package5-0.1-py2.6.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package5-0.1-py2.6.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package5-0.1-py2.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package5-0.1-py2.7.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package5-0.1-py3.2.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package5-0.1-py3.2.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package5-0.1-py3.3.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package5-0.1-py3.3.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package5-0.1-py3.4.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package5-0.1-py3.4.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package5-0.1-py3.5.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package5-0.1-py3.5.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package5-0.1-py3.6.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package5-0.1-py3.6.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package5-0.1-py3.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package5-0.1-py3.7.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package5-0.1-py3.8.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package5-0.1-py3.8.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package6-0.1-py2.6.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package6-0.1-py2.6.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package6-0.1-py2.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package6-0.1-py2.7.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package6-0.1-py3.2.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package6-0.1-py3.2.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package6-0.1-py3.3.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package6-0.1-py3.3.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package6-0.1-py3.4.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package6-0.1-py3.4.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package6-0.1-py3.5.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package6-0.1-py3.5.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package6-0.1-py3.6.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package6-0.1-py3.6.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package6-0.1-py3.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package6-0.1-py3.7.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package6-0.1-py3.8.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package6-0.1-py3.8.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package7-0.1-py2.6.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package7-0.1-py2.6.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package7-0.1-py2.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package7-0.1-py2.7.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package7-0.1-py3.2.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package7-0.1-py3.2.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package7-0.1-py3.3.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package7-0.1-py3.3.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package7-0.1-py3.4.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package7-0.1-py3.4.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package7-0.1-py3.5.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package7-0.1-py3.5.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package7-0.1-py3.6.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package7-0.1-py3.6.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package7-0.1-py3.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package7-0.1-py3.7.egg -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggs2/Package7-0.1-py3.8.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/component/loader/tests/eggs2/Package7-0.1-py3.8.egg -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/archive_directory.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/misc/tests/archivereader/archive_directory.tar.gz -------------------------------------------------------------------------------- /pyutilib/misc/tests/archivereader/win_archive_directory.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PyUtilib/pyutilib/HEAD/pyutilib/misc/tests/archivereader/win_archive_directory.zip -------------------------------------------------------------------------------- /pyutilib/misc/tests/yamldata2.yml: -------------------------------------------------------------------------------- 1 | --- 2 | a: 3 | b: 1 4 | c: 1.3 5 | d: 6 | e: the rain in spain 7 | f: is mostly on the plain 8 | g: again 9 | ... 10 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/yamldata4.txt: -------------------------------------------------------------------------------- 1 | BEGIN 2 | a: 3 | b: 1 4 | c: 1.3 5 | d: 6 | e: the rain in spain 7 | f: is mostly on the plain 8 | g: again 9 | END 10 | -------------------------------------------------------------------------------- /pyutilib/autotest/tests/test3.txt: -------------------------------------------------------------------------------- 1 | 2 | Test suite categories defined in 'autotest': 3 | x_nightly 4 | x_smoke 5 | x_suite1 6 | x_suite2 7 | x_suite3 8 | 9 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/yamldata7.yml: -------------------------------------------------------------------------------- 1 | --- 2 | a: 3 | - 1 4 | - 5 | c: ccc 6 | d: ddd 7 | e: eee 8 | - 1.3 9 | - x 10 | - y 11 | g: again 12 | ... 13 | -------------------------------------------------------------------------------- /doc/workflow/examples/driver_2.txt: -------------------------------------------------------------------------------- 1 | usage: myprog TaskZ [-h] [--x X] [--y Y] 2 | 3 | optional arguments: 4 | -h, --help show this help message and exit 5 | --x X 6 | --y Y 7 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/import_main_exception.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | if __name__ == "__main__": 4 | print("import_main_exception - main") 5 | raise RuntimeError("raised from __main__") 6 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/jsondata6.jsn: -------------------------------------------------------------------------------- 1 | { 2 | "a": 3 | [ 4 | 1, 5 | { 6 | "c": "ccc", 7 | "d": "ddd", 8 | "e": "eee" 9 | }, 10 | 1.3 11 | ], 12 | "g": "again" 13 | } 14 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/jsondata5.jsn: -------------------------------------------------------------------------------- 1 | { 2 | "a": 3 | [ 4 | "b", 5 | 1, 6 | { 7 | "c": "ccc", 8 | "d": "ddd", 9 | "e": "eee" 10 | }, 11 | 1.3 12 | ], 13 | "g": "again" 14 | } 15 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/plugins1/test1.py: -------------------------------------------------------------------------------- 1 | from pyutilib.component.core import * 2 | from pyutilib.component.config import * 3 | 4 | 5 | class test1_foo(Plugin): 6 | 7 | bar = Option("bar") 8 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/jsondata1.jsn: -------------------------------------------------------------------------------- 1 | { 2 | "a": 3 | { 4 | "b": 1, 5 | "c": 1.3 6 | }, 7 | "d": 8 | { 9 | "e": "the rain in spain", 10 | "f": "is mostly on the plain" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/jsondata10.jsn: -------------------------------------------------------------------------------- 1 | { 2 | "a": 3 | { 4 | "b": 1, 5 | "c": 1.4 6 | }, 7 | "d": 8 | { 9 | "e": "the rain in spain", 10 | "f": "is mostly on the plain" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/jsondata9.jsn: -------------------------------------------------------------------------------- 1 | { 2 | "a": 3 | { 4 | "b": 1, 5 | "c": 1.3 6 | }, 7 | "x": 8 | { 9 | "e": "the rain in spain", 10 | "f": "is mostly on the plain" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/jsondata8.jsn: -------------------------------------------------------------------------------- 1 | { 2 | "a": 3 | [ 4 | 1, 5 | { 6 | "c": "ccc", 7 | "d": "ddd", 8 | "e": "eee" 9 | }, 10 | 1.3, 11 | "y" 12 | ], 13 | "g": "again" 14 | } 15 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/plugins2/test2.py: -------------------------------------------------------------------------------- 1 | from pyutilib.component.core import * 2 | from pyutilib.component.config import * 3 | 4 | 5 | class test2_foo(SingletonPlugin): 6 | 7 | abc = Option("abc") 8 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/jsondata7.jsn: -------------------------------------------------------------------------------- 1 | { 2 | "a": 3 | [ 4 | 1, 5 | { 6 | "c": "ccc", 7 | "d": "ddd", 8 | "e": "eee" 9 | }, 10 | 1.3, 11 | "x", 12 | "y" 13 | ], 14 | "g": "again" 15 | } 16 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/xmldata1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | the rain in spain 8 | is mostly on the plain 9 | 10 | 11 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/xmldata10.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | the rain in spain 8 | is mostly on the plain 9 | 10 | 11 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/xmldata9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | the rain in spain 8 | is mostly on the plain 9 | 10 | 11 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/jsondata2.jsn: -------------------------------------------------------------------------------- 1 | { 2 | "a": 3 | { 4 | "b": 1, 5 | "c": 1.3 6 | }, 7 | "d": 8 | { 9 | "e": "the rain in spain", 10 | "f": "is mostly on the plain" 11 | }, 12 | "g": "again" 13 | } 14 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/xmldata11.xml: -------------------------------------------------------------------------------- 1 | 2 | <_>a 3 | <_> 4 | <_>b 5 | <_>c 6 | <_> 7 | <_>d 8 | <_>e 9 | 10 | <_>f 11 | <_>g 12 | 13 | <_>h 14 | 15 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/xmldata6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | <_>1 4 | <_> 5 | ccc 6 | ddd 7 | eee 8 | 9 | <_>1.3 10 | 11 | again 12 | 13 | -------------------------------------------------------------------------------- /doc/workflow/examples/driver1.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | import tasks_yz 3 | 4 | driver = pyutilib.workflow.TaskDriver() 5 | driver.register_task('TaskZ') 6 | driver.register_task('TaskY') 7 | 8 | print(driver.parse_args()) 9 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/xmldata2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | the rain in spain 8 | is mostly on the plain 9 | 10 | again 11 | 12 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/jsondata4.txt: -------------------------------------------------------------------------------- 1 | BEGIN 2 | { 3 | "a": 4 | { 5 | "b": 1, 6 | "c": 1.3 7 | }, 8 | "d": 9 | { 10 | "e": "the rain in spain", 11 | "f": "is mostly on the plain" 12 | }, 13 | "g": "again" 14 | } 15 | END 16 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/xmldata5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | <_>b 4 | <_>1 5 | <_> 6 | ccc 7 | ddd 8 | eee 9 | 10 | <_>1.3 11 | 12 | again 13 | 14 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/xmldata8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | <_>1 4 | <_> 5 | ccc 6 | ddd 7 | eee 8 | 9 | <_>1.3 10 | <_>y 11 | 12 | again 13 | 14 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/format_io.txt: -------------------------------------------------------------------------------- 1 | 0.0 2 | 0 3 | 0.1 4 | 10.0 5 | 1e-9 6 | 1000000000.0 7 | 1e-99 8 | 1e+99 9 | 1e-100 10 | 1e+100 11 | -0.1 12 | -10.0 13 | -1e-9 14 | -1000000000.0 15 | -1e-99 16 | -1e+99 17 | -1e-100 18 | -1e+100 19 | string 20 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/xmldata4.txt: -------------------------------------------------------------------------------- 1 | BEGIN 2 | 3 | 4 | 5 | 6 | 7 | 8 | the rain in spain 9 | is mostly on the plain 10 | 11 | again 12 | 13 | END 14 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/xmldata7.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | <_>1 4 | <_> 5 | ccc 6 | ddd 7 | eee 8 | 9 | <_>1.3 10 | <_>x 11 | <_>y 12 | 13 | again 14 | 15 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/xmldata12.xml: -------------------------------------------------------------------------------- 1 | 2 | <_>a 3 | <_> 4 | 5 | <_>b 6 | <_> 7 | <_>d 8 | <_>e 9 | 10 | <_>f 11 | <_>g 12 | 13 | FOO 14 | 15 | <_>h 16 | 17 | -------------------------------------------------------------------------------- /examples/pyro/factor_srvr: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import factor 4 | import pyutilib.pyro 5 | import sys 6 | 7 | if len(sys.argv) == 2: 8 | host=sys.argv[1] 9 | else: 10 | host=None 11 | pyutilib.pyro.TaskWorkerServer(factor.FactorWorker, host=host) 12 | 13 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg2/package2/main.py: -------------------------------------------------------------------------------- 1 | from pyutilib.component.core import * 2 | 3 | 4 | class IPackage2Util(Interface): 5 | """Interface for Package2 utilities""" 6 | 7 | 8 | class Package2Util(Plugin): 9 | 10 | implements(IPackage1Util) 11 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/import2.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | 4 | def a(): 5 | pass 6 | 7 | 8 | def foo(): 9 | b = "" + [] 10 | 11 | 12 | if __name__ == "__main__": 13 | print("import2") 14 | sys.stdout.flush() 15 | foo() 16 | print("import1 b=" + str(b)) 17 | -------------------------------------------------------------------------------- /examples/autotest/README.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory contains a working pyutilib.autotest example that will 3 | execute on Linux platforms. 4 | 5 | example.yml - The YAML test configuration 6 | example.py - The test driver plugin 7 | autotest.py - The Python module that executes tests 8 | 9 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg1/package1/main.py: -------------------------------------------------------------------------------- 1 | from pyutilib.component.core import * 2 | 3 | 4 | class IPackage1Util(Interface): 5 | """Interface for Package1 utilities""" 6 | 7 | 8 | class Package1Util(SingletonPlugin): 9 | 10 | implements(IPackage1Util) 11 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg4/package4/main.py: -------------------------------------------------------------------------------- 1 | from pyutilib.component.core import * 2 | 3 | 4 | class IPackage4Util(Interface): 5 | """Interface for Package4 utilities""" 6 | 7 | 8 | class Package4Util(SingletonPlugin): 9 | 10 | implements(IPackage4Util) 11 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg5/package5/main.py: -------------------------------------------------------------------------------- 1 | from pyutilib.component.core import * 2 | 3 | 4 | class IPackage5Util(Interface): 5 | """Interface for Package5 utilities""" 6 | 7 | 8 | class Package5Util(SingletonPlugin): 9 | 10 | implements(IPackage5Util) 11 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg6/package6/main.py: -------------------------------------------------------------------------------- 1 | from pyutilib.component.core import * 2 | 3 | 4 | class IPackage6Util(Interface): 5 | """Interface for Package6 utilities""" 6 | 7 | 8 | class Package6Util(SingletonPlugin): 9 | 10 | implements(IPackage6Util) 11 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg7/package7/main.py: -------------------------------------------------------------------------------- 1 | from pyutilib.component.core import * 2 | 3 | 4 | class IPackage7Util(Interface): 5 | """Interface for Package7 utilities""" 6 | 7 | 8 | class Package7Util(SingletonPlugin): 9 | 10 | implements(IPackage7Util) 11 | -------------------------------------------------------------------------------- /pyutilib/component/config/tests/log2.txt: -------------------------------------------------------------------------------- 1 | [Services] Configuration_ConfigParser = True 2 | [Services] ImportLoader = True 3 | [Services] TempfileManager = True 4 | [globals] a = XX 1 5 | [globals] b = /dev/null 6 | [globals] c = XX 1,2,3 7 | [globals] xx = 4.5 8 | [globals] yy = foo 9 | 10 | -------------------------------------------------------------------------------- /AUTHORS.txt: -------------------------------------------------------------------------------- 1 | 2 | The GitHub contributors page provides a list of developers who have 3 | contributed to this repository. 4 | 5 | The following were the main developers who contributed to the 6 | original subversion repository: 7 | . William Hart 8 | . John Siirola 9 | . Gabe Hackabiel 10 | 11 | -------------------------------------------------------------------------------- /examples/autotest/test_suite1_cat_p1.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory contains a working pyutilib.autotest example that will 3 | execute on Linux platforms. 4 | 5 | example.yml - The YAML test configuration 6 | example.py - The test driver plugin 7 | autotest.py - The Python module that executes tests 8 | 9 | -------------------------------------------------------------------------------- /examples/autotest/test_suite2_cat_p1.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory contains a working pyutilib.autotest example that will 3 | execute on Linux platforms. 4 | 5 | example.yml - The YAML test configuration 6 | example.py - The test driver plugin 7 | autotest.py - The Python module that executes tests 8 | 9 | -------------------------------------------------------------------------------- /examples/autotest/test_suite3_cat_p1.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory contains a working pyutilib.autotest example that will 3 | execute on Linux platforms. 4 | 5 | example.yml - The YAML test configuration 6 | example.py - The test driver plugin 7 | autotest.py - The Python module that executes tests 8 | 9 | -------------------------------------------------------------------------------- /pyutilib/component/app/tests/app1b.py: -------------------------------------------------------------------------------- 1 | import pyutilib.component.app 2 | import os 3 | import sys 4 | 5 | currdir = sys.argv[-1] + os.sep 6 | 7 | app = pyutilib.component.app.SimpleApplication("foo") 8 | app.config.load(currdir + "config1.txt") 9 | app.config.save(currdir + "config1.out") 10 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/plugins2/test3.py: -------------------------------------------------------------------------------- 1 | # 2 | # This generates a load error 3 | # 4 | from pyutilib.component.core import Plugin 5 | from pyutilib.component.config import Option 6 | 7 | 8 | class test3_foo(Plugin): 9 | 10 | abc = Option("ABC") 11 | 12 | 13 | inst = test3_foo() 14 | -------------------------------------------------------------------------------- /pyutilib/component/app/tests/app1a.py: -------------------------------------------------------------------------------- 1 | import pyutilib.component.app 2 | import os 3 | import sys 4 | 5 | currdir = sys.argv[-1] + os.sep 6 | 7 | app = pyutilib.component.app.SimpleApplication("foo") 8 | app._env_config.options.path = "DEFAULT PATH HERE" 9 | app.config.save(currdir + "config1.out") 10 | -------------------------------------------------------------------------------- /examples/pyro/README.txt: -------------------------------------------------------------------------------- 1 | To execute this example, do the following in four separate processes: 2 | 3 | P1) pyro-ns 4 | 5 | P2) dispatch_srvr 6 | 7 | P3) factor_srvr 8 | 9 | P4) factorize 10 | 11 | NOTE: These examples assume that Pyro is installed on your machine. 12 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg3/package3/main.py: -------------------------------------------------------------------------------- 1 | from pyutilib.component.core import * 2 | 3 | 4 | class IPackage3Util(Interface): 5 | """Interface for Package3 utilities""" 6 | 7 | 8 | class Package3Util(Plugin): 9 | 10 | implements(IPackage3Util) 11 | 12 | 13 | inst1 = Package3Util() 14 | inst2 = Package3Util() 15 | -------------------------------------------------------------------------------- /examples/autotest/test_suite1_cat2_p1.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 This directory contains a working pyutilib.autotest example that will 3 | 3 execute on Linux platforms. 4 | 4 5 | 5 example.yml - The YAML test configuration 6 | 6 example.py - The test driver plugin 7 | 7 autotest.py - The Python module that executes tests 8 | 8 9 | -------------------------------------------------------------------------------- /examples/autotest/test_suite3_catx_p1.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 This directory contains a working pyutilib.autotest example that will 3 | 3 execute on Linux platforms. 4 | 4 5 | 5 example.yml - The YAML test configuration 6 | 6 example.py - The test driver plugin 7 | 7 autotest.py - The Python module that executes tests 8 | 8 9 | -------------------------------------------------------------------------------- /pyutilib/component/app/tests/app2.py: -------------------------------------------------------------------------------- 1 | import pyutilib.component.app 2 | import pyutilib.misc 3 | import os 4 | import sys 5 | 6 | currdir = sys.argv[-1] + os.sep 7 | 8 | app = pyutilib.component.app.SimpleApplication("foo") 9 | pyutilib.misc.setup_redirect(currdir + "summary.out") 10 | app.config.summarize() 11 | pyutilib.misc.reset_redirect() 12 | -------------------------------------------------------------------------------- /doc/plugin/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Create The Following Documents: 3 | # 4 | # . An Overview of the PyUtilib Component Architecture 5 | # pca.tex 6 | # 7 | 8 | all: pca 9 | 10 | pca: 11 | pdflatex pca 12 | bibtex pca 13 | pdflatex pca 14 | pdflatex pca 15 | 16 | sand: 17 | pdflatex SAND 18 | bibtex SAND 19 | pdflatex SAND 20 | pdflatex SAND 21 | 22 | -------------------------------------------------------------------------------- /pyutilib/misc/generator.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2009, All Rights Reserved 3 | # David Beazley 4 | # Permission granted to distribute with PyUtilib under the BSD license 5 | # 6 | 7 | 8 | def coroutine(func): 9 | 10 | def start(*args, **kwargs): 11 | cr = func(*args, **kwargs) 12 | #print 'y',cr.send(None) 13 | return cr 14 | 15 | return start 16 | -------------------------------------------------------------------------------- /doc/workflow/examples/example_driver1.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | import pyutilib.component.core 3 | 4 | # @usage: 5 | import tasks_yz 6 | 7 | driver = pyutilib.workflow.TaskDriver() 8 | driver.register_task('TaskZ') 9 | driver.register_task('TaskY') 10 | 11 | print(driver.parse_args(['TaskZ','--x=3','--y=4'])) 12 | print(driver.parse_args(['TaskY','--X=3','--Y=4'])) 13 | # @:usage 14 | -------------------------------------------------------------------------------- /pyutilib/component/app/tests/app4.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import pyutilib.component.app 4 | 5 | currdir = sys.argv[-1] + os.sep 6 | 7 | app = pyutilib.component.app.SimpleApplication("foo") 8 | app.config.load(currdir + "log1.ini") 9 | #print type(app.logger.log_dir) 10 | app.logger.log_dir = currdir 11 | #print type(app.logger.log_dir) 12 | app.config.save(currdir + "tmp2.ini") 13 | -------------------------------------------------------------------------------- /pyutilib/component/config/tests/config1.txt: -------------------------------------------------------------------------------- 1 | ; 2 | ; Note: the following configuration options have been omitted because their 3 | ; value is 'None': 4 | ; section='globals' option='tempdir' 5 | ; 6 | ; 7 | [Services] 8 | Configuration_ConfigParser = True 9 | ImportLoader = True 10 | TempfileManager = True 11 | 12 | [a.b] 13 | zz = 4.5 14 | 15 | [globals] 16 | a = 1 17 | b = /dev/null 18 | c = 1,2,3 19 | yy = foo 20 | 21 | -------------------------------------------------------------------------------- /pyutilib/component/app/tests/app3.py: -------------------------------------------------------------------------------- 1 | import pyutilib.component.app 2 | import os 3 | import sys 4 | 5 | currdir = sys.argv[-1] + os.sep 6 | 7 | app = pyutilib.component.app.SimpleApplication("foo") 8 | app.config.load(currdir + "log1.ini") 9 | app.logger.log_dir = currdir 10 | app.logger.log_file = "app3.log" 11 | app.logger.reset_after_updates() 12 | app.env.load_services() 13 | app.log("test_app3 message") 14 | app.flush() 15 | -------------------------------------------------------------------------------- /pyutilib/subprocess/tests/tee_script.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import time 3 | # Write ERR first so that the output is deterministic 4 | sys.stderr.write("Tee Script: ERR\n") 5 | sys.stdout.write("Tee Script: OUT\n") 6 | # sleep just enough so that the STDERR thread should finish flushing its 7 | # buffer before the process terminates (at which point the order in 8 | # which the buffers are flushed is somewhat random). 9 | time.sleep(0.5) 10 | -------------------------------------------------------------------------------- /pyutilib/component/config/tests/config4.txt: -------------------------------------------------------------------------------- 1 | ; 2 | ; Note: the following configuration options have been omitted because their 3 | ; value is 'None': 4 | ; section='a.b' option='zz' 5 | ; section='globals' option='tempdir' 6 | ; 7 | ; 8 | [Services] 9 | Configuration_ConfigParser = True 10 | ImportLoader = True 11 | TempfileManager = True 12 | 13 | [globals] 14 | a = XX 1 15 | b = /dev/null 16 | c = XX 1,2,3 17 | xx = 4.5 18 | yy = foo 19 | 20 | -------------------------------------------------------------------------------- /pyutilib/workflow/file.py: -------------------------------------------------------------------------------- 1 | __all__ = ['FileResource'] 2 | 3 | import os.path 4 | from pyutilib.workflow import resource 5 | 6 | 7 | class FileResource(resource.Resource): 8 | 9 | def __init__(self, name=None): 10 | resource.Resource.__init__(self) 11 | self.filename = name 12 | if name is None: 13 | self.name = "File" + self.id 14 | else: 15 | self.name = "File_" + os.path.basename(name) 16 | -------------------------------------------------------------------------------- /doc/workflow/acknow.tex: -------------------------------------------------------------------------------- 1 | We are grateful to John Siirola for discussing the design of 2 | multi-task connectors, which strongly influenced the design currently 3 | employed in \code{pyutilib.workflow}. Sandia National Laboratories 4 | is a multi-program laboratory operated by Sandia Corporation, a 5 | wholly owned subsidiary of Lockheed Martin company, for the U.S. 6 | Department of Energy's National Nuclear Security Administration 7 | under contract DE-AC04-94AL85000. 8 | -------------------------------------------------------------------------------- /doc/workflow/macros.tex: -------------------------------------------------------------------------------- 1 | \newcommand{\HLine}{$\mbox{ }$\hrulefill$\mbox{ }$} 2 | 3 | \newtheorem{Rem}{Remark} 4 | 5 | \def\Argmax{\mathop{\rm argmax}} 6 | \def\Argmin{\mathop{\rm argmin}} 7 | 8 | \def\Abs{\mathop{\rm abs}} 9 | \newcommand{\Gets}{:=} 10 | 11 | \newcommand\eg{e.g.\ } 12 | \newcommand\ie{i.e.\ } 13 | 14 | \newcommand{\code}[1]{\textmd{\texttt{#1}}} 15 | 16 | \def\pw{PW} 17 | \def\pwsp{PW\ } 18 | 19 | \newcommand{\todo}[1]{\textbf{\textit{TODO: #1}}} 20 | -------------------------------------------------------------------------------- /pyutilib/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | -------------------------------------------------------------------------------- /pyutilib/excel/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | -------------------------------------------------------------------------------- /pyutilib/component/core/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | -------------------------------------------------------------------------------- /pyutilib/dev/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | -------------------------------------------------------------------------------- /doc/release_notes.txt: -------------------------------------------------------------------------------- 1 | Pull latest updates 2 | git pull 3 | 4 | Update the CHANGELOG.txt file 5 | vi CHANGELOG.txt 6 | 7 | Update the version in setup.py 8 | vi setup.py 9 | 10 | Commit and push these revisions 11 | git commit . 12 | git push 13 | 14 | Tag the release 15 | git tag -a '5.6.3' -m 'Tagging PyUtilib 5.6.3' 16 | 17 | Push the tag 18 | git push --tags 19 | 20 | Upload to PyPI 21 | lpython setup.py register sdist --format=gztar bdist_wheel --universal upload 22 | -------------------------------------------------------------------------------- /pyutilib/component/config/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | -------------------------------------------------------------------------------- /pyutilib/math/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | -------------------------------------------------------------------------------- /pyutilib/subprocess/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | -------------------------------------------------------------------------------- /doc/workflow/examples/driver_3.txt: -------------------------------------------------------------------------------- 1 | usage: myprog [-h] {TaskY,TaskZ} ... 2 | 3 | This is the description of this task driver 4 | 5 | positional arguments: 6 | {TaskY,TaskZ} Sub-commands 7 | TaskZ 8 | TaskY 9 | 10 | optional arguments: 11 | -h, --help show this help message and exit 12 | 13 | ********************** 14 | This is more text 15 | that describes this command driver. Note 16 | 17 | that the format of the epilog string is preserved in the 18 | help 19 | output! 20 | ********************** 21 | -------------------------------------------------------------------------------- /doc/workflow/abstract.tex: -------------------------------------------------------------------------------- 1 | We describe the capabilities of the \code{pyutilib.workflow} software package. 2 | This package provides Python classes that provide an intuitive interface 3 | for defining and executing scientific workflows. Further, \code{pyutilib.workflow} 4 | is a native Python package, so it can be used to define workflows within 5 | Python software applications. Additionally, \code{pyutilib.workflow} includes a utility 6 | for creating a command-line driver that execute workflows as subcommands of a command-line script. 7 | -------------------------------------------------------------------------------- /doc/plugin/macros.tex: -------------------------------------------------------------------------------- 1 | \newcommand{\HLine}{$\mbox{ }$\hrulefill$\mbox{ }$} 2 | 3 | \newtheorem{Rem}{Remark} 4 | 5 | \def\Argmax{\mathop{\rm argmax}} 6 | \def\Argmin{\mathop{\rm argmin}} 7 | 8 | \def\Abs{\mathop{\rm abs}} 9 | \newcommand{\Gets}{:=} 10 | 11 | \newcommand\eg{e.g.\ } 12 | \newcommand\ie{i.e.\ } 13 | 14 | \newcommand{\code}[1]{\textmd{\texttt{#1}}} 15 | 16 | \if 0 17 | \lstinputlisting{source_filename.py} 18 | \fi 19 | 20 | \def\pca{PCA} 21 | \def\pcasp{PCA\ } 22 | \newcommand{\todo}[1]{\textbf{\textit{TODO: #1}}} 23 | -------------------------------------------------------------------------------- /doc/workflow/examples/driver2.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | import tasks_yz 3 | 4 | driver = pyutilib.workflow.TaskDriver(prog='myprog', 5 | description='This is the description of this task driver', 6 | epilog="""********************** 7 | This is more text 8 | that describes this command driver. Note 9 | 10 | that the format of the epilog string is preserved in the 11 | help 12 | output! 13 | ********************** 14 | """) 15 | driver.register_task('TaskZ') 16 | driver.register_task('TaskY') 17 | 18 | print(driver.parse_args()) 19 | -------------------------------------------------------------------------------- /pyutilib/autotest/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | """ 11 | pyutilib.autotest tests 12 | """ 13 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/load1a.py: -------------------------------------------------------------------------------- 1 | import pyutilib.misc 2 | import pyutilib.component.core 3 | import os 4 | import sys 5 | 6 | currdir = sys.argv[-2] + os.sep 7 | 8 | pyutilib.component.core.PluginGlobals.get_env().load_services( 9 | path=currdir + "plugins1", auto_disable=True) 10 | pyutilib.misc.setup_redirect(currdir + "load1a.out") 11 | if sys.argv[-1] == "json": 12 | pyutilib.component.core.PluginGlobals.pprint(json=True) 13 | else: 14 | pyutilib.component.core.PluginGlobals.pprint() 15 | pyutilib.misc.reset_redirect() 16 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/load2.py: -------------------------------------------------------------------------------- 1 | import pyutilib.misc 2 | import pyutilib.component.core 3 | import os 4 | import sys 5 | 6 | currdir = sys.argv[-2] + os.sep 7 | 8 | pyutilib.component.core.PluginGlobals.get_env().load_services( 9 | path=[currdir + "plugins1", currdir + "plugins2"]) 10 | pyutilib.misc.setup_redirect(currdir + "load2.out") 11 | if sys.argv[-1] == "json": 12 | pyutilib.component.core.PluginGlobals.pprint(json=True) 13 | else: 14 | pyutilib.component.core.PluginGlobals.pprint() 15 | pyutilib.misc.reset_redirect() 16 | -------------------------------------------------------------------------------- /pyutilib/misc/GlobalData.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | debug = False 11 | current_process = None 12 | signal_handler_busy = None 13 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/load2a.py: -------------------------------------------------------------------------------- 1 | import pyutilib.misc 2 | import pyutilib.component.core 3 | import os 4 | import sys 5 | 6 | currdir = sys.argv[-2] + os.sep 7 | 8 | pyutilib.component.core.PluginGlobals.get_env().load_services( 9 | path=[currdir + "plugins1", currdir + "plugins2"], auto_disable=True) 10 | pyutilib.misc.setup_redirect(currdir + "load2a.out") 11 | if sys.argv[-1] == "json": 12 | pyutilib.component.core.PluginGlobals.pprint(json=True) 13 | else: 14 | pyutilib.component.core.PluginGlobals.pprint() 15 | pyutilib.misc.reset_redirect() 16 | -------------------------------------------------------------------------------- /pyutilib/workflow/tests/test_doc.py: -------------------------------------------------------------------------------- 1 | # Imports 2 | import sys 3 | import os 4 | from os.path import dirname, abspath 5 | 6 | import pyutilib.th as unittest 7 | 8 | currdir = dirname(abspath(__file__)) + os.sep 9 | datadir = os.sep.join([dirname(dirname(dirname(dirname(abspath(__file__))))), 10 | 'doc', 'workflow', 'examples']) + os.sep 11 | 12 | sys.path.insert(0, datadir) 13 | try: 14 | from test_example import * 15 | finally: 16 | sys.path.remove(datadir) 17 | 18 | # Execute the tests 19 | if __name__ == '__main__': 20 | unittest.main() 21 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/README: -------------------------------------------------------------------------------- 1 | # cd pkg? 2 | # lpython setup.py sdist bdist_egg 3 | # cp dist/P*egg ../../eggs? 4 | 5 | 6 | 7 | pkg1 - project1 8 | singleton plugin 9 | 10 | pkg2 - project2 11 | nonsingleton plugin 12 | 13 | pkg3 - project1 14 | singleton plugin 15 | instances 16 | 17 | pkg4 - project1 18 | bad package requirements 19 | 20 | pkg5 - project1 21 | Requires PyUtilib version 100.0 22 | 23 | pkg6 - project1 24 | Import error 25 | 26 | pkg7 - project1 27 | Unknown extra 28 | 29 | -------------------------------------------------------------------------------- /pyutilib/ply/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | from pyutilib.ply.ply import ply_init, t_newline, t_ignore, t_COMMENT, _find_column, p_error 11 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/load1.py: -------------------------------------------------------------------------------- 1 | import pyutilib.misc 2 | import pyutilib.component.core 3 | import os 4 | import sys 5 | import logging 6 | 7 | currdir = sys.argv[-2] + os.sep 8 | 9 | logging.basicConfig(level=logging.DEBUG) 10 | pyutilib.component.core.PluginGlobals.get_env().load_services( 11 | path=currdir + "plugins1") 12 | pyutilib.misc.setup_redirect(currdir + "load1.out") 13 | if sys.argv[-1] == "json": 14 | pyutilib.component.core.PluginGlobals.pprint(json=True) 15 | else: 16 | pyutilib.component.core.PluginGlobals.pprint() 17 | pyutilib.misc.reset_redirect() 18 | -------------------------------------------------------------------------------- /pyutilib/services/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | from pyutilib.services.services import registered_executable, register_executable, TempfileManager 11 | -------------------------------------------------------------------------------- /pyutilib/component/app/tests/config1.txt: -------------------------------------------------------------------------------- 1 | ; 2 | ; Note: the following configuration options have been omitted because their 3 | ; value is 'None': 4 | ; section='globals' option='tempdir' 5 | ; section='logging.foo' option='log_dir' 6 | ; section='logging.foo' option='log_format' 7 | ; 8 | ; 9 | [Services] 10 | Configuration_ConfigParser = True 11 | EggLoader.foo = True 12 | ImportLoader = True 13 | TempfileManager = True 14 | 15 | [foo] 16 | path = DEFAULT PATH HERE 17 | 18 | [logging.foo] 19 | log_file = foo.log 20 | log_level = WARN 21 | log_type = none 22 | timestamp = False 23 | 24 | -------------------------------------------------------------------------------- /pyutilib/common/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | 11 | from pyutilib.common._exceptions import ConfigurationError, ApplicationError, BadDebuggingValue, WindowsError 12 | -------------------------------------------------------------------------------- /pyutilib/excel/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | try: 11 | from pyutilib.excel.spreadsheet import ExcelSpreadsheet 12 | 13 | except ImportError: #pragma:nocover 14 | pass 15 | -------------------------------------------------------------------------------- /doc/workflow/examples/example1.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | 3 | # @class: 4 | class TaskA(pyutilib.workflow.Task): 5 | 6 | def __init__(self, *args, **kwds): 7 | """Constructor.""" 8 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 9 | self.inputs.declare('x') 10 | self.inputs.declare('y') 11 | self.outputs.declare('z') 12 | 13 | def execute(self): 14 | """Compute the sum of the inputs.""" 15 | self.z = self.x + self.y 16 | # @:class 17 | # @usage: 18 | A = TaskA() 19 | w = pyutilib.workflow.Workflow() 20 | w.add(A) 21 | print(w(x=1, y=3)) 22 | # @:usage 23 | -------------------------------------------------------------------------------- /doc/workflow/examples/example1a.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | 3 | class TaskA(pyutilib.workflow.Task): 4 | 5 | def __init__(self, *args, **kwds): 6 | """Constructor.""" 7 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 8 | self.inputs.declare('x') 9 | self.inputs.declare('y') 10 | self.outputs.declare('z') 11 | 12 | def execute(self): 13 | """Compute the sum of the inputs.""" 14 | self.z = self.x + self.y 15 | 16 | # @ex: 17 | A = TaskA() 18 | w = pyutilib.workflow.Workflow() 19 | w.add(A) 20 | A.inputs.x = 1 21 | A.inputs.y = 3 22 | print(w()) 23 | # @:ex 24 | -------------------------------------------------------------------------------- /pyutilib/th/nose_gc.py: -------------------------------------------------------------------------------- 1 | """This module defines a nose plugin to forceably run the Python garbage collector before and after every test. 2 | 3 | Use the following command-line option with nosetests :: 4 | 5 | nosetests --with-forced-gc 6 | 7 | """ 8 | 9 | from gc import collect 10 | from nose.plugins.base import Plugin 11 | 12 | 13 | class ForcedGC(Plugin): 14 | """Force calls to the Python garbage collector before and after each test.""" 15 | name = 'forced-gc' 16 | score = 5000 # Run early 17 | 18 | def beforeTest(self, test): 19 | collect() 20 | 21 | def afterTest(self, test): 22 | collect() 23 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/update: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # A script that is used to update the EGG files with a new version of Python 4 | # 5 | 6 | cd pkg1 7 | python setup.py sdist bdist_egg 8 | 9 | cd ../pkg2 10 | python setup.py sdist bdist_egg 11 | 12 | cd ../pkg3 13 | python setup.py sdist bdist_egg 14 | 15 | cd ../pkg4 16 | python setup.py sdist bdist_egg 17 | 18 | cd ../pkg5 19 | python setup.py sdist bdist_egg 20 | 21 | cd ../pkg6 22 | python setup.py sdist bdist_egg 23 | 24 | cd ../pkg7 25 | python setup.py sdist bdist_egg 26 | 27 | cd .. 28 | cp pkg[1-2]/dist/P*egg ../eggs1 29 | cp pkg[3-7]/dist/P*egg ../eggs2 30 | 31 | -------------------------------------------------------------------------------- /pyutilib/subprocess/GlobalData.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | debug = False 11 | current_process = None 12 | signal_handler_busy = None 13 | DEFINE_SIGNAL_HANDLERS_DEFAULT = True 14 | original_signal_handlers = {} 15 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Fixes: # 2 | 3 | ## Summary/Motivation: 4 | 5 | 6 | ## Changes proposed in this PR: 7 | - 8 | - 9 | 10 | ### Legal Acknowledgement 11 | 12 | By contributing to this software project, I agree to the following terms and conditions for my contribution: 13 | 14 | 1. I agree my contributions are submitted under the BSD license. 15 | 2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer. 16 | -------------------------------------------------------------------------------- /pyutilib/factory/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | 11 | from pyutilib.factory.executable import register_executable, registered_executable, unregister_executable 12 | from pyutilib.factory.factory import Factory, CachedFactory 13 | -------------------------------------------------------------------------------- /doc/workflow/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Create The Following Documents: 3 | # 4 | # . Managing Python Workflows with pyutilib.workflow 5 | # workflow.tex 6 | # 7 | 8 | all: workflow 9 | 10 | workflow: lstanchors 11 | pdflatex workflow 12 | bibtex workflow 13 | pdflatex workflow 14 | pdflatex workflow 15 | 16 | sand: lstanchors 17 | pdflatex SAND 18 | bibtex SAND 19 | pdflatex SAND 20 | pdflatex SAND 21 | 22 | strip_examples: 23 | python example_exec.py 24 | 25 | lstanchors: 26 | ./lstanchors.pl workflow-*.tex 27 | 28 | clean: 29 | @- find . -name '*_strip.py' | xargs rm 30 | @- find . -name '*.py.bak' | xargs rm 31 | @- find . -name '*.tex.bak' | xargs rm 32 | -------------------------------------------------------------------------------- /pyutilib/math/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | 11 | from pyutilib.math.numtypes import infinity, nan, is_nan, is_finite 12 | from pyutilib.math.util import approx_equal, as_number, isint, argmax, argmin, mean, median, factorial, perm, isclose 13 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/yamldata13.yml: -------------------------------------------------------------------------------- 1 | python: 2 | - import coopr.opt 3 | 4 | driver: coopr.pyomo 5 | 6 | solvers: 7 | glpk: 8 | cplex: 9 | pico: 10 | cbc: 11 | asl_pico: 12 | name: "_asl:PICO" 13 | gurobi: 14 | 15 | problems: 16 | diet1: 17 | files: diet1.py diet1.dat 18 | 19 | suites: 20 | lp_smoke: 21 | categories: 22 | - integration 23 | - nightly 24 | - smoke 25 | solvers: 26 | glpk: 27 | cplex: 28 | pico: 29 | cbc: 30 | gurobi: 31 | problems: 32 | diet1: 33 | tolerance: 1e-5 34 | 35 | -------------------------------------------------------------------------------- /pyutilib/component/app/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | """ 10 | The pyutilib.component.app package defines application interfaces that 11 | simplify the use of the PyUtilib Component Architecture. 12 | """ 13 | 14 | from .simple import SimpleApplication 15 | -------------------------------------------------------------------------------- /RELEASE.txt: -------------------------------------------------------------------------------- 1 | We are pleased to announce the release of PyUtilib 6.0.0. The 2 | PyUtilib project supports the development of an ensemble of Python 3 | packages that include a wide variety of utilities, including a 4 | well-developed component architecture. 5 | 6 | The following are highlights of the 6.0 release series: 7 | 8 | - Removed the pyutilib.enum package 9 | - Expanded timer support 10 | - Automated release management 11 | 12 | Additional changes are listed in CHANGELOG.txt 13 | 14 | PyUtilib can be installed from PyPI using pip or conda-forge using conda. 15 | 16 | Enjoy! 17 | 18 | - PyUtilib Developer Team 19 | - pyutilib-developers@googlecode.com 20 | - https://github.com/PyUtilib/pyutilib.git 21 | -------------------------------------------------------------------------------- /pyutilib/excel/base.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | 11 | class ExcelSpreadsheet_base(object): 12 | 13 | def can_read(self): 14 | return False 15 | 16 | def can_write(self): 17 | return False 18 | 19 | def can_calculate(self): 20 | return False 21 | -------------------------------------------------------------------------------- /pyutilib/component/executables/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | from pyutilib.component.core import PluginGlobals 11 | PluginGlobals.add_env("pca") 12 | 13 | from pyutilib.component.executables.executable import IExternalExecutable, ExternalExecutable 14 | 15 | PluginGlobals.pop_env() 16 | -------------------------------------------------------------------------------- /doc/workflow/examples/example1c.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | 3 | class TaskAA(pyutilib.workflow.Task): 4 | 5 | def __init__(self, *args, **kwds): 6 | """Constructor.""" 7 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 8 | self.inputs.declare('x') 9 | self.inputs.declare('y') 10 | self.add_argument('--x', dest='x', type=int) 11 | self.add_argument('--y', dest='y', type=int) 12 | self.outputs.declare('z') 13 | 14 | def execute(self): 15 | """Compute the sum of the inputs.""" 16 | self.z = self.x + self.y 17 | 18 | # @ex: 19 | AA = TaskAA() 20 | w = pyutilib.workflow.Workflow() 21 | w.add(AA) 22 | w.set_options(['--x=1', '--y=3']) 23 | print(w(y=4)) 24 | # @:ex 25 | -------------------------------------------------------------------------------- /doc/workflow/examples/example1b.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | 3 | # @ex: 4 | class TaskAA(pyutilib.workflow.Task): 5 | 6 | def __init__(self, *args, **kwds): 7 | """Constructor.""" 8 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 9 | self.inputs.declare('x') 10 | self.inputs.declare('y') 11 | self.add_argument('--x', dest='x', type=int) 12 | self.add_argument('--y', dest='y', type=int) 13 | self.outputs.declare('z') 14 | 15 | def execute(self): 16 | """Compute the sum of the inputs.""" 17 | self.z = self.x + self.y 18 | 19 | AA = TaskAA() 20 | w = pyutilib.workflow.Workflow() 21 | w.add(AA) 22 | w.set_options(['--x=1', '--y=3', '--bad=4']) 23 | print(w()) 24 | # @:ex 25 | -------------------------------------------------------------------------------- /pyutilib/subprocess/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | 11 | from pyutilib.component.core import PluginGlobals 12 | PluginGlobals.add_env("pyutilib") 13 | 14 | from pyutilib.subprocess.processmngr import subprocess, SubprocessMngr, run_command, timer, signal_handler, run, PIPE, STDOUT 15 | 16 | PluginGlobals.pop_env() 17 | -------------------------------------------------------------------------------- /pyutilib/component/loader/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | from pyutilib.component.core import PluginGlobals 11 | PluginGlobals.add_env("pca") 12 | 13 | from pyutilib.component.loader.plugin_importLoader import ImportLoader 14 | from pyutilib.component.loader.plugin_eggLoader import EggLoader 15 | 16 | PluginGlobals.pop_env() 17 | -------------------------------------------------------------------------------- /pyutilib/workflow/globals.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | __all__ = ['unique_id', 'reset_id_counter'] 11 | 12 | 13 | def unique_id(): 14 | unique_id.counter += 1 15 | return unique_id.counter 16 | 17 | 18 | unique_id.counter = 0 19 | 20 | 21 | def reset_id_counter(): 22 | global unique_id 23 | unique_id.counter = 0 24 | -------------------------------------------------------------------------------- /doc/workflow/examples/example_plugin.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | import pyutilib.component.core 3 | 4 | # @class: 5 | class PluginTaskA(pyutilib.workflow.TaskPlugin): 6 | 7 | pyutilib.component.core.alias('TaskA') 8 | 9 | def __init__(self, *args, **kwds): 10 | """Constructor.""" 11 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 12 | self.inputs.declare('x') 13 | self.inputs.declare('y') 14 | self.outputs.declare('z') 15 | 16 | def execute(self): 17 | """Compute the sum of the inputs.""" 18 | self.z = self.x + self.y 19 | # @:class 20 | 21 | # @usage: 22 | A = pyutilib.workflow.TaskFactory('TaskA') 23 | w = pyutilib.workflow.Workflow() 24 | w.add(A) 25 | print(w(x=1, y=3)) 26 | # @:usage 27 | -------------------------------------------------------------------------------- /doc/workflow/example_exec.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | def strip_example(file): 4 | base, name = os.path.split(file) 5 | prefix = os.path.splitext(name)[0] 6 | if prefix.endswith('_strip'): 7 | return 8 | print "STRIPPING",file 9 | OUTPUT = open(base+'/'+prefix+'_strip.py','w') 10 | INPUT = open(file,'r') 11 | for line in INPUT: 12 | if line[0] == '#' and '@' in line: 13 | continue 14 | print >>OUTPUT, line, 15 | INPUT.close() 16 | OUTPUT.close() 17 | 18 | 19 | for root, dirs, files in os.walk(os.path.abspath(os.path.dirname(__file__)), topdown=True): 20 | for name in files: 21 | if name == 'example_exec.py': 22 | continue 23 | if name.endswith('.py'): 24 | strip_example(root+'/'+name) 25 | -------------------------------------------------------------------------------- /doc/workflow/examples/example9a.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | 3 | # @code: 4 | class TaskA(pyutilib.workflow.Task): 5 | 6 | def __init__(self, *args, **kwds): 7 | """Constructor.""" 8 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 9 | self.inputs.declare('x') 10 | self.inputs.declare('y') 11 | self.outputs.declare('z') 12 | 13 | def execute(self): 14 | """Compute the sum of the inputs.""" 15 | self.z = self.x + self.y 16 | 17 | B = pyutilib.workflow.TaskFactory('workflow.selection') 18 | A = TaskA() 19 | A.inputs.x = B.outputs.selection 20 | w = pyutilib.workflow.Workflow() 21 | w.add(B) 22 | 23 | print(w(index='a', y=100, data={'a':1, 'b':2})) 24 | w.reset() 25 | print(w(index='b', y=100, data={'a':1, 'b':2})) 26 | # @:code 27 | -------------------------------------------------------------------------------- /doc/workflow/examples/example10.py: -------------------------------------------------------------------------------- 1 | from pyutilib.workflow import Resource, Task, Workflow 2 | 3 | class BusyResource(Resource): 4 | 5 | def __init__(self, name=None): 6 | Resource.__init__(self) 7 | self._counter = 1 8 | 9 | def available(self): 10 | if self._counter > 0: 11 | print("BUSY %d" % self._counter) 12 | self._counter -= 1 13 | return False 14 | return True 15 | 16 | class TaskA(Task): 17 | 18 | def __init__(self, *args, **kwds): 19 | Task.__init__(self, *args, **kwds) 20 | self.inputs.declare('x') 21 | self.outputs.declare('x', self.inputs.x) 22 | 23 | def execute(self): 24 | pass 25 | 26 | A = TaskA() 27 | A.add_resource(BusyResource()) 28 | w = Workflow() 29 | w.add(A) 30 | 31 | print(w(x=1)) 32 | -------------------------------------------------------------------------------- /pyutilib/component/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | from . import core 11 | 12 | # 13 | # Import the 'pyutilib.component' plugins 14 | # 15 | core.PluginGlobals.add_env("pca") 16 | 17 | from . import config 18 | from . import executables 19 | from . import loader 20 | from . import app 21 | 22 | # 23 | # Remove the "pca" environment as the default 24 | # 25 | core.PluginGlobals.pop_env() 26 | -------------------------------------------------------------------------------- /pyutilib/enum/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | 11 | import sys 12 | 13 | if 'nose' not in sys.modules and 'nose2' not in sys.modules: 14 | raise ImportError("""pyutilib.enum has been removed. 15 | 16 | Python 3 now has an enum implementation in the standard library (also 17 | available for older Python versions as the third-party enum34 PyPI 18 | package) that supersedes this library.""") 19 | -------------------------------------------------------------------------------- /examples/pyro/factor.py: -------------------------------------------------------------------------------- 1 | 2 | import sys 3 | from math import sqrt 4 | import pyutilib.pyro 5 | 6 | if sys.version_info >= (3,0): 7 | xrange = range 8 | 9 | 10 | def factorize(n): 11 | def isPrime(n): 12 | return not [x for x in xrange(2,int(sqrt(n))+1) if n%x == 0] 13 | primes = [] 14 | candidates = xrange(2,n+1) 15 | candidate = 2 16 | while not primes and candidate in candidates: 17 | if n%candidate == 0 and isPrime(candidate): 18 | primes = primes + [candidate] + factorize(n/candidate) 19 | candidate += 1 20 | return primes 21 | 22 | 23 | class FactorWorker(pyutilib.pyro.TaskWorker): 24 | 25 | def process(self,data): 26 | print "factorizing",data,"-->", 27 | sys.stdout.flush() 28 | res = factorize(int(data)) 29 | print res 30 | return res 31 | -------------------------------------------------------------------------------- /examples/autotest/autotest.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | # 11 | # Tests driven by example1.yml 12 | # 13 | 14 | import os 15 | from os.path import abspath, dirname 16 | currdir = dirname(abspath(__file__))+os.sep 17 | 18 | import pyutilib.th as unittest 19 | import pyutilib.autotest 20 | 21 | pyutilib.autotest.create_test_suites(filename=currdir+'example1.yml', _globals=globals()) 22 | 23 | if __name__ == "__main__": 24 | unittest.main() 25 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/egg1.py: -------------------------------------------------------------------------------- 1 | import pyutilib.component.core 2 | import sys 3 | import os 4 | import logging 5 | 6 | currdir = sys.argv[-2] + os.sep 7 | 8 | pyutilib.component.core.PluginGlobals.add_env( 9 | pyutilib.component.core.PluginEnvironment("testing")) 10 | service = pyutilib.component.core.PluginFactory( 11 | "EggLoader", namespace='project1', env='pca') 12 | pyutilib.misc.setup_redirect(currdir + "egg1.out") 13 | if service is None: 14 | print( 15 | "Cannot test the PyUtilib EggLoader Plugin on this system because the pkg_resources package is not available.") 16 | sys.exit(1) 17 | # 18 | #logging.basicConfig(level=logging.DEBUG) 19 | # 20 | pyutilib.component.core.PluginGlobals.get_env().load_services( 21 | path=currdir + "eggs1") 22 | # 23 | if sys.argv[-1] == 'json': 24 | pyutilib.component.core.PluginGlobals.pprint(json=True) 25 | else: 26 | pyutilib.component.core.PluginGlobals.pprint() 27 | pyutilib.misc.reset_redirect() 28 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/egg2.py: -------------------------------------------------------------------------------- 1 | import pyutilib.component.core 2 | import os 3 | import sys 4 | 5 | currdir = sys.argv[-2] + os.sep 6 | 7 | pyutilib.component.core.PluginGlobals.add_env( 8 | pyutilib.component.core.PluginEnvironment("testing")) 9 | service = pyutilib.component.core.PluginFactory( 10 | "EggLoader", namespace="project1", env='pca') 11 | if service is None: 12 | print( 13 | "Cannot test the PyUtilib EggLoader Plugin on this system because the pkg_resources package is not available.") 14 | sys.exit(1) 15 | # 16 | #logging.basicConfig(level=logging.DEBUG) 17 | # 18 | pyutilib.component.core.PluginGlobals.get_env().load_services( 19 | path=[currdir + "eggs1", currdir + "eggs2"]) 20 | # 21 | pyutilib.misc.setup_redirect(currdir + "egg2.out") 22 | if sys.argv[-1] == 'json': 23 | pyutilib.component.core.PluginGlobals.pprint(json=True) 24 | else: 25 | pyutilib.component.core.PluginGlobals.pprint() 26 | pyutilib.misc.reset_redirect() 27 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg7/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: iso-8859-1 -*- 3 | 4 | from setuptools import setup 5 | 6 | setup( 7 | name='Package7', 8 | version='0.1', 9 | packages=['package7'], 10 | package_data={'package7': []}, 11 | author='Jane Doe', 12 | author_email='jdoe@dev.null', 13 | description='Package7 description.', 14 | license='BSD', 15 | keywords='package7 plugin', 16 | classifiers=[ 17 | 'Framework :: Package7', 18 | 'Development Status :: 1 - Planning', 19 | 'Environment :: Web Environment', 20 | 'License :: OSI Approved :: BSD License', 21 | 'Natural Language :: English', 22 | 'Operating System :: OS Independent', 23 | 'Programming Language :: Python', 24 | ], 25 | install_requires=['PyUtilib[FOO]'], 26 | entry_points={ 27 | 'project1.plugins': [ 28 | 'package7.main = package7.main', 29 | ] 30 | }) 31 | -------------------------------------------------------------------------------- /pyutilib/autotest/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | 11 | __test__ = False 12 | 13 | import pyutilib.component.core 14 | pyutilib.component.core.PluginGlobals.add_env('pyutilib.autotest') 15 | 16 | from pyutilib.autotest.plugins import ITestDriver, TestDriverFactory, ITestParser, TestDriverBase 17 | from pyutilib.autotest.driver import run, main, create_test_suites 18 | import pyutilib.autotest.yaml_plugin 19 | import pyutilib.autotest.json_plugin 20 | import pyutilib.autotest.default_testdriver 21 | 22 | pyutilib.component.core.PluginGlobals.pop_env() 23 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg5/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: iso-8859-1 -*- 3 | 4 | from setuptools import setup 5 | 6 | setup( 7 | name='Package5', 8 | version='0.1', 9 | packages=['package5'], 10 | package_data={'package5': []}, 11 | author='Jane Doe', 12 | author_email='jdoe@dev.null', 13 | description='Package5 description.', 14 | license='BSD', 15 | keywords='package5 plugin', 16 | classifiers=[ 17 | 'Framework :: Package5', 18 | 'Development Status :: 1 - Planning', 19 | 'Environment :: Web Environment', 20 | 'License :: OSI Approved :: BSD License', 21 | 'Natural Language :: English', 22 | 'Operating System :: OS Independent', 23 | 'Programming Language :: Python', 24 | ], 25 | install_requires=['PyUtilib==100.0'], 26 | entry_points={ 27 | 'project1.plugins': [ 28 | 'package5.main = package5.main', 29 | ] 30 | }) 31 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg4/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: iso-8859-1 -*- 3 | 4 | from setuptools import setup 5 | 6 | setup( 7 | name='Package4', 8 | version='0.1', 9 | packages=['package4'], 10 | package_data={'package4': []}, 11 | author='Jane Doe', 12 | author_email='jdoe@dev.null', 13 | description='Package4 description.', 14 | license='BSD', 15 | keywords='package4 plugin', 16 | classifiers=[ 17 | 'Framework :: Package4', 18 | 'Development Status :: 1 - Planning', 19 | 'Environment :: Web Environment', 20 | 'License :: OSI Approved :: BSD License', 21 | 'Natural Language :: English', 22 | 'Operating System :: OS Independent', 23 | 'Programming Language :: Python', 24 | ], 25 | install_requires=['PyUtilibDummyProject>=0.11'], 26 | entry_points={ 27 | 'project1.plugins': [ 28 | 'package4.main = package4.main', 29 | ] 30 | }) 31 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg6/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: iso-8859-1 -*- 3 | 4 | from setuptools import setup 5 | 6 | setup( 7 | name='Package6', 8 | version='0.1', 9 | packages=['package6'], 10 | package_data={'package6': []}, 11 | author='Jane Doe', 12 | author_email='jdoe@dev.null', 13 | description='Package6 description.', 14 | license='BSD', 15 | keywords='package6 plugin', 16 | classifiers=[ 17 | 'Framework :: Package6', 18 | 'Development Status :: 1 - Planning', 19 | 'Environment :: Web Environment', 20 | 'License :: OSI Approved :: BSD License', 21 | 'Natural Language :: English', 22 | 'Operating System :: OS Independent', 23 | 'Programming Language :: Python', 24 | ], 25 | 26 | #install_requires = ['PyUtilib==100.0'], 27 | entry_points={ 28 | 'project1.plugins': [ 29 | 'package6.main = package6.unknown', 30 | ] 31 | }) 32 | -------------------------------------------------------------------------------- /install_jython.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #export JYTHON=org.python:jython-installer:2.7.0 4 | #export HOME=/Users/wehart/src/python27/src/pyutilib 5 | #export VIRTUAL_ENV=$HOME 6 | #printenv $HOME 7 | #jip install joda-time:joda-time:2.3 8 | set -e 9 | #set -v 10 | 11 | pip install jip 12 | jip install $JYTHON 13 | 14 | # 15 | # Install Jython 16 | # 17 | NON_GROUP_ID=${JYTHON#*:} 18 | _JYTHON_BASENAME=${NON_GROUP_ID/:/-} 19 | export CLASSPATH=$VIRTUAL_ENV/javalib/* 20 | java -jar $VIRTUAL_ENV/javalib/${_JYTHON_BASENAME}.jar -s -d $HOME/jython 21 | 22 | # 23 | # Create virtual environment 24 | # 25 | # pip isn't available in 2.7.0, so we need to use an older version of virtualenv 26 | # 27 | pip install virtualenv==1.9.1 28 | virtualenv --version 29 | virtualenv -p $HOME/jython/bin/jython $HOME/myvirtualenv 30 | $HOME/myvirtualenv/bin/pip install nose 31 | 32 | # 33 | # Install packages into the jython virtual environment 34 | # 35 | export PATH=$HOME/myvirtualenv/bin:$PATH 36 | #ls $HOME/myvirtualenv/bin 37 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg1/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: iso-8859-1 -*- 3 | 4 | from setuptools import setup 5 | 6 | setup( 7 | name='Package1', 8 | version='0.1', 9 | packages=['package1'], 10 | package_data={'package1': []}, 11 | author='Jane Doe', 12 | author_email='jdoe@dev.null', 13 | description='Package1 description.', 14 | license='BSD', 15 | keywords='package1 plugin', 16 | classifiers=[ 17 | 'Framework :: Package1', 18 | 'Development Status :: 1 - Planning', 19 | 'Environment :: Web Environment', 20 | 'License :: OSI Approved :: BSD License', 21 | 'Natural Language :: English', 22 | 'Operating System :: OS Independent', 23 | 'Programming Language :: Python', 24 | ], 25 | 26 | #install_requires = ['Trac>=0.11', 'Genshi>=0.5'], 27 | entry_points={ 28 | 'project1.plugins': [ 29 | 'package1.main = package1.main', 30 | ] 31 | }) 32 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg2/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: iso-8859-1 -*- 3 | 4 | from setuptools import setup 5 | 6 | setup( 7 | name='Package2', 8 | version='0.1', 9 | packages=['package2'], 10 | package_data={'package2': []}, 11 | author='Jane Doe', 12 | author_email='jdoe@dev.null', 13 | description='Package2 description.', 14 | license='BSD', 15 | keywords='package2 plugin', 16 | classifiers=[ 17 | 'Framework :: Package2', 18 | 'Development Status :: 1 - Planning', 19 | 'Environment :: Web Environment', 20 | 'License :: OSI Approved :: BSD License', 21 | 'Natural Language :: English', 22 | 'Operating System :: OS Independent', 23 | 'Programming Language :: Python', 24 | ], 25 | 26 | #install_requires = ['Trac>=0.11', 'Genshi>=0.5'], 27 | entry_points={ 28 | 'project2.plugins': [ 29 | 'package2.main = package2.main', 30 | ] 31 | }) 32 | -------------------------------------------------------------------------------- /pyutilib/component/loader/tests/eggsrc/pkg3/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: iso-8859-1 -*- 3 | 4 | from setuptools import setup 5 | 6 | setup( 7 | name='Package3', 8 | version='0.1', 9 | packages=['package3'], 10 | package_data={'package3': []}, 11 | author='Jane Doe', 12 | author_email='jdoe@dev.null', 13 | description='Package3 description.', 14 | license='BSD', 15 | keywords='package3 plugin', 16 | classifiers=[ 17 | 'Framework :: Package3', 18 | 'Development Status :: 1 - Planning', 19 | 'Environment :: Web Environment', 20 | 'License :: OSI Approved :: BSD License', 21 | 'Natural Language :: English', 22 | 'Operating System :: OS Independent', 23 | 'Programming Language :: Python', 24 | ], 25 | 26 | #install_requires = ['Trac>=0.11', 'Genshi>=0.5'], 27 | entry_points={ 28 | 'project1.plugins': [ 29 | 'package3.main = package3.main', 30 | ] 31 | }) 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | TEST-*.xml 46 | *,cover 47 | .hypothesis/ 48 | 49 | # Translations 50 | *.mo 51 | *.pot 52 | 53 | # Django stuff: 54 | *.log 55 | 56 | # Sphinx documentation 57 | docs/_build/ 58 | 59 | # PyBuilder 60 | target/ 61 | -------------------------------------------------------------------------------- /pyutilib/math/median2.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | 11 | def median(mylist): 12 | """ 13 | Returns the median value of a list 14 | """ 15 | mylist = list(mylist) 16 | mylist.sort() 17 | if (len(mylist) == 0): 18 | raise ArithmeticError( 19 | "Attempting to compute the median of a zero-length list") 20 | elif (len(mylist) == 1): 21 | return mylist[0] 22 | elif (divmod(len(mylist), 2)[1] == 1): 23 | return mylist[(len(mylist) - 1) / 2] 24 | ndx = len(mylist) / 2 25 | return (mylist[ndx - 1] + mylist[ndx]) / 2.0 26 | -------------------------------------------------------------------------------- /pyutilib/math/median3.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | 11 | def median(mylist): 12 | """ 13 | Returns the median value of a list 14 | """ 15 | mylist = list(mylist) 16 | mylist.sort() 17 | if (len(mylist) == 0): 18 | raise ArithmeticError( 19 | "Attempting to compute the median of a zero-length list") 20 | elif (len(mylist) == 1): 21 | return mylist[0] 22 | elif (divmod(len(mylist), 2)[1] == 1): 23 | return mylist[(len(mylist) - 1) // 2] 24 | ndx = len(mylist) // 2 25 | return (mylist[ndx - 1] + mylist[ndx]) / 2.0 26 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/test_singleton.py: -------------------------------------------------------------------------------- 1 | # 2 | # Unit Tests for util/singleton 3 | # 4 | # 5 | 6 | import os 7 | from os.path import abspath, dirname 8 | currdir = dirname(abspath(__file__)) + os.sep 9 | import pyutilib.th as unittest 10 | import pyutilib.misc 11 | 12 | 13 | class A(pyutilib.misc.MonoState): 14 | 15 | def __init__(self): 16 | self.state = True 17 | 18 | 19 | class B(pyutilib.misc.Singleton): 20 | 21 | def __init__(self): 22 | self.state = True 23 | 24 | 25 | class SingletonDebug(unittest.TestCase): 26 | 27 | def test_A(self): 28 | # Verify that MonoState generates one global state 29 | a1 = A() 30 | a2 = A() 31 | self.assertNotEqual(a1, a2) 32 | self.assertEqual(a1.__dict__, a2.__dict__) 33 | 34 | def test_B(self): 35 | # Verify that Singleton generates one instance 36 | b1 = B() 37 | b2 = B() 38 | self.assertEqual(b1, b2) 39 | 40 | 41 | if __name__ == "__main__": 42 | unittest.main() 43 | -------------------------------------------------------------------------------- /pyutilib/misc/singleton.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | 11 | class MonoState(object): 12 | """A class where every instance shares state.""" 13 | _state = {} 14 | 15 | def __new__(cls, *p, **k): 16 | self = object.__new__(cls, *p, **k) 17 | self.__dict__ = cls._state 18 | return self 19 | 20 | 21 | class Singleton(object): 22 | """A class where the __new__() method returns the same instance.""" 23 | 24 | def __new__(cls, *p, **k): 25 | if not '_the_instance' in cls.__dict__: 26 | cls._the_instance = object.__new__(cls) 27 | return cls._the_instance 28 | -------------------------------------------------------------------------------- /doc/workflow/examples/example2.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | 3 | class TaskA(pyutilib.workflow.Task): 4 | 5 | def __init__(self, *args, **kwds): 6 | """Constructor.""" 7 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 8 | self.inputs.declare('x') 9 | self.inputs.declare('y') 10 | self.outputs.declare('z') 11 | 12 | def execute(self): 13 | """Compute the sum of the inputs.""" 14 | self.z = self.x + self.y 15 | 16 | # @class: 17 | class TaskB(pyutilib.workflow.Task): 18 | 19 | def __init__(self, *args, **kwds): 20 | """Constructor.""" 21 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 22 | self.inputs.declare('X') 23 | self.outputs.declare('Z') 24 | 25 | def execute(self): 26 | """Compute the sum of the inputs.""" 27 | self.Z = 2*self.X 28 | # @:class 29 | 30 | # @usage: 31 | A = TaskA() 32 | B = TaskB() 33 | A.inputs.x = B.outputs.Z 34 | 35 | w = pyutilib.workflow.Workflow() 36 | w.add(A) 37 | print(w(X=1, y=3)) 38 | # @:usage 39 | -------------------------------------------------------------------------------- /pyutilib/component/core/tests/factory.yml: -------------------------------------------------------------------------------- 1 | #-------------------------------------------------------------- 2 | Environment Stack: 3 | '1': pca 4 | '2': testing 5 | #-------------------------------------------------------------- 6 | Interfaces Declared: 7 | IConfiguration: 8 | IDebug1: 9 | IDebug2: 10 | IDebug3: 11 | IDebug4: 12 | IEnvironmentConfig: 13 | IExternalExecutable: 14 | IFileOption: 15 | IIgnorePluginWhenLoading: 16 | IOption: 17 | IOptionDataProvider: 18 | IPluginLoadPath: 19 | IPluginLoader: 20 | ITempfileManager: 21 | IUpdatedOptionsAction: 22 | #-------------------------------------------------------------- 23 | Interfaces Declared by Environment: 24 | pca: 25 | IConfiguration: 26 | IEnvironmentConfig: 27 | IExternalExecutable: 28 | IFileOption: 29 | IIgnorePluginWhenLoading: 30 | IOption: 31 | IOptionDataProvider: 32 | IPluginLoadPath: 33 | IPluginLoader: 34 | ITempfileManager: 35 | IUpdatedOptionsAction: 36 | testing: 37 | IDebug1: 38 | IDebug2: 39 | IDebug3: 40 | IDebug4: 41 | 42 | -------------------------------------------------------------------------------- /.github/workflows/release_wheel_creation.yml: -------------------------------------------------------------------------------- 1 | name: PyUtilib Release Distribution Creation 2 | 3 | on: 4 | push: 5 | tags: 6 | - '*' 7 | 8 | jobs: 9 | wheelcreation: 10 | name: pyutilib/wheel_creation 11 | runs-on: ${{ matrix.os }} 12 | strategy: 13 | fail-fast: false 14 | matrix: 15 | os: [ubuntu-latest] 16 | include: 17 | - os: ubuntu-latest 18 | TARGET: linux 19 | python-version: [3.7] 20 | steps: 21 | - uses: actions/checkout@v2 22 | - name: Set up Python ${{ matrix.python-version }} 23 | uses: actions/setup-python@v1 24 | with: 25 | python-version: ${{ matrix.python-version }} 26 | - name: Install dependencies 27 | run: | 28 | python -m pip install --upgrade pip 29 | pip install twine wheel setuptools 30 | - name: Build Python wheels 31 | run: | 32 | python setup.py sdist --format=gztar bdist_wheel 33 | - name: Upload artifact 34 | uses: actions/upload-artifact@v1 35 | with: 36 | name: pyutilib-wheels 37 | path: dist 38 | -------------------------------------------------------------------------------- /doc/workflow/examples/example3.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | 3 | class TaskA(pyutilib.workflow.Task): 4 | 5 | def __init__(self, *args, **kwds): 6 | """Constructor.""" 7 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 8 | self.inputs.declare('x') 9 | self.inputs.declare('y') 10 | self.outputs.declare('z') 11 | 12 | def execute(self): 13 | """Compute the sum of the inputs.""" 14 | self.z = self.x + self.y 15 | 16 | # @class: 17 | class TaskC(pyutilib.workflow.Task): 18 | 19 | def __init__(self, *args, **kwds): 20 | """Constructor.""" 21 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 22 | self.inputs.declare('X') 23 | self.inputs.declare('y') 24 | self.outputs.declare('W') 25 | self.outputs.declare('Z') 26 | 27 | def execute(self): 28 | """Compute the sum of the inputs.""" 29 | self.W = self.X+self.y 30 | self.Z = 2*self.W 31 | # @:class 32 | 33 | A = TaskA() 34 | C = TaskC() 35 | A.inputs.x = C.outputs.Z 36 | 37 | w = pyutilib.workflow.Workflow() 38 | w.add(A) 39 | print(w(X=1, y=3)) 40 | -------------------------------------------------------------------------------- /pyutilib/autotest/tests/test1.txt: -------------------------------------------------------------------------------- 1 | Usage: autotest [options] 2 | 3 | Options: 4 | -h, --help Print command options 5 | -d, --debug Set debugging flag 6 | -v, --verbose Verbose output 7 | -q, --quiet Minimal output 8 | -f, --failfast Stop on first failure 9 | -c, --catch Catch control-C and display results 10 | -b, --buffer Buffer stdout and stderr durring test runs 11 | --cat=CATEGORIES, --category=CATEGORIES 12 | Define a list of categories that filter the execution 13 | of test suites 14 | --help-suites Print the test suites that can be executed 15 | --help-tests=HELP_TESTS 16 | Print the tests in the specified test suite 17 | --help-categories Print the test suite categories that can be specified 18 | 19 | Examples: 20 | autotest - run all test suites 21 | autotest MyTestCase.testSomething - run MyTestCase.testSomething 22 | autotest MyTestCase - run all 'test*' test methods 23 | in MyTestCase 24 | 25 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing to PyUtilib 2 | ===================== 3 | 4 | Pull Requests 5 | ------------- 6 | 7 | PyUtilib manages source code contributions via pull requests. For a pull 8 | request to be accepted, it must satisfy all code integration and 9 | coverage tests, and then pass review by two core developers. For core 10 | developers, authorship of a pull request counts as a review. 11 | 12 | Submitted code that addresses an issue should include a test exercising 13 | the relevant case. New functionality should include tests to establish 14 | validity of its results and/or effects. 15 | 16 | Legal Disclaimer 17 | ---------------- 18 | 19 | By contributing to this software project, you are agreeing to the 20 | following terms and conditions for your contributions: 21 | 22 | 1. You agree your contributions are submitted under the BSD license. 23 | 2. You represent you are authorized to make the contributions and grant 24 | the license. If your employer has rights to intellectual property that 25 | includes your contributions, you represent that you have received 26 | permission to make contributions and grant the required license on 27 | behalf of that employer. 28 | -------------------------------------------------------------------------------- /pyutilib/workflow/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | import pyutilib.component.core 11 | pyutilib.component.core.PluginGlobals.add_env("pyutilib.workflow") 12 | 13 | from pyutilib.workflow.resource import Resource 14 | from pyutilib.workflow.task import Task, EmptyTask, Component, Port, Ports, InputPorts, OutputPorts, Connector 15 | from pyutilib.workflow.workflow import Workflow 16 | from pyutilib.workflow.file import FileResource 17 | from pyutilib.workflow.executable import ExecutableResource 18 | from pyutilib.workflow.tasks import TaskPlugin, TaskFactory, WorkflowPlugin 19 | from pyutilib.workflow.driver import TaskDriver 20 | from pyutilib.workflow.functor import functor_api, IFunctorTask, FunctorAPIFactory, FunctorAPIData 21 | 22 | pyutilib.component.core.PluginGlobals.pop_env() 23 | -------------------------------------------------------------------------------- /doc/workflow/examples/example3a.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | 3 | class TaskA(pyutilib.workflow.Task): 4 | 5 | def __init__(self, *args, **kwds): 6 | """Constructor.""" 7 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 8 | self.inputs.declare('x') 9 | self.inputs.declare('y') 10 | self.outputs.declare('z') 11 | 12 | def execute(self): 13 | """Compute the sum of the inputs.""" 14 | self.z = self.x + self.y 15 | 16 | # @class: 17 | class TaskD(pyutilib.workflow.Task): 18 | 19 | def __init__(self, *args, **kwds): 20 | """Constructor.""" 21 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 22 | self.inputs.declare('X') 23 | self.inputs.declare('y') 24 | self.inputs.declare('a', constant=True) 25 | self.outputs.declare('W') 26 | self.outputs.declare('Z') 27 | 28 | def execute(self): 29 | """Compute the sum of the inputs.""" 30 | self.W = self.X+self.y+self.a 31 | self.Z = 2*self.W 32 | # @:class 33 | 34 | A = TaskA() 35 | D = TaskD() 36 | D.inputs.a = 100 37 | A.inputs.x = D.outputs.Z 38 | 39 | w = pyutilib.workflow.Workflow() 40 | w.add(A) 41 | print(w(X=1, y=3)) 42 | -------------------------------------------------------------------------------- /pyutilib/math/numtypes.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | __all__ = ['infinity', 'nan', 'is_nan', 'is_finite'] 11 | """ 12 | Definitions of mathematical constants 13 | """ 14 | 15 | import math 16 | 17 | 18 | """ Definition of infinity """ 19 | infinity = float('inf') 20 | """ Definition of NaN """ 21 | nan = infinity / infinity 22 | 23 | def is_nan(x): 24 | """ 25 | Returns true if the argument is a float and it does not equal itself 26 | """ 27 | try: 28 | return math.isnan(x) 29 | except TypeError: 30 | return False 31 | 32 | def is_finite(x): 33 | """ 34 | Returns true if the argument is a float or int and it is not infinite or NaN 35 | """ 36 | try: 37 | return not math.isinf(x) 38 | except TypeError: 39 | return False 40 | -------------------------------------------------------------------------------- /doc/workflow/examples/example7.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | import os.path 3 | import os 4 | currdir = os.path.dirname(os.path.abspath(__file__))+os.sep 5 | 6 | import sys 7 | if sys.platform.startswith('win'): 8 | INPUT = open('example7.txt','r') 9 | for line in INPUT: 10 | sys.stdout.write(line) 11 | INPUT.close() 12 | else: 13 | 14 | # @ex: 15 | class TaskH(pyutilib.workflow.Task): 16 | 17 | def __init__(self, *args, **kwds): 18 | """Constructor.""" 19 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 20 | self.inputs.declare('dir') 21 | self.outputs.declare('list') 22 | self.add_resource(pyutilib.workflow.ExecutableResource('ls')) 23 | 24 | def execute(self): 25 | self.resource('ls').run(self.dir, logfile=currdir+'logfile') 26 | self.list = [] 27 | INPUT = open(currdir+'logfile','r') 28 | for line in INPUT: 29 | self.list.append( line.strip() ) 30 | INPUT.close() 31 | self.list.sort() 32 | 33 | H = TaskH() 34 | w = pyutilib.workflow.Workflow() 35 | w.add(H) 36 | print(w(dir=currdir+'dummy')) 37 | # @:ex 38 | 39 | if os.path.exists(currdir+'logfile'): 40 | os.remove(currdir+'logfile') 41 | -------------------------------------------------------------------------------- /pyutilib/th/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | from pyutilib.th.pyunit import TestCase, TestResult, TestSuite, TextTestRunner, main, nottest, category 11 | try: 12 | from pyutilib.th.pyunit import skip, skipIf, skipUnless, expectedFailure, SkipTest 13 | except: 14 | pass 15 | 16 | try: 17 | import pyutilib.th.nose_testdata 18 | except ImportError: 19 | pass 20 | try: 21 | import pyutilib.th.nose_gc 22 | except ImportError: 23 | pass 24 | try: 25 | import pyutilib.th.nose_timeout 26 | except ImportError: 27 | pass 28 | 29 | 30 | mock_available = False 31 | try: 32 | from unittest import mock 33 | 34 | mock_available = True 35 | except ImportError: 36 | try: 37 | import mock 38 | 39 | mock_available = True 40 | except ImportError: 41 | pass 42 | -------------------------------------------------------------------------------- /pyutilib/workflow/tests/test3.txt: -------------------------------------------------------------------------------- 1 | { 'A_TYPE': 'Port', 2 | 'Mode': 'inputs', 3 | 'Name': 'Task1-inputs', 4 | 'Owner': 'Task1 prev: [2] next: [] resources: []', 5 | 'x': { 'A_TYPE': 'Port', 6 | 'Action': 'store', 7 | 'Connections': { 'Inputs': [ 'DirectConnector: from=(2) to=(1) False'], 'Outputs': []}, 8 | 'Constant': 'False', 9 | 'Name': 'x', 10 | 'Optional': 'False', 11 | 'Ready': 'False', 12 | 'Task': '1', 13 | 'Value': 'None'}, 14 | 'y': { 'A_TYPE': 'Port', 15 | 'Action': 'store', 16 | 'Connections': { 'Inputs': [], 'Outputs': []}, 17 | 'Constant': 'False', 18 | 'Name': 'y', 19 | 'Optional': 'False', 20 | 'Ready': 'False', 21 | 'Task': '1', 22 | 'Value': 'None'}} 23 | { 'A_TYPE': 'Port', 24 | 'Mode': 'outputs', 25 | 'Name': 'Task1-outputs', 26 | 'Owner': 'Task1 prev: [2] next: [] resources: []', 27 | 'z': { 'A_TYPE': 'Port', 28 | 'Action': 'store', 29 | 'Connections': { 'Inputs': [], 'Outputs': []}, 30 | 'Constant': 'False', 31 | 'Name': 'z', 32 | 'Optional': 'False', 33 | 'Ready': 'False', 34 | 'Task': '1', 35 | 'Value': 'None'}} 36 | -------------------------------------------------------------------------------- /doc/workflow/examples/example7a.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | import os.path 3 | import os 4 | currdir = os.path.dirname(os.path.abspath(__file__))+os.sep 5 | 6 | import sys 7 | if sys.platform.startswith('win'): 8 | INPUT = open('example7a.txt','r') 9 | for line in INPUT: 10 | sys.stdout.write(line) 11 | INPUT.close() 12 | else: 13 | 14 | # @ex: 15 | class TaskH(pyutilib.workflow.Task): 16 | 17 | def __init__(self, *args, **kwds): 18 | """Constructor.""" 19 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 20 | self.inputs.declare('dir') 21 | self.outputs.declare('list') 22 | self.add_resource(pyutilib.workflow.ExecutableResource(executable='/bin/ls')) 23 | 24 | def execute(self): 25 | self.resource('ls').run(self.dir, logfile=currdir+'logfile', debug=True) 26 | self.list = [] 27 | INPUT = open(currdir+'logfile','r') 28 | for line in INPUT: 29 | self.list.append( line.strip() ) 30 | INPUT.close() 31 | self.list.sort() 32 | 33 | H = TaskH() 34 | w = pyutilib.workflow.Workflow() 35 | w.add(H) 36 | print(w(dir=currdir+'dummy')) 37 | # @:ex 38 | 39 | if os.path.exists(currdir+'logfile'): 40 | os.remove(currdir+'logfile') 41 | -------------------------------------------------------------------------------- /pyutilib/autotest/json_plugin.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | 11 | try: 12 | import json 13 | json_available = True 14 | except: #pragma:nocover 15 | json_available = False 16 | from pyutilib.component.core import SingletonPlugin, implements 17 | from pyutilib.autotest import plugins 18 | 19 | 20 | class JsonTestParser(SingletonPlugin): 21 | 22 | implements(plugins.ITestParser) 23 | 24 | def __init__(self, **kwds): 25 | SingletonPlugin.__init__(self, **kwds) 26 | self.name = 'json' 27 | 28 | def load_test_config(self, filename): 29 | INPUT = open(filename, 'r') 30 | repn = json.load(INPUT) 31 | INPUT.close() 32 | return repn 33 | 34 | def print_test_config(self, repn): 35 | print(repn) #pragma:nocover 36 | 37 | def enabled(self): 38 | return json_available 39 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/test_method.py: -------------------------------------------------------------------------------- 1 | # 2 | # Unit Tests for util/method 3 | # 4 | # 5 | 6 | import pyutilib.th as unittest 7 | import pyutilib.misc 8 | 9 | 10 | class MethodDebug(unittest.TestCase): 11 | 12 | def test_add_method(self): 13 | # Verify that we can add a method to a class 14 | class A(object): 15 | 16 | def __init__(self): 17 | pass 18 | 19 | def foo(self, x): 20 | return (x,) 21 | 22 | a = A() 23 | pyutilib.misc.add_method(a, foo) 24 | self.assertEqual(a.foo("a"), ("a",)) 25 | pyutilib.misc.add_method(a, foo, "bar") 26 | self.assertEqual(a.bar("b"), ("b",)) 27 | 28 | def test_add_method_by_name(self): 29 | # Verify that we can add a method to a class 30 | class A(object): 31 | 32 | def __init__(self): 33 | pass 34 | 35 | def foo(self, x): 36 | return (x,) 37 | 38 | a = A() 39 | pyutilib.misc.add_method_by_name(a, "foo", locals=locals()) 40 | self.assertEqual(a.foo("a"), ("a",)) 41 | pyutilib.misc.add_method_by_name(a, "foo", "bar", locals=locals()) 42 | self.assertEqual(a.bar("b"), ("b",)) 43 | 44 | 45 | if __name__ == "__main__": 46 | unittest.main() 47 | -------------------------------------------------------------------------------- /doc/workflow/examples/example4.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | 3 | class TaskA(pyutilib.workflow.Task): 4 | 5 | def __init__(self, *args, **kwds): 6 | """Constructor.""" 7 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 8 | self.inputs.declare('x') 9 | self.inputs.declare('y') 10 | self.outputs.declare('z') 11 | 12 | def execute(self): 13 | """Compute the sum of the inputs.""" 14 | self.z = self.x + self.y 15 | 16 | class TaskC(pyutilib.workflow.Task): 17 | 18 | def __init__(self, *args, **kwds): 19 | """Constructor.""" 20 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 21 | self.inputs.declare('X') 22 | self.inputs.declare('y') 23 | self.outputs.declare('W') 24 | self.outputs.declare('Z') 25 | 26 | def execute(self): 27 | """Compute the sum of the inputs.""" 28 | self.W = self.X+self.y 29 | self.Z = 2*self.W 30 | 31 | # @ex: 32 | A = TaskA() 33 | C = TaskC() 34 | A.inputs.x = C.outputs.Z 35 | 36 | w1 = pyutilib.workflow.Workflow() 37 | w1.add(A) 38 | 39 | AA = TaskA() 40 | AA.inputs.x = w1.outputs.W 41 | AA.inputs.y = w1.outputs.z 42 | 43 | w2 = pyutilib.workflow.Workflow() 44 | w2.add(AA) 45 | 46 | print(w2(X=1, y=3)) 47 | # @:ex 48 | -------------------------------------------------------------------------------- /doc/workflow/examples/tasks_yz.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | import pyutilib.component.core 3 | 4 | # @class: 5 | class PluginTaskZ(pyutilib.workflow.TaskPlugin): 6 | 7 | pyutilib.component.core.alias('TaskZ') 8 | 9 | def __init__(self, *args, **kwds): 10 | """Constructor.""" 11 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 12 | self.inputs.declare('x') 13 | self.inputs.declare('y') 14 | self.add_argument('--x', dest='x', type=int) 15 | self.add_argument('--y', dest='y', type=int) 16 | self.outputs.declare('z') 17 | 18 | def execute(self): 19 | """Compute the sum of the inputs.""" 20 | self.z = self.x + self.y 21 | 22 | class PluginTaskY(pyutilib.workflow.TaskPlugin): 23 | 24 | pyutilib.component.core.alias('TaskY') 25 | 26 | def __init__(self, *args, **kwds): 27 | """Constructor.""" 28 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 29 | self.inputs.declare('X') 30 | self.inputs.declare('Y') 31 | self.add_argument('--X', dest='X', type=int) 32 | self.add_argument('--Y', dest='Y', type=int) 33 | self.outputs.declare('Z') 34 | 35 | def execute(self): 36 | """Compute the sum of the inputs.""" 37 | self.Z = self.X * self.Y 38 | # @:class 39 | -------------------------------------------------------------------------------- /examples/autotest/example1.yml: -------------------------------------------------------------------------------- 1 | driver: example 2 | 3 | python: 4 | - import example 5 | 6 | solvers: 7 | cat: 8 | cat2: 9 | name: cat 10 | cat_options: -n 11 | echo: 12 | 13 | problems: 14 | p1: 15 | file: README.txt 16 | p2: 17 | file: example.py 18 | p3: 19 | file: LoremIpsum1.txt 20 | 21 | suites: 22 | 23 | suite1: 24 | categories: 25 | - smoke 26 | - suite1 27 | solvers: 28 | cat: 29 | cat2: 30 | echo: 31 | problems: 32 | p1: 33 | 34 | suite2: 35 | categories: 36 | - nightly 37 | - suite2 38 | solvers: 39 | cat: 40 | cat2: 41 | echo: 42 | problems: 43 | p1: 44 | p2: 45 | p3: 46 | tests: 47 | - solver: cat 48 | problem: p1 49 | - solver: cat2 50 | problem: p2 51 | - solver: echo 52 | problem: p3 53 | 54 | suite3: 55 | categories: 56 | - suite3 57 | solvers: 58 | cat: 59 | catx: 60 | solver: cat 61 | cat_options: -n 62 | problems: 63 | p1: 64 | 65 | -------------------------------------------------------------------------------- /doc/workflow/examples/example9b.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | 3 | # @code: 4 | class TaskA(pyutilib.workflow.Task): 5 | 6 | def __init__(self, *args, **kwds): 7 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 8 | self.inputs.declare('x', constant=True) 9 | self.inputs.declare('y') 10 | self.outputs.declare('z') 11 | 12 | def execute(self): 13 | """Compute the sum of the inputs.""" 14 | self.z = self.x + self.y 15 | 16 | class TaskZ(pyutilib.workflow.Task): 17 | 18 | def __init__(self, *args, **kwds): 19 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 20 | self.inputs.declare('z', action='store_any') 21 | self.outputs.declare('z', self.inputs.z) 22 | 23 | def execute(self): 24 | pass 25 | 26 | B = pyutilib.workflow.TaskFactory('workflow.switch') 27 | A1 = TaskA() 28 | A1.inputs.x = 1 29 | B.add_branch('a', A1) 30 | A2 = TaskA() 31 | A2.inputs.x = -2 32 | B.add_branch('b', A2) 33 | Z = TaskZ() 34 | Z.inputs.z = A1.outputs.z 35 | Z.inputs.z = A2.outputs.z 36 | w = pyutilib.workflow.Workflow() 37 | w.add(B) 38 | 39 | print("Branch a") 40 | print(w(value='a', y=100)) 41 | w.reset() 42 | print("Branch b") 43 | print(w(value='b', y=100)) 44 | # @:code 45 | 46 | try: 47 | print(w(value='c', y=100)) 48 | except ValueError: 49 | pass 50 | 51 | -------------------------------------------------------------------------------- /pyutilib/dev/entry_point.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | import sys 11 | from pyutilib.subprocess import run 12 | 13 | def run_entry_point(package, script, args=[], **kwds): 14 | """Run the named entry point script from the specified package 15 | 16 | Args: 17 | package (str): The name of the Python package 18 | script (str): The name of the entry point script to run 19 | args (list): The list of command line arguments to pass the script 20 | **kwds: Any additional arguments to pass to pyutilib.subprocess.run 21 | """ 22 | package = str(package) 23 | script = str(script) 24 | assert type(args) is list 25 | cmdLine \ 26 | = "import pkg_resources,sys; "\ 27 | "sys.argv=%r; "\ 28 | "sys.exit(pkg_resources.load_entry_point(%r,'console_scripts',%r)())" \ 29 | % ( [script]+args, package, script ) 30 | run([sys.executable, '-c', cmdLine], **kwds) 31 | -------------------------------------------------------------------------------- /pyutilib/component/config/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | """ 10 | The pyutilib.component.config package includes utilities to configure 11 | the PyUtilib Component Architecture. This includes facilities for using 12 | configuration files, controlling logging, and specifying component options. 13 | """ 14 | 15 | from pyutilib.component.core import PluginGlobals 16 | PluginGlobals.add_env("pca") 17 | 18 | from pyutilib.component.config.env_config import EnvironmentConfig 19 | from pyutilib.component.config.options import ExecutableOption, declare_option, Option 20 | from pyutilib.component.config.managed_plugin import ManagedPlugin, ManagedSingletonPlugin 21 | from pyutilib.component.config.configuration import Configuration, ConfigurationError 22 | from pyutilib.component.config.logging_config import LoggingConfig 23 | from pyutilib.component.config.tempfiles import ITempfileManager, TempfileManagerPlugin, TempfileManager 24 | import pyutilib.component.config.plugin_ConfigParser 25 | 26 | PluginGlobals.pop_env() 27 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/test_hierarchical_timer.py: -------------------------------------------------------------------------------- 1 | from pyutilib.misc.timing import HierarchicalTimer 2 | import pyutilib.th as unittest 3 | 4 | 5 | class TestHierarchicalTimer(unittest.TestCase): 6 | def test_hierarchical_timer(self): 7 | timer = HierarchicalTimer() 8 | timer.start('all') 9 | for i in range(10): 10 | timer.start('a') 11 | for i in range(5): 12 | timer.start('aa') 13 | timer.stop('aa') 14 | timer.start('ab') 15 | timer.stop('ab') 16 | timer.stop('a') 17 | timer.start('b') 18 | timer.stop('b') 19 | timer.start('a') 20 | with self.assertRaisesRegex(ValueError, 'all is not the currently active timer. The only timer that can currently be stopped is all.a'): 21 | timer.stop('all') 22 | timer.stop('a') 23 | timer.stop('all') 24 | 25 | a_percent = timer.get_relative_percent_time('all.a') 26 | aa_percent = timer.get_relative_percent_time('all.a.aa') 27 | aa_total_percent = timer.get_total_percent_time('all.a.aa') 28 | self.assertAlmostEqual(aa_total_percent, a_percent/100 * aa_percent/100 * 100) 29 | self.assertAlmostEqual(timer.get_num_calls('all.a'), 11) 30 | self.assertAlmostEqual(timer.get_num_calls('all.a.ab'), 10) 31 | self.assertAlmostEqual(timer.get_num_calls('all.a.aa'), 50) 32 | timer.get_total_time('all.b') 33 | print(timer) 34 | -------------------------------------------------------------------------------- /doc/workflow/examples/example5.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | import math 3 | 4 | # @class: 5 | class TaskD(pyutilib.workflow.Task): 6 | 7 | def __init__(self, *args, **kwds): 8 | """Constructor.""" 9 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 10 | self.inputs.declare('x', action='append') 11 | self.outputs.declare('z') 12 | 13 | def execute(self): 14 | """Compute the sum of the inputs.""" 15 | self.z = sum(self.x) 16 | # @:class 17 | 18 | # @usage: 19 | class TaskE(pyutilib.workflow.Task): 20 | 21 | def __init__(self, *args, **kwds): 22 | """Constructor.""" 23 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 24 | self.inputs.declare('Y') 25 | self.outputs.declare('Z') 26 | 27 | def execute(self): 28 | """Compute the sum of the inputs.""" 29 | self.Z = int(math.floor(self.Y/7.0)) 30 | 31 | D = TaskD() 32 | 33 | # there is currently an issue with memory leaks and the workflow/task/port structure. 34 | # to correct this issue in the interim, all tasks that are to be retained in memory 35 | # (not garbage collected) should be referenced by the user. thus, the introduction of 36 | # e_tasks. ultimately, the workflow should own a reference to all composite tasks. 37 | e_tasks = [] 38 | 39 | for i in range(100): 40 | E = TaskE() 41 | e_tasks.append(E) 42 | D.inputs.x = E.outputs.Z 43 | 44 | w = pyutilib.workflow.Workflow() 45 | w.add(D) 46 | print(w(Y=100)) 47 | # @:usage 48 | -------------------------------------------------------------------------------- /examples/autotest/example.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | 11 | import pyutilib.autotest 12 | from pyutilib.component.core import alias 13 | import pyutilib.subprocess 14 | 15 | 16 | class ExampleTestDriver(pyutilib.autotest.TestDriverBase): 17 | """ 18 | This test driver executes a unix command and compares its output 19 | with a baseline value. 20 | """ 21 | 22 | alias('example') 23 | 24 | def run_test(self, testcase, name, options): 25 | """Execute a single test in the suite""" 26 | name = options.suite+'_'+name 27 | cmd = options.solver+' ' 28 | if not options.cat_options is None: 29 | cmd += options.cat_options+' ' 30 | cmd += options.file 31 | print( "Running test suite '%s' test '%s' command '%s'" % \ 32 | (options.suite, name, cmd)) 33 | pyutilib.subprocess.run(cmd, outfile=options.currdir+'test_'+name+".out") 34 | testcase.failUnlessFileEqualsBaseline( 35 | options.currdir+'test_'+name+".out", 36 | options.currdir+'test_'+name+".txt") 37 | -------------------------------------------------------------------------------- /doc/workflow/workflow.tex: -------------------------------------------------------------------------------- 1 | % NOTES: 2 | % 3 | 4 | % TODO: should we stick with LaTeX documentation? It might make sense 5 | % to migrate to reStructured text, since that is a Python standard and 6 | % since it can generate LaTeX. We'll have to decide that sometime soon. 7 | 8 | \documentclass[12pt]{article} 9 | 10 | \usepackage{fullpage} 11 | \usepackage[authoryear]{natbib} 12 | \usepackage{listings} 13 | \usepackage{url} 14 | \usepackage[usenames]{color} 15 | \usepackage{graphicx} 16 | 17 | \bibpunct{[}{]}{,}{n}{}{} 18 | \include{macros} 19 | \include{example_macros} 20 | 21 | \widowpenalty=3000 22 | \clubpenalty=3000 23 | 24 | 25 | \begin{document} 26 | 27 | \title{Managing Scientific Workflows in Python with \code{pyutilib.workflow}} 28 | 29 | \author{William E.\ Hart\footnote{Sandia National Laboratories, 30 | Data Analysis and Informatics Department, 31 | PO Box 5800, Albuquerque, NM 87185; 32 | {\tt wehart@sandia.gov}} 33 | } 34 | 35 | \date{\today} 36 | 37 | \maketitle 38 | 39 | \begin{abstract} 40 | \input{abstract} 41 | \end{abstract} 42 | 43 | 44 | \lstset{language=Python} 45 | \definecolor{light-gray}{gray}{0.9} 46 | \lstset{backgroundcolor=\color{light-gray}} 47 | \lstset{aboveskip=1em,belowskip=1em,showspaces=false,showstringspaces=false} 48 | 49 | \newpage 50 | 51 | \input{workflow-intro} 52 | \input{workflow-doc} 53 | \input{workflow-disc} 54 | 55 | \section*{Acknowledgements} 56 | 57 | \input{acknow} 58 | 59 | 60 | \bibliographystyle{siam} 61 | \bibliography{coopr} 62 | 63 | \end{document} 64 | 65 | -------------------------------------------------------------------------------- /pyutilib/autotest/default_testdriver.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | 11 | import sys 12 | from pyutilib.component.core import Plugin, implements, alias 13 | from pyutilib.autotest import plugins 14 | 15 | 16 | class DefaultTestDriver(Plugin): 17 | """ 18 | This is the 'default' test driver, which simply prints the 19 | arguments being passed into a test. 20 | """ 21 | 22 | implements(plugins.ITestDriver) 23 | alias('default') 24 | 25 | def setUpClass(self, cls, options): 26 | """Set-up the class that defines the suite of tests""" 27 | 28 | def tearDownClass(self, cls, options): 29 | """Tear-down the class that defines the suite of tests""" 30 | 31 | def setUp(self, testcase, options): 32 | """Set-up a single test in the suite""" 33 | 34 | def tearDown(self, testcase, options): 35 | """Tear-down a single test in the suite""" 36 | sys.stdout.flush() 37 | 38 | def run_test(self, testcase, name, options): 39 | """Execute a single test in the suite""" 40 | print('run_test ' + name) 41 | print(options) 42 | -------------------------------------------------------------------------------- /pyutilib/workflow/resource.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | __all__ = ['Resource'] 11 | 12 | from pyutilib.workflow import globals 13 | 14 | 15 | class Resource(object): 16 | 17 | def __init__(self, id=None, name=None): 18 | if not id is None: 19 | # TBD: does this ever happen? 20 | self.id = id 21 | else: 22 | self.id = globals.unique_id() 23 | if name is None: 24 | self.description = "Resource" + str(self.id) 25 | self.name = self.description 26 | else: 27 | # TBD: does this ever happen? 28 | self.description = name 29 | self.name = name 30 | self._busy = False 31 | 32 | def available(self): 33 | return not self._busy #pragma:nocover 34 | 35 | def lock(self): 36 | self._busy = True #pragma:nocover 37 | 38 | def unlock(self): 39 | self._busy = False #pragma:nocover 40 | 41 | def __repr__(self): 42 | return str(self) #pragma:nocover 43 | 44 | def __str__(self): 45 | return "%s" % str(self.name) #pragma:nocover 46 | -------------------------------------------------------------------------------- /doc/workflow/examples/test_example.py: -------------------------------------------------------------------------------- 1 | # Imports 2 | import pyutilib.th as unittest 3 | import glob 4 | import os 5 | from os.path import dirname, abspath, abspath, basename 6 | import sys 7 | 8 | currdir = dirname(abspath(__file__))+os.sep 9 | datadir = currdir 10 | 11 | def filter(line): 12 | return 'Running' in line or "IGNORE" in line or line.startswith('usage:') or 'Sub-commands' in line 13 | 14 | # Declare an empty TestCase class 15 | class Test(unittest.TestCase): 16 | pass 17 | 18 | # Find all example*.py files, and use them to define baseline tests 19 | for file in glob.glob(datadir+'example*.py'): 20 | bname = basename(file) 21 | name=bname.split('.')[0] 22 | # 23 | # We use add_baseline_test instead of add_import_test because the latter does not seem to 24 | # work when running with nosetests 25 | # 26 | if not os.path.exists(datadir+name+'.txt'): 27 | sys.stderr.write("WARNING: no baseline available for file "+file) 28 | else: 29 | Test.add_import_test(name=name, cwd=datadir, baseline=datadir+name+'.txt', filter=filter) 30 | 31 | if not sys.platform.startswith('win'): 32 | # Find all *.sh files, and use them to define baseline tests 33 | for file in glob.glob(datadir+'*.sh'): 34 | bname = basename(file) 35 | name=bname.split('.')[0] 36 | Test.add_baseline_test(cmd='cd %s; /usr/bin/env bash %s' % (datadir, file), baseline=datadir+name+'.txt', name=name, filter=filter) 37 | 38 | # Execute the tests 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /pyutilib/misc/format_io.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | 11 | def format_float(x, precision=None): 12 | """ 13 | Format float in a portable manner, standardizing the 14 | number of digits in the exponent. 15 | """ 16 | if not type(x) is float: 17 | raise TypeError("Argument " + str(x) + " is not a float") 18 | tmp = str(x) 19 | if not ("E" in tmp or "e" in tmp): 20 | return tmp 21 | if "+" in tmp: 22 | sign = "+" 23 | else: 24 | sign = "-" 25 | lst = tmp.split(sign) 26 | if lst[0] == "" and len(lst) >= 2: 27 | lst[1] = sign + lst[1] 28 | lst = lst[1:] 29 | if abs(x) <= 1e-100 or abs(x) >= 1e100: 30 | return tmp 31 | else: 32 | # 33 | # Use a 2-digit exponent 34 | # 35 | i = 0 36 | while lst[1][i] == '0': 37 | i += 1 38 | return lst[0] + sign + lst[1][i:] 39 | 40 | 41 | def format_io(x): 42 | """ 43 | Filter function for controlling the format of objects 44 | """ 45 | if type(x) is float: 46 | return format_float(x) 47 | return str(x) 48 | -------------------------------------------------------------------------------- /doc/workflow/examples/example8.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | 3 | # @class: 4 | class TaskA(pyutilib.workflow.Task): 5 | 6 | def __init__(self, *args, **kwds): 7 | """Constructor.""" 8 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 9 | self.inputs.declare('z') 10 | self.outputs.declare('z') 11 | 12 | def execute(self): 13 | """Compute the sum of the inputs.""" 14 | self.z = -1*self.z 15 | 16 | 17 | class TaskB(pyutilib.workflow.Task): 18 | 19 | def __init__(self, *args, **kwds): 20 | """Constructor.""" 21 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 22 | self.inputs.declare('y') 23 | self.outputs.declare('y') 24 | 25 | def execute(self): 26 | """Compute the sum of the inputs.""" 27 | self.y = -1*self.y 28 | 29 | class TaskC(pyutilib.workflow.Task): 30 | 31 | def __init__(self, *args, **kwds): 32 | """Constructor.""" 33 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 34 | self.inputs.declare('x', action='store_any') 35 | self.outputs.declare('x') 36 | 37 | def execute(self): 38 | pass 39 | # @:class 40 | 41 | # @usage: 42 | A = TaskA() 43 | B = TaskB() 44 | 45 | C = pyutilib.workflow.TaskFactory('workflow.branch') 46 | C.add_branch(True, A) 47 | C.add_branch(False, B) 48 | 49 | D = TaskC() 50 | D.inputs.x = A.outputs.z 51 | D.inputs.x = B.outputs.y 52 | 53 | w = pyutilib.workflow.Workflow() 54 | w.add(C) 55 | 56 | print(w(value=True, z=1, y=2)) 57 | w.reset() 58 | print(w(value=False, z=1, y=2)) 59 | # @:usage 60 | -------------------------------------------------------------------------------- /pyutilib/autotest/yaml_plugin.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | 11 | try: 12 | import yaml 13 | using_yaml = True 14 | except ImportError: #pragma:nocover 15 | using_yaml = False 16 | from pyutilib.component.core import SingletonPlugin, implements 17 | from pyutilib.autotest import plugins 18 | import pyutilib.misc 19 | 20 | 21 | class YamlTestParser(SingletonPlugin): 22 | 23 | implements(plugins.ITestParser) 24 | 25 | def __init__(self, **kwds): 26 | SingletonPlugin.__init__(self, **kwds) 27 | self.name = 'yml' 28 | 29 | def load_test_config(self, filename): 30 | if using_yaml: 31 | INPUT = open(filename, 'r') 32 | repn = yaml.load(INPUT, yaml.SafeLoader) 33 | INPUT.close() 34 | return repn 35 | # 36 | # If PyYaml is not available, then we use a simple yaml parser 37 | # 38 | INPUT = open(filename, 'r') 39 | repn = pyutilib.misc.simple_yaml_parser(INPUT) 40 | INPUT.close() 41 | return repn 42 | 43 | def print_test_config(self, repn): 44 | print(repn) #pragma:nocover 45 | 46 | def enabled(self): 47 | return True 48 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/test_cross.py: -------------------------------------------------------------------------------- 1 | # 2 | # Unit Tests for util/math 3 | # 4 | # 5 | 6 | from os.path import abspath, dirname 7 | pkgdir = dirname(abspath(__file__)) + "/../.." 8 | 9 | import pyutilib.th as unittest 10 | import pyutilib.misc 11 | 12 | 13 | class CrossDebug(unittest.TestCase): 14 | 15 | def setUp(self): 16 | self.tmp = [(10, 22, 31), (10, 22, 32), (10, 22, 33), (10, 23, 31), 17 | (10, 23, 32), (10, 23, 33), (11, 22, 31), (11, 22, 32), 18 | (11, 22, 33), (11, 23, 31), (11, 23, 32), (11, 23, 33)] 19 | self.tmp.sort() 20 | 21 | self.ttmp = [(10, 22, 31), (10, 23, 32), (11, 22, 31), (11, 23, 32)] 22 | self.ttmp.sort() 23 | 24 | def test_cross1(self): 25 | # Apply the cross() method 26 | ans = pyutilib.misc.cross(((10, 11), (22, 23), (31, 32, 33))) 27 | ans.sort() 28 | self.assertEqual(ans, self.tmp) 29 | 30 | def test_cross2(self): 31 | # Apply the cross_iter() method 32 | ans = [] 33 | for item in pyutilib.misc.cross_iter((10, 11), (22, 23), (31, 32, 33)): 34 | ans.append(item) 35 | ans.sort() 36 | self.assertEqual(ans, self.tmp) 37 | 38 | def test_cross3(self): 39 | # Apply the flattened_cross_iter() method 40 | ans = [] 41 | for item in pyutilib.misc.flattened_cross_iter((10, 11), ((22, 31), 42 | (23, 32))): 43 | ans.append(item) 44 | ans.sort() 45 | self.assertEqual(ans, self.ttmp) 46 | 47 | 48 | if __name__ == "__main__": 49 | unittest.main() 50 | -------------------------------------------------------------------------------- /pyutilib/pyro/nameserver.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | __all__ = ('start_ns', 'start_nsc') 11 | 12 | import sys 13 | import socket 14 | from pyutilib.pyro.util import set_maxconnections, Pyro, using_pyro4 15 | 16 | 17 | def start_ns(max_allowed_connections=None): 18 | if Pyro is not None: 19 | set_maxconnections(max_allowed_connections=max_allowed_connections) 20 | args = [] 21 | for val in sys.argv[1:]: 22 | if val.startswith("-n") or val.startswith("--host"): 23 | args = list(sys.argv[1:]) 24 | break 25 | else: # execute when no break occurs 26 | args = list(sys.argv[1:]) 27 | args.append("-n") 28 | args.append(str(socket.gethostname())) 29 | Pyro.naming.main(args) 30 | else: 31 | raise ImportError("Pyro or Pyro4 is not installed") 32 | 33 | 34 | def start_nsc(): 35 | if Pyro is not None: 36 | if using_pyro4: 37 | import Pyro4 38 | import Pyro4.nsc 39 | else: 40 | import Pyro 41 | import Pyro.nsc 42 | Pyro.nsc.main(sys.argv[1:]) 43 | else: 44 | raise ImportError("Pyro or Pyro4 is not installed") 45 | -------------------------------------------------------------------------------- /pyutilib/workflow/executable.py: -------------------------------------------------------------------------------- 1 | __all__ = ['ExecutableResource'] 2 | 3 | import os.path 4 | from pyutilib.workflow import resource 5 | import pyutilib.services 6 | import pyutilib.subprocess 7 | 8 | # TODO: add support for logging 9 | 10 | 11 | class ExecutableResource(resource.Resource): 12 | 13 | def __init__(self, name=None, executable=None): 14 | resource.Resource.__init__(self) 15 | if name is None and not executable is None: 16 | name = os.path.basename(executable) 17 | if executable is None: 18 | executable = name 19 | self.register(name, executable) 20 | 21 | def register(self, name, executable): 22 | self.filename = executable 23 | if name is None: 24 | # TBD: when is this branch executed? 25 | self.description = "Executable" + self.id 26 | self.name = self.description 27 | else: 28 | self.description = "Executable_" + name 29 | self.name = name 30 | pyutilib.services.register_executable(executable) 31 | 32 | def run(self, args, logfile=None, debug=False): 33 | executable = pyutilib.services.registered_executable(self.filename) 34 | if executable is None: 35 | # TBD: tests generating this error do not cause global exceptions in a workflow ... 36 | raise IOError("Cannot find executable '%s'" % self.filename) 37 | cmd = executable.get_path() + " " + args 38 | if debug: 39 | print("Running... %s" % cmd) 40 | pyutilib.subprocess.run(cmd, outfile=logfile) 41 | 42 | def available(self): 43 | return not pyutilib.services.registered_executable( 44 | self.filename) is None 45 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2008 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the Sandia National Laboratories nor the names of 17 | its contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 26 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /doc/workflow/examples/example6.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | 3 | # @ex: 4 | class TaskF1(pyutilib.workflow.Task): 5 | 6 | def __init__(self, *args, **kwds): 7 | """Constructor.""" 8 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 9 | self.inputs.declare('a',) 10 | self.inputs.declare('aval') 11 | self.outputs.declare('a', self.inputs.a) 12 | self.outputs.declare('aval', self.inputs.aval) 13 | 14 | def execute(self): 15 | pass 16 | 17 | class TaskF2(pyutilib.workflow.Task): 18 | 19 | def __init__(self, *args, **kwds): 20 | """Constructor.""" 21 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 22 | self.inputs.declare('A',) 23 | self.inputs.declare('Aval') 24 | self.outputs.declare('A', self.inputs.A) 25 | self.outputs.declare('Aval', self.inputs.Aval) 26 | 27 | def execute(self): 28 | pass 29 | 30 | class TaskG(pyutilib.workflow.Task): 31 | 32 | def __init__(self, *args, **kwds): 33 | """Constructor.""" 34 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 35 | self.inputs.declare('x', action='map') 36 | self.inputs.declare('y', action='map') 37 | self.outputs.declare('z') 38 | 39 | def execute(self): 40 | """Compute the sum of the inputs.""" 41 | self.z = {} 42 | for key in self.x: 43 | self.z[ self.x[key] ] = self.y[key] 44 | 45 | F1 = TaskF1() 46 | F2 = TaskF2() 47 | G = TaskG() 48 | G.inputs.x = F1.outputs.a 49 | G.inputs.y = F1.outputs.aval 50 | G.inputs.x = F2.outputs.A 51 | G.inputs.y = F2.outputs.Aval 52 | 53 | w = pyutilib.workflow.Workflow() 54 | w.add(G) 55 | print("IGNORE %s" % str(w(a='a', aval=1, A='A', Aval=2))) 56 | # @:ex 57 | -------------------------------------------------------------------------------- /doc/workflow/examples/example6a.py: -------------------------------------------------------------------------------- 1 | import pyutilib.workflow 2 | 3 | # @ex: 4 | class TaskF1(pyutilib.workflow.Task): 5 | 6 | def __init__(self, *args, **kwds): 7 | """Constructor.""" 8 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 9 | self.inputs.declare('a',) 10 | self.inputs.declare('aval') 11 | self.outputs.declare('a', self.inputs.a) 12 | self.outputs.declare('aval', self.inputs.aval) 13 | 14 | def execute(self): 15 | pass 16 | 17 | class TaskF2(pyutilib.workflow.Task): 18 | 19 | def __init__(self, *args, **kwds): 20 | """Constructor.""" 21 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 22 | self.inputs.declare('A',) 23 | self.inputs.declare('Aval') 24 | self.outputs.declare('A', self.inputs.A) 25 | self.outputs.declare('Aval', self.inputs.Aval) 26 | 27 | def execute(self): 28 | pass 29 | 30 | class TaskG(pyutilib.workflow.Task): 31 | 32 | def __init__(self, *args, **kwds): 33 | """Constructor.""" 34 | pyutilib.workflow.Task.__init__(self, *args, **kwds) 35 | self.inputs.declare('x', action='map') 36 | self.inputs.declare('y', action='map') 37 | self.outputs.declare('z') 38 | 39 | def execute(self): 40 | """Compute the sum of the inputs.""" 41 | self.z = {} 42 | for key in self.x: 43 | self.z[ self.x[key] ] = self.y[key] 44 | 45 | F1 = TaskF1() 46 | F2 = TaskF2() 47 | G = TaskG() 48 | G.inputs.x = F1.outputs.a 49 | G.inputs.y = F1.outputs.aval 50 | G.inputs.x = F2.outputs.A 51 | G.inputs.y = F2.outputs.Aval 52 | 53 | w = pyutilib.workflow.Workflow() 54 | w.add(G) 55 | print("IGNORE %s" % str(w(a='a', aval=1, A='A', Aval=2))) 56 | # @:ex 57 | -------------------------------------------------------------------------------- /examples/autotest/test_suite2_cat2_p2.txt: -------------------------------------------------------------------------------- 1 | 1 # _________________________________________________________________________ 2 | 2 # 3 | 3 # PyUtilib: A Python utility library. 4 | 4 # Copyright (c) 2008 Sandia Corporation. 5 | 5 # This software is distributed under the BSD License. 6 | 6 # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | 7 # the U.S. Government retains certain rights in this software. 8 | 8 # _________________________________________________________________________ 9 | 9 # 10 | 10 11 | 11 import pyutilib.autotest 12 | 12 from pyutilib.component.core import * 13 | 13 import pyutilib.subprocess 14 | 14 15 | 15 16 | 16 class ExampleTestDriver(pyutilib.autotest.TestDriverBase): 17 | 17 """ 18 | 18 This test driver executes a unix command and compares its output 19 | 19 with a baseline value. 20 | 20 """ 21 | 21 22 | 22 alias('example') 23 | 23 24 | 24 def run_test(self, testcase, name, options): 25 | 25 """Execute a single test in the suite""" 26 | 26 name = options.suite+'_'+name 27 | 27 cmd = options.solver+' ' 28 | 28 if not options.cat_options is None: 29 | 29 cmd += options.cat_options+' ' 30 | 30 cmd += options.file 31 | 31 print "Running test suite '%s' test '%s' command '%s'" % \ 32 | 32 (options.suite, name, cmd) 33 | 33 pyutilib.subprocess.run(cmd, outfile=options.currdir+'test_'+name+".out") 34 | 34 testcase.failUnlessFileEqualsBaseline( 35 | 35 options.currdir+'test_'+name+".out", 36 | 36 options.currdir+'test_'+name+".txt") 37 | 37 38 | -------------------------------------------------------------------------------- /pyutilib/dev/checkCopyright.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # A script that verifies that suitable copyright statements are 4 | # defined in files. 5 | # 6 | 7 | import sys 8 | import os 9 | import re 10 | 11 | suffixes = ['.c', '.cc', '.h', '.H', '.cpp', '.py'] 12 | 13 | 14 | def recurse(dir): 15 | for root, dirnames, filenames in os.walk(dir): 16 | for filename in filenames: 17 | for suffix in suffixes: 18 | if filename.endswith(suffix): 19 | yield os.path.join(root, filename) 20 | 21 | 22 | def match(filename, pat): 23 | INPUT = open(filename, 'r') 24 | fstring = INPUT.read() 25 | INPUT.close() 26 | if pat.search(fstring): 27 | return True 28 | return False 29 | 30 | 31 | def main(): 32 | nfiles = 0 33 | badfiles = [] 34 | if sys.argv[1] == '-c': 35 | cfile = sys.argv[2] 36 | files = sys.argv[3:] 37 | INPUT = open(cfile, 'r') 38 | cstring = INPUT.read() 39 | INPUT.close() 40 | pat = re.compile(cstring) 41 | else: 42 | cfile = None 43 | cstring = None 44 | pat = re.compile('Copyright') 45 | files = sys.argv[1:] 46 | for dir_ in files: 47 | for filename in recurse(dir_): 48 | nfiles += 1 49 | if not match(filename, pat): 50 | badfiles.append(filename) 51 | 52 | print("Total number of files missing copyright: " + str(len(badfiles))) 53 | print("Total number of files checked: " + str(nfiles)) 54 | if len(badfiles) > 0: 55 | print("") 56 | print("Bad Files") 57 | print("-" * 40) 58 | for filename in badfiles: 59 | print(filename) 60 | 61 | 62 | if __name__ == '__main__': 63 | main() 64 | -------------------------------------------------------------------------------- /pyutilib/common/_exceptions.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | import sys 11 | 12 | __all__ = ['ConfigurationError', 'ApplicationError', 'BadDebuggingValue'] 13 | 14 | 15 | class WindowsError_def(Exception): 16 | """ 17 | An exception used there is an error configuring a package. 18 | """ 19 | 20 | def __init__(self, *args, **kargs): 21 | Exception.__init__(self, *args, **kargs) #pragma:nocover 22 | 23 | 24 | if (sys.platform[0:3] != "win"): 25 | WindowsError = WindowsError_def 26 | else: 27 | WindowsError = WindowsError 28 | __all__.append("WindowsError") 29 | 30 | 31 | class ConfigurationError(Exception): 32 | """ 33 | An exception used there is an error configuring a package. 34 | """ 35 | 36 | def __init__(self, *args, **kargs): 37 | Exception.__init__(self, *args, **kargs) #pragma:nocover 38 | 39 | 40 | class ApplicationError(Exception): 41 | """ 42 | An exception used when an external application generates an error. 43 | """ 44 | 45 | def __init__(self, *args, **kargs): 46 | Exception.__init__(self, *args, **kargs) #pragma:nocover 47 | 48 | 49 | class BadDebuggingValue(Exception): 50 | """ 51 | An exception used when a bad debugging value is used. 52 | """ 53 | 54 | def __init__(self, *args, **kargs): 55 | Exception.__init__(self, *args, **kargs) #pragma:nocover 56 | -------------------------------------------------------------------------------- /pyutilib/misc/method.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | 11 | def add_method(self, method, name=None): 12 | """ 13 | Add a method to a class: 14 | 15 | self - the object that is modified 16 | method - a function 17 | name - a string that describes the new method name 18 | 19 | Adapted from code submitted by Moshe Zadka to the 20 | ActiveState Programmer Network http://aspn.activestate.com 21 | """ 22 | if name is None: 23 | name = method.__name__ 24 | 25 | class new(self.__class__): 26 | pass 27 | 28 | setattr(new, name, method) 29 | self.__class__ = new 30 | return getattr(self, name) 31 | 32 | 33 | def add_method_by_name(self, 34 | method_name, 35 | name=None, 36 | globals=globals(), 37 | locals=None): 38 | """ 39 | Add a method to a class given a function class 40 | 41 | self - the object that is modified 42 | method_name - the name of a function 43 | name - a string that describes the new method name 44 | globals - the global dictionary 45 | locals - the local dictionary 46 | 47 | Adapted from code submitted by Moshe Zadka to the 48 | ActiveState Programmer Network http://aspn.activestate.com 49 | """ 50 | add_method(self, eval(method_name, globals, locals), name) 51 | -------------------------------------------------------------------------------- /examples/pyro/factorize: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from pyutilib.pyro import Client, Task 4 | import random 5 | import sys 6 | 7 | NUMBER_OF_ITEMS = 40 8 | 9 | numbers = {} 10 | 11 | def processResult(item): 12 | print "Got result: %s (from %s)" % (item, item.processedBy) 13 | numbers[item.data] = item.result 14 | 15 | 16 | def main(): 17 | if len(sys.argv) == 2: 18 | host=sys.argv[1] 19 | else: 20 | host=None 21 | client = Client(host=host) 22 | print "\nThis program will calculate Prime Factorials of a bunch of random numbers." 23 | print "The more workers you will start (on different cpus/cores/machines)," 24 | print "the faster you will get the complete list of results!\n" 25 | print "placing work items into dispatcher queue." 26 | for i in range(NUMBER_OF_ITEMS): 27 | number=random.randint(3211, 5000)*random.randint(177,3000)*37 28 | numbers[number] = None 29 | item = Task(data=number) 30 | client.add_task(item) 31 | print "getting results from dispatcher queue." 32 | resultCount=0 33 | while resultCount0: 42 | print "removing leftover results from the dispatcher" 43 | while True: 44 | result = client.get_result() 45 | if not result is None: 46 | processResult(result) 47 | 48 | print "\nComputed Prime Factorials follow:" 49 | for (number, factorials) in numbers.items(): 50 | print number,"-->",factorials 51 | 52 | if __name__=="__main__": 53 | main() 54 | 55 | -------------------------------------------------------------------------------- /pyutilib/component/core/__init__.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | """ 10 | The outline of the PyUtilib Component Architecture (PCA) is adapted from Trac 11 | (see the trac.core module). This framework generalizes the Trac by supporting 12 | multi-environment management of components, as well as non-singleton plugins. 13 | 14 | This package provides a stand-alone module that defines all of the core 15 | aspects of the PCA. Related Python packages define extensions of this 16 | framework that support current component-based applications. 17 | 18 | NOTE: The PCA does not rely on any other part of PyUtilib. Consequently, 19 | this package can be independently used in other projects. 20 | """ 21 | 22 | from pyutilib.component.core.core import ( 23 | Plugin, implements, Interface, CreatePluginFactory, 24 | PluginMeta, alias, ExtensionPoint, SingletonPlugin, 25 | PluginFactory, PluginError, PluginGlobals, with_metaclass, 26 | IPluginLoader, IPluginLoadPath, IIgnorePluginWhenLoading, 27 | IOptionDataProvider, PluginEnvironment 28 | ) 29 | 30 | # 31 | # This declaration is here because this is a convenient place where 32 | # all symbols in this module have been defined. 33 | # 34 | 35 | class IgnorePluginPlugins(SingletonPlugin): 36 | """Ignore plugins from the pyutilib.component module""" 37 | 38 | implements(IIgnorePluginWhenLoading) 39 | 40 | def ignore(self, name): 41 | return name in globals() 42 | -------------------------------------------------------------------------------- /pyutilib/misc/gc_manager.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | import gc 11 | 12 | 13 | # PauseGC is a class for clean, scoped management of the Python 14 | # garbage collector. To disable the GC for the duration of a 15 | # scoped block use PauseGC in combination with the Python 'with' 16 | # statement. E.g., 17 | # 18 | # def my_func(): 19 | # with PauseGC() as pgc: 20 | # [...] 21 | # 22 | # When the instance falls out of scope (by termination or exception), 23 | # the GC will be re-enabled (if it was not initially disabled). It is 24 | # safe to nest instances of PauseGC That is, you don't have to worry 25 | # if an outer function/method has its own instance of PauseGC. 26 | class PauseGC(object): 27 | 28 | __slots__ = ("reenable_gc",) 29 | 30 | def __init__(self, pause=True): 31 | self.reenable_gc = False 32 | if pause: 33 | try: 34 | self.reenable_gc = gc.isenabled() 35 | gc.disable() 36 | except NotImplementedError: 37 | # This will only happen if the Python implementation 38 | # doesn't support disabling the GC. 39 | pass 40 | 41 | def __enter__(self): 42 | return self 43 | 44 | def __exit__(self, type, value, traceback): 45 | self.close() 46 | 47 | def close(self): 48 | if self.reenable_gc: 49 | gc.enable() 50 | self.reenable_gc = False 51 | -------------------------------------------------------------------------------- /pyutilib/math/tests/test_numtypes.py: -------------------------------------------------------------------------------- 1 | # 2 | # Unit Tests for numtypes 3 | # 4 | # 5 | 6 | import os 7 | import unittest 8 | import pyutilib.math 9 | 10 | 11 | class NumTypesDebug(unittest.TestCase): 12 | 13 | def test_infinity1(self): 14 | # Check that infinity is defined appropriately 15 | if 1 > pyutilib.math.infinity: 16 | self.fail("test_infinity") 17 | if not ((1.0 / pyutilib.math.infinity) == 0.0): 18 | self.fail("test_infinity - 1/infinity is not zero") 19 | if pyutilib.math.is_finite(pyutilib.math.infinity): 20 | self.fail("test_infinity - infinity is finite") 21 | if pyutilib.math.is_finite(-pyutilib.math.infinity): 22 | self.fail("test_infinity - -infinity is finite") 23 | if not pyutilib.math.is_finite(1.0): 24 | self.fail("test_infinity - 1.0 is not finite") 25 | if pyutilib.math.is_finite(None): 26 | self.fail("test_infinity - None is not infinite") 27 | if pyutilib.math.is_finite('foo'): 28 | self.fail("test_infinity - 'foo' is not infinite") 29 | 30 | def test_nan(self): 31 | # Check that nan is defined appropriately 32 | if not type(pyutilib.math.nan) is type(1.0): 33 | self.fail("test_nan") 34 | if not pyutilib.math.is_nan(pyutilib.math.infinity / 35 | pyutilib.math.infinity): 36 | self.fail("test_nan - infinity/infinity is not NaN") 37 | if pyutilib.math.is_nan(1.0 / pyutilib.math.infinity): 38 | self.fail("test_nan - 1.0/infinity is NaN") 39 | if pyutilib.math.is_nan(None): 40 | self.fail("test_nan - None is not NaN") 41 | if pyutilib.math.is_nan('foo'): 42 | self.fail("test_nan - 'foo' is not NaN") 43 | 44 | 45 | if __name__ == "__main__": 46 | unittest.main() 47 | -------------------------------------------------------------------------------- /pyutilib/component/app/tests/test_simple.py: -------------------------------------------------------------------------------- 1 | # 2 | # Test simple applications 3 | # 4 | 5 | import os 6 | import sys 7 | from os.path import abspath, dirname 8 | currdir = dirname(abspath(__file__)) + os.sep 9 | 10 | import pyutilib.th as unittest 11 | import pyutilib.subprocess 12 | 13 | 14 | class Test(unittest.TestCase): 15 | 16 | def test_app1a(self): 17 | pyutilib.subprocess.run(sys.executable + " " + currdir + os.sep + 18 | "app1a.py " + currdir) 19 | self.assertFileEqualsBaseline(currdir + "config1.out", 20 | currdir + "config1.txt") 21 | 22 | def test_app1b(self): 23 | pyutilib.subprocess.run(sys.executable + " " + currdir + os.sep + 24 | "app1b.py " + currdir) 25 | self.assertFileEqualsBaseline(currdir + "config1.out", 26 | currdir + "config1.txt") 27 | 28 | def test_app2(self): 29 | pyutilib.subprocess.run(sys.executable + " " + currdir + os.sep + 30 | "app2.py " + currdir) 31 | self.assertFileEqualsBaseline(currdir + "summary.out", 32 | currdir + "summary.txt") 33 | 34 | def test_app3(self): 35 | pyutilib.subprocess.run(sys.executable + " " + currdir + os.sep + 36 | "app3.py " + currdir) 37 | if not os.path.exists(currdir + "app3.log"): 38 | self.fail("expected log file") 39 | else: 40 | os.remove(currdir + "app3.log") 41 | 42 | def test_app4(self): 43 | pyutilib.subprocess.run(sys.executable + " " + currdir + os.sep + 44 | "app4.py " + currdir) 45 | if not os.path.exists(currdir + "tmp2.ini"): 46 | self.fail("expected ini file") 47 | else: 48 | os.remove(currdir + "tmp2.ini") 49 | 50 | 51 | if __name__ == "__main__": 52 | unittest.main() 53 | -------------------------------------------------------------------------------- /pyutilib/autotest/tests/example1.yml: -------------------------------------------------------------------------------- 1 | driver: default 2 | 3 | solvers: 4 | s1: 5 | soption1: s1_opt1 6 | s2: 7 | name: solver2 8 | s3: 9 | soption1: s3_opt1 10 | 11 | problems: 12 | p1: 13 | option1: p1_opt1 14 | option2: p1_opt2 15 | p2: 16 | option1: p2_opt1 17 | p3: 18 | option1: p3_opt1 19 | option2: p3_opt2 20 | 21 | suites: 22 | 23 | suite1: 24 | categories: 25 | - x_nightly 26 | - x_smoke 27 | - x_suite1 28 | solvers: 29 | s1: 30 | s2: 31 | problems: 32 | p1: 33 | 34 | suite1a: 35 | categories: 36 | - x_nightly 37 | - x_suite1 38 | solvers: 39 | s1: 40 | s2: 41 | problems: 42 | p2: 43 | 44 | suite2: 45 | categories: 46 | - x_nightly 47 | - x_smoke 48 | - x_suite2 49 | solvers: 50 | s1: 51 | soption1: s1_option1 52 | s3: 53 | problems: 54 | p1: 55 | p2: 56 | option2: p2_option2 57 | p3: 58 | option2: p3_option2 59 | 60 | suite3: 61 | categories: 62 | - x_nightly 63 | - x_smoke 64 | - x_suite3 65 | solvers: 66 | sx1: 67 | solver: s1 68 | soption1: s1_option1 69 | sx3: 70 | solver: s3 71 | problems: 72 | px1: 73 | problem: p1 74 | px2: 75 | problem: p2 76 | option2: p2_option2 77 | px3: 78 | problem: p3 79 | option2: p3_option2 80 | tests: 81 | - 82 | solver: sx1 83 | problem: px1 84 | - 85 | solver: sx3 86 | problem: px2 87 | 88 | 89 | -------------------------------------------------------------------------------- /pyutilib/ply/ply.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | __all__ = ['ply_init', 't_newline', 't_ignore', 't_COMMENT', '_find_column', 11 | 'p_error'] 12 | 13 | # 14 | # Utility functions that are used with PLY 15 | # 16 | 17 | 18 | def ply_init(data): 19 | global _parsedata 20 | _parsedata = data 21 | global _init 22 | _init = True 23 | 24 | 25 | def t_newline(t): 26 | r'[\n]+' 27 | global _init 28 | if _init: 29 | t.lexer.lineno = len(t.value) 30 | _init = False 31 | else: 32 | t.lexer.lineno += len(t.value) 33 | 34 | # Ignore space and tab 35 | t_ignore = " \t\r" 36 | 37 | 38 | # Discard comments 39 | def t_COMMENT(t): 40 | r'\#[^\n]*' 41 | pass 42 | # Tokens in comments are discarded. 43 | 44 | 45 | # 46 | # Compute column. 47 | # input is the input text string 48 | # token is a token instance 49 | # 50 | def _find_column(input, token): 51 | i = token.lexpos 52 | while i > 0: 53 | if input[i] == '\n': break 54 | i -= 1 55 | column = (token.lexpos - i) + 1 56 | return column 57 | 58 | 59 | def p_error(p): 60 | if p is None: 61 | tmp = "Syntax error at end of file." 62 | else: 63 | tmp = "Syntax error at token " 64 | if p.type == "": 65 | tmp = tmp + "''" 66 | else: 67 | tmp = tmp + str(p.type) 68 | tmp = tmp + " with value '" + str(p.value) + "'" 69 | tmp = tmp + " in line " + str(p.lineno) 70 | tmp = tmp + " at column " + str(_find_column(_parsedata, p)) 71 | raise IOError(tmp) 72 | -------------------------------------------------------------------------------- /pyutilib/misc/tests/test_factory.py: -------------------------------------------------------------------------------- 1 | # 2 | # Unit Tests for util/math 3 | # 4 | # 5 | 6 | from os.path import abspath, dirname 7 | pkgdir = dirname(abspath(__file__)) + "/../.." 8 | 9 | import pyutilib.th as unittest 10 | import pyutilib.misc 11 | 12 | 13 | class FactoryDebug(unittest.TestCase): 14 | 15 | class A(object): 16 | 17 | def __init__(self, *args, **kargs): 18 | pass 19 | 20 | class B(object): 21 | 22 | def __init__(self, *args, **kargs): 23 | pass 24 | 25 | def Afunc(*args, **kargs): 26 | return FactoryDebug.A(*args, **kargs) 27 | 28 | def Bfunc(*args, **kargs): 29 | return FactoryDebug.B(*args, **kargs) 30 | 31 | def setUp(self): 32 | self.factory = pyutilib.misc.Factory() 33 | self.factory.register("classA", self.Afunc, None, None) 34 | self.factory.register("classB", self.Bfunc, None, None) 35 | 36 | def test_kyes(self): 37 | self.assertEqual(self.factory.keys(), ["classA", "classB"]) 38 | 39 | def test_len(self): 40 | self.assertEqual(len(self.factory), 2) 41 | 42 | def test_iter(self): 43 | ans = {0: "classA", 1: "classB"} 44 | i = 0 45 | for name in self.factory: 46 | self.assertEqual(name, ans[i]) 47 | i = i + 1 48 | 49 | def test_getitem(self): 50 | self.assertEqual(self.factory[0], "classA") 51 | self.assertEqual(self.factory[1], "classB") 52 | 53 | def test_unregister(self): 54 | self.factory.unregister("classA") 55 | self.assertEqual(len(self.factory), 1) 56 | self.assertEqual(self.factory[0], "classB") 57 | 58 | def test_call(self): 59 | a = self.factory("classA") 60 | self.assertEqual(FactoryDebug.A, type(a)) 61 | b = self.factory("classB") 62 | self.assertEqual(FactoryDebug.B, type(b)) 63 | c = self.factory("classC") 64 | self.assertEqual(None, c) 65 | 66 | 67 | if __name__ == "__main__": 68 | unittest.main() 69 | -------------------------------------------------------------------------------- /pyutilib/misc/indent_io.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | 11 | class StreamIndenter(object): 12 | """Mock-up of a file-like object that wraps another file-like object 13 | and indents all data using the specified string before passing it to 14 | the underlying file. Since this presents a full file interface, 15 | StreamIndenter objects may be arbitrarily nested.""" 16 | 17 | def __init__(self, ostream, indent=" "): 18 | self.os = ostream 19 | self.indent = indent 20 | self.stripped_indent = indent.rstrip() 21 | self.newline = True 22 | 23 | def __getattr__(self, name): 24 | return getattr(self.os, name) 25 | 26 | def write(self, data): 27 | if not len(data): 28 | return 29 | lines = data.split('\n') 30 | if self.newline: 31 | if lines[0]: 32 | self.os.write(self.indent+lines[0]) 33 | else: 34 | self.os.write(self.stripped_indent) 35 | else: 36 | self.os.write(lines[0]) 37 | if len(lines) < 2: 38 | self.newline = False 39 | return 40 | for line in lines[1:-1]: 41 | if line: 42 | self.os.write("\n"+self.indent+line) 43 | else: 44 | self.os.write("\n"+self.stripped_indent) 45 | if lines[-1]: 46 | self.os.write("\n"+self.indent+lines[-1]) 47 | self.newline = False 48 | else: 49 | self.os.write("\n") 50 | self.newline = True 51 | 52 | def writelines(self, sequence): 53 | for x in sequence: 54 | self.write(x) 55 | -------------------------------------------------------------------------------- /doc/plugin/pca-disc.tex: -------------------------------------------------------------------------------- 1 | 2 | \section{Discussion} 3 | 4 | \label{chap:disc} 5 | 6 | A major driver for the development of the \pcasp is the Pyomo optimization software~\cite{Pyomo}. 7 | Pyomo defines a variety of component interfaces that can be used to 8 | customized and extend Pyomo's management of optimization solvers. This includes interfaces for components that 9 | \begin{itemize} 10 | \item write files that define an optimization problem 11 | \item convert files into a format that is compatible with an optimizer 12 | \item execute an optimizer 13 | \item read files that define optimizer results and execution status 14 | \end{itemize} 15 | The \pcasp has had a fundamental impact on the design of Pyomo because it 16 | supports a new software design for optimization frameworks. 17 | 18 | The typical object oriented approach for optimization software is 19 | to use classes and class inheritance. For example, the OPT++~\cite{Mez94} 20 | optimization software library defines base classes with different 21 | characteristics (e.g. differentiability), and a concrete optimization 22 | solver is instantiated as a subclass of an appropriate base class. In this 23 | context, the base class can be viewed as defining the interface for the 24 | solvers that inherit from it. 25 | 26 | Pyomo components leverage the \pcasp to separate the declaration 27 | of component interfaces from their implementation. For example, 28 | the interface to optimization solvers are again declared with a class. 29 | However, solver plugins are not required to be subclasses of the interface 30 | class. Instead, they are simply required to provide the same interface 31 | methods. Consequently, Pyomo can be extended and configured in a modular 32 | manner that is qualitatively different from other optimization frameworks. 33 | The PCA allows Pyomo to dynamically construct optimization strategies and 34 | combine independently-developed modeling, reformulation, preprocessing, 35 | and optimization approaches in a manner that is substantially more 36 | flexible and extensible compared to other widely used optimization 37 | frameworks. 38 | 39 | -------------------------------------------------------------------------------- /pyutilib/workflow/tests/test4.txt: -------------------------------------------------------------------------------- 1 | { 'A_TYPE': 'Task', 2 | 'Id': 1, 3 | 'InputControls': { 'A_TYPE': 'Port', 4 | 'Mode': 'inputs', 5 | 'Name': 'Task1-input-controls', 6 | 'Owner': 'Task1 prev: [] next: [] resources: []'}, 7 | 'Inputs': { 'A_TYPE': 'Port', 8 | 'Mode': 'inputs', 9 | 'Name': 'Task1-inputs', 10 | 'Owner': 'Task1 prev: [] next: [] resources: []', 11 | 'x': { 'A_TYPE': 'Port', 12 | 'Action': 'store', 13 | 'Connections': { 'Inputs': [], 'Outputs': []}, 14 | 'Constant': 'False', 15 | 'Name': 'x', 16 | 'Optional': 'False', 17 | 'Ready': 'True', 18 | 'Task': '1', 19 | 'Value': '2'}, 20 | 'y': { 'A_TYPE': 'Port', 21 | 'Action': 'store', 22 | 'Connections': { 'Inputs': [], 'Outputs': []}, 23 | 'Constant': 'False', 24 | 'Name': 'y', 25 | 'Optional': 'False', 26 | 'Ready': 'False', 27 | 'Task': '1', 28 | 'Value': 'None'}}, 29 | 'Name': 'Task1', 30 | 'OutputControls': { 'A_TYPE': 'Port', 31 | 'Mode': 'outputs', 32 | 'Name': 'Task1-output-controls', 33 | 'Owner': 'Task1 prev: [] next: [] resources: []'}, 34 | 'Outputs': { 'A_TYPE': 'Port', 35 | 'Mode': 'outputs', 36 | 'Name': 'Task1-outputs', 37 | 'Owner': 'Task1 prev: [] next: [] resources: []', 38 | 'z': { 'A_TYPE': 'Port', 39 | 'Action': 'store', 40 | 'Connections': { 'Inputs': [], 'Outputs': []}, 41 | 'Constant': 'False', 42 | 'Name': 'z', 43 | 'Optional': 'False', 44 | 'Ready': 'False', 45 | 'Task': '1', 46 | 'Value': 'None'}}} 47 | -------------------------------------------------------------------------------- /pyutilib/services/services.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | 10 | __all__ = ['registered_executable', 'register_executable', 'TempfileManager'] 11 | 12 | from pyutilib.component.core import ExtensionPoint, PluginGlobals 13 | from pyutilib.component.config import TempfileManager 14 | from pyutilib.component.executables import IExternalExecutable, ExternalExecutable 15 | """ 16 | Test if an exectuable is registered, using the IExternalExecutable extension 17 | point. 18 | 19 | If 'name' is None, then return a list of the names of all registered 20 | executables that are enabled. 21 | 22 | If either this executable is not registered or it is disabled, then 23 | None is returned. 24 | """ 25 | 26 | 27 | def registered_executable(name=None): 28 | ep = ExtensionPoint(IExternalExecutable) 29 | if name is None: 30 | return filter(lambda x: x.name, ep.extensions()) 31 | return ep.service(name) 32 | 33 | 34 | """ 35 | Register an executable, using the IExternalExecutable extension 36 | point. 37 | 38 | If this executable has been registered, then do not reregister it 39 | (even if it is disabled). 40 | """ 41 | 42 | 43 | def register_executable(name, validate=None): 44 | ep = ExtensionPoint(IExternalExecutable) 45 | if len(ep(name, all=True)) == 0: 46 | PluginGlobals.add_env("pca") 47 | PluginGlobals._executables.append( 48 | ExternalExecutable( 49 | name=name, validate=validate)) 50 | PluginGlobals.pop_env() 51 | else: 52 | # 53 | # If the executable is being 'registered', then we search for it 54 | # again, since the user environment may have changed. 55 | # 56 | list(ep(name, all=True))[0].find_executable() 57 | -------------------------------------------------------------------------------- /pyutilib/component/app/simple.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | """ 10 | This is a convenience class that configures the PyUtilib Component Architecture 11 | for a named application. This class registers and activates a variety of 12 | plugins that are commonly used in simple applications. 13 | """ 14 | 15 | import pyutilib.component.core 16 | import pyutilib.component.config 17 | import os 18 | 19 | 20 | class SimpleApplication(object): 21 | 22 | def __init__(self, name, filename=None): 23 | self.name = name 24 | if filename is None: 25 | self.filename = 'config.ini' 26 | else: 27 | self.filename = filename 28 | self.env = pyutilib.component.core.PluginGlobals.add_env(self.name) 29 | self.config = pyutilib.component.config.Configuration(filename) 30 | self._env_config = pyutilib.component.config.EnvironmentConfig(name) 31 | self._env_config.options.path = os.getcwd() 32 | self.logger = pyutilib.component.config.LoggingConfig(name) 33 | self._egg_plugin = pyutilib.component.core.PluginFactory( 34 | "EggLoader", namespace=name, env='pca') 35 | 36 | def configure(self, filename): 37 | """Load a configuration file, and update options""" 38 | self.config.load(filename) 39 | 40 | def save_configuration(self, filename): 41 | """Save a configuration file""" 42 | self.config.save(filename) 43 | 44 | def exit(self): 45 | """Perform cleanup operations""" 46 | self.logger.shutdown() 47 | 48 | def log(self, message): 49 | """Generate logging output""" 50 | self.logger.log(message) 51 | 52 | def flush(self): 53 | """Flush the log output""" 54 | self.logger.flush() 55 | -------------------------------------------------------------------------------- /pyutilib/autotest/plugins.py: -------------------------------------------------------------------------------- 1 | # _________________________________________________________________________ 2 | # 3 | # PyUtilib: A Python utility library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the BSD License. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | # _________________________________________________________________________ 9 | # 10 | 11 | __all__ = ['ITestDriver', 'TestDriverFactory', 'ITestParser', 'TestDriverBase'] 12 | 13 | from pyutilib.component.core import Interface, implements, Plugin, CreatePluginFactory 14 | 15 | 16 | class ITestParser(Interface): 17 | 18 | def load_test_config(self, filename): 19 | pass #pragma:nocover 20 | 21 | def print_test_config(self, repn): 22 | pass #pragma:nocover 23 | 24 | 25 | class ITestDriver(Interface): 26 | 27 | def setUpClass(self, cls, options): 28 | """Set-up the class that defines the suite of tests""" 29 | 30 | def tearDownClass(self, cls, options): 31 | """Tear-down the class that defines the suite of tests""" 32 | 33 | def setUp(self, testcase, options): 34 | """Set-up a single test in the suite""" 35 | 36 | def tearDown(self, testcase, options): 37 | """Tear-down a single test in the suite""" 38 | 39 | def run_test(self, testcase, name, options): 40 | """Execute a single test in the suite""" 41 | 42 | 43 | class TestDriverBase(Plugin): 44 | 45 | implements(ITestDriver) 46 | 47 | def setUpClass(self, cls, options): 48 | """Set-up the class that defines the suite of tests""" 49 | 50 | def tearDownClass(self, cls, options): 51 | """Tear-down the class that defines the suite of tests""" 52 | 53 | def setUp(self, testcase, options): 54 | """Set-up a single test in the suite""" 55 | 56 | def tearDown(self, testcase, options): 57 | """Tear-down a single test in the suite""" 58 | 59 | def run_test(self, testcase, name, options): 60 | """Execute a single test in the suite""" 61 | 62 | 63 | TestDriverFactory = CreatePluginFactory(ITestDriver) 64 | --------------------------------------------------------------------------------