Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Add some small improvements #536

Merged
merged 3 commits into from
Nov 14, 2017

Conversation

swails
Copy link
Contributor

@swails swails commented Nov 9, 2017

  • six is already listed as a requirement, so use six.moves instead of
    defining builtins based on checking sys.version_info
  • Fix formatting of several exceptions.

- six is already listed as a requirement, so use six.moves instead of
defining builtins based on checking sys.version_info
- Fix formatting of several exceptions.
raise TypeError('Must be DataFrame with DatetimeIndex or \
PeriodIndex.')
raise TypeError('Must be DataFrame with DatetimeIndex or '
'PeriodIndex.')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If this was ever raised, the formatting would end up looking weird:

>>> raise TypeError('this is a long error message \
...                 that gets split over lines, but look \
...                 at all those spaces!')
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
TypeError: this is a long error message                 that gets split over lines, but look                 at all those spaces!

if _error:
raise(_error)
if not retry:
raise
Copy link
Contributor Author

Choose a reason for hiding this comment

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

linters like this approach a little better, and it also gives more digestible tracebacks IMO:

>>> e = None
>>> try:
...     raise ValueError('this is a raised value error')
... except ValueError as _e:
...     e = _e
... 
>>> raise(e)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in <module>
ValueError: this is a raised value error
>>> try:
...     raise ValueError('this is a raised value error')
... except ValueError:
...     raise
... 
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
ValueError: this is a raised value error

This seems to be the original intent.

Copy link
Collaborator

@xginn8 xginn8 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 contributing!

@xginn8 xginn8 merged commit 2b95797 into influxdata:master Nov 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants