summaryrefslogtreecommitdiffstats
path: root/combox/file.py
Commit message (Collapse)AuthorAgeFilesLines
* Copyright changed.Siddharth Ravikumar2016-03-011-1/+1
| | | | From combox contributors -> Dr. Robert C. Green II.
* modified combox.file.rm_path function.Siddharth Ravikumar2016-01-111-0/+1
|
* combox/file.py: updated docstrings.Siddharth Ravikumar2015-12-231-84/+184
|
* authors -> contributors.Siddharth Ravikumar2015-12-221-1/+1
|
* .py files coding set to utf-8.Siddharth Ravikumar2015-12-221-0/+2
|
* Now use `os.renames` instead `os.rename` function.Siddharth Ravikumar2015-12-211-2/+2
|
* Removed buffering in combox.file.write_file func.Siddharth Ravikumar2015-12-171-1/+1
|
* Re-did the error messages in at combox.fileSiddharth Ravikumar2015-12-171-5/+5
|
* combox/file.py: modded write_file.Siddharth Ravikumar2015-11-021-1/+1
| | | | File writes are now buffered. Addresses bug#10.
* combox now uses python's logging module instead of `print` to stdout ↵Siddharth Ravikumar2015-10-171-7/+7
| | | | | | | | | | information/errors. modified: ChangeLog modified: combox/cbox.py modified: combox/events.py modified: combox/file.py modified: combox/log.py
* refactored read_file function combox.file module.Siddharth Ravikumar2015-10-161-7/+4
| | | | Thanks https://stackoverflow.com/questions/8009882/how-to-read-large-file-line-by-line-in-python
* Fxed bug #9.Siddharth Ravikumar2015-10-161-1/+5
| | | | | | | | Now the read_file and write_file functions in combox.file module close the file objects before returning. modified: TODO.org modified: combox/file.py
* fix for bug #7.Siddharth Ravikumar2015-09-121-1/+1
|
* fix for bug #5.rsiddharth2015-09-121-8/+7
|
* added new function file.no_of_shards + tests.Siddharth Ravikumar2015-08-251-0/+16
| | | | | modified: combox/file.py modified: tests/file_test.py
* updated combox.file.relative_path.Siddharth Ravikumar2015-04-011-1/+8
| | | | | | | | | This method now returns relative paths w. r. t all node directories. Before it used to return relative paths only w. r. t the first node directory. Also updated the tests for it :~( modified: combox/file.py modified: tests/file_test.py
* new function combox.file.node_paths: returns the abs. path of ↵Siddharth Ravikumar2015-03-191-0/+28
| | | | | | | shards/directories in node directories. modified: combox/file.py modified: tests/file_test.py
* combox/file.py: edited docstring of the node_path method.Siddharth Ravikumar2015-03-191-2/+3
|
* modded combox.file.node_path function.Siddharth Ravikumar2015-03-061-2/+3
| | | | | | | | | | | It has a third argument (boolean) which tells whether `cb_path' (the first argument) is a file or not. Updated the test for node_path function + code wherever node_path was used. modified: combox/events.py modified: combox/file.py modified: tests/file_test.py
* fixed combox.file.cb_pathSiddharth Ravikumar2015-03-041-1/+1
| | | | | | instead of using `path.isfile' to check if the path is a shard file or not, it is checked if the path endswidth 'shard.N' where `N' is a number.
* renamed combox.file.rm_dir -> combox.file.rm_pathSiddharth Ravikumar2015-03-041-4/+10
| | | | | | | | rm_path deletes a file or an empty directory. updated the test for it too. modified: tests/file_test.py
* combox.file.mk_nodedir uses mk_dir to create a directory.Siddharth Ravikumar2015-03-041-4/+1
|
* combox.file.rm_nodedir uses the rm_dir function to remove directories.Siddharth Ravikumar2015-03-041-4/+1
|
* new function combox.file.mk_dirSiddharth Ravikumar2015-03-041-0/+8
| | | | | | | wrote test for it too. modified: combox/file.py modified: tests/file_test.py
* new function combox.file.rm_dirSiddharth Ravikumar2015-03-041-0/+8
| | | | | | | also wrote test for it. modified: combox/file.py modified: tests/file_test.py
* modded combox.file.hash_file function -- added new arg `file_content'Siddharth Ravikumar2015-02-261-2/+5
| | | | | | | | | | - `file_content' is set to None by default - If `file_content' is not None, hash of this is returned. Updated the test for hash_file function. modified: combox/file.py modified: tests/file_test.py
* new function combox.file.node_path.Siddharth Ravikumar2015-02-251-0/+22
| | | | | | | | | | | | | This function takes the path to the file in the combox and returns the path of its first shard in the node directory. If the the given argument is a directory (inside the combox directory), the function returns the corresponding path of the directory under the first node directory. Test for the function was also written. modified: combox/file.py modified: tests/file_test.py
* Refactored combox.file.cb_path to accept a file or a directory under a node ↵Siddharth Ravikumar2015-02-201-5/+15
| | | | | | | | | | | directory. It returns the path of the respective file or directory in the combox directory. Also updated the test for this function at tests.file_test.TestFile.test_cbpath modified: combox/file.py modified: tests/file_test.py
* Defined new function in combox.file.cb_pathSiddharth Ravikumar2015-02-191-0/+10
| | | | | | | | | | This function, given the path of a file shard, returns the corresponding path of the file in the combox directory. The test for this function is at tests.file_test.TestFile.test_cbpath modified: combox/file.py modified: tests/file_test.py
* modded combox.file.relative_path function.Siddharth Ravikumar2015-02-191-4/+13
| | | | | | | | | | Now the function is rigged up to return path relative to both combox directory and node directory. Corresponding test for this function is at tests.file_test module. modified: combox/file.py modified: tests/file_test.py
* [bug fix] combox/file.py: rm_shards function checks if a shard exists before ↵Siddharth Ravikumar2015-01-271-1/+7
| | | | os.remove()ing it.
* combox/file.py: defined hash_file function.Siddharth Ravikumar2015-01-211-0/+13
| | | | | | hash_file function returns the SHA512 hash of the file's content. The test for the hash_file function is at tests/file_test.py
* updated copright year.Siddharth Ravikumar2015-01-201-1/+1
| | | | | | | | | | | | modified: combox/cbox.py modified: combox/config.py modified: combox/crypto.py modified: combox/events.py modified: combox/file.py modified: tests/config_test.py modified: tests/crypto_test.py modified: tests/events_test.py modified: tests/file_test.py
* [bug fix] combox/file.py: fixed bug in move_shards functionSiddharth Ravikumar2015-01-161-0/+5
| | | | | the fix: the shards don't have to be renamed when the directory under which they're located is renamed/moved.
* combox/file.py: wrote new utility functions.Siddharth Ravikumar2015-01-151-0/+99
| | | | | | | - rm_nodedir - move_nodedir - rm_shards - move_shards
* combox/file.py: new functions defined.Siddharth Ravikumar2015-01-141-6/+53
| | | | | | relative_path: returns relative path of directory or file w. r. t combox directory. mk_nodedir: creates a directory inside all node directories purge_dir: (1) purges a file or (2) purges everything inside a directory (except itself).
* combox/file.py: added mk_nodedir function.Siddharth Ravikumar2015-01-131-0/+13
|
* rewrote the read_shards() and write_shards() function in combox/file.py.Siddharth Ravikumar2015-01-131-12/+17
| | | | | | | | | Tests were accordingly modded and now use the test config.yaml to split and write shards to dirs. modified: combox/file.py modified: tests/crypto_test.py modified: tests/file_test.py
* added back combox/file.pySiddharth Ravikumar2015-01-121-0/+127
|
* consolidated everything into combox/combox.py.Siddharth Ravikumar2015-01-121-127/+0
| | | | | | | | | | | | tests were removed. will write tests using `nose` later. renamed: combox/file.py -> combox/combox.py deleted: combox/config.py deleted: combox/crypto.py renamed: tests/test_config.py -> tests/combox_tests.py deleted: tests/files/the-red-star.jpg deleted: tests/test_crypto.py deleted: tests/test_file.py
* file.py: wrote two new functions -- write_shards(), read_shards()Siddharth Ravikumar2014-11-051-0/+33
| | | | | modified: file.py modified: tests/test_file.py
* updated file.py: fixed typo in glue_data documentation.Siddharth Ravikumar2014-10-301-1/+1
|
* updated combox/file.py: renamed split_file -> split_data and glue_file -> ↵Siddharth Ravikumar2014-10-301-31/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | glue_data split_data: reads a string or a stream of bytes and splits them into `n' parts. glue_data: reads an array of strings / stream of bytes and glues them into one string / stream of bytes. read_file: reads content from file and returns it. --- "Python has been an important part of Google since the beginning, and remains so as the system grows and evolves. Today dozens of Google engineers use Python, and we're looking for more people with skills in this language." said Peter Norvig, director of search quality at Google, Inc. --- Google has employed a Gingrich-era Republican as its head lobbyist in DC. Now, Google is effectively helping Comcast kill the Internet as we know it, and end "Net Neutrality" forever. -- SumOfUs.org Sign a petition to ask Google to stand up for Net Neutrality: http://action.sumofus.org/a/googlesupportnn/
* renamed: utils/file.py -> file.py, tests/utils_file.py -> tests/test_file.pyrsiddharth2014-10-301-0/+84
utils/ directory deleted now.