Skip to content
Snippets Groups Projects
Commit 8976be7f authored by Alexa Valentová's avatar Alexa Valentová
Browse files

fix import names

parent 622e533f
Branches
No related tags found
2 merge requests!939Release,!937Fix calendars
Pipeline #17009 failed
"""
Downloads an iCal url or reads an iCal file.
"""
from httplib2 import Http
import logging
from httplib2 import Http
def apple_data_fix(content):
"""
......
from threading import Lock, Thread
from .icalparser import parse_events, Event
from .icaldownload import ICalDownload
from .icalparser import Event, parse_events
# Lock for event data
event_lock = Lock()
......
"""
Parse iCal data to Events.
"""
from datetime import date, datetime, timedelta
# for UID generation
from faulthandler import is_enabled
from random import randint
from datetime import datetime, timedelta, date, tzinfo
from typing import Optional
from uuid import uuid4
from dateutil.rrule import rrulestr
from dateutil.tz import UTC, gettz
from icalendar import Calendar
from icalendar.prop import vDDDLists, vText
from uuid import uuid4
from icalendar.windows_to_olson import WINDOWS_TO_OLSON
from pytz import timezone
......@@ -107,7 +106,6 @@ class Event:
return "%s: %s (%s)" % (self.start, self.summary, self.end - self.start)
def astimezone(self, tzinfo):
if type(self.start) is datetime:
self.start = self.start.astimezone(tzinfo)
......@@ -244,7 +242,11 @@ def create_event(component, utc_default):
if component.get("categories"):
categoriesval = component.get("categories")
categories = component.get("categories").cats if hasattr(categoriesval, "cats") else categoriesval
categories = (
component.get("categories").cats
if hasattr(categoriesval, "cats")
else categoriesval
)
encoded_categories = list()
for category in categories:
encoded_categories.append(encode(category))
......
......@@ -3,8 +3,8 @@ from datetime import date, timedelta
import arrow
from django.db import migrations
from icalevents import icalevents
from calendar_utils.icalevents import icalevents
from calendar_utils.parser import process_event_list
......
......@@ -8,8 +8,8 @@ from django.core.serializers.json import DjangoJSONEncoder
from django.core.validators import URLValidator, ValidationError
from django.db import models, transaction
from django.utils.timezone import now
from icalevents import icalevents
from .icalevents import icalevents
from .parser import process_event_list
from .tasks import update_calendar_source
......
......@@ -8,7 +8,7 @@ from django.conf import settings
from django.utils.timezone import is_naive
if TYPE_CHECKING:
from icalevents.icalparser import Event
from .icalevents.icalparser import Event
EVENT_KEYS = ("start", "end", "all_day", "summary", "description", "location", "url")
......
......@@ -3,7 +3,8 @@ from datetime import datetime
from pathlib import Path
import pytest
from icalevents.icalparser import Event
from calendar_utils.icalevents.icalparser import Event
@pytest.fixture(scope="session")
......
from datetime import datetime
import pytest
from icalevents.icalparser import Event
from calendar_utils.icalevents.icalparser import Event
from calendar_utils.parser import (
process_event_list,
set_event_duration,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment