Skip to content

Commit f58f75e

Browse files
authored
Merge pull request #235 from networktocode/release_v2.2.4
Release v2.2.4
2 parents ab0782c + c739b4c commit f58f75e

File tree

7 files changed

+948
-283
lines changed

7 files changed

+948
-283
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Default owner(s) of all files in this repository
2-
* @chadell @glennmatthews @pke11y @scetron
2+
* @chadell @glennmatthews @pke11y @scetron @jvanderaa

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
name: "CI"
3-
concurrency: # Cancel any existing runs of this workflow for this same PR
3+
concurrency: # Cancel any existing runs of this workflow for this same PR
44
group: "${{ github.workflow }}-${{ github.ref }}"
55
cancel-in-progress: true
6-
on: # yamllint disable
6+
on: # yamllint disable
77
push:
88
branches:
99
- "main"

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
# Changelog
22

3+
## v2.2.4 - 2023-07-12
4+
5+
- #230 - Swap out tzwhere for TimezoneFinder
6+
- #234 - Added upper bound to pydantic dependency
7+
8+
### Changed
9+
310
## v2.2.3 - 2023-03-21
411

512
### Changed
613

714
- #216 - Allow Lumen maintenance multiple windows to be parsed
815
- #212 - Updated documentation: Contribution section
916
- #210 - Ability to parse multiple maintenance windows from Zayo
10-
- #190 - Update Telstra for new notificaiton format
17+
- #190 - Update Telstra for new notification format
1118

1219
### Fixed
1320

circuit_maintenance_parser/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from geopy.exc import GeocoderUnavailable, GeocoderTimedOut, GeocoderServiceError # type: ignore
88
from geopy.geocoders import Nominatim # type: ignore
9-
from tzwhere import tzwhere # type: ignore
9+
from timezonefinder import TimezoneFinder # type: ignore
1010
import backoff # type: ignore
1111

1212
from .errors import ParserError
@@ -39,7 +39,7 @@ class Geolocator:
3939
def timezone(cls): # pylint: disable=no-self-argument
4040
"""Load the timezone resolver."""
4141
if cls._timezone is None:
42-
cls._timezone = tzwhere.tzwhere()
42+
cls._timezone = TimezoneFinder()
4343
logger.info("Loaded local timezone resolver.")
4444
return cls._timezone
4545

@@ -110,12 +110,12 @@ def city_timezone(self, city: str) -> str:
110110
if self.timezone is not None:
111111
try:
112112
latitude, longitude = self.get_location(city)
113-
timezone = self.timezone.tzNameAt(latitude, longitude) # pylint: disable=no-member
113+
timezone = self.timezone.timezone_at(lat=latitude, lng=longitude) # pylint: disable=no-member
114114
if not timezone:
115115
# In some cases, given a latitued and longitued, the tzwhere library returns
116116
# an empty timezone, so we try with the coordinates from the API as an alternative
117117
latitude, longitude = self.get_location_from_api(city)
118-
timezone = self.timezone.tzNameAt(latitude, longitude) # pylint: disable=no-member
118+
timezone = self.timezone.timezone_at(lat=latitude, lng=longitude) # pylint: disable=no-member
119119

120120
if timezone:
121121
logger.debug("Matched city %s to timezone %s", city, timezone)

poetry.lock

Lines changed: 914 additions & 271 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "circuit-maintenance-parser"
3-
version = "2.2.3"
3+
version = "2.2.4"
44
description = "Python library to parse Circuit Maintenance notifications and return a structured data back"
55
authors = ["Network to Code <opensource@networktocode.com>"]
66
license = "Apache-2.0"
@@ -24,12 +24,12 @@ include = [
2424
[tool.poetry.dependencies]
2525
python = "^3.7"
2626
click = ">=7.1, <9.0"
27-
pydantic = {version = ">= 1.8.0, != 1.9.*, >= 1.10.4", extras = ["dotenv"]}
27+
pydantic = {version = ">= 1.8.0, != 1.9.*, >= 1.10.4, < 2", extras = ["dotenv"]}
2828
icalendar = "^5.0.0"
2929
bs4 = "^0.0.1"
3030
lxml = "^4.6.2"
3131
geopy = "^2.1.0"
32-
tzwhere = "^3.0.3"
32+
timezonefinder = "^6.0.1"
3333
backoff = "^1.11.1"
3434
chardet = "^5"
3535

tasks.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Tasks for use with Invoke."""
22
import os
33
import sys
4-
from distutils.util import strtobool
54
from invoke import task # type: ignore
65

76
try:
@@ -10,6 +9,22 @@
109
sys.exit("Please make sure to `pip install toml` or enable the Poetry shell and run `poetry install`.")
1110

1211

12+
def strtobool(val):
13+
"""
14+
Convert a string representation of truth to a boolean.
15+
16+
True values are "y", "yes", "t", "true", "on", and "1".
17+
False values are "n", "no", "f", "false", "off", and "0".
18+
Raises ValueError if 'val' is anything else.
19+
"""
20+
val = val.lower()
21+
if val in ("y", "yes", "t", "true", "on", "1"):
22+
return True
23+
if val in ("n", "no", "f", "false", "off", "0"):
24+
return False
25+
raise ValueError(f"invalid truth value {val}")
26+
27+
1328
def is_truthy(arg):
1429
"""Convert "truthy" strings into Booleans.
1530

0 commit comments

Comments
 (0)