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

Change behaviour of as_binary when data is not present? #31

Open
martinjthompson opened this issue Feb 1, 2023 · 2 comments
Open

Change behaviour of as_binary when data is not present? #31

martinjthompson opened this issue Feb 1, 2023 · 2 comments

Comments

@martinjthompson
Copy link

For my use-case it would be useful for as_binary to raise an Exception if I ask for data which is not contained in the files I have added.

At the moment, if padding is None, it is converted to a default of 0xFF . I would request the following (which admittedly changes the API):

make the default parameters more explicit:

def as_binary(self,
                  minimum_address=None,
                  maximum_address=None,
                  padding=0xFF):

and then alter the behaviour of padding==None to raise a RuntimeException if there is any data requested which does not 'exist'. Would this be acceptable?

@eerimoq
Copy link
Owner

eerimoq commented Feb 1, 2023

Maybe add another argument?

def as_binary(self,
              minimum_address=None,
              maximum_address=None,
              padding=None,
              data_must_exist=False):

@martinjthompson
Copy link
Author

Oh, yes, that could work :) I'll try and pull a PR together...

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

No branches or pull requests

2 participants