# Path: exactonline/storage/base.py
# class ExactOnlineConfig(object):
#     """
#     The configuration class.
# 
#     The getters all assert that a native-string type is returned (unless
#     a different type is explicitly mentioned). This way the callers
#     won't have to think about what they get.
#     """
#     def get_or_set_default(self, section, option, value):
#         """
#         Base method to fetch values and to set defaults in case they
#         don't exist.
#         """
#         try:
#             ret = self.get(section, option)
#         except MissingSetting:
#             self.set(section, option, value)
#             ret = value
# 
#         return ret
# 
#     # [server]
#     # ; These always return something. They may write their default to
#     # ; your config object if they are unset.
#     # ; If you want to change the values from your application, you need
#     # ; to write your own routines.
# 
#     def get_auth_url(self):
#         return native_string(self.get_or_set_default(
#             'server', 'auth_url',
#             'https://start.exactonline.nl/api/oauth2/auth'))
# 
#     def get_rest_url(self):
#         return native_string(self.get_or_set_default(
#             'server', 'rest_url',
#             'https://start.exactonline.nl/api'))
# 
#     def get_token_url(self):
#         return native_string(self.get_or_set_default(
#             'server', 'token_url',
#             'https://start.exactonline.nl/api/oauth2/token'))
# 
#     # [application]
#     # ; These return something, or raise MissingSetting if they are
#     # ; unset.
#     # ; If you want to change the values from your application, you need
#     # ; to write your own routines.
# 
#     def get_base_url(self):
#         return native_string(self.get('application', 'base_url'))
# 
#     def get_iteration_limit(self):
#         return int(self.get_or_set_default(
#             'application', 'iteration_limit', '50'))
# 
#     def get_response_url(self):
#         """
#         Get a default value for get_response_url() where the user is
#         redirected back to after the OAuth step on the ExactOnline site.
# 
#         You'll probably want to subclass this method to return a more
#         specific location.
#         """
#         return self.get_base_url()
# 
#     def get_client_id(self):
#         return native_string(self.get('application', 'client_id'))
# 
#     def get_client_secret(self):
#         return native_string(self.get('application', 'client_secret'))
# 
#     # [transient]
#     # ; These return something, or raise MissingSetting if they are
#     # ; unset.
#     # ; These will be written to by this exactonline library, so all
#     # ; their get methods have set counterparts.
# 
#     def get_access_expiry(self):
#         return int(self.get_or_set_default(
#             'transient', 'access_expiry', '0'))
# 
#     def set_access_expiry(self, value):
#         self.set('transient', 'access_expiry', native_string(value))
# 
#     def get_access_token(self):
#         return native_string(self.get('transient', 'access_token'))
# 
#     def set_access_token(self, value):
#         self.set('transient', 'access_token', native_string(value))
# 
#     def get_code(self):
#         return native_string(self.get('transient', 'code'))
# 
#     def set_code(self, value):
#         self.set('transient', 'code', native_string(value))
# 
#     def get_division(self):
#         return int(self.get('transient', 'division'))
# 
#     def set_division(self, value):
#         self.set('transient', 'division', native_string(value))
# 
#     def get_refresh_token(self):
#         return native_string(self.get('transient', 'refresh_token'))
# 
#     def set_refresh_token(self, value):
#         self.set('transient', 'refresh_token', native_string(value))
# 
#     # ; aliases
# 
#     def get_refresh_url(self):
#         "Alias for get_token_url()."
#         return self.get_token_url()
# 
# class MissingSetting(ValueError):
#     pass


