<commit_before>import logging

from dateutil.parser import parse

from O365.address_book import Contact
from O365.drive import Storage
from O365.utils import ApiComponent

log = logging.getLogger(__name__)

class Task(ApiComponent):
    """ A Microsoft Planner task """

    _endpoints = {
    }

    def __init__(self, *, parent=None, con=None, **kwargs):
        """ A Microsoft planner task

        :param parent: parent object
        :type parent: Sharepoint
        :param Connection con: connection to use if no parent specified
        :param Protocol protocol: protocol to use if no parent specified
         (kwargs)
        :param str main_resource: use this resource instead of parent resource
         (kwargs)
        """
        assert parent or con, 'Need a parent or a connection'
        self.con = parent.con if parent else con

        cloud_data = kwargs.get(self._cloud_data_key, {})

        self.object_id = cloud_data.get('id')

        # Choose the main_resource passed in kwargs over parent main_resource
        main_resource = (kwargs.pop('main_resource', None) or
                         getattr(parent,
                                 'main_resource',
                                 None) if parent else None)

        main_resource = '{}{}'.format(main_resource, '')

        super().__init__(
            protocol=parent.protocol if parent else kwargs.get('protocol'),
            main_resource=main_resource)
        
        self.object_id = cloud_data.get('id')


    def __str__(self):
        return self.__repr__()

    def __repr__(self):
        return 'Task: {}'.format(self.object_id)

      

class Planner(ApiComponent):
    """ A microsoft planner class """

    _endpoints = {
        'get_my_tasks': '/me/planner/tasks',
    }
    task_constructor = Task

    def __init__(self, *, parent=None, con=None, **kwargs):
        """ A Planner object

        :param parent: parent object
        :type parent: Account
        :param Connection con: connection to use if no parent specified
        :param Protocol protocol: protocol to use if no parent specified
         (kwargs)
        :param str main_resource: use this resource instead of parent resource
         (kwargs)
        """<commit_msg>Task related properties<commit_after>import logging

from dateutil.parser import parse

from O365.address_book import Contact
from O365.drive import Storage
from O365.utils import ApiComponent

log = logging.getLogger(__name__)

class Task(ApiComponent):
    """ A Microsoft Planner task """

    _endpoints = {
    }

    def __init__(self, *, parent=None, con=None, **kwargs):
        """ A Microsoft planner task

        :param parent: parent object
        :type parent: Sharepoint
        :param Connection con: connection to use if no parent specified
        :param Protocol protocol: protocol to use if no parent specified
         (kwargs)
        :param str main_resource: use this resource instead of parent resource
         (kwargs)
        """
        assert parent or con, 'Need a parent or a connection'
        self.con = parent.con if parent else con

        cloud_data = kwargs.get(self._cloud_data_key, {})

        self.object_id = cloud_data.get('id')

           # Choose the main_resource passed in kwargs over parent main_resource
        main_resource = (kwargs.pop('main_resource', None) or
                         getattr(parent,
                                 'main_resource',
                                 None) if parent else None)

        main_resource = '{}{}'.format(main_resource, '')

        super().__init__(
            protocol=parent.protocol if parent else kwargs.get('protocol'),
            main_resource=main_resource)

        self.plan_id = cloud_data.get('plan_id')
        self.bucket_id = cloud_data.get('bucketId')
        self.title = cloud_data.get(self._cc('title'), '')
        self.order_hint = cloud_data.get(self._cc('orderHint'), '')
        self.assignee_priority = cloud_data.get(self._cc('assigneePriority'), '')
        self.percent_complete = cloud_data.get(self._cc('percentComplete'), '')
        self.title = cloud_data.get(self._cc('title'), '')
        self.has_description = cloud_data.get(self._cc('hasDescription'), '')
        created = cloud_data.get(self._cc('createdDateTime'), None)
        due_date = cloud_data.get(self._cc('dueDateTime'), None)
        start_date = cloud_data.get(self._cc('startDateTime'), None)
        completed_date = cloud_data.get(self._cc('completedDateTime'), None)
        local_tz = self.protocol.timezone
        self.start_date = parse(start_date).astimezone(local_tz) if start_date else None
        self.created_date = parse(created).astimezone(local_tz) if created else None
        self.due_date = parse(due_date).astimezone(local_tz) if due_date else None
        self.completed_date = parse(completed_date).astimezone(local_tz) if completed_date else None
        self.preview_type = cloud_data.get(self._cc('previewType'), None)
        self.reference_count = cloud_data.get(self._cc('referenceCount'), None)
        self.checklist_item_count = cloud_data.get(self._cc('checklistItemCount'), None)
        self.active_checklist_item_count = cloud_data.get(self._cc('activeChecklistItemCount'), None)
        self.conversation_thread_id = cloud_data.get(self._cc('conversationThreadId'), None)


    def __str__(self):
        return self.__repr__()

    def __repr__(self):
        return 'Task: {}'.format(self.title)

      

class Planner(ApiComponent):
    """ A microsoft planner class """

    _endpoints = {
        'get_my_tasks': '/me/planner/tasks',
    }
    task_constructor = Task

    def __init__(self, *, parent=None, con=None, **kwargs):
        """ A Planner object

        :param parent: parent object
        :type parent: Account
        :param Connection con: connection to use if no parent specified
        :param Protocol protocol: protocol to use if no parent specified
         (kwargs)
        :param str main_resource: use this resource instead of parent resource
         (kwargs)
        """
{'fraction_non_alphanumeric': 0.0995571592586518, 'fraction_numerical': 0.002952271608988027, 'mean_word_length': 2.6362552176505667, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1015655', 'n_tokens_mistral': 1675, 'n_tokens_neox': 1634, 'n_words': 455}