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

743 infer legend prop #749

Merged
merged 8 commits into from
Jun 10, 2019
Merged

743 infer legend prop #749

merged 8 commits into from
Jun 10, 2019

Conversation

Jesus89
Copy link
Member

@Jesus89 Jesus89 commented Jun 7, 2019

Fixes #743

@Jesus89 Jesus89 requested a review from rjimenezda June 7, 2019 14:55
@Jesus89 Jesus89 force-pushed the 743-infer-legend-prop branch 2 times, most recently from 132cfa7 to d5e9616 Compare June 7, 2019 16:06
@Jesus89 Jesus89 requested a review from elenatorro June 10, 2019 08:30
@Jesus89 Jesus89 force-pushed the 743-infer-legend-prop branch from d5e9616 to d7bd0d4 Compare June 10, 2019 08:40
Copy link
Contributor

@elenatorro elenatorro left a comment

Choose a reason for hiding this comment

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

Great improvement! I left two minor comments. I'd also add it to the CHANGELOG.


self._check_prop(_prop)

print(_prop)
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove print

))

def _check_prop(self, _prop):
print(_prop)
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove print

Copy link
Contributor

Choose a reason for hiding this comment

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

As an improvement, I'd move _type and _prop initialization to separated methods and I'd leave the responsibility of checking if they're correct to these methods:

def _get_type(self, geom_type):
    _type = self._type.get(geom_type)
        if isinstance(self._type, dict) and geom_type in self._type
        else self._type
  
    self._check_type(self._type)
    return _type
def _get_prop(self, _type):
    _prop = self._prop if self._prop else self._infer_prop(_type)
    
    self._check_prop(_prop)
    return _prop

And then, in get_info:

def get_info(self, geom_type=None):
   # ...
    _type = self._get_type(geom_type)
    _prop = self._get_prop(_type)

@Jesus89
Copy link
Member Author

Jesus89 commented Jun 10, 2019

Thanks! Suggestions added.

Note: I have updated the changelog of this feature in #741

@Jesus89 Jesus89 requested a review from elenatorro June 10, 2019 09:44
Copy link
Contributor

@elenatorro elenatorro left a comment

Choose a reason for hiding this comment

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

Awesome ✨

@Jesus89 Jesus89 merged commit 8e72968 into develop Jun 10, 2019
@Jesus89 Jesus89 deleted the 743-infer-legend-prop branch June 10, 2019 10:19
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.

Detect legends prop from the type
2 participants