From a1b132fc5676964ee83695a96fe462e5afaa5f5e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 4 Dec 2014 16:12:41 +0100 Subject: [PATCH] cleanup: return status result (was taking args) --- client/cli/bam.py | 38 ++++++++------------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/client/cli/bam.py b/client/cli/bam.py index b5c8e33..96c3193 100755 --- a/client/cli/bam.py +++ b/client/cli/bam.py @@ -206,12 +206,11 @@ class bam_session: @staticmethod def status(session_rootdir, - paths_add, paths_remove, paths_modified, paths_uuid_update=None): - assert(isinstance(paths_add, dict)) - assert(isinstance(paths_remove, dict)) - assert(isinstance(paths_modified, dict)) + paths_add = {} + paths_remove = {} + paths_modified = {} from bam_utils.system import sha1_from_file @@ -267,6 +266,8 @@ class bam_session: if paths_uuid_update is not None: paths_uuid_update[f_rel] = sha1_from_file(f_abs) + return paths_add, paths_remove, paths_modified + @staticmethod def load_paths_uuid(session_rootdir): with open(os.path.join(session_rootdir, ".bam_paths_uuid.json")) as f: @@ -274,15 +275,7 @@ class bam_session: @staticmethod def is_dirty(session_rootdir): - paths_add = {} - paths_modified = {} - paths_remove = {} - - bam_session.status( - session_rootdir, - paths_add, paths_remove, paths_modified - ) - + paths_add, paths_remove, paths_modified = bam_session.status(session_rootdir) return any((paths_add, paths_modified, paths_remove)) @@ -528,16 +521,9 @@ class bam_commands: deps_remap = json.load(f) """ - paths_add = {} - paths_modified = {} - paths_remove = {} paths_uuid_update = {} - bam_session.status( - session_rootdir, - paths_add, paths_remove, paths_modified, - paths_uuid_update, - ) + paths_add, paths_remove, paths_modified = bam_session.status(session_rootdir, paths_uuid_update) if not any((paths_add, paths_modified, paths_remove)): print("Nothing to commit!") @@ -717,15 +703,7 @@ class bam_commands: del paths session_rootdir = bam_config.find_sessiondir(path, abort=True) - - paths_add = {} - paths_modified = {} - paths_remove = {} - - bam_session.status( - session_rootdir, - paths_add, paths_remove, paths_modified, - ) + paths_add, paths_remove, paths_modified = bam_session.status(session_rootdir) if not use_json: for f in sorted(paths_add):