Tryag File Manager
Home
-
Turbo Force
Current Path :
/
usr
/
lib
/
python2.4
/
site-packages
/
dateutil
/
Upload File :
New :
File
Dir
//usr/lib/python2.4/site-packages/dateutil/relativedelta.pyc
mò R^Cc @ s» d Z d Z d Z d k Z d k Z d d d d d d d d g Z d e f d „ ƒ YZ e g Z e d ƒ D] Z e e e ƒ ql [ ƒ \ Z Z Z Z Z Z Z Z d f d „ ƒ YZ d S( sŽ Copyright (c) 2003-2005 Gustavo Niemeyer <gustavo@niemeyer.net> This module offers extensions to the standard python 2.3+ datetime module. s' Gustavo Niemeyer <gustavo@niemeyer.net>s PSF LicenseNt relativedeltat MOt TUt WEt THt FRt SAt SUt weekdayc B s; t Z d d g Z d d „ Z d „ Z d „ Z d „ Z RS( NR t nc C s | | _ | | _ d S( N( R t selfR ( R R R ( ( t: /usr/lib/python2.4/site-packages/dateutil/relativedelta.pyt __init__ s c C s/ | | i j o | Sn | i | i | ƒ Sd S( N( R R t __class__R ( R R ( ( R t __call__ s c C sP y2 | i | i j p | i | i j o t Sn Wn t j o t Sn Xt S( N( R R t otherR t Falset AttributeErrort True( R R ( ( R t __eq__ s & c C s4 d | i } | i p | Sn d | | i f Sd S( NR R R R R R R s %s(%+d)( s MOs TUs WEs THs FRs SAs SU( R R t sR ( R R ( ( R t __repr__$ s ( t __name__t __module__t __slots__t NoneR R R R ( ( ( R R s i c B sË t Z d Z e e d d d d d d d d d e e e e e e e e e e d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z RS( sk The relativedelta type is based on the specification of the excelent work done by M.-A. Lemburg in his mx.DateTime extension. However, notice that this type does *NOT* implement the same algorithm as his work. Do *NOT* expect it to behave like mx.DateTime's counterpart. There's two different ways to build a relativedelta instance. The first one is passing it two date/datetime classes: relativedelta(datetime1, datetime2) And the other way is to use the following keyword arguments: year, month, day, hour, minute, second, microsecond: Absolute information. years, months, weeks, days, hours, minutes, seconds, microseconds: Relative information, may be negative. weekday: One of the weekday instances (MO, TU, etc). These instances may receive a parameter N, specifying the Nth weekday, which could be positive or negative (like MO(+1) or MO(-2). Not specifying it is the same as specifying +1. You can also use an integer, where 0=MO. leapdays: Will add given days to the date found, if year is a leap year, and the date found is post 28 of february. yearday, nlyearday: Set the yearday or the non-leap year day (jump leap days). These are converted to day/month/leapdays information. Here is the behavior of operations with relativedelta: 1) Calculate the absolute year, using the 'year' argument, or the original datetime year, if the argument is not present. 2) Add the relative 'years' argument to the absolute year. 3) Do steps 1 and 2 for month/months. 4) Calculate the absolute day, using the 'day' argument, or the original datetime day, if the argument is not present. Then, subtract from the day until it fits in the year and month found after their operations. 5) Add the relative 'days' argument to the absolute day. Notice that the 'weeks' argument is multiplied by 7 and added to 'days'. 6) Do steps 1 and 2 for hour/hours, minute/minutes, second/seconds, microsecond/microseconds. 7) If the 'weekday' argument is present, calculate the weekday, with the given (wday, nth) tuple. wday is the index of the weekday (0-6, 0=Mon), and nth is the number of weeks to add forward or backward, depending on its signal. Notice that if the calculated date is already Monday, for example, using (0, 1) or (0, -1) won't change the day. i c C s | oJ| oCt | t i ƒ p t | t i ƒ o t d ‚ n t | ƒ t | ƒ j ob t | t i ƒ p t i i | i ƒ ƒ } q¾ t | t i ƒ p t i i | i ƒ ƒ } q¾ n d | _ d | _ d | _ d | _ d | _ d | _ d | _ d | _ d | _ d | _ d | _ d | _ d | _ d | _ d | _ d | _ d | _ | i d | i | i d | i } | i | ƒ | i | ƒ } | | j o? xw | | j o* | d 7} | i | ƒ | i | ƒ } q©Wn<