Skip to content

Commit

Permalink
Merge pull request #48 from cdeil/no_2to3
Browse files Browse the repository at this point in the history
Get rid of 2to3
  • Loading branch information
crawfordsm committed May 6, 2014
2 parents 1bcfb01 + 43d5d57 commit b142c4c
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 25 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ htmlcov
.*.swp
*~
.tox

.settings
.project
.pydevproject

# Mac OSX
.DS_Store
Expand Down
4 changes: 2 additions & 2 deletions ccdproc/ccddata.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def meta(self, value):
else:
h = fits.Header()
try:
for k, v in value.iteritems():
for k, v in value.items():
h[k] = v
except (ValueError, AttributeError):
raise TypeError('NDData meta attribute must be dict-like')
Expand Down Expand Up @@ -265,7 +265,7 @@ def fits_ccddata_reader(filename, hdu=0, unit=None, **kwd):
'ccdproc operations.'),
'scale_back': 'Scale information is not preserved.'
}
for key, msg in unsupport_open_keywords.iteritems():
for key, msg in unsupport_open_keywords.items():
if key in kwd:
prefix = 'Unsupported keyword: {0}.'.format(key)
raise TypeError(' '.join([prefix, msg]))
Expand Down
8 changes: 4 additions & 4 deletions ccdproc/ccdproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numbers

import numpy as np

from astropy.extern import six
from astropy.units.quantity import Quantity
from astropy import units as u
from astropy.modeling import fitting
Expand Down Expand Up @@ -172,7 +172,7 @@ def subtract_overscan(ccd, overscan=None, fits_section=None,
if (overscan is not None) and (not isinstance(overscan, CCDData)):
raise TypeError('overscan is not a CCDData object')

if (fits_section is not None) and not isinstance(fits_section, basestring):
if (fits_section is not None) and not isinstance(fits_section, six.string_types):
raise TypeError('overscan is not a string')

if fits_section is not None:
Expand Down Expand Up @@ -251,7 +251,7 @@ def trim_image(ccd, fits_section=None):
In this case, `not_really_trimmed` is a view of the underlying array
`arr1`, not a copy.
"""
if fits_section is not None and not isinstance(fits_section, basestring):
if fits_section is not None and not isinstance(fits_section, six.string_types):
raise TypeError("fits_section must be a string.")
trimmed = ccd.copy()
if fits_section:
Expand Down Expand Up @@ -742,7 +742,7 @@ def value(self, value):
elif isinstance(value, Quantity):
self._unit = value.unit
self._value = value
elif isinstance(value, basestring):
elif isinstance(value, six.string_types):
if self.unit is not None:
raise ValueError("Keyword with a unit cannot have a "
"string value.")
Expand Down
3 changes: 1 addition & 2 deletions ccdproc/log_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from functools import wraps
import inspect

#from decorator import decorator
from astropy.extern import six

import ccdproc.ccdproc # really only need Keyword from ccdproc
Expand Down Expand Up @@ -46,7 +45,7 @@ def wrapper(*args, **kwd):


def _insert_in_metadata(metadata, arg):
if isinstance(arg, basestring):
if isinstance(arg, six.string_types):
# add the key, no value
metadata[arg] = None
elif isinstance(arg, ccdproc.ccdproc.Keyword):
Expand Down
3 changes: 2 additions & 1 deletion ccdproc/tests/test_keyword.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from astropy.extern import six
from astropy.tests.helper import pytest
from astropy import units as u
from astropy.units import Quantity
Expand Down Expand Up @@ -50,7 +51,7 @@ def test_value_setting(value, unit, expected):
key = Keyword(name, unit=unit, value=value)
else:
key = Keyword(name, unit=unit, value=value)
if isinstance(expected, basestring):
if isinstance(expected, six.string_types):
assert key.value == expected
else:
assert key.value == numerical_value * key.unit
Expand Down
7 changes: 0 additions & 7 deletions script_example

This file was deleted.

7 changes: 0 additions & 7 deletions scripts/script_example

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@
long_description=LONG_DESCRIPTION,
cmdclass=cmdclassd,
zip_safe=False,
use_2to3=True,
use_2to3=False,
**package_info
)

0 comments on commit b142c4c

Please sign in to comment.