Skip to content

Commit

Permalink
tooling: fix mypy warnings (add types and "type: ignore"s)
Browse files Browse the repository at this point in the history
Fixes the rest of #576
  • Loading branch information
dbarnett committed Aug 24, 2024
1 parent 8b4d200 commit 5028d91
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
6 changes: 4 additions & 2 deletions gcalcli/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
from typing import Any, Dict, List, TYPE_CHECKING, TypedDict

if TYPE_CHECKING:
from googleapiclient._apis.calendar.v3.schemas \
import CalendarListEntry, Event as GoogleEvent
from googleapiclient._apis.calendar.v3.schemas import ( # type: ignore
CalendarListEntry,
Event as GoogleEvent
)

class Event(GoogleEvent):
"""GoogleEvent, extended with some convenience attributes."""
Expand Down
3 changes: 2 additions & 1 deletion gcalcli/deprecations.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import argparse
import functools
from typing import Any

import gcalcli

Expand Down Expand Up @@ -70,7 +71,7 @@ def __call__(self, parser, namespace, values, option_string=None):
'action': DeprecatedStoreTrue}}


OPTIONS = {
OPTIONS: dict[str, dict[str, Any]] = {
'program': {
"--client_id": {'default': gcalcli.__API_CLIENT_ID__},
"--client_secret": {'default': gcalcli.__API_CLIENT_SECRET__},
Expand Down
10 changes: 5 additions & 5 deletions gcalcli/gcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
from dateutil.parser import parse
from dateutil.relativedelta import relativedelta
from dateutil.tz import tzlocal
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
from google.auth.transport.requests import Request
from google_auth_oauthlib.flow import InstalledAppFlow # type: ignore
from googleapiclient.discovery import build # type: ignore
from googleapiclient.errors import HttpError # type: ignore
from google.auth.transport.requests import Request # type: ignore

from . import actions, utils
from ._types import Cache, CalendarListEntry
Expand All @@ -34,7 +34,7 @@
STR_NOT_EMPTY, STR_TO_INT, VALID_COLORS)

try:
import cPickle as pickle
import cPickle as pickle # type: ignore
except Exception:
import pickle

Expand Down
2 changes: 1 addition & 1 deletion gcalcli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from dateutil.parser import parse as dateutil_parse
from dateutil.tz import tzlocal
from parsedatetime.parsedatetime import Calendar
from parsedatetime.parsedatetime import Calendar # type: ignore

locale.setlocale(locale.LC_ALL, '')
fuzzy_date_parse = Calendar().parse
Expand Down

0 comments on commit 5028d91

Please sign in to comment.