# Path: poker/_common.py
# def _make_int(string):
#     return int(string.strip().replace(",", ""))


import re
import attr
import requests
import parsedatetime
from datetime import datetime
from lxml import etree
from dateutil.tz import tzoffset
from pytz import UTC
from .._common import _make_int
    try:
        found_name = root[0].text
    except IndexError:
        raise UserNotFoundError(username)

    # The request is basically a search, can return multiple userids
    # for users starting with username. Make sure we got the right one!
    if found_name.upper() != username.upper():
        exc = AmbiguousUserNameError(username)
        # attach the extra users to the exception
        exc.users = tuple(
            _ExtraUser(name=child.text, id=child.attrib["userid"]) for child in root
        )  # noqa
        raise exc

    return root[0].attrib["userid"]


class ForumMember:
    """Download and store a member data from the Two Plus Two forum."""

    _tz_re = re.compile("GMT (.*?)\.")
    _attributes = (
        ("username", '//td[@id="username_box"]/h1/text()', str),
        ("rank", '//td[@id="username_box"]/h2/text()', str),
        ("profile_picture", '//td[@id="profilepic_cell"]/img/@src', str),
        ("location", '//div[@id="collapseobj_aboutme"]/div/ul/li/dl/dd[1]/text()', str),
        (
            "total_posts",
            '//div[@id="collapseobj_stats"]/div/fieldset[1]/ul/li[1]/text()',

# Path: poker/_common.py
# def _make_int(string):
#     return int(string.strip().replace(",", ""))


# Path: poker/website/twoplustwo.py
import re
import attr
import requests
import parsedatetime
from datetime import datetime
from lxml import etree
from dateutil.tz import tzoffset
from pytz import UTC
from .._common import _make_int

    try:
        found_name = root[0].text
    except IndexError:
        raise UserNotFoundError(username)

    # The request is basically a search, can return multiple userids
    # for users starting with username. Make sure we got the right one!
    if found_name.upper() != username.upper():
        exc = AmbiguousUserNameError(username)
        # attach the extra users to the exception
        exc.users = tuple(
            _ExtraUser(name=child.text, id=child.attrib["userid"]) for child in root
        )  # noqa
        raise exc

    return root[0].attrib["userid"]


class ForumMember:
    """Download and store a member data from the Two Plus Two forum."""

    _tz_re = re.compile("GMT (.*?)\.")
    _attributes = (
        ("username", '//td[@id="username_box"]/h1/text()', str),
        ("rank", '//td[@id="username_box"]/h2/text()', str),
        ("profile_picture", '//td[@id="profilepic_cell"]/img/@src', str),
        ("location", '//div[@id="collapseobj_aboutme"]/div/ul/li/dl/dd[1]/text()', str),
        (
            "total_posts",
            '//div[@id="collapseobj_stats"]/div/fieldset[1]/ul/li[1]/text()',

            _make_int,