# Path: battlenet/enums.py
# RACE = {
#     1: 'Human',
#     2: 'Orc',
#     3: 'Dwarf',
#     4: 'Night Elf',
#     5: 'Undead',
#     6: 'Tauren',
#     7: 'Gnome',
#     8: 'Troll',
#     9: 'Goblin',
#     10: 'Blood Elf',
#     11: 'Draenei',
#     22: 'Worgen',
# }
# 
# CLASS = {
#     1: 'Warrior',
#     2: 'Paladin',
#     3: 'Hunter',
#     4: 'Rogue',
#     5: 'Priest',
#     7: 'Shaman',
#     8: 'Mage',
#     9: 'Warlock',
#     11: 'Druid',
#     6: 'Death Knight',
# }
# 
# QUALITY = {
#     1: 'Common',
#     2: 'Uncommon',
#     3: 'Rare',
#     4: 'Epic',
#     5: 'Legendary',
# }
# 
# RACE_TO_FACTION = {
#     1: 'Alliance',
#     2: 'Horde',
#     3: 'Alliance',
#     4: 'Alliance',
#     5: 'Horde',
#     6: 'Horde',
#     7: 'Alliance',
#     8: 'Horde',
#     9: 'Horde',
#     10: 'Horde',
#     11: 'Alliance',
#     22: 'Alliance',
# }
# 
# Path: battlenet/utils.py
# def make_icon_url(region, icon, size='large'):
#     if not icon:
#         return ''
# 
#     if size == 'small':
#         size = 18
#     else:
#         size = 56
# 
#     return 'http://%s.media.blizzard.com/wow/icons/%d/%s.jpg' % (region, size, icon)
# 
# def normalize(name):
#     if not isinstance(name, unicode):
#         name = name.decode('utf8')
# 
#     return unicodedata.normalize('NFKC', name).encode('utf8')
# 
# def make_connection():
#     if not hasattr(make_connection, 'Connection'):
#         from .connection import Connection
#         make_connection.Connection = Connection
# 
#     return make_connection.Connection()


import operator
import collections
import datetime
    import simplejson as json
    import json
from .enums import RACE, CLASS, QUALITY, RACE_TO_FACTION
from .utils import make_icon_url, normalize, make_connection
        self._data = data

        self.min_guild_level = data['minGuildLevel']
        self.min_guild_reputation = data['minGuildRepLevel']
        self.races = data.get('races', [])
        self.achievement = data.get('achievement')
        self.item = EquippedItem(region, data['item'])

    def __str__(self):
        return self.item.name

    def __repr__(self):
        return '<%s: %s>' % (self.__class__.__name__, str(self))

    def get_race_names(self):
        return [RACE[race] for race in self.races]


class Realm(Thing):
    PVP = 'pvp'
    PVE = 'pve'
    RP = 'rp'
    RPPVP = 'rppvp'

    HIGH = 'high'
    MEDIUM = 'medium'
    LOW = 'low'

    def __init__(self, region, name=None, data=None, connection=None):
        self.region = region

# Path: battlenet/enums.py
# RACE = {
#     1: 'Human',
#     2: 'Orc',
#     3: 'Dwarf',
#     4: 'Night Elf',
#     5: 'Undead',
#     6: 'Tauren',
#     7: 'Gnome',
#     8: 'Troll',
#     9: 'Goblin',
#     10: 'Blood Elf',
#     11: 'Draenei',
#     22: 'Worgen',
# }
# 
# CLASS = {
#     1: 'Warrior',
#     2: 'Paladin',
#     3: 'Hunter',
#     4: 'Rogue',
#     5: 'Priest',
#     7: 'Shaman',
#     8: 'Mage',
#     9: 'Warlock',
#     11: 'Druid',
#     6: 'Death Knight',
# }
# 
# QUALITY = {
#     1: 'Common',
#     2: 'Uncommon',
#     3: 'Rare',
#     4: 'Epic',
#     5: 'Legendary',
# }
# 
# RACE_TO_FACTION = {
#     1: 'Alliance',
#     2: 'Horde',
#     3: 'Alliance',
#     4: 'Alliance',
#     5: 'Horde',
#     6: 'Horde',
#     7: 'Alliance',
#     8: 'Horde',
#     9: 'Horde',
#     10: 'Horde',
#     11: 'Alliance',
#     22: 'Alliance',
# }
# 
# Path: battlenet/utils.py
# def make_icon_url(region, icon, size='large'):
#     if not icon:
#         return ''
# 
#     if size == 'small':
#         size = 18
#     else:
#         size = 56
# 
#     return 'http://%s.media.blizzard.com/wow/icons/%d/%s.jpg' % (region, size, icon)
# 
# def normalize(name):
#     if not isinstance(name, unicode):
#         name = name.decode('utf8')
# 
#     return unicodedata.normalize('NFKC', name).encode('utf8')
# 
# def make_connection():
#     if not hasattr(make_connection, 'Connection'):
#         from .connection import Connection
#         make_connection.Connection = Connection
# 
#     return make_connection.Connection()


# Path: battlenet/things.py
import operator
import collections
import datetime
    import simplejson as json
    import json
from .enums import RACE, CLASS, QUALITY, RACE_TO_FACTION
from .utils import make_icon_url, normalize, make_connection

        self._data = data

        self.min_guild_level = data['minGuildLevel']
        self.min_guild_reputation = data['minGuildRepLevel']
        self.races = data.get('races', [])
        self.achievement = data.get('achievement')
        self.item = EquippedItem(region, data['item'])

    def __str__(self):
        return self.item.name

    def __repr__(self):
        return '<%s: %s>' % (self.__class__.__name__, str(self))

    def get_race_names(self):
        return [RACE[race] for race in self.races]


class Realm(Thing):
    PVP = 'pvp'
    PVE = 'pve'
    RP = 'rp'
    RPPVP = 'rppvp'

    HIGH = 'high'
    MEDIUM = 'medium'
    LOW = 'low'

    def __init__(self, region, name=None, data=None, connection=None):
        self.region = region

        self.connection = connection or make_connection()