mirror of
https://github.com/b4tman/sync_ics2gcal
synced 2026-02-05 15:55:04 +00:00
Compare commits
15 Commits
1f270d65af
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 1eed6af952 | |||
|
|
8bcf94b58a | ||
|
|
c047d7c6f7 | ||
|
|
5f24e9a89e | ||
|
|
807c0d63cf | ||
|
|
a5cc6d9dc7 | ||
|
|
f226e7a6a6 | ||
|
|
ee098b338a | ||
|
|
d5301e6ec1 | ||
|
|
5717af6270 | ||
| b3e515ebe9 | |||
|
|
a37daded9e | ||
|
|
474f6ab58f | ||
| 3fcb4855d5 | |||
|
|
b34b1a8b20 |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1 +1 @@
|
|||||||
custom: ['https://boosty.to/0xffff', 'https://www.donationalerts.com/r/b4tman1']
|
custom: ['https://boosty.to/0xffff']
|
||||||
|
|||||||
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
# We must fetch at least the immediate parents so that if this is
|
# We must fetch at least the immediate parents so that if this is
|
||||||
# a pull request then we can checkout the head.
|
# a pull request then we can checkout the head.
|
||||||
|
|||||||
8
.github/workflows/pythonpackage.yml
vendored
8
.github/workflows/pythonpackage.yml
vendored
@@ -15,14 +15,14 @@ jobs:
|
|||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
max-parallel: 4
|
max-parallel: 3
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ['3.9', '3.10', '3.11', '3.12']
|
python-version: ['3.11', '3.12', '3.13']
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Upgrade pip
|
- name: Upgrade pip
|
||||||
|
|||||||
4
.github/workflows/pythonpublish.yml
vendored
4
.github/workflows/pythonpublish.yml
vendored
@@ -8,9 +8,9 @@ jobs:
|
|||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
- name: Upgrade pip
|
- name: Upgrade pip
|
||||||
|
|||||||
4
.github/workflows/reviewdog.yml
vendored
4
.github/workflows/reviewdog.yml
vendored
@@ -11,10 +11,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.x
|
python-version: 3.x
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
import importlib
|
import importlib
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
|
||||||
project = "sync_ics2gcal"
|
project = "sync_ics2gcal"
|
||||||
copyright = "2023, b4tman"
|
copyright = "2023, b4tman"
|
||||||
author = "b4tman"
|
author = "b4tman"
|
||||||
|
|||||||
3434
poetry.lock
generated
3434
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -11,20 +11,19 @@ keywords = ["icalendar", "sync", "google", "calendar"]
|
|||||||
classifiers = [
|
classifiers = [
|
||||||
'License :: OSI Approved :: MIT License',
|
'License :: OSI Approved :: MIT License',
|
||||||
'Operating System :: OS Independent',
|
'Operating System :: OS Independent',
|
||||||
'Programming Language :: Python :: 3.9',
|
'Programming Language :: Python :: 3.11',
|
||||||
'Programming Language :: Python :: 3.10',
|
|
||||||
'Programming Language :: Python :: 3.11',
|
|
||||||
'Programming Language :: Python :: 3.12',
|
'Programming Language :: Python :: 3.12',
|
||||||
|
'Programming Language :: Python :: 3.13',
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.9"
|
python = "^3.11"
|
||||||
google-auth = "2.40.2"
|
google-auth = "2.48.0"
|
||||||
google-api-python-client = "2.170.0"
|
google-api-python-client = "2.188.0"
|
||||||
icalendar = "6.3.1"
|
icalendar = "6.3.2"
|
||||||
pytz = "2025.2"
|
pytz = "2025.2"
|
||||||
PyYAML = "6.0.2"
|
PyYAML = "6.0.3"
|
||||||
fire = "0.7.0"
|
fire = "0.7.1"
|
||||||
|
|
||||||
[tool.poetry.group.dev]
|
[tool.poetry.group.dev]
|
||||||
optional = true
|
optional = true
|
||||||
@@ -33,21 +32,21 @@ optional = true
|
|||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
pytest = ">=7.4,<9.0"
|
pytest = ">=8.1,<10.0"
|
||||||
flake8 = ">=5.0.4,<8.0.0"
|
flake8 = ">=7.0.4,<8.0.0"
|
||||||
black = ">=23.7,<26.0"
|
black = ">=25.0,<27.0"
|
||||||
mypy = ">=0.960"
|
mypy = ">=1.16.1"
|
||||||
types-python-dateutil = "^2.8.19"
|
types-python-dateutil = ">=2.9.0.20250516"
|
||||||
types-pytz = ">=2021.3.8"
|
types-pytz = ">=2025.2.0.20250516"
|
||||||
types-PyYAML = "^6.0.12"
|
types-PyYAML = "^6.0.12.20250516"
|
||||||
lxml = ">=4.9.3,<6.0.0"
|
lxml = ">=5.4.0,<7.0.0"
|
||||||
|
|
||||||
[tool.poetry.group.docs.dependencies]
|
[tool.poetry.group.docs.dependencies]
|
||||||
sphinx = ">=7.1,<7.5"
|
sphinx = ">=8.2,<9.0"
|
||||||
myst-parser = ">=2,<4"
|
myst-parser = ">=4,<6"
|
||||||
sphinx-rtd-theme = ">=1.2.2,<4.0.0"
|
sphinx-rtd-theme = ">=3.0.2,<4.0.0"
|
||||||
sphinx-copybutton = "^0.5.2"
|
sphinx-copybutton = "^0.5.2"
|
||||||
sphinx-design = ">=0.5,<0.7"
|
sphinx-design = ">=0.6,<0.8"
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
sync-ics2gcal = "sync_ics2gcal.sync_calendar:main"
|
sync-ics2gcal = "sync_ics2gcal.sync_calendar:main"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ def get_start_date(date: ConfigDate) -> datetime.datetime:
|
|||||||
if isinstance(date, datetime.datetime):
|
if isinstance(date, datetime.datetime):
|
||||||
return date
|
return date
|
||||||
if "now" == date:
|
if "now" == date:
|
||||||
result = datetime.datetime.utcnow()
|
result = datetime.datetime.now(datetime.UTC)
|
||||||
else:
|
else:
|
||||||
result = dateutil.parser.parse(date)
|
result = dateutil.parser.parse(date)
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -8,45 +8,27 @@ from sync_ics2gcal import CalendarConverter
|
|||||||
from sync_ics2gcal.ical import format_datetime_utc
|
from sync_ics2gcal.ical import format_datetime_utc
|
||||||
|
|
||||||
uid = "UID:uisgtr8tre93wewe0yr8wqy@test.com"
|
uid = "UID:uisgtr8tre93wewe0yr8wqy@test.com"
|
||||||
only_start_date = (
|
only_start_date = uid + """
|
||||||
uid
|
|
||||||
+ """
|
|
||||||
DTSTART;VALUE=DATE:20180215
|
DTSTART;VALUE=DATE:20180215
|
||||||
"""
|
"""
|
||||||
)
|
date_val = only_start_date + """
|
||||||
date_val = (
|
|
||||||
only_start_date
|
|
||||||
+ """
|
|
||||||
DTEND;VALUE=DATE:20180217
|
DTEND;VALUE=DATE:20180217
|
||||||
"""
|
"""
|
||||||
)
|
date_duration = only_start_date + """
|
||||||
date_duration = (
|
|
||||||
only_start_date
|
|
||||||
+ """
|
|
||||||
DURATION:P2D
|
DURATION:P2D
|
||||||
"""
|
"""
|
||||||
)
|
datetime_utc_val = uid + """
|
||||||
datetime_utc_val = (
|
|
||||||
uid
|
|
||||||
+ """
|
|
||||||
DTSTART;VALUE=DATE-TIME:20180319T092001Z
|
DTSTART;VALUE=DATE-TIME:20180319T092001Z
|
||||||
DTEND:20180321T102501Z
|
DTEND:20180321T102501Z
|
||||||
"""
|
"""
|
||||||
)
|
datetime_utc_duration = uid + """
|
||||||
datetime_utc_duration = (
|
|
||||||
uid
|
|
||||||
+ """
|
|
||||||
DTSTART;VALUE=DATE-TIME:20180319T092001Z
|
DTSTART;VALUE=DATE-TIME:20180319T092001Z
|
||||||
DURATION:P2DT1H5M
|
DURATION:P2DT1H5M
|
||||||
"""
|
"""
|
||||||
)
|
created_updated = date_val + """
|
||||||
created_updated = (
|
|
||||||
date_val
|
|
||||||
+ """
|
|
||||||
CREATED:20180320T071155Z
|
CREATED:20180320T071155Z
|
||||||
LAST-MODIFIED:20180326T120235Z
|
LAST-MODIFIED:20180326T120235Z
|
||||||
"""
|
"""
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def ics_test_cal(content: str) -> str:
|
def ics_test_cal(content: str) -> str:
|
||||||
@@ -107,7 +89,7 @@ def param_events_start_end(request: Any) -> Any:
|
|||||||
|
|
||||||
|
|
||||||
def test_event_start_end(param_events_start_end: Tuple[str, str, str, str]) -> None:
|
def test_event_start_end(param_events_start_end: Tuple[str, str, str, str]) -> None:
|
||||||
(date_type, ics_str, start, end) = param_events_start_end
|
date_type, ics_str, start, end = param_events_start_end
|
||||||
converter = CalendarConverter()
|
converter = CalendarConverter()
|
||||||
converter.loads(ics_str)
|
converter.loads(ics_str)
|
||||||
events = converter.events_to_gcal()
|
events = converter.events_to_gcal()
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ def test_compare() -> None:
|
|||||||
@pytest.mark.parametrize("no_time", [True, False], ids=["date", "dateTime"])
|
@pytest.mark.parametrize("no_time", [True, False], ids=["date", "dateTime"])
|
||||||
def test_filter_events_by_date(no_time: bool) -> None:
|
def test_filter_events_by_date(no_time: bool) -> None:
|
||||||
msk = timezone("Europe/Moscow")
|
msk = timezone("Europe/Moscow")
|
||||||
now = utc.localize(datetime.datetime.utcnow())
|
now = datetime.datetime.now(datetime.UTC)
|
||||||
msk_now = msk.normalize(now.astimezone(msk))
|
msk_now = msk.normalize(now.astimezone(msk))
|
||||||
|
|
||||||
part_len = 5
|
part_len = 5
|
||||||
@@ -152,7 +152,7 @@ def test_filter_events_by_date(no_time: bool) -> None:
|
|||||||
|
|
||||||
def test_filter_events_to_update() -> None:
|
def test_filter_events_to_update() -> None:
|
||||||
msk = timezone("Europe/Moscow")
|
msk = timezone("Europe/Moscow")
|
||||||
now = utc.localize(datetime.datetime.utcnow())
|
now = datetime.datetime.now(datetime.UTC)
|
||||||
msk_now = msk.normalize(now.astimezone(msk))
|
msk_now = msk.normalize(now.astimezone(msk))
|
||||||
|
|
||||||
one_hour = datetime.datetime(1, 1, 1, 2) - datetime.datetime(1, 1, 1, 1)
|
one_hour = datetime.datetime(1, 1, 1, 2) - datetime.datetime(1, 1, 1, 1)
|
||||||
@@ -179,7 +179,7 @@ def test_filter_events_no_updated() -> None:
|
|||||||
test filtering events that not have 'updated' field
|
test filtering events that not have 'updated' field
|
||||||
such events should always pass the filter
|
such events should always pass the filter
|
||||||
"""
|
"""
|
||||||
now = datetime.datetime.utcnow()
|
now = datetime.datetime.now()
|
||||||
yesterday = now - datetime.timedelta(days=-1)
|
yesterday = now - datetime.timedelta(days=-1)
|
||||||
|
|
||||||
count = 10
|
count = 10
|
||||||
|
|||||||
Reference in New Issue
Block a user