mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-25 19:44:13 +01:00
Fixed dateutil to use the "local" subdirectory format.
This commit is contained in:
parent
8c66ed9a3f
commit
279c00a925
@ -11,9 +11,9 @@ import datetime
|
|||||||
import struct
|
import struct
|
||||||
import time
|
import time
|
||||||
|
|
||||||
relativedelta = None
|
import relativedelta
|
||||||
parser = None
|
import parser
|
||||||
rrule = None
|
rrule = None # XXX Where does this come from? Why isn't it here?
|
||||||
|
|
||||||
__all__ = ["tzutc", "tzoffset", "tzlocal", "tzfile",
|
__all__ = ["tzutc", "tzoffset", "tzlocal", "tzfile",
|
||||||
"tzrange", "tzstr", "tzical", "gettz"]
|
"tzrange", "tzstr", "tzical", "gettz"]
|
||||||
@ -443,9 +443,6 @@ class tzrange(datetime.tzinfo):
|
|||||||
def __init__(self, stdabbr, stdoffset=None,
|
def __init__(self, stdabbr, stdoffset=None,
|
||||||
dstabbr=None, dstoffset=None,
|
dstabbr=None, dstoffset=None,
|
||||||
start=None, end=None):
|
start=None, end=None):
|
||||||
global relativedelta
|
|
||||||
if not relativedelta:
|
|
||||||
from dateutil import relativedelta
|
|
||||||
self._std_abbr = stdabbr
|
self._std_abbr = stdabbr
|
||||||
self._dst_abbr = dstabbr
|
self._dst_abbr = dstabbr
|
||||||
if stdoffset is not None:
|
if stdoffset is not None:
|
||||||
@ -519,9 +516,6 @@ class tzrange(datetime.tzinfo):
|
|||||||
class tzstr(tzrange):
|
class tzstr(tzrange):
|
||||||
|
|
||||||
def __init__(self, s):
|
def __init__(self, s):
|
||||||
global parser
|
|
||||||
if not parser:
|
|
||||||
from dateutil import parser
|
|
||||||
self._s = s
|
self._s = s
|
||||||
|
|
||||||
res = parser._parsetz(s)
|
res = parser._parsetz(s)
|
||||||
@ -654,6 +648,7 @@ class _tzicalvtz(datetime.tzinfo):
|
|||||||
|
|
||||||
class tzical:
|
class tzical:
|
||||||
def __init__(self, fileobj):
|
def __init__(self, fileobj):
|
||||||
|
# XXX This should be fixed, but doesn't seem to be in our dateutil.
|
||||||
global rrule
|
global rrule
|
||||||
if not rrule:
|
if not rrule:
|
||||||
from dateutil import rrule
|
from dateutil import rrule
|
@ -30,13 +30,13 @@
|
|||||||
import time
|
import time
|
||||||
TIME = time # For later use.
|
TIME = time # For later use.
|
||||||
|
|
||||||
import dateutil.parser
|
|
||||||
|
|
||||||
import supybot.conf as conf
|
import supybot.conf as conf
|
||||||
import supybot.utils as utils
|
import supybot.utils as utils
|
||||||
from supybot.commands import *
|
from supybot.commands import *
|
||||||
import supybot.callbacks as callbacks
|
import supybot.callbacks as callbacks
|
||||||
|
|
||||||
|
parser = utils.python.universalImport('dateutil.parser', 'local.dateutil.parser')
|
||||||
|
|
||||||
def parse(s):
|
def parse(s):
|
||||||
todo = []
|
todo = []
|
||||||
s = s.replace('noon', '12:00')
|
s = s.replace('noon', '12:00')
|
||||||
@ -47,7 +47,7 @@ def parse(s):
|
|||||||
if 'next week' in s:
|
if 'next week' in s:
|
||||||
todo.append(lambda i: i + 86400*7)
|
todo.append(lambda i: i + 86400*7)
|
||||||
s = s.replace('next week', '')
|
s = s.replace('next week', '')
|
||||||
i = int(time.mktime(dateutil.parser.parse(s, fuzzy=True).timetuple()))
|
i = int(time.mktime(parser.parse(s, fuzzy=True).timetuple()))
|
||||||
for f in todo:
|
for f in todo:
|
||||||
i = f(i)
|
i = f(i)
|
||||||
return i
|
return i
|
||||||
|
Loading…
Reference in New Issue
Block a user