Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Minor code cleanup #34

Merged
merged 3 commits into from
May 18, 2018

Conversation

tjstansell
Copy link

No description provided.

@Rockstar04 Rockstar04 requested review from wolph and Rockstar04 May 4, 2018 17:30
@@ -275,7 +275,7 @@ def metric_payload(self, value, min_value=None, max_value=None, count=None,
if not value:
value = 0

if isinstance(value, basestring):
if isinstance(value, ("".__class__, u"".__class__)):
Copy link

Choose a reason for hiding this comment

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

Wouldn't it be better to use six for this? I find this method a tad hard to read to be honest :P

if isinstance(value, six.string_types)

Copy link
Author

Choose a reason for hiding this comment

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

I thought about that ... but didn't want to introduce another library dependency. Though, as we move to trying to make this fully python3 compliant, maybe we'll rely on six for other stuff. Would you rather I back this out? or introduce six as a dependency?

Copy link

Choose a reason for hiding this comment

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

Personally I think six is available nearly everywhere because of other dependencies so it shouldn't be that much of a problem, but lets ask @Rockstar04 as well :)
Alternatively we could simply integrate six into the library since it's a single file anyhow: https://github.com/benjaminp/six/blob/master/six.py

Copy link
Member

@Rockstar04 Rockstar04 May 9, 2018

Choose a reason for hiding this comment

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

I'm pretty sure I've mentioned before, I'm from from familiar with the Python ecosystem. I do know enough that python-six is available all the way back to Ubuntu 12.04, and a quick search looks like good coverage in RPM based systems as well. I'd be fine with adding it as a dependency. We would just have to make sure its clearly listed in the readme here.

Copy link
Author

Choose a reason for hiding this comment

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

OK, I updated it to use six and included six>=1.5 in setup.py. wasn't sure what version, but awscli uses six>=1.5 so that seemed good to me.

@wolph wolph merged commit e046e0f into NewRelic-Python-Plugins:master May 18, 2018
@tjstansell tjstansell deleted the minor-code-cleanup branch May 22, 2018 18:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants