Skip to content

Commit

Permalink
fixing #1166 ... cleaner with identity list of binary methods
Browse files Browse the repository at this point in the history
  • Loading branch information
petersilva committed Aug 19, 2024
1 parent 123c842 commit a2d26d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sarracenia/flow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@ def file_should_be_downloaded(self, msg) -> bool:
method='unknown'

# if no method given, then assume binary comparison is good.
if method in ['sha512', 'md5', 'unknown']:
if method in sarracenia.identity.binary_methods:
if 'size' in msg:
end = msg['size']
# compare sizes... if (sr_subscribe is downloading partitions into taget file) and (target_file isn't fully done)
Expand Down
6 changes: 6 additions & 0 deletions sarracenia/identity/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ def value(self):
import sarracenia.identity.random
import sarracenia.identity.sha512

# the 'unknown' method is created to accomodate cases where a identity field
# missing, or the corresponding class is not known to this instance.

# methods where size checks makes sense. updated when new methods added.
binary_methods = [ 'sha512', 'md5', 'unknown' ]

known_methods = []
for sc in Identity.__subclasses__():
known_methods.append(sc.__name__.lower())

0 comments on commit a2d26d3

Please sign in to comment.