<commit_before># -*- coding: utf-8 -*-
'''
    vdirsyncer.storage.base
    ~~~~~~~~~~~~~~~~~~~~~~~

    :copyright: (c) 2014 <NAME>
    :license: MIT, see LICENSE for more details.
'''

from .. import exceptions
from .. import utils


class Item(object):

    '''should-be-immutable wrapper class for VCALENDAR and VCARD'''

    def __init__(self, raw):
        assert isinstance(raw, utils.text_type)
        raw = raw.splitlines()
        self.uid = None

        for line in raw:
            if line.startswith(u'UID:'):
                self.uid = line[4:].strip()

        self.raw = u'\n'.join(raw)


class Storage(object):

    '''Superclass of all storages, mainly useful to summarize the interface to
    implement.

    Terminology:
      - ITEM: Instance of the Item class, represents a calendar event, task or
          contact.
      - UID: String; Global identifier of the item, across storages.
      - HREF: String; Per-storage identifier of item, might be UID. The reason
          items aren't just referenced by their UID is because the CalDAV and
          CardDAV specifications make this imperformant to implement.
      - ETAG: String; Checksum of item, or something similar that changes when
          the item does.

    Strings can be either unicode strings or bytestrings. If bytestrings, an
    ASCII encoding is assumed.

    :param collection: If None, the given URL or path is already directly
        referring to a collection. Otherwise it will be treated as a basepath
        to many collections (e.g. a vdir) and the given collection name will be
        looked for.
    '''<commit_msg>Don't assign empty UID<commit_after># -*- coding: utf-8 -*-
'''
    vdirsyncer.storage.base
    ~~~~~~~~~~~~~~~~~~~~~~~

    :copyright: (c) 2014 <NAME>
    :license: MIT, see LICENSE for more details.
'''

from .. import exceptions
from .. import utils


class Item(object):

    '''should-be-immutable wrapper class for VCALENDAR and VCARD'''

    def __init__(self, raw):
        assert isinstance(raw, utils.text_type)
        raw = raw.splitlines()
        self.uid = None

        for line in raw:
            if line.startswith(u'UID:'):
                uid = line[4:].strip()
                if uid:
                    self.uid = uid

        self.raw = u'\n'.join(raw)


class Storage(object):

    '''Superclass of all storages, mainly useful to summarize the interface to
    implement.

    Terminology:
      - ITEM: Instance of the Item class, represents a calendar event, task or
          contact.
      - UID: String; Global identifier of the item, across storages.
      - HREF: String; Per-storage identifier of item, might be UID. The reason
          items aren't just referenced by their UID is because the CalDAV and
          CardDAV specifications make this imperformant to implement.
      - ETAG: String; Checksum of item, or something similar that changes when
          the item does.

    Strings can be either unicode strings or bytestrings. If bytestrings, an
    ASCII encoding is assumed.

    :param collection: If None, the given URL or path is already directly
        referring to a collection. Otherwise it will be treated as a basepath
        to many collections (e.g. a vdir) and the given collection name will be
        looked for.
    '''
{'fraction_non_alphanumeric': 0.0934947049924357, 'fraction_numerical': 0.003630862329803328, 'mean_word_length': 2.411764705882353, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7629491', 'n_tokens_mistral': 929, 'n_tokens_neox': 885, 'n_words': 377}