Skip to content

Commit

Permalink
Merge pull request #242 from ocefpaf/run_codespell
Browse files Browse the repository at this point in the history
run_codespell
  • Loading branch information
jswhit authored May 25, 2021
2 parents 8cba512 + 8fa748e commit 5280089
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ version 1.3.1 (release tag v1.3.1rel)
version 1.3.0 (release tag v1.3.0rel)
=====================================
* zero pad years in strtime (issue #194)
* have cftime.datetime constuctor create 'calendar-aware' instances (default is
* have cftime.datetime constructor create 'calendar-aware' instances (default is
'standard' calendar, if calendar='' or None the instance is not calendar aware and some
methods, like dayofwk, dayofyr, __add__ and __sub__, will not work). Fixes issue #198.
The calendar specific sub-classes are now deprecated, but remain for now
Expand Down
10 changes: 5 additions & 5 deletions src/cftime/_cftime.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ISO8601_REGEX = re.compile(r"(?P<year>[+-]?[0-9]+)(-(?P<month>[0-9]{1,2})(-(?P<d
r"(((?P<separator1>.)(?P<hour>[0-9]{1,2}):(?P<minute>[0-9]{1,2})(:(?P<second>[0-9]{1,2})(\.(?P<fraction>[0-9]+))?)?)?"
r"((?P<separator2>.?)(?P<timezone>Z|(([-+])([0-9]{2})((:([0-9]{2}))|([0-9]{2}))?)))?)?)?)?"
)
# Note: The re module apparently does not support branch reset groups that allow redifinition of the same group name in alternative branches as PCRE does.
# Note: The re module apparently does not support branch reset groups that allow redefinition of the same group name in alternative branches as PCRE does.
# Using two different group names is also somewhat ugly, but other solutions might hugely inflate the expression. feel free to contribute a better solution.
TIMEZONE_REGEX = re.compile(
"(?P<prefix>[+-])(?P<hours>[0-9]{2})(?:(?::(?P<minutes1>[0-9]{2}))|(?P<minutes2>[0-9]{2}))?")
Expand Down Expand Up @@ -499,7 +499,7 @@ def num2date(

use_python_datetime = False
if only_use_python_datetimes and not only_use_cftime_datetimes:
# only_use_cftime_datetimes takes precendence
# only_use_cftime_datetimes takes precedence
use_python_datetime = True
if not only_use_python_datetimes and not only_use_cftime_datetimes and can_use_python_datetime:
# if only_use_cftimes_datetimes and only_use_python_datetimes are False
Expand Down Expand Up @@ -1287,7 +1287,7 @@ The default format of the string produced by strftime is controlled by self.form
Day 0 starts at noon January 1 of the year -4713 for the
julian, gregorian and standard calendars (year -4712 if year
zero allowd).
zero allowed).
Day 0 starts at noon on November 24 of the year -4714 for the
proleptic gregorian calendar (year -4713 if year zero allowed).
Expand Down Expand Up @@ -1335,7 +1335,7 @@ The default format of the string produced by strftime is controlled by self.form
delta = self
else:
return NotImplemented
# return calendar-specific subclasses for backward compatbility,
# return calendar-specific subclasses for backward compatibility,
# even though after 1.3.0 this is no longer necessary.
if calendar == '360_day':
#return dt.__class__(*add_timedelta_360_day(dt, delta),calendar=calendar)
Expand Down Expand Up @@ -1391,7 +1391,7 @@ datetime object."""
return dt._to_real_datetime() - other
elif isinstance(other, timedelta):
# datetime - timedelta
# return calendar-specific subclasses for backward compatbility,
# return calendar-specific subclasses for backward compatibility,
# even though after 1.3.0 this is no longer necessary.
has_year_zero=self.has_year_zero
if self.calendar == '360_day':
Expand Down
10 changes: 5 additions & 5 deletions test/test_cftime.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def test_tz_naive(self):
# check num2date method.
d2 = self.cdftime_mixed.num2date(t1)
self.assertTrue(str(d) == str(d2))
# this is a non-existant date, should raise ValueError.
# this is a non-existent date, should raise ValueError.
d = datetime(1582, 10, 5, 0)
self.assertRaises(ValueError, self.cdftime_mixed.date2num, d)
# check date2num/num2date with date after switch.
Expand Down Expand Up @@ -210,7 +210,7 @@ def test_tz_naive(self):
ndayr = d.timetuple()[7]
self.assertTrue(ndayr == 125)
# check noleap calendar.
# this is a non-existant date, should raise ValueError.
# this is a non-existent date, should raise ValueError.
self.assertRaises(
ValueError, utime, 'days since 1600-02-29 00:00:00', calendar='noleap')
self.assertTrue(self.cdftime_noleap.units == 'days')
Expand All @@ -236,7 +236,7 @@ def test_tz_naive(self):
# check day of year.
ndayr = d2.timetuple()[7]
self.assertTrue(ndayr == 59)
# non-existant date, should raise ValueError.
# non-existent date, should raise ValueError.
date = datetime(2000, 2, 29)
self.assertRaises(ValueError, self.cdftime_noleap.date2num, date)
# check all_leap calendar.
Expand Down Expand Up @@ -407,7 +407,7 @@ def test_tz_naive(self):
units = 'hours since 2013-12-12T12:00:00'
assert(1.0 == date2num(num2date(1.0, units), units))

# test rountrip accuracy
# test roundtrip accuracy
# also tests error found in issue #349
dateref = datetime(2015,2,28,12)
verbose = True # print out max error diagnostics
Expand Down Expand Up @@ -575,7 +575,7 @@ def roundtrip(delta,eps,units):
except ValueError:
pass
# test fix for issue #596 - julian day calculations wrong for negative years,
# caused incorrect rountrip num2date(date2num(date)) roundtrip for dates with year
# caused incorrect roundtrip num2date(date2num(date)) roundtrip for dates with year
# < 0.
u = utime("seconds since 1-1-1",calendar='julian')
with warnings.catch_warnings():
Expand Down

0 comments on commit 5280089

Please sign in to comment.