Skip to content

Commit

Permalink
refactor: remove dependency on pytz (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
scop authored Sep 17, 2023
1 parent 615785a commit 4619caa
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 20 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ repos:
rev: v1.3.0
hooks:
- id: mypy
additional_dependencies: [types-pytz>=2023.3.0.0]
- repo: https://github.com/PyCQA/bandit
rev: 1.7.4
hooks:
Expand Down
15 changes: 0 additions & 15 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ myst-parser = {version = "^0.18", optional = true}
bluetooth-sensor-state-data = ">=1.6.1"
sensor-state-data = ">=2.16.1"
bluetooth-data-tools = ">=0.1.2"
pytz = "^2023.3"
cryptography = ">=40.0.0"

[tool.poetry.extras]
Expand Down
5 changes: 2 additions & 3 deletions src/bthome_ble/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
import logging
import struct
import sys
from datetime import datetime
from datetime import datetime, timezone
from enum import Enum
from typing import Any

import pytz
from bluetooth_data_tools import short_address
from bluetooth_sensor_state_data import BluetoothData
from cryptography.exceptions import InvalidTag
Expand Down Expand Up @@ -92,7 +91,7 @@ def parse_string(data_obj: bytes) -> str | None:
def parse_timestamp(data_obj: bytes) -> datetime:
"""Convert bytes to a datetime object."""
value = datetime.fromtimestamp(
int.from_bytes(data_obj, "little", signed=False), tz=pytz.utc
int.from_bytes(data_obj, "little", signed=False), tz=timezone.utc
)
_LOGGER.error("time %s", value)
return value
Expand Down

0 comments on commit 4619caa

Please sign in to comment.