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

Add ability to supply a dataset name to xport library. #15

Closed
wants to merge 1 commit into from

Conversation

dsgoldberg
Copy link

As I mentioned in #14 - currently the dataset name defaults to 'dataset'.

This pull request adds an optional variable of dataset_name to the from_* functions so that you can provide a dataset_name if needed.

Copy link
Owner

@selik selik left a comment

Choose a reason for hiding this comment

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

Thanks for the pull-request. I think we should increment the minor version number for this change.

@@ -163,7 +163,9 @@ def __init__(self, fp):
self.created = created
self.modified = modified

namestr_size = self._read_member_header()[-1]
dsname, _, dslabel, _, _, _, _, namestr_size = self._read_member_header()
self.dsname = dsname
Copy link
Owner

Choose a reason for hiding this comment

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

I'm not sure that dsname and dslabel are the best attribute names. Regardless of whether you can come up with something better, do you mind adding a change to the README to explain these?

Another option is making them properties to allow a docstring for them separate from the class.

@@ -597,7 +599,7 @@ def from_columns(mapping, fp):

# make a copy to avoid accidentally mutating the passed-in data
columns = OrderedDict((k, list(v)) for k, v in mapping.items())

dataset_name_binary = dataset_name.encode('ascii').ljust(8)
Copy link
Owner

Choose a reason for hiding this comment

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

What happens if the dataset name is longer than 8 characters?

@selik selik mentioned this pull request Apr 21, 2020
@selik
Copy link
Owner

selik commented Apr 21, 2020

Sorry I didn't get around to this for so long @dsgoldberg . I merged a big change (#34) which adds this feature.

@selik selik closed this Apr 21, 2020
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

Successfully merging this pull request may close these issues.

2 participants