Package parsedatetime :: Module context :: Class pdtContext
[hide private]
[frames] | no frames]

type pdtContext

source code

object --+
         |
        pdtContext


Context contains accuracy flag detected by L{Calendar.parse()}

Accuracy flag uses bitwise-OR operation and is combined by:

    ACU_YEAR - "next year", "2014"
    ACU_MONTH - "March", "July 2014"
    ACU_WEEK - "last week", "next 3 weeks"
    ACU_DAY - "tomorrow", "July 4th 2014"
    ACU_HALFDAY - "morning", "tonight"
    ACU_HOUR - "18:00", "next hour"
    ACU_MIN - "18:32", "next 10 minutes"
    ACU_SEC - "18:32:55"
    ACU_NOW - "now"

Instance Methods [hide private]
object
__init__(self, accuracy=0)
Default constructor of pdtContext class.
source code
 
updateAccuracy(self, *accuracy)
Updates current accuracy flag
source code
 
update(self, context)
Uses another pdtContext instance to update current one
source code
 
__repr__(self) source code
 
__eq__(self, ctx) source code
Class Variables [hide private]
  ACU_YEAR = 1
  ACU_MONTH = 2
  ACU_WEEK = 4
  ACU_DAY = 8
  ACU_HALFDAY = 16
  ACU_HOUR = 32
  ACU_MIN = 64
  ACU_SEC = 128
  ACU_NOW = 256
  ACU_DATE = 15
  ACU_TIME = 496
  _ACCURACY_MAPPING = [(1, 'year'), (2, 'month'), (4, 'week'), (...
  _ACCURACY_REVERSE_MAPPING = {'afternoon': 16, 'day': 8, 'days'...
Properties [hide private]
  hasDate
Returns True if current context is accurate to date
  hasTime
Returns True if current context is accurate to time
  dateTimeFlag
Returns the old date/time flag code
  hasDateOrTime
Returns True if current context is accurate to date/time
  accuracy
Method Details [hide private]

__init__(self, accuracy=0)
(Constructor)

source code 

Default constructor of pdtContext class.

Parameters:
  • accuracy (integer) - Accuracy flag
Returns: object
pdtContext instance
Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 
Overrides: object.__repr__
(inherited documentation)

Class Variable Details [hide private]

_ACCURACY_MAPPING

Value:
[(1, 'year'),
 (2, 'month'),
 (4, 'week'),
 (8, 'day'),
 (16, 'halfday'),
 (32, 'hour'),
 (64, 'min'),
 (128, 'sec'),
...

_ACCURACY_REVERSE_MAPPING

Value:
{'afternoon': 16,
 'day': 8,
 'days': 8,
 'evening': 16,
 'halfday': 16,
 'hour': 32,
 'hours': 32,
 'midnight': 16,
...

Property Details [hide private]

hasDate

Returns True if current context is accurate to date

hasTime

Returns True if current context is accurate to time

dateTimeFlag

Returns the old date/time flag code

hasDateOrTime

Returns True if current context is accurate to date/time