<commit_before>from datetime import date, datetime, timedelta, tzinfo
from numpy import (array, einsum, float_, interp, isnan, nan, rollaxis,
                   searchsorted, sin, where, zeros_like)
from time import strftime
from .constants import T0, DAY_S
from .earthlib import sidereal_time
from .framelib import ICRS_to_J2000 as B
from .nutationlib import compute_nutation, earth_tilt
from .precessionlib import compute_precession

try:
    from pytz import utc
except ImportError:

    class UTC(tzinfo):
        'UTC'
        zero = timedelta(0)
        def utcoffset(self, dt):
            return self.zero
        def tzname(self, dt):
            return 'UTC'
        def dst(self, dt):
            return self.zero

    utc = UTC()

# Much of the following code is adapted from the USNO's "novas.c".

_half_second = 0.5 / DAY_S
_half_millisecond = 0.5e-3 / DAY_S
_half_microsecond = 0.5e-6 / DAY_S
_months = array(['Month zero', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
                 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'])

extra_documentation = """

        This routine takes a date as its argument.  You can either
        provide a `jd=` keyword argument with a `JulianDate` you have
        built yourself, or use one of these keyword arguments::

            # Coordinated Universal Time
            utc=(1973, 12, 29, 23, 59, 48.0)
            utc=datetime(1973, 12, 29, 23, 59, 48.0)

            # International Atomic Time
            tai=2442046.5
            tai=(1973, 12, 29, 23, 59, 48.0)

            # Terrestrial Time
            tt=2442046.5
            tt=(1973, 12, 29, 23, 59, 48.0)

            # Barycentric Dynamical Time
            tdb=2442046.5
            tdb=(1973, 12, 29, 23, 59, 48.0)

"""

def takes_julian_date(function):
    """Wrap `function` so it accepts the standard Julian date arguments.

    A function that takes two arguments, `self` and `jd`, may be wrapped
    with this decorator if it wants to support optional auto-creation of
    its `jd` argument by accepting all of the same keyword arguments
    that the JulianDate constructor itself supports.

    """
    def wrapper(self, jd=None, utc=None, tai=None, tt=None, tdb=None,
                delta_t=None):
        if jd is None:
            jd = JulianDate(utc, tai, tt, tdb, delta_t)
        elif not isinstance(jd, JulianDate):
            if isinstance(jd, tuple):
                s = _tuple_error
            else:
                s = 'your "jd" argument is not a JulianDate: {0!r}'.format(jd)
            raise ValueError(s)
        return function(self, jd)
    wrapper.__name__ = function.__name__
    synopsis, blank_line, description = function.__doc__.partition('\n\n')
    wrapper.__doc__ = synopsis + extra_documentation + description
    return wrapper
<commit_msg>Remove "delta_t" argument from wrapper<commit_after>from datetime import date, datetime, timedelta, tzinfo
from numpy import (array, einsum, float_, interp, isnan, nan, rollaxis,
                   searchsorted, sin, where, zeros_like)
from time import strftime
from .constants import T0, DAY_S
from .earthlib import sidereal_time
from .framelib import ICRS_to_J2000 as B
from .nutationlib import compute_nutation, earth_tilt
from .precessionlib import compute_precession

try:
    from pytz import utc
except ImportError:

    class UTC(tzinfo):
        'UTC'
        zero = timedelta(0)
        def utcoffset(self, dt):
            return self.zero
        def tzname(self, dt):
            return 'UTC'
        def dst(self, dt):
            return self.zero

    utc = UTC()

# Much of the following code is adapted from the USNO's "novas.c".

_half_second = 0.5 / DAY_S
_half_millisecond = 0.5e-3 / DAY_S
_half_microsecond = 0.5e-6 / DAY_S
_months = array(['Month zero', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
                 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'])

extra_documentation = """

        This routine takes a date as its argument.  You can either
        provide a `jd=` keyword argument with a `JulianDate` you have
        built yourself, or use one of these keyword arguments::

            # Coordinated Universal Time
            utc=(1973, 12, 29, 23, 59, 48.0)
            utc=datetime(1973, 12, 29, 23, 59, 48.0)

            # International Atomic Time
            tai=2442046.5
            tai=(1973, 12, 29, 23, 59, 48.0)

            # Terrestrial Time
            tt=2442046.5
            tt=(1973, 12, 29, 23, 59, 48.0)

            # Barycentric Dynamical Time
            tdb=2442046.5
            tdb=(1973, 12, 29, 23, 59, 48.0)

"""

def takes_julian_date(function):
    """Wrap `function` so it accepts the standard Julian date arguments.

    A function that takes two arguments, `self` and `jd`, may be wrapped
    with this decorator if it wants to support optional auto-creation of
    its `jd` argument by accepting all of the same keyword arguments
    that the JulianDate constructor itself supports.

    """
    def wrapper(self, jd=None, utc=None, tai=None, tt=None, tdb=None):
        if jd is None:
            ts = Timescale()
            jd = JulianDate(utc, tai, tt, tdb, ts=ts)
        elif not isinstance(jd, JulianDate):
            if isinstance(jd, tuple):
                s = _tuple_error
            else:
                s = 'your "jd" argument is not a JulianDate: {0!r}'.format(jd)
            raise ValueError(s)
        return function(self, jd)
    wrapper.__name__ = function.__name__
    synopsis, blank_line, description = function.__doc__.partition('\n\n')
    wrapper.__doc__ = synopsis + extra_documentation + description
    return wrapper

{'fraction_non_alphanumeric': 0.09857651245551602, 'fraction_numerical': 0.040569395017793594, 'mean_word_length': 2.384105960264901, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3906067', 'n_tokens_mistral': 1940, 'n_tokens_neox': 1685, 'n_words': 593}