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

fixes#47 Implement ability to query fields used on a worksheet #54

Merged
merged 14 commits into from
Jul 21, 2016
Merged

fixes#47 Implement ability to query fields used on a worksheet #54

merged 14 commits into from
Jul 21, 2016

Conversation

graysonarts
Copy link
Contributor

No description provided.

@t8y8
Copy link
Contributor

t8y8 commented Jul 19, 2016

This is a large review so I'll need some time to wrap my head around it (Nice find on the hidden bug in missing fields though!)

Leaving some superficial comments on my first pass

</window>
</windows>
<thumbnails>
<thumbnail height='104' name='Sheet 1' width='144'>
Copy link
Contributor

Choose a reason for hiding this comment

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

Clear out the thumbnails, I think they'll just get regenerated as we iterate on these in the future and it keeps the diff a little more managable.

@@ -64,3 +64,24 @@ def __getitem__(self, key):
key = self._indexes['caption'][key]

return dict.__getitem__(self, key)


class PredicatedDictionary(object):
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the code is here is fine, but I'm a little fuzzy on the need for a new type -- would a regular dictionary or data structure do?

It just makes the code read a little more complicated for new contributors. Not a strong objection, mostly curiosity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bah, this was left over from the previous approach. I'll remove it.

@@ -33,7 +33,7 @@ def _get_metadata_xml_for_field(root_xml, field_name):


def _is_used_by_worksheet(names, field):
return any((True for y in names if y in field.worksheets))
return any((y for y in names if y in field.worksheets))
Copy link
Contributor

Choose a reason for hiding this comment

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

You can murder even more ()'s -- there's an implicit generator inside the fucntion call to any, so it can just be any(i for i in iterable if condition)



class FieldDictionary(MultiLookupDict):
def found_in(self, name):
Copy link
Contributor

Choose a reason for hiding this comment

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

And let the bikeshedding begin!

found_in?
used_in?
used_by?
on_some_level_of_detail_somewhere_in?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah found_in seems a bit not right to me. I think used_by hits the right level of obviousness, though maybe we need "used_by_worksheet" to be specific that this only works on worksheets (eventually a worksheet object, but for now, just the name)

Copy link
Contributor

Choose a reason for hiding this comment

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

used_by_sheet() feels good to me (Or whatever our docs call a 'sheet' that is only a 'sheet' and not a dashboard or story)

@t8y8
Copy link
Contributor

t8y8 commented Jul 20, 2016

🚀🚀🚀 (LGTM)

I'm struggling with the basestring thing, I can't put my finger on why (I might prefer explicit py2/py3 checking but I may also just need sleep). I'll submit a PR if the 'better' way ever hits me.

@graysonarts graysonarts merged commit 3757ada into tableau:development Jul 21, 2016
@graysonarts graysonarts deleted the feature-47-fields-in-use branch July 21, 2016 03:57
graysonarts pushed a commit that referenced this pull request Jul 21, 2016
* refactoring for better readability

* rename metadata_field_objects to metadata_only_field_objects
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