# Path: schwa/dr/fields_core.py
# class Field(BaseField):
#   def default(self):
#     return None
# 
#   def from_wire(self, val, rtfield, cur_store, doc):
#     return val
# 
#   def to_wire(self, obj, rtfield, cur_store, doc):
#     return obj
# 
#   def resolve_klasses(self):
#     pass


import warnings
import dateutil.parser
import six
from .fields_core import Field
# vim: set et nosi ai ts=2 sts=2 sw=2:
# coding: utf-8
from __future__ import absolute_import, print_function, unicode_literals



__all__ = ['DateTime', 'Text']


class DateTime(Field):
  def from_wire(self, val, rtfield, cur_store, doc):
    if val is None:
      return None
    try:
      return dateutil.parser.parse(val)
    # Some parse errors manifest as Nones due to a bug in dateutil
    # https://bugs.launchpad.net/dateutil/+bug/1247643
    except TypeError:
      return ValueError

  def to_wire(self, obj, rtfield, cur_store, doc):
    if obj is None:
      return None
    return obj.isoformat()



# Path: schwa/dr/fields_core.py
# class Field(BaseField):
#   def default(self):
#     return None
# 
#   def from_wire(self, val, rtfield, cur_store, doc):
#     return val
# 
#   def to_wire(self, obj, rtfield, cur_store, doc):
#     return obj
# 
#   def resolve_klasses(self):
#     pass


# Path: schwa/dr/fields_extra.py
import warnings
import dateutil.parser
import six
from .fields_core import Field

# vim: set et nosi ai ts=2 sts=2 sw=2:
# coding: utf-8
from __future__ import absolute_import, print_function, unicode_literals



__all__ = ['DateTime', 'Text']


class DateTime(Field):
  def from_wire(self, val, rtfield, cur_store, doc):
    if val is None:
      return None
    try:
      return dateutil.parser.parse(val)
    # Some parse errors manifest as Nones due to a bug in dateutil
    # https://bugs.launchpad.net/dateutil/+bug/1247643
    except TypeError:
      return ValueError

  def to_wire(self, obj, rtfield, cur_store, doc):
    if obj is None:
      return None
    return obj.isoformat()



class Text(Field):