Skip to content

Commit

Permalink
Merge pull request #570 from a-detiste/main
Browse files Browse the repository at this point in the history
remove Python2 crumbs, dependency on six
  • Loading branch information
pllim authored Dec 4, 2024
2 parents c48318e + b064a76 commit 1e5de98
Show file tree
Hide file tree
Showing 24 changed files with 11 additions and 61 deletions.
3 changes: 0 additions & 3 deletions astroplan/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
an observer.
"""

from __future__ import (absolute_import, division, print_function,
unicode_literals)

# Standard library
from abc import ABCMeta, abstractmethod
import datetime
Expand Down
2 changes: 0 additions & 2 deletions astroplan/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)

from astropy.utils.exceptions import AstropyWarning

Expand Down
3 changes: 0 additions & 3 deletions astroplan/moon.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
This version of the `moon` module calculates lunar phase angle for a geocentric
"""

from __future__ import (absolute_import, division, print_function,
unicode_literals)

# Third-party
import numpy as np
from astropy.coordinates import get_sun, get_body
Expand Down
5 changes: 1 addition & 4 deletions astroplan/observer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from six import string_types

# Standard library
import sys
Expand Down Expand Up @@ -216,7 +213,7 @@ def __init__(self, location=None, timezone='UTC', name=None, latitude=None,
# Accept various timezone inputs, default to UTC
if isinstance(timezone, datetime.tzinfo):
self.timezone = timezone
elif isinstance(timezone, string_types):
elif isinstance(timezone, str):
self.timezone = pytz.timezone(timezone)
else:
raise TypeError('timezone keyword should be a string, or an '
Expand Down
2 changes: 0 additions & 2 deletions astroplan/periodic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
import astropy.units as u
from astropy.time import Time
Expand Down
2 changes: 0 additions & 2 deletions astroplan/plots/finder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)

import numpy as np

Expand Down
3 changes: 0 additions & 3 deletions astroplan/plots/mplstyles.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)

import copy

from astropy.visualization import astropy_mpl_style
Expand Down
2 changes: 0 additions & 2 deletions astroplan/plots/tests/test_sky.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import pytest

try:
Expand Down
2 changes: 0 additions & 2 deletions astroplan/plots/time_dependent.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import copy
import numpy as np
import operator
Expand Down
17 changes: 7 additions & 10 deletions astroplan/scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
Tools for scheduling observations.
"""

from __future__ import (absolute_import, division, print_function,
unicode_literals)

import copy
from abc import ABCMeta, abstractmethod

Expand All @@ -24,7 +21,7 @@
'Transitioner', 'Scorer']


class ObservingBlock(object):
class ObservingBlock:
"""
An observation to be scheduled, consisting of a target and associated
constraints on observations.
Expand Down Expand Up @@ -98,7 +95,7 @@ def from_exposures(cls, target, priority, time_per_exposure,
return ob


class Scorer(object):
class Scorer:
"""
Returns scores and score arrays from the evaluation of constraints on
observing blocks
Expand Down Expand Up @@ -166,7 +163,7 @@ def from_start_end(cls, blocks, observer, start_time, end_time,
return sc


class TransitionBlock(object):
class TransitionBlock:
"""
Parameterizes the "dead time", e.g. between observations, while the
telescope is slewing, instrument is reconfiguring, etc.
Expand Down Expand Up @@ -224,7 +221,7 @@ def from_duration(cls, duration):
return tb


class Schedule(object):
class Schedule:
"""
An object that represents a schedule, consisting of a list of
`~astroplan.scheduling.Slot` objects.
Expand Down Expand Up @@ -423,7 +420,7 @@ def change_slot_block(self, slot_index, new_block=None):
return slot_index - 1


class Slot(object):
class Slot:
"""
A time slot consisting of a start and end time
"""
Expand Down Expand Up @@ -481,7 +478,7 @@ def split_slot(self, early_time, later_time):
return [new_slot]


class Scheduler(object):
class Scheduler:
"""
Schedule a set of `~astroplan.scheduling.ObservingBlock` objects
"""
Expand Down Expand Up @@ -948,7 +945,7 @@ def attempt_insert_block(self, b, new_start_time, start_time_idx):
return True


class Transitioner(object):
class Transitioner:
"""
A class that defines how to compute transition times from one block to
another.
Expand Down
2 changes: 0 additions & 2 deletions astroplan/target.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)

# Standard library
from abc import ABCMeta
Expand Down
2 changes: 0 additions & 2 deletions astroplan/tests/test_constraints.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import datetime as dt

import numpy as np
Expand Down
3 changes: 0 additions & 3 deletions astroplan/tests/test_moon.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)

from ..observer import Observer
from astropy.time import Time
from astropy.coordinates import EarthLocation
Expand Down
2 changes: 0 additions & 2 deletions astroplan/tests/test_observer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)

# Standard library
import datetime
Expand Down
3 changes: 0 additions & 3 deletions astroplan/tests/test_periodic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from __future__ import (absolute_import, division, print_function,
unicode_literals)

import numpy as np
from astropy.time import Time
import astropy.units as u
Expand Down
2 changes: 0 additions & 2 deletions astroplan/tests/test_scheduling.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)

import numpy as np
from astropy.time import Time
Expand Down
2 changes: 0 additions & 2 deletions astroplan/tests/test_target.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)

import pytest

Expand Down
3 changes: 0 additions & 3 deletions astroplan/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)

import numpy as np
import pytest

Expand Down
2 changes: 0 additions & 2 deletions astroplan/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)

# Standard library
import warnings
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,4 @@
# continue
# dtype, target = line.split(None, 1)
# target = target.strip()
# nitpick_ignore.append((dtype, six.u(target)))
# nitpick_ignore.append((dtype, str(target)))
2 changes: 1 addition & 1 deletion docs/faq/iers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ astropy's IERS machinery:
import numpy as np
import astropy.units as u
from astropy.time import Time
from six.moves.urllib.error import HTTPError
from urllib.error import HTTPError

# Download and cache the IERS Bulletins A and B using astropy's machinery
# (reminder: astroplan has its own function for this: `download_IERS_A`)
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Requirements
============

**astroplan** works on Linux, Mac OS X and Windows.
It requires Python 3.7+ as well as numpy, astropy, pytz, and six.
It requires Python 3.7+ as well as numpy, astropy, and pytz.
Additional features are available when you install `Matplotlib`_
and `astroquery`_.

Expand Down
3 changes: 0 additions & 3 deletions docs/tutorials/constraints.rst
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,6 @@ satisfied.

.. plot::

from __future__ import (absolute_import, division, print_function,
unicode_literals)

from astroplan import (FixedTarget, Observer, AltitudeConstraint,
AtNightConstraint, MoonSeparationConstraint)
from astropy.time import Time
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ install_requires =
numpy>=1.17
astropy>=4
pytz
six

[options.extras_require]
all =
Expand Down

0 comments on commit 1e5de98

Please sign in to comment.