Skip to content

Commit 4021fff

Browse files
committed
No magic numbers. 9999 -> datetime.MAXYEAR and 1 -> datetime.MINYEAR where appropriate.
1 parent 03ec9d6 commit 4021fff

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

spyne/model/primitive.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -569,16 +569,16 @@ class Attributes(SimpleModel.Attributes):
569569
"""Customizable attributes of the :class:`spyne.model.primitive.DateTime`
570570
type."""
571571

572-
gt = datetime.datetime(1, 1, 1, 0, 0, 0, 0, pytz.utc) # minExclusive
572+
gt = datetime.datetime(datetime.MINYEAR, 1, 1, 0, 0, 0, 0, pytz.utc) # minExclusive
573573
"""The datetime should be greater than this datetime."""
574574

575-
ge = datetime.datetime(1, 1, 1, 0, 0, 0, 0, pytz.utc) # minInclusive
575+
ge = datetime.datetime(datetime.MINYEAR, 1, 1, 0, 0, 0, 0, pytz.utc) # minInclusive
576576
"""The datetime should be greater than or equal to this datetime."""
577577

578-
lt = datetime.datetime(9999, 12, 31, 23, 59, 59, 999999, pytz.utc) # maxExclusive
578+
lt = datetime.datetime(datetime.MAXYEAR, 12, 31, 23, 59, 59, 999999, pytz.utc) # maxExclusive
579579
"""The datetime should be lower than this datetime."""
580580

581-
le = datetime.datetime(9999, 12, 31, 23, 59, 59, 999999, pytz.utc) # maxInclusive
581+
le = datetime.datetime(datetime.MAXYEAR, 12, 31, 23, 59, 59, 999999, pytz.utc) # maxInclusive
582582
"""The datetime should be lower than or equal to this datetime."""
583583

584584
pattern = None
@@ -694,10 +694,10 @@ class Attributes(DateTime.Attributes):
694694
ge = datetime.date(1, 1, 1) # minInclusive
695695
"""The date should be greater than or equal to this date."""
696696

697-
lt = datetime.date(9999, 12, 31) # maxExclusive
697+
lt = datetime.date(datetime.MAXYEAR, 12, 31) # maxExclusive
698698
"""The date should be lower than this date."""
699699

700-
le = datetime.date(9999, 12, 31) # maxInclusive
700+
le = datetime.date(datetime.MAXYEAR, 12, 31) # maxInclusive
701701
"""The date should be lower than or equal to this date."""
702702

703703
format = '%Y-%m-%d'

0 commit comments

Comments
 (0)