<commit_before>from apps.barrel import Store, Field, BooleanField, DateField, IntField, FloatField, LongIntField, EmbeddedStoreField
from apps.barrel.cache import cache, sliced_call_args
from apps.barrel.rpc import RpcMixin
from money import Money


COMMERCIAL_LICENSES = ['commercial-retailer-default', 'commercial-enduser-default', 'cc-publicdomain']


class Document(Store, RpcMixin):
    interface = 'WSDocMgmt'

    class Author(Store):
        first_name = Field(target='firstName')
        last_name = Field(target='lastName')

    class Attributes(Store):
        as_epub = BooleanField(target='available_as_epub') # should be deprecated soon
        as_pdf = BooleanField(target='available_as_pdf') # should be deprecated soon
        as_watermark = BooleanField(target='available_as_watermark') # should be deprecated soon
        author = Field(target='author', default='')
        author_bio = Field(target='author_biography', default='')
        content_provider_id = Field(target='content_provider_specific_id')
        content_provider_name = Field(target='content_provider_name')
        content_source_id = Field(target='content_source_id')
        cover_ratio = FloatField(target='cover_image_aspect_ratio')
        currency = Field(target='currency')
        description = Field(target='description')
        editors_comment = Field(target='editors_comment')
        extract = Field(target='extract')
        first_publication = Field(target='date_of_first_publication')
        fulfillment_id = Field(target='fulfillment_id')
        fulfillment_type = Field(target='fulfillment_type')
        hash = Field(target='binary_hash')
        isbn = LongIntField(target='isbn')
        language = Field(target='language')
        large_cover_url = Field(target='cover_image_url_large')
        medium_cover_url = Field(target='cover_image_url_medium')
        normal_cover_url = Field(target='cover_image_url_normal')
        pages = IntField(target='number_of_pages')
        price = FloatField(target='price')
        publication_date = DateField(target='publication_date')
        publication_status = DateField(target='publication_status')
        publisher = Field(target='publisher')
        size = IntField(target='size')
        subtitle = Field(target='subtitle')
        tax_group = Field(target='tax_group')
        title = Field(target='title', default='')
        undiscounted_price = FloatField(target='undiscounted_price')
        via_iap = BooleanField(target='available_via_iap') # should be deprecated soon
        with_adobe_drm = BooleanField(target='available_with_adobe_drm') # should be deprecated soon
        year = IntField(target='year')

    class License(Store):
        key = Field(target='key')
        user_roles = Field(target='currentUserRoles')

    id = Field(target='documentID')
    attributes = EmbeddedStoreField(target='attributes', store_class=Attributes)
    authors = EmbeddedStoreField(target='authors', store_class=Author, is_array=True)
    catalog_state = Field(target='catalogDocumentState')
    _categories = EmbeddedStoreField(target='contentCategories', store_class='apps.reaktor_barrel.category.models.Category', is_array=True)
    category_ids = Field(target='contentCategoryIDs')
    creation_date = DateField(target='creationTime')<commit_msg>SKNS-1548 - display imprint first<commit_after>from apps.barrel import Store, Field, BooleanField, DateField, IntField, FloatField, LongIntField, EmbeddedStoreField
from apps.barrel.cache import cache, sliced_call_args
from apps.barrel.rpc import RpcMixin
from money import Money


COMMERCIAL_LICENSES = ['commercial-retailer-default', 'commercial-enduser-default', 'cc-publicdomain']


class Document(Store, RpcMixin):
    interface = 'WSDocMgmt'

    class Author(Store):
        first_name = Field(target='firstName')
        last_name = Field(target='lastName')

    class Attributes(Store):
        as_epub = BooleanField(target='available_as_epub') # should be deprecated soon
        as_pdf = BooleanField(target='available_as_pdf') # should be deprecated soon
        as_watermark = BooleanField(target='available_as_watermark') # should be deprecated soon
        author = Field(target='author', default='')
        author_bio = Field(target='author_biography', default='')
        content_provider_id = Field(target='content_provider_specific_id')
        content_provider_name = Field(target='content_provider_name')
        content_source_id = Field(target='content_source_id')
        cover_ratio = FloatField(target='cover_image_aspect_ratio')
        currency = Field(target='currency')
        description = Field(target='description')
        editors_comment = Field(target='editors_comment')
        extract = Field(target='extract')
        first_publication = Field(target='date_of_first_publication')
        fulfillment_id = Field(target='fulfillment_id')
        fulfillment_type = Field(target='fulfillment_type')
        hash = Field(target='binary_hash')
        isbn = LongIntField(target='isbn')
        imprint = Field(target='imprint', default='')
        language = Field(target='language')
        large_cover_url = Field(target='cover_image_url_large')
        medium_cover_url = Field(target='cover_image_url_medium')
        normal_cover_url = Field(target='cover_image_url_normal')
        pages = IntField(target='number_of_pages')
        price = FloatField(target='price')
        publication_date = DateField(target='publication_date')
        publication_status = DateField(target='publication_status')
        publisher = Field(target='publisher')
        size = IntField(target='size')
        subtitle = Field(target='subtitle')
        tax_group = Field(target='tax_group')
        title = Field(target='title', default='')
        undiscounted_price = FloatField(target='undiscounted_price')
        via_iap = BooleanField(target='available_via_iap') # should be deprecated soon
        with_adobe_drm = BooleanField(target='available_with_adobe_drm') # should be deprecated soon
        year = IntField(target='year')

    class License(Store):
        key = Field(target='key')
        user_roles = Field(target='currentUserRoles')

    id = Field(target='documentID')
    attributes = EmbeddedStoreField(target='attributes', store_class=Attributes)
    authors = EmbeddedStoreField(target='authors', store_class=Author, is_array=True)
    catalog_state = Field(target='catalogDocumentState')
    _categories = EmbeddedStoreField(target='contentCategories', store_class='apps.reaktor_barrel.category.models.Category', is_array=True)
    category_ids = Field(target='contentCategoryIDs')
    creation_date = DateField(target='creationTime')
{'fraction_non_alphanumeric': 0.10835820895522388, 'fraction_numerical': 0.0005970149253731343, 'mean_word_length': 4.598162071846282, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4181809', 'n_tokens_mistral': 1901, 'n_tokens_neox': 1877, 'n_words': 323}