# Path: num2words/compat.py
# def to_s(val):
#     try:
#         return unicode(val)
#     except NameError:
#         return str(val)
# 
# Path: num2words/currency.py
# def parse_currency_parts(value, is_int_with_cents=True):
#     if isinstance(value, int):
#         if is_int_with_cents:
#             # assume cents if value is integer
#             negative = value < 0
#             value = abs(value)
#             integer, cents = divmod(value, 100)
#         else:
#             negative = value < 0
#             integer, cents = abs(value), 0
# 
#     else:
#         value = Decimal(value)
#         value = value.quantize(
#             Decimal('.01'),
#             rounding=ROUND_HALF_UP
#         )
#         negative = value < 0
#         value = abs(value)
#         integer, fraction = divmod(value, 1)
#         integer = int(integer)
#         cents = int(fraction * 100)
# 
#     return integer, cents, negative
# 
# def prefix_currency(prefix, base):
#     return tuple("%s %s" % (prefix, i) for i in base)


import math
from collections import OrderedDict
from decimal import Decimal
from .compat import to_s
from .currency import parse_currency_parts, prefix_currency
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA

from __future__ import unicode_literals




class Num2Word_Base(object):
    CURRENCY_FORMS = {}
    CURRENCY_ADJECTIVES = {}

    def __init__(self):
        self.is_title = False
        self.precision = 2
        self.exclude_title = []
        self.negword = "(-) "
        self.pointword = "(.)"
        self.errmsg_nonnum = "type(%s) not in [long, int, float]"
        self.errmsg_floatord = "Cannot treat float %s as ordinal."
        self.errmsg_negord = "Cannot treat negative num %s as ordinal."
        self.errmsg_toobig = "abs(%s) must be less than %s."

        self.setup()

        # uses cards
        if any(hasattr(self, field) for field in

# Path: num2words/compat.py
# def to_s(val):
#     try:
#         return unicode(val)
#     except NameError:
#         return str(val)
# 
# Path: num2words/currency.py
# def parse_currency_parts(value, is_int_with_cents=True):
#     if isinstance(value, int):
#         if is_int_with_cents:
#             # assume cents if value is integer
#             negative = value < 0
#             value = abs(value)
#             integer, cents = divmod(value, 100)
#         else:
#             negative = value < 0
#             integer, cents = abs(value), 0
# 
#     else:
#         value = Decimal(value)
#         value = value.quantize(
#             Decimal('.01'),
#             rounding=ROUND_HALF_UP
#         )
#         negative = value < 0
#         value = abs(value)
#         integer, fraction = divmod(value, 1)
#         integer = int(integer)
#         cents = int(fraction * 100)
# 
#     return integer, cents, negative
# 
# def prefix_currency(prefix, base):
#     return tuple("%s %s" % (prefix, i) for i in base)


# Path: num2words/base.py
import math
from collections import OrderedDict
from decimal import Decimal
from .compat import to_s
from .currency import parse_currency_parts, prefix_currency

# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA

from __future__ import unicode_literals




class Num2Word_Base(object):
    CURRENCY_FORMS = {}
    CURRENCY_ADJECTIVES = {}

    def __init__(self):
        self.is_title = False
        self.precision = 2
        self.exclude_title = []
        self.negword = "(-) "
        self.pointword = "(.)"
        self.errmsg_nonnum = "type(%s) not in [long, int, float]"
        self.errmsg_floatord = "Cannot treat float %s as ordinal."
        self.errmsg_negord = "Cannot treat negative num %s as ordinal."
        self.errmsg_toobig = "abs(%s) must be less than %s."

        self.setup()

        # uses cards
        if any(hasattr(self, field) for field in

               ['high_numwords', 'mid_numwords', 'low_numwords']):