Skip to content

Commit

Permalink
Mypy corrections.
Browse files Browse the repository at this point in the history
  • Loading branch information
coddingtonbear committed Jan 4, 2024
1 parent 1bbda81 commit cecd11a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Expand Up @@ -30,4 +30,5 @@ repos:
- --show-error-context
- --ignore-missing-imports
additional_dependencies:
- types-requests
- types-python-dateutil
6 changes: 3 additions & 3 deletions myfitnesspal/client.py
Expand Up @@ -9,14 +9,14 @@
from http.cookiejar import CookieJar
from pathlib import Path
from typing import Any, Dict, List, Optional, Union, cast, overload
from urllib import parse

import browser_cookie3
import cloudscraper
import lxml.html
import requests
from measurement.base import MeasureBase
from measurement.measures import Energy, Mass, Volume
from six.moves.urllib import parse

from . import types
from .base import MFPBase
Expand Down Expand Up @@ -64,7 +64,7 @@ class Client(MFPBase):

def __init__(
self,
cookiejar: CookieJar = None,
cookiejar: Optional[CookieJar] = None,
unit_aware: bool = False,
log_requests_to: Path | None = None,
):
Expand Down Expand Up @@ -654,7 +654,7 @@ def get_measurements(
def set_measurements(
self,
measurement="Weight",
value: float = None,
value: Optional[float] = None,
date: Optional[datetime.date] = None,
) -> None:
"""Sets measurement for today's date."""
Expand Down
8 changes: 4 additions & 4 deletions myfitnesspal/day.py
Expand Up @@ -16,10 +16,10 @@ def __init__(
self,
date: datetime.date,
meals: Optional[List[Meal]] = None,
goals: Dict[str, float] = None,
notes: Callable[[], str] = None,
water: Callable[[], float] = None,
exercises: Callable[[], List[Exercise]] = None,
goals: Optional[Dict[str, float]] = None,
notes: Optional[Callable[[], str]] = None,
water: Optional[Callable[[], float]] = None,
exercises: Optional[Callable[[], List[Exercise]]] = None,
complete: bool = False,
):
self._date = date
Expand Down
4 changes: 2 additions & 2 deletions myfitnesspal/note.py
Expand Up @@ -2,15 +2,15 @@

import datetime
from html import unescape
from typing import Dict, Optional
from typing import Optional

from .types import NoteDataDict


class Note(str):
"""Stores information about a note"""

_note_data: Dict[str, str]
_note_data: NoteDataDict

def __new__(cls, note_data: NoteDataDict) -> Note:
# I'm not sure I understand why this is double-encoded, but it is?
Expand Down

0 comments on commit cecd11a

Please sign in to comment.