MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / parse

Method parse

suds/sax/date.py:76–97  ·  view source on GitHub ↗

Parse the string date. This supports the subset of ISO8601 used by xsd:date, but is lenient with what is accepted, handling most reasonable syntax. Any timezone is parsed but ignored because a) it's meaningless without a time and b) B{datetime}.I{date} does not sup

(value)

Source from the content-addressed store, hash-verified

74
75 @staticmethod
76 def parse(value):
77 """Parse the string date.
78
79 This supports the subset of ISO8601 used by xsd:date, but is lenient
80 with what is accepted, handling most reasonable syntax.
81
82 Any timezone is parsed but ignored because a) it's meaningless without
83 a time and b) B{datetime}.I{date} does not support a tzinfo property.
84
85 @param value: A date string.
86 @type value: str
87 @return: A date object.
88 @rtype: B{datetime}.I{date}
89
90 """
91 match_result = RE_DATE.match(value)
92 if match_result is None:
93 raise ValueError('date data has invalid format "%s"' % value)
94
95 value = date_from_match(match_result)
96
97 return value
98
99 def __str__(self):
100 return self.value.isoformat()

Callers 4

__init__Method · 0.95
jquery.jsFile · 0.45
prism.jsFile · 0.45
json-lint.jsFile · 0.45

Calls 2

date_from_matchFunction · 0.85
matchMethod · 0.45

Tested by

no test coverage detected