Commit Graph

30 Commits (5824a697a4222beac1bce90508e7169aa3db1c9f)

Author SHA1 Message Date
Raphaël Vinot a834cfea39 fix: Don't fail on create dir if an intermediate is missing 2020-01-16 13:36:20 +01:00
Raphaël Vinot d0f7d1bf81 new: Add typing everywhere, use pathlib when possible 2020-01-13 17:37:19 +01:00
Dan Puttick 7db95c3889 Set exec bits to 0 in safe_copy 2017-08-07 11:48:32 -04:00
Dan Puttick 4205d57dec Fix logging for errors and symlinks 2017-07-20 18:40:16 -04:00
Dan Puttick 35eb8ea8ab Fixups for PR #16
* ObjectPool winoffice files are now make_dangerous
* safe_copy now catches IOErrors only
* Use os.makedirs(exist_ok=True) instead of checking for existence in safe_copy
and create_metadata_file
* Added stubs for two tests related to safe_copy
2017-07-17 14:52:22 -04:00
Dan Puttick fcbf2e6574 Add tests for force_ext and groomer 2017-07-17 09:17:20 -04:00
Dan Puttick a47a00d7a9 Fix bug in split_mimetype and add test 2017-07-16 14:25:16 -04:00
Dan Puttick d7280a8535 Add tests for make_dangerous and safe_copy 2017-07-14 17:37:30 -04:00
Dan Puttick b77451ae7a Description_string now only allows strings 2017-07-14 16:42:31 -04:00
Dan Puttick a2989cfbd3 Add tests for mimetypes 2017-07-14 16:40:26 -04:00
Dan Puttick 930b059ae1 Add tests for has_extension 2017-07-14 14:06:55 -04:00
Dan Puttick df97228a75 Fix symlink behavior in helpers.py 2017-07-13 17:36:43 -04:00
Dan Puttick 6a96d3f7a2 Add tests for helpers.py 2017-07-13 17:01:02 -04:00
Dan Puttick d3576db35d Stub out new unit tests 2017-07-13 14:44:51 -04:00
Dan Puttick e19064c83f Refactor FileBase to store props as attributes
* This is kind of a big refactoring - I realized that storing file
props in a dict was causing some subtle problems, and that just having
them as attributes makes things a lot more simple
* I considered making a separate FileProps object and nesting it
inside FileBase, but almost all FileBase methods concern manipulating
file props, so it didn't really make sense.
* Tests are almost passing with this commit, but need a few more changes
and fixes for full test coverage + all passing.
2017-07-12 17:58:39 -04:00
Dan Puttick 7b8b175a93 Fixup comments, add stubs for new tests 2017-07-11 15:48:40 -04:00
Dan Puttick e88ec8a474 Rename src_valid and src_invalid
* In preparation for having source files be a submodule instead of bundled with PyCIRCLean
* First, going to get the tests running with the new set of files
* Then, going to make the tests run file by file instead of on the whole directory
* Also, need to rewrite the KittenGroomer tests to mock the libmagic methods
2017-06-30 15:25:53 -04:00
Dan Puttick 3f49612a23 Add new logger, move logging to filecheck
* Wrote a new text-based logger that displays all file information in the tree
instead of using two separate logs
* Stopped using twiggy since it wasn't giving us anything useful
* Moved a lot of the logging code to filecheck, since it didn't really seem
appropriate as an API. Left a Logging stub in kittengroomer to hold methods
that might be useful for implementing other loggers.
* For the new logger, had to change the way that we traverse the items in the
source file tree.
2017-04-10 13:22:20 +02:00
Dan Puttick 3e7b38c5d4 Improve doc strings on FileBase 2017-03-21 18:58:17 -04:00
Dan Puttick 51760ebbb1 Move default log setup back into filecheck
* Realized that the API consumer might want to write their own logging tool.
* FileBase and KittenGroomerBase will have no logging code.
* If the API consumer likes, they can import GroomerLogger and use it in their
implementation.
2017-03-20 16:10:57 -04:00
Dan Puttick 963a2feef4 Change various methods to properties 2017-03-15 22:55:51 -04:00
Dan Puttick 0038d3ef66 Switch to using file properties
* make_dangerous now takes a description string
* add_file_string takes strings describing the file
2017-03-15 21:06:07 -04:00
Dan Puttick fc8923fddd Change Groomer private methods to public
* Changed safe_rmtree, safe_copy, safe_remove, and safe_mkdir to public methods
* If something is being used in a subclass it probably shouldn't be a private
method
2017-03-15 21:06:07 -04:00
Dan Puttick 12d5624b4d Change FileBase.log_details to Filebase._file_props
* _file_props is a dict that will hold all information about the file
* Updated filecheck.py to reflect this
* Potentially will change contents of file_props to being attributes on the
file in the future. This change would be easy since all access to _file_props
is now via set_property and get_property methods.
* Add filename to _file_props
2017-03-15 21:06:06 -04:00
Dan Puttick 1c58a7347e If no extentions FileBase.ext is now None 2017-03-15 21:06:06 -04:00
Dan Puttick 3d36c90d66 Make list_all_files a public method 2017-03-15 21:04:57 -04:00
Dan Puttick 1cf8a62f46 First commit with Logger object
- Made logger object
- Moved some logger related code from Groomer to Logger
- Changed logging related tests
- Filecheck tests still do not pass
2017-03-15 21:04:57 -04:00
Dan Puttick 92d1b1cd93 Refactor metadata processing code 2017-03-15 21:01:28 -04:00
Dan Puttick 833ade6008 Change to Python 3 compatible only 2017-01-19 17:06:34 -05:00
Dan Puttick 3b1df108d5 Rename test_helpers 2017-01-19 16:19:15 -05:00