Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split into library and executable #60

Merged
merged 5 commits into from
Mar 4, 2018
Merged

Split into library and executable #60

merged 5 commits into from
Mar 4, 2018

Conversation

jyn514
Copy link
Collaborator

@jyn514 jyn514 commented Mar 4, 2018

Closes #54. Should make #39 much easier to implement. Gets #55 slightly closer to completion.

Highlights:

  • add wrapper file for easy use from console
  • imports are a lot easier to understand at a glance
  • most functionality is now in library.py
  • bitshuffle.py has been renamed to main.py due to technical limitations

Minor changes:

  • abstracted create_parser into its own function for stylistic reasons
  • removed pylint ignore for this guy
  • renamed shashum globally to shasum

Note: anything imported in __init__.py is accessible programmatically

Copy link
Owner

@charlesdaniels charlesdaniels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits, mostly unrelated to #60 itself.

Feel free to merge when you feel ready, all of the changes that actually related to #60 look good.

return packet


def encode_file(fhandle=stdin, chunksize=2048, compresslevel=5,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not necessary to deal with this for #60, however at some point, we should check if fhandle is bytes or bytearray, in which case we should use it as data rather than opening it as a handle.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added #61

del gzip_compress, gzip_decompress


def warn(integer, *argv, **kwargs):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not need to be handled for #60, but in the long run, we should probably use python's logging library. When we started with Bitshuffle, it was sufficiently small that logging would be overkill, but at this point, we want to make sure we aren't polluting other developer's output streams.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added #62

def decode(message):
'''Decode any number of packets previously encoded with bitshuffle
Assumes all packets are part of the same message'''
_, _, _, compression, seq_num, \
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very nitpicky, and not really related to #60, but these variables names do not make it obvious that these values are indicies. Reading file_hash, you would expect the variable to hold the hash, not the index thereof.

I think it's been like this for a while, but it just occurred to me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added #63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants