# Path: oaxmlapi/base.py
# class _Base(object):
#     """
#     A base class for defining helpful class methods.
# 
#     """
#     def __init__(self):
#         self._header = False
# 
#     def __str__(self):
#         return "<_Base>"
# 
#     def _main(self):
#         return None
# 
#     def tostring(self):
#         """
#         Return a bytestring containing XML tags.
# 
#         """
#         header, body = None, None
# 
#         if self._header:
#             header = b'<?xml version="1.0" encoding="utf-8"?>'
# 
#         if self._main() is not None:
#             body = ET.tostring(self._main(), 'utf-8')
# 
#         return (header if header else b'') + (body if body else b'')
# 
#     def prettify(self):
#         """
#         Return a formatted, prettified string containing XML tags. Note
#         that this also adds an XML declaration tag to the top of the XML
#         document, so this should only be used for debugging.
# 
#         """
#         reparsed = minidom.parseString(self.tostring())
#         return reparsed.toprettyxml(indent='  ', encoding='utf-8')
# 
# Path: oaxmlapi/utilities.py
# READ_METHODS = ('all', 'equal to', 'not equal to', 'custom equal to', 'user',
#     'project', 'not exported', )
# 
# REPORT_TYPES = ('Envelope', 'Timesheet', 'Report', )
# 
# SUBMIT_TYPES = ('Envelope', 'Timesheet', 'Invoice', )
# 
# SWITCH_TYPES = ('Company', 'User', )
# 
# PAGE_ATTRIBUTES = ('default-url', 'company-settings', 'currency-rates',
#     'import-export', 'custom-fields', 'list-reports', 'list-customers',
#     'list-projects', 'list-prospects', 'list-resources', 'list-timesheets',
#     'create-timesheet', 'list-timebills', 'list-invoices', 'create-invoice',
#     'list-envelope-receipts', 'list-envelopes', 'create-envelope',
#     'create-envelope-receipt', 'dashboard', 'list-purchase-requests',
#     'quick-search-resources', 'custom-search-resources', 'view-invoice',
#     'dashboard-project', 'grid-timesheet', 'report-timesheet', )
# 
# APP_ATTRIBUTES = ('km', 'ma', 'pb', 'rm', 'pm', 'ta', 'te', 'tb', )


    import xml.etree.cElementTree as ET
    import xml.etree.ElementTree as ET
from oaxmlapi.base import _Base
from oaxmlapi.utilities import (READ_METHODS, REPORT_TYPES, SUBMIT_TYPES,
    SWITCH_TYPES, PAGE_ATTRIBUTES, APP_ATTRIBUTES, )
            return f


class Report(_Base):
    """
    Use the Report command to run a report and email a PDF copy
    of a Timesheet, Envelope, or Saved report.

    Arguments:
        type (str): a valid XML type. Only Timesheet, Envelope
                        or Reportf datatypes are allowed
        datatype (obj): a valid XML report element datatype

    """
    def __init__(self, type, datatype):
        _Base.__init__(self)
        self.type = type
        self.datatype = datatype.getDatatype()

    def __str__(self):
        return "<Report type={type}>".format(type=self.type)

    @property
    def type(self):
        return self._type

    @type.setter
    def type(self, t):
        if not t in REPORT_TYPES:
            raise Exception('type "{type}" must be one of {allowed}'.format(

# Path: oaxmlapi/base.py
# class _Base(object):
#     """
#     A base class for defining helpful class methods.
# 
#     """
#     def __init__(self):
#         self._header = False
# 
#     def __str__(self):
#         return "<_Base>"
# 
#     def _main(self):
#         return None
# 
#     def tostring(self):
#         """
#         Return a bytestring containing XML tags.
# 
#         """
#         header, body = None, None
# 
#         if self._header:
#             header = b'<?xml version="1.0" encoding="utf-8"?>'
# 
#         if self._main() is not None:
#             body = ET.tostring(self._main(), 'utf-8')
# 
#         return (header if header else b'') + (body if body else b'')
# 
#     def prettify(self):
#         """
#         Return a formatted, prettified string containing XML tags. Note
#         that this also adds an XML declaration tag to the top of the XML
#         document, so this should only be used for debugging.
# 
#         """
#         reparsed = minidom.parseString(self.tostring())
#         return reparsed.toprettyxml(indent='  ', encoding='utf-8')
# 
# Path: oaxmlapi/utilities.py
# READ_METHODS = ('all', 'equal to', 'not equal to', 'custom equal to', 'user',
#     'project', 'not exported', )
# 
# REPORT_TYPES = ('Envelope', 'Timesheet', 'Report', )
# 
# SUBMIT_TYPES = ('Envelope', 'Timesheet', 'Invoice', )
# 
# SWITCH_TYPES = ('Company', 'User', )
# 
# PAGE_ATTRIBUTES = ('default-url', 'company-settings', 'currency-rates',
#     'import-export', 'custom-fields', 'list-reports', 'list-customers',
#     'list-projects', 'list-prospects', 'list-resources', 'list-timesheets',
#     'create-timesheet', 'list-timebills', 'list-invoices', 'create-invoice',
#     'list-envelope-receipts', 'list-envelopes', 'create-envelope',
#     'create-envelope-receipt', 'dashboard', 'list-purchase-requests',
#     'quick-search-resources', 'custom-search-resources', 'view-invoice',
#     'dashboard-project', 'grid-timesheet', 'report-timesheet', )
# 
# APP_ATTRIBUTES = ('km', 'ma', 'pb', 'rm', 'pm', 'ta', 'te', 'tb', )


# Path: oaxmlapi/commands.py
    import xml.etree.cElementTree as ET
    import xml.etree.ElementTree as ET
from oaxmlapi.base import _Base
from oaxmlapi.utilities import (READ_METHODS, REPORT_TYPES, SUBMIT_TYPES,
    SWITCH_TYPES, PAGE_ATTRIBUTES, APP_ATTRIBUTES, )

            return f


class Report(_Base):
    """
    Use the Report command to run a report and email a PDF copy
    of a Timesheet, Envelope, or Saved report.

    Arguments:
        type (str): a valid XML type. Only Timesheet, Envelope
                        or Reportf datatypes are allowed
        datatype (obj): a valid XML report element datatype

    """
    def __init__(self, type, datatype):
        _Base.__init__(self)
        self.type = type
        self.datatype = datatype.getDatatype()

    def __str__(self):
        return "<Report type={type}>".format(type=self.type)

    @property
    def type(self):
        return self._type

    @type.setter
    def type(self, t):
        if not t in REPORT_TYPES:
            raise Exception('type "{type}" must be one of {allowed}'.format(

                type=t, allowed=REPORT_TYPES))