mirror of
https://github.com/b4tman/sync_ics2gcal
synced 2026-07-27 04:02:54 +03:00
Compare commits
23 Commits
e3888af9f0
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| d409c8687e | |||
| 3e84f26c47 | |||
| c53b783a06 | |||
| 77dfe921bf | |||
| f83eaf1f2c | |||
| e059f33e1c | |||
| 8bdce1b5f5 | |||
| 092911262c | |||
| 3f7bd864c9 | |||
| b9a0bac78e | |||
| c31c7ed7a9 | |||
| 0cb54571ee | |||
| 53694d8754 | |||
| 7d51ebcc44 | |||
| 81ee36bc57 | |||
| 64baa3cbb9 | |||
| b9dd093ca5 | |||
| 98cd8428d6 | |||
| 0497fbfb90 | |||
| 55f1feae3b | |||
| a5967b1043 | |||
| caa7b388a1 | |||
| 0676540e76 |
+1
-1
@@ -1 +1 @@
|
||||
custom: ['https://boosty.to/0xffff']
|
||||
custom: ['https://dalink.to/b4tman1', 'https://boosty.to/0xffff']
|
||||
|
||||
@@ -15,9 +15,9 @@ jobs:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
max-parallel: 3
|
||||
max-parallel: 4
|
||||
matrix:
|
||||
python-version: ['3.11', '3.12', '3.13']
|
||||
python-version: ['3.11', '3.12', '3.13', '3.14']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
Generated
+583
-480
File diff suppressed because it is too large
Load Diff
+10
-6
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "sync_ics2gcal"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
description = "Sync ics file with Google calendar"
|
||||
authors = ["Dmitry Belyaev <b4tm4n@mail.ru>"]
|
||||
license = "MIT"
|
||||
@@ -14,14 +14,15 @@ classifiers = [
|
||||
'Programming Language :: Python :: 3.11',
|
||||
'Programming Language :: Python :: 3.12',
|
||||
'Programming Language :: Python :: 3.13',
|
||||
'Programming Language :: Python :: 3.14',
|
||||
]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.11"
|
||||
google-auth = "2.48.0"
|
||||
google-api-python-client = "2.188.0"
|
||||
icalendar = "6.3.2"
|
||||
pytz = "2025.2"
|
||||
google-auth = "2.55.1"
|
||||
google-api-python-client = "2.198.0"
|
||||
icalendar = "7.2.0"
|
||||
pytz = "2026.2"
|
||||
PyYAML = "6.0.3"
|
||||
fire = "0.7.1"
|
||||
|
||||
@@ -42,7 +43,7 @@ types-PyYAML = "^6.0.12.20250516"
|
||||
lxml = ">=5.4.0,<7.0.0"
|
||||
|
||||
[tool.poetry.group.docs.dependencies]
|
||||
sphinx = ">=8.2,<9.0"
|
||||
sphinx = ">=8.2,<10.0"
|
||||
myst-parser = ">=4,<6"
|
||||
sphinx-rtd-theme = ">=3.0.2,<4.0.0"
|
||||
sphinx-copybutton = "^0.5.2"
|
||||
@@ -56,6 +57,9 @@ manage-ics2gcal = "sync_ics2gcal.manage_calendars:main"
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[tool.mypy]
|
||||
disable_error_code = "unused-ignore"
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = [
|
||||
'icalendar',
|
||||
|
||||
@@ -120,7 +120,7 @@ class GoogleCalendarService:
|
||||
scopes = ["https://www.googleapis.com/auth/calendar"]
|
||||
credentials = service_account.Credentials.from_service_account_file(
|
||||
service_account_file
|
||||
)
|
||||
) # type: ignore[no-untyped-call]
|
||||
scoped_credentials = credentials.with_scopes(scopes)
|
||||
service = discovery.build(
|
||||
"calendar", "v3", credentials=scoped_credentials, cache_discovery=False
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import datetime
|
||||
import logging
|
||||
from typing import Union, Dict, Callable, Optional, Mapping, TypedDict
|
||||
from typing import Union, Dict, Callable, Optional, Mapping, TypedDict, cast
|
||||
|
||||
from icalendar import Calendar, Event
|
||||
from pytz import utc
|
||||
@@ -75,7 +75,7 @@ class EventConverter(Event): # type: ignore
|
||||
string value
|
||||
"""
|
||||
|
||||
return str(self.decoded(prop).decode(encoding="utf-8"))
|
||||
return str(self.decoded(prop))
|
||||
|
||||
def _datetime_str_prop(self, prop: str) -> str:
|
||||
"""utc datetime as string from property
|
||||
@@ -182,20 +182,23 @@ class CalendarConverter:
|
||||
def load(self, filename: str) -> None:
|
||||
"""load calendar from ics file"""
|
||||
with open(filename, "r", encoding="utf-8") as f:
|
||||
self.calendar = Calendar.from_ical(f.read())
|
||||
self.calendar = cast(Calendar, Calendar.from_ical(f.read())) # type: ignore[redundant-cast]
|
||||
self.logger.info("%s loaded", filename)
|
||||
|
||||
def loads(self, string: str) -> None:
|
||||
"""load calendar from ics string"""
|
||||
self.calendar = Calendar.from_ical(string)
|
||||
self.calendar = cast(Calendar, Calendar.from_ical(string)) # type: ignore[redundant-cast]
|
||||
|
||||
def events_to_gcal(self) -> EventList:
|
||||
"""Convert events to google calendar resources"""
|
||||
|
||||
calendar: Calendar = self.calendar
|
||||
if self.calendar is None:
|
||||
raise ValueError("calendar not set")
|
||||
|
||||
calendar: Calendar = cast(Calendar, self.calendar) # type: ignore[redundant-cast]
|
||||
ics_events = calendar.walk(name="VEVENT")
|
||||
self.logger.info("%d events read", len(ics_events))
|
||||
|
||||
result = list(map(lambda event: EventConverter(event).convert(), ics_events))
|
||||
result = list(map(lambda event: EventConverter(event).convert(), ics_events)) # type: ignore[no-untyped-call]
|
||||
self.logger.info("%d events converted", len(result))
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user