Skip to content

Commit

Permalink
Merge pull request #1406 from cguennou/pep8
Browse files Browse the repository at this point in the history
Fix PEP8 issues from the landscape.io
  • Loading branch information
Cadair committed May 25, 2015
2 parents 77f78b9 + b895857 commit 4828e16
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions sunpy/database/attrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def _create(wlk, root, session):
elif typ == 'path':
path, inverted = value
if inverted:
# pylint: disable=E711
query = query.filter(or_(
DatabaseEntry.path != path, DatabaseEntry.path == None))
else:
Expand Down
2 changes: 1 addition & 1 deletion sunpy/image/rescale.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def resample(orig, dimensions, method='linear', center=False, minusone=False):
"when calling resample.")

#@note: will this be okay for integer (e.g. JPEG 2000) data?
if not orig.dtype in [np.float64, np.float32]:
if orig.dtype not in [np.float64, np.float32]:
orig = orig.astype(np.float64)

dimensions = np.asarray(dimensions, dtype=np.float64)
Expand Down
4 changes: 2 additions & 2 deletions sunpy/instr/fermi.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ def download_weekly_pointing_file(date):
urllib2.HTTPError
exists = False
#if the file exists then exit and retain this filepath
if exists == True:
if exists:
break

#if no matches at all were found, then the pointing file doesn't exist
if exists == False:
if not exists:
raise ValueError('No Fermi pointing files found for given date!')


Expand Down
4 changes: 2 additions & 2 deletions sunpy/instr/lyra.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,13 @@ def _remove_lytaf_events(time, channels=None, artifacts=None,
if not artifacts:
raise ValueError("User has supplied no artifacts to remove.")
if type(artifacts) is str:
artifacts = [artifacts]
artifacts = [artifacts]
if not all(isinstance(artifact_type, str) for artifact_type in artifacts):
raise TypeError("All elements in artifacts must in strings.")
all_lytaf_event_types = get_lytaf_event_types(lytaf_path=lytaf_path,
print_event_types=False)
for artifact in artifacts:
if not artifact in all_lytaf_event_types:
if artifact not in all_lytaf_event_types:
print all_lytaf_event_types
raise ValueError("{0} is not a valid artifact type. See above.".format(artifact))
# Define outputs
Expand Down
4 changes: 2 additions & 2 deletions sunpy/instr/rhessi.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,9 @@ def backprojection(calibrated_event_list, pixel_size=(1.,1.) * u.arcsec, image_d
if not isinstance(pixel_size, u.Quantity):
raise ValueError("Must be astropy Quantity in arcseconds")
try:
pixel_size = pixel_size.to(u.arcsec)
pixel_size = pixel_size.to(u.arcsec)
except:
raise ValueError("'{0}' is not a valid pixel_size unit".format(pixel_size.unit))
raise ValueError("'{0}' is not a valid pixel_size unit".format(pixel_size.unit))
if not (isinstance(image_dim, u.Quantity) and image_dim.unit == 'pix'):
raise ValueError("Must be astropy Quantity in pixels")
calibrated_event_list = sunpy.RHESSI_EVENT_LIST
Expand Down
4 changes: 2 additions & 2 deletions sunpy/lightcurve/sources/eve.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class EVELightCurve(LightCurve):
def peek(self, column = None, **kwargs):
figure = plt.figure()
# Choose title if none was specified
if not kwargs.has_key("title") and column is None:
if "title" not in kwargs and column is None:
if len(self.data.columns) > 1:
kwargs['title'] = 'EVE (1 minute data)'
else:
Expand All @@ -51,7 +51,7 @@ def peek(self, column = None, **kwargs):
self.plot(**kwargs)
else:
data = self.data[column]
if not kwargs.has_key("title"):
if "title" not in kwargs:
kwargs['title'] = 'EVE ' + column.replace('_', ' ')
data.plot(**kwargs)
figure.show()
Expand Down

0 comments on commit 4828e16

Please sign in to comment.