from .base import ExactOnlineConfig, MissingSetting
    from configparser import NoSectionError, NoOptionError, ConfigParser
    from ConfigParser import (
        NoSectionError, NoOptionError,
        SafeConfigParser as ConfigParserOldStyle)
    """
    def __init__(self, filename_or_fp, **kwargs):
        super(IniStorage, self).__init__(**kwargs)

        if hasattr(filename_or_fp, 'read'):
            if hasattr(self, 'read_file'):
                self.read_file(filename_or_fp)
            else:
                self.readfp(filename_or_fp)  # python<3.2
            self.overwrite = False
        else:
            self.read([filename_or_fp])
            self.overwrite = filename_or_fp

    def get(self, section, option, **kwargs):
        """
        Get method that raises MissingSetting if the value was unset.

        This differs from the SafeConfigParser which may raise either a
        NoOptionError or a NoSectionError.

        We take extra **kwargs because the Python 3.5 configparser extends the
        get method signature and it calls self with those parameters.

            def get(self, section, option, *, raw=False, vars=None,
                    fallback=_UNSET):
        """
        try:
            ret = super(ExactOnlineConfig, self).get(section, option, **kwargs)
        except (NoOptionError, NoSectionError):

# Path: exactonline/storage/base.py
# class ExactOnlineConfig(object):
#     """
#     The configuration class.
# 
#     The getters all assert that a native-string type is returned (unless
#     a different type is explicitly mentioned). This way the callers
#     won't have to think about what they get.
#     """
#     def get_or_set_default(self, section, option, value):
#         """
#         Base method to fetch values and to set defaults in case they
#         don't exist.
#         """
#         try:
#             ret = self.get(section, option)
#         except MissingSetting:
#             self.set(section, option, value)
#             ret = value
# 
#         return ret
# 
#     # [server]
#     # ; These always return something. They may write their default to
#     # ; your config object if they are unset.
#     # ; If you want to change the values from your application, you need
#     # ; to write your own routines.
# 
#     def get_auth_url(self):
#         return native_string(self.get_or_set_default(
#             'server', 'auth_url',
#             'https://start.exactonline.nl/api/oauth2/auth'))
# 
#     def get_rest_url(self):
#         return native_string(self.get_or_set_default(
#             'server', 'rest_url',
#             'https://start.exactonline.nl/api'))
# 
#     def get_token_url(self):
#         return native_string(self.get_or_set_default(
#             'server', 'token_url',
#             'https://start.exactonline.nl/api/oauth2/token'))
# 
#     # [application]
#     # ; These return something, or raise MissingSetting if they are
#     # ; unset.
#     # ; If you want to change the values from your application, you need
#     # ; to write your own routines.
# 
#     def get_base_url(self):
#         return native_string(self.get('application', 'base_url'))
# 
#     def get_iteration_limit(self):
#         return int(self.get_or_set_default(
#             'application', 'iteration_limit', '50'))
# 
#     def get_response_url(self):
#         """
#         Get a default value for get_response_url() where the user is
#         redirected back to after the OAuth step on the ExactOnline site.
# 
#         You'll probably want to subclass this method to return a more
#         specific location.
#         """
#         return self.get_base_url()
# 
#     def get_client_id(self):
#         return native_string(self.get('application', 'client_id'))
# 
#     def get_client_secret(self):
#         return native_string(self.get('application', 'client_secret'))
# 
#     # [transient]
#     # ; These return something, or raise MissingSetting if they are
#     # ; unset.
#     # ; These will be written to by this exactonline library, so all
#     # ; their get methods have set counterparts.
# 
#     def get_access_expiry(self):
#         return int(self.get_or_set_default(
#             'transient', 'access_expiry', '0'))
# 
#     def set_access_expiry(self, value):
#         self.set('transient', 'access_expiry', native_string(value))
# 
#     def get_access_token(self):
#         return native_string(self.get('transient', 'access_token'))
# 
#     def set_access_token(self, value):
#         self.set('transient', 'access_token', native_string(value))
# 
#     def get_code(self):
#         return native_string(self.get('transient', 'code'))
# 
#     def set_code(self, value):
#         self.set('transient', 'code', native_string(value))
# 
#     def get_division(self):
#         return int(self.get('transient', 'division'))
# 
#     def set_division(self, value):
#         self.set('transient', 'division', native_string(value))
# 
#     def get_refresh_token(self):
#         return native_string(self.get('transient', 'refresh_token'))
# 
#     def set_refresh_token(self, value):
#         self.set('transient', 'refresh_token', native_string(value))
# 
#     # ; aliases
# 
#     def get_refresh_url(self):
#         "Alias for get_token_url()."
#         return self.get_token_url()
# 
# class MissingSetting(ValueError):
#     pass


# Path: exactonline/storage/ini.py
from .base import ExactOnlineConfig, MissingSetting
    from configparser import NoSectionError, NoOptionError, ConfigParser
    from ConfigParser import (
        NoSectionError, NoOptionError,
        SafeConfigParser as ConfigParserOldStyle)

    """
    def __init__(self, filename_or_fp, **kwargs):
        super(IniStorage, self).__init__(**kwargs)

        if hasattr(filename_or_fp, 'read'):
            if hasattr(self, 'read_file'):
                self.read_file(filename_or_fp)
            else:
                self.readfp(filename_or_fp)  # python<3.2
            self.overwrite = False
        else:
            self.read([filename_or_fp])
            self.overwrite = filename_or_fp

    def get(self, section, option, **kwargs):
        """
        Get method that raises MissingSetting if the value was unset.

        This differs from the SafeConfigParser which may raise either a
        NoOptionError or a NoSectionError.

        We take extra **kwargs because the Python 3.5 configparser extends the
        get method signature and it calls self with those parameters.

            def get(self, section, option, *, raw=False, vars=None,
                    fallback=_UNSET):
        """
        try:
            ret = super(ExactOnlineConfig, self).get(section, option, **kwargs)
        except (NoOptionError, NoSectionError):

            raise MissingSetting(option, section)