<commit_before>"""
byceps.services.shop.shop.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2018 <NAME>
:License: Modified BSD, see LICENSE for details.
"""

from typing import NewType

from ....database import db
from ....typing import PartyID
from ....util.instances import ReprBuilder


ShopID = NewType('ShopID', str)


class Shop(db.Model):
    """A shop."""
    __tablename__ = 'shops'

    id = db.Column(db.Unicode(40), primary_key=True)
    party_id = db.Column(db.Unicode(40), db.ForeignKey('parties.id'), index=True, nullable=False)

    def __init__(self, shop_id: ShopID, party_id: PartyID) -> None:
        self.id = shop_id
        self.party_id = party_id

    def __repr__(self) -> str:
        return ReprBuilder(self) \
            .add_with_lookup('id') \
            .add('party', self.party_id) \<commit_msg>Only allow one shop per party<commit_after>"""
byceps.services.shop.shop.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2018 <NAME>
:License: Modified BSD, see LICENSE for details.
"""

from typing import NewType

from ....database import db
from ....typing import PartyID
from ....util.instances import ReprBuilder


ShopID = NewType('ShopID', str)


class Shop(db.Model):
    """A shop."""
    __tablename__ = 'shops'

    id = db.Column(db.Unicode(40), primary_key=True)
    party_id = db.Column(db.Unicode(40), db.ForeignKey('parties.id'), unique=True, nullable=False)

    def __init__(self, shop_id: ShopID, party_id: PartyID) -> None:
        self.id = shop_id
        self.party_id = party_id

    def __repr__(self) -> str:
        return ReprBuilder(self) \
            .add_with_lookup('id') \
            .add('party', self.party_id) \
{'fraction_non_alphanumeric': 0.1753972925250147, 'fraction_numerical': 0.014125956444967627, 'mean_word_length': 3.292929292929293, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5545499', 'n_tokens_mistral': 584, 'n_tokens_neox': 548, 'n_words': 133}