mirror of
https://github.com/davidkeegan/dklrt
synced 2024-12-26 21:58:08 +01:00
Applied python 2to3
This commit is contained in:
parent
013af926c9
commit
469468e72c
2 changed files with 3 additions and 4 deletions
1
Misc.py
1
Misc.py
|
@ -2,7 +2,6 @@
|
||||||
# Miscellaneous Utilities (dklrt).
|
# Miscellaneous Utilities (dklrt).
|
||||||
# (c) David Keegan 2011-06-28.
|
# (c) David Keegan 2011-06-28.
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
def Out(*Args):
|
def Out(*Args):
|
||||||
|
|
6
Time.py
6
Time.py
|
@ -60,7 +60,7 @@ def DateAddYears(Seconds, Count):
|
||||||
If Seconds is Feb 29, shifts to Feb 28, even if shifing to a
|
If Seconds is Feb 29, shifts to Feb 28, even if shifing to a
|
||||||
leap year.
|
leap year.
|
||||||
"""
|
"""
|
||||||
if not isinstance(Count, (int, long)):
|
if not isinstance(Count, int):
|
||||||
_Throw("Count argument not an int!")
|
_Throw("Count argument not an int!")
|
||||||
|
|
||||||
dtd = datetime.date.fromtimestamp(Seconds)
|
dtd = datetime.date.fromtimestamp(Seconds)
|
||||||
|
@ -74,14 +74,14 @@ def DateAddMonths(Seconds, Count):
|
||||||
"""Shifts Seconds (a date) forward by Count months.
|
"""Shifts Seconds (a date) forward by Count months.
|
||||||
If the day is >= 29, shifts to 28.
|
If the day is >= 29, shifts to 28.
|
||||||
"""
|
"""
|
||||||
if not isinstance(Count, (int, long)):
|
if not isinstance(Count, int):
|
||||||
_Throw("Count argument not an int!")
|
_Throw("Count argument not an int!")
|
||||||
|
|
||||||
dtd = datetime.date.fromtimestamp(Seconds)
|
dtd = datetime.date.fromtimestamp(Seconds)
|
||||||
if not Count == 0:
|
if not Count == 0:
|
||||||
if dtd.day >= 29: dtd = dtd.replace(day=28)
|
if dtd.day >= 29: dtd = dtd.replace(day=28)
|
||||||
Month = (dtd.month + Count) - 1
|
Month = (dtd.month + Count) - 1
|
||||||
Years = Month / 12
|
Years = Month // 12
|
||||||
dtd = dtd.replace(year=(dtd.year + Years))
|
dtd = dtd.replace(year=(dtd.year + Years))
|
||||||
Month = (Month % 12) + 1
|
Month = (Month % 12) + 1
|
||||||
dtd = dtd.replace(month=Month)
|
dtd = dtd.replace(month=Month)
|
||||||
|
|
Loading…
Reference in a new issue