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

Meta tab #144

Merged
merged 5 commits into from Apr 7, 2017
Merged

Meta tab #144

merged 5 commits into from Apr 7, 2017

Conversation

Bjwebb
Copy link
Member

@Bjwebb Bjwebb commented Mar 20, 2017

Allow metadata that will appear at the top level, e.g. version number, to be specified in an additional spreadsheet tab.

Bjwebb referenced this pull request Mar 20, 2017
Was just bugging me and I didn't want to try to reconcile other changes I've made locally
"--metatab-schema",
help="The jsonschema of the metadata tab")
parser_unflatten.add_argument(
"--metatab-only",
Copy link
Member Author

Choose a reason for hiding this comment

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

Should this have action='store_true' ?

Copy link
Member Author

Choose a reason for hiding this comment

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

(done)

sheet_names = sorted([fname[:-4] for fname in sheet_file_names if fname.endswith('.csv')])
if self.include_sheets:
for sheet in list(sheet_names):
if sheet not in self.include_sheets:
Copy link
Member Author

Choose a reason for hiding this comment

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

Should this be case insensitive? The metatab spec isn't consistent with case for "Meta"

Copy link
Member Author

Choose a reason for hiding this comment

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

Happy to leave this as case sensitive for now, but we might need to come back to this in future, as I think Excel users generally expect the MS pattern of case insensitive but preserving (e.g. I can't create two tabs with the same name in different cases).

for sheet in list(self.sheet_names_map):
if sheet not in self.include_sheets:
self.sheet_names_map.pop(sheet)
for sheet in list(self.exclude_sheets) or []:
Copy link
Member Author

Choose a reason for hiding this comment

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

Why list( on line 448 and 451?

Copy link
Contributor

Choose a reason for hiding this comment

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

list is needed on 448 as you are not able to pop things from a map while iterating over it (in python3 as it creates a generator).

It is not needed on 451 so will remove it there.

cells[header] = Cell(line[header], (sheet_name, _get_column_letter(k+1), j+2, actual_headings[k]))
headings = actual_headings[k] if actual_headings else header
if self.vertical_orientation:
cells[header] = Cell(line[header], (sheet_name, str(k+1), j+2, headings))
Copy link
Member Author

Choose a reason for hiding this comment

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

Shouldn't this be (sheet_name, _get_column_letter(j+2), k+1, headings)?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, because this would lead to broken "Rows" output in Cove. We think there's also problems with this/the current approach, but there's a new issue for this #153

@@ -246,10 +260,11 @@ def do_unflatten(self):
root_id_or_none = line.get(self.root_id) if self.root_id else None
cells = OrderedDict()
for k, header in enumerate(line):
if actual_headings:
cells[header] = Cell(line[header], (sheet_name, _get_column_letter(k+1), j+2, actual_headings[k]))
headings = actual_headings[k] if actual_headings else header
Copy link
Member Author

Choose a reason for hiding this comment

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

Should be heading not headings.

Copy link
Member Author

Choose a reason for hiding this comment

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

(done)

Fix some naming and add comment from review. Also remove an not needed
list.
@Bjwebb
Copy link
Member Author

Bjwebb commented Apr 6, 2017

@kindly Thanks for the changes to this.

I'm happy to see this merge now. I can't actually approve it, because I created the pull request!

@Bjwebb Bjwebb merged commit 3f6d9f5 into master Apr 7, 2017
@Bjwebb Bjwebb deleted the meta-tab branch April 7, 2017 08:49
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.

None yet

2 participants