mirror of
https://github.com/b4tman/sync_ics2gcal
synced 2026-07-27 12:12:54 +03:00
Compare commits
19 Commits
55f1feae3b
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| d409c8687e | |||
| 3e84f26c47 | |||
| c53b783a06 | |||
| 77dfe921bf | |||
| f83eaf1f2c | |||
| e059f33e1c | |||
| 8bdce1b5f5 | |||
| 092911262c | |||
| 3f7bd864c9 | |||
| b9a0bac78e | |||
| c31c7ed7a9 | |||
| 0cb54571ee | |||
| 53694d8754 | |||
| 7d51ebcc44 | |||
| 81ee36bc57 | |||
| 64baa3cbb9 | |||
| b9dd093ca5 | |||
| 98cd8428d6 | |||
| 0497fbfb90 |
+1
-1
@@ -1 +1 @@
|
|||||||
custom: ['https://boosty.to/0xffff']
|
custom: ['https://dalink.to/b4tman1', 'https://boosty.to/0xffff']
|
||||||
|
|||||||
Generated
+524
-444
File diff suppressed because it is too large
Load Diff
+7
-4
@@ -19,10 +19,10 @@ classifiers = [
|
|||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.11"
|
python = "^3.11"
|
||||||
google-auth = "2.48.0"
|
google-auth = "2.55.1"
|
||||||
google-api-python-client = "2.190.0"
|
google-api-python-client = "2.198.0"
|
||||||
icalendar = "7.0.2"
|
icalendar = "7.2.0"
|
||||||
pytz = "2025.2"
|
pytz = "2026.2"
|
||||||
PyYAML = "6.0.3"
|
PyYAML = "6.0.3"
|
||||||
fire = "0.7.1"
|
fire = "0.7.1"
|
||||||
|
|
||||||
@@ -57,6 +57,9 @@ manage-ics2gcal = "sync_ics2gcal.manage_calendars:main"
|
|||||||
requires = ["poetry-core>=1.0.0"]
|
requires = ["poetry-core>=1.0.0"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
|
[tool.mypy]
|
||||||
|
disable_error_code = "unused-ignore"
|
||||||
|
|
||||||
[[tool.mypy.overrides]]
|
[[tool.mypy.overrides]]
|
||||||
module = [
|
module = [
|
||||||
'icalendar',
|
'icalendar',
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class GoogleCalendarService:
|
|||||||
scopes = ["https://www.googleapis.com/auth/calendar"]
|
scopes = ["https://www.googleapis.com/auth/calendar"]
|
||||||
credentials = service_account.Credentials.from_service_account_file(
|
credentials = service_account.Credentials.from_service_account_file(
|
||||||
service_account_file
|
service_account_file
|
||||||
)
|
) # type: ignore[no-untyped-call]
|
||||||
scoped_credentials = credentials.with_scopes(scopes)
|
scoped_credentials = credentials.with_scopes(scopes)
|
||||||
service = discovery.build(
|
service = discovery.build(
|
||||||
"calendar", "v3", credentials=scoped_credentials, cache_discovery=False
|
"calendar", "v3", credentials=scoped_credentials, cache_discovery=False
|
||||||
|
|||||||
@@ -182,12 +182,12 @@ class CalendarConverter:
|
|||||||
def load(self, filename: str) -> None:
|
def load(self, filename: str) -> None:
|
||||||
"""load calendar from ics file"""
|
"""load calendar from ics file"""
|
||||||
with open(filename, "r", encoding="utf-8") as f:
|
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)
|
self.logger.info("%s loaded", filename)
|
||||||
|
|
||||||
def loads(self, string: str) -> None:
|
def loads(self, string: str) -> None:
|
||||||
"""load calendar from ics string"""
|
"""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:
|
def events_to_gcal(self) -> EventList:
|
||||||
"""Convert events to google calendar resources"""
|
"""Convert events to google calendar resources"""
|
||||||
@@ -195,10 +195,10 @@ class CalendarConverter:
|
|||||||
if self.calendar is None:
|
if self.calendar is None:
|
||||||
raise ValueError("calendar not set")
|
raise ValueError("calendar not set")
|
||||||
|
|
||||||
calendar: Calendar = cast(Calendar, self.calendar)
|
calendar: Calendar = cast(Calendar, self.calendar) # type: ignore[redundant-cast]
|
||||||
ics_events = calendar.walk(name="VEVENT")
|
ics_events = calendar.walk(name="VEVENT")
|
||||||
self.logger.info("%d events read", len(ics_events))
|
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))
|
self.logger.info("%d events converted", len(result))
|
||||||
return result
|
return result
|
||||||
|
|||||||
Reference in New Issue
Block a user