System: Imagine that you are a code reviewer, your task is to check the written code with what is required in the task, also the evaluation should depend on the level of the developer (Junior, Middle, Senior). I will send you the text of the assignment and the content of the files, and you should check everything and answer in this format: Found files, Downsides/Comments, Rating - from 1 to 5 depending on the level of the developer and Conclusion.
User: Task: Implement a console application to check the weather, type all functions and classes, as well as add the ability to save the result to a file., Code: .gitignore: ### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
#   For a library or package, you might want to ignore these files since the code is
#   intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
#   However, in case of collaboration, if having platform-specific dependencies or dependencies
#   having no cross-platform support, pipenv may install dependencies that don't work, or not
#   install all needed dependencies.
#Pipfile.lock

# poetry
#   Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
#   This is especially recommended for binary packages to ensure reproducibility, and is more
#   commonly ignored for libraries.
#   https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
#   Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
#   pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
#   in version control.
#   https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
#  JetBrains specific template is maintained in a separate JetBrains.gitignore that can
#  be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
#  and can be added to the global gitignore or merged into this file.  For a more nuclear
#  option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/


config.py: USE_ROUNDED_COORDS = True
LANG = 'ua'  # en, ua
OPENWEATHER_API_KEY = '<TRUFFLEHOG_REDACTED_OPENWEATHER>'
OPENWEATHER_URL = (
    'https://api.openweathermap.org/data/2.5/weather?'
    'lat={latitude}&lon={longitude}'
    '&appid=' + OPENWEATHER_API_KEY + f'&lang={LANG}'
    'units=metric'
)

coordinates.py: import json
from dataclasses import dataclass
from json import JSONDecodeError
from subprocess import Popen, PIPE

import config
from exceptions import CantGetCoordinates


@dataclass(slots=True, frozen=True)
class Coordinates:
    latitude: float
    longitude: float


def get_gps_coordinates() -> Coordinates:
    coordinates = _get_ipinfo_coordinate()
    return _round_coordinates(coordinates)


def _get_ipinfo_coordinate() -> Coordinates:
    response = _get_ipinfo_response()
    response = _decode_ipinfo_response_to_dict(response)
    return _parse_ipinfo_response(response)


def _parse_ipinfo_response(response: dict) -> Coordinates:
    try:
        latitude, longitude = map(_convert_str_to_float, response['loc'].split(','))
        return Coordinates(latitude=latitude, longitude=longitude)
    except KeyError:
        raise CantGetCoordinates


def _convert_str_to_float(value: str) -> float:
    try:
        return float(value)
    except ValueError:
        raise CantGetCoordinates


def _round_coordinates(coordinates: Coordinates) -> Coordinates:
    if not config.USE_ROUNDED_COORDS:
        return coordinates
    return Coordinates(*map(lambda c: round(c, 1), [coordinates.latitude, coordinates.longitude]))


def _get_ipinfo_response() -> bytes:
    process = Popen(['curl', 'ipinfo.io'], stdout=PIPE)
    (output, err) = process.communicate()
    exit_code = process.wait()
    if err is not None or exit_code != 0:
        raise CantGetCoordinates
    return output


def _decode_ipinfo_response_to_dict(response: bytes) -> dict:
    try:
        return json.loads(response)
    except JSONDecodeError:
        raise CantGetCoordinates


if __name__ == '__main__':
    print(get_gps_coordinates())

exceptions.py: class CantGetCoordinates(Exception):
    """Program can't get current GPS coordinates"""


class ApiServiceError(Exception):
    """"""

history.json: [
    {
        "date": "2023-10-08 14:04:03.952057",
        "weather": "Pokotylivka, 284°C, Clouds\nSunrise: 06:44\nSunset: 18:00\n"
    },
    {
        "date": "2023-10-08 14:05:27.842116",
        "weather": "Pokotylivka, 284°C, Хмарно\nСхід сонця: 06:44\nЗахід сонця: 18:00\n"
    }
]
history.py: import dataclasses
import json
from datetime import datetime
from pathlib import Path
from typing import Protocol, TypedDict

from weather_api_service import Weather

from weather_formatter import format_weather


class HistoryRecord(TypedDict):
    date: str
    weather: str


class JSONFileWeatherStorage:
    """Store weather in JSON file"""

    def __init__(self, jsonfile: Path):
        self._jsonfile = jsonfile
        self._init_storage()

    def save(self, weather: Weather):
        history = self._read_history()
        history.append(
            {
                'date': str(datetime.now()),
                'weather': format_weather(weather)
            }
        )
        self._write(history)

    def _init_storage(self):
        if not self._jsonfile.exists():
            self._jsonfile.write_text('[]')

    def _read_history(self) -> list[HistoryRecord]:
        with open(self._jsonfile, 'r') as f:
            return json.load(f)

    def _write(self, history: list[HistoryRecord]):
        with open(self._jsonfile, 'w') as f:
            json.dump(history, f, ensure_ascii=False, indent=4)


class PlainFileWeatherStorage:
    """Store weather in plain text file"""

    def __init__(self, file: Path):
        self._file = file

    def save(self, weather: Weather):
        now = datetime.now()
        formatted_weather = format_weather(weather)
        with open(self._file, 'a') as f:
            f.write(f'{now}\n{formatted_weather}\n')


class WeatherStorage(Protocol):
    """Interface for any storage saving weather"""

    def save(self, weather: Weather):
        raise NotImplementedError


def save_weather(weather: Weather, storage: WeatherStorage):
    """Save weather in the storage"""
    storage.save(weather)

weather.py: #!/usr/bin/env python3.10
from pathlib import Path

from coordinates import get_gps_coordinates
from exceptions import CantGetCoordinates, ApiServiceError
from history import save_weather, PlainFileWeatherStorage, JSONFileWeatherStorage
from weather_api_service import get_weather
from weather_formatter import format_weather


def main():
    try:
        coordinates = get_gps_coordinates()
    except CantGetCoordinates:
        print('Do not get GPS coordinates.')
        exit(1)
    try:
        weather = get_weather(coordinates)
    except ApiServiceError:
        print('Do not get weather from weather service API.')
        exit(1)
    save_weather(
        weather,
        JSONFileWeatherStorage(Path.cwd() / 'history.json')
    )
    print(format_weather(weather))


if __name__ == '__main__':
    main()

weather_api_service.py: from datetime import datetime
from dataclasses import dataclass
from enum import Enum
import json
from json.decoder import JSONDecodeError
import ssl
from typing import Literal
import urllib.request
from urllib.error import URLError
from coordinates import Coordinates
import config
from exceptions import ApiServiceError

Celsius = int


class WeatherType(str, Enum):
    if config.LANG == 'en':
        THUNDERSTORM = 'Thunderstorm'
        DRIZZLE = 'Drizzle'
        RAIN = 'Rain'
        SNOW = 'Snow'
        CLEAR = 'Clear'
        FOG = 'Fog'
        CLOUDS = 'Clouds'
    elif config.LANG == 'ua':
        THUNDERSTORM = 'Блискавка'
        DRIZZLE = 'Мороз'
        RAIN = 'Дощ'
        SNOW = 'Сніг'
        CLEAR = 'Ясно'
        FOG = 'Туман'
        CLOUDS = 'Хмарно'


@dataclass(slots=True, frozen=True)
class Weather:
    temperature: Celsius
    weather_type: WeatherType
    sunrise: datetime
    sunset: datetime
    city: str


def get_weather(coordinates: Coordinates) -> Weather:
    """Requests weather in OpenWeather API and returns it"""
    openweather_response = _get_openweather_response(coordinates)
    weather = _parse_openweather_response(openweather_response)
    return weather


def _get_openweather_response(coordinates: Coordinates) -> str:
    ssl._create_default_https_context = ssl._create_unverified_context
    url = config.OPENWEATHER_URL.format(latitude=coordinates.latitude, longitude=coordinates.longitude)
    try:
        return urllib.request.urlopen(url).read()
    except URLError:
        raise ApiServiceError


def _parse_openweather_response(openweather_response: str) -> Weather:
    try:
        openweather_response = json.loads(openweather_response)
    except JSONDecodeError:
        raise ApiServiceError
    return Weather(
        temperature=_parse_temperature(openweather_response),
        weather_type=_parse_weather_type(openweather_response),
        sunrise=_parse_sun_time(openweather_response, 'sunrise'),
        sunset=_parse_sun_time(openweather_response, 'sunset'),
        city=_parse_city(openweather_response),
    )


def _parse_temperature(openweather_dict: dict) -> Celsius:
    return round(openweather_dict['main']['temp'])


def _parse_weather_type(openweather_dict: dict) -> WeatherType:
    try:
        weather_type_id = str(openweather_dict['weather'][0]['id'])
    except (IndexError, KeyError):
        raise ApiServiceError

    weather_type = {
        '1': WeatherType.THUNDERSTORM,
        '3': WeatherType.DRIZZLE,
        '5': WeatherType.RAIN,
        '6': WeatherType.SNOW,
        '7': WeatherType.FOG,
        '800': WeatherType.CLEAR,
        '80': WeatherType.CLOUDS,
    }
    for _id, _weather_type in weather_type.items():
        if weather_type_id.startswith(_id):
            return _weather_type
    raise ApiServiceError


def _parse_sun_time(openweather_dict: dict, time: Literal['sunrise'] | Literal['sunset']) -> datetime:
    return datetime.fromtimestamp(openweather_dict['sys'][time])


def _parse_city(openweather_dict: dict) -> str:
    return openweather_dict['name']


if __name__ == '__main__':
    print(get_weather(Coordinates(latitude=49.9, longitude=36.2)))

weather_formatter.py: import config
from weather_api_service import Weather

formatted_molds = {
    'en': ('{city}, {temperature}°C, {type}\n'
           'Sunrise: {sunrise}\n'
           'Sunset: {sunset}\n'),
    'ua': ('{city}, {temperature}°C, {type}\n'
           'Схід сонця: {sunrise}\n'
           'Захід сонця: {sunset}\n'),
}


def format_weather(weather: Weather):
    """Formats weather data in string"""
    ret = formatted_molds[config.LANG]
    ret = ret.format(
        city=weather.city,
        temperature=weather.temperature,
        type=weather.weather_type,
        sunrise=weather.sunrise.strftime('%H:%M'),
        sunset=weather.sunset.strftime('%H:%M'),
    )
    return ret


if __name__ == '__main__':
    from datetime import datetime
    from weather_api_service import WeatherType

    print(format_weather(Weather(
        temperature=25,
        weather_type=WeatherType.CLEAR,
        sunrise=datetime.fromisoformat('2022-05-03 04:00:00'),
        sunset=datetime.fromisoformat('2022-05-03 20:25:00'),
        city='Kharkov'
    )))
.
Assistant: