Skip to content

Commit

Permalink
Merge pull request #235 from networktocode/release_v2.2.4
Browse files Browse the repository at this point in the history
Release v2.2.4
  • Loading branch information
chadell authored Jul 12, 2023
2 parents ab0782c + c739b4c commit f58f75e
Show file tree
Hide file tree
Showing 7 changed files with 948 additions and 283 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Default owner(s) of all files in this repository
* @chadell @glennmatthews @pke11y @scetron
* @chadell @glennmatthews @pke11y @scetron @jvanderaa
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: "CI"
concurrency: # Cancel any existing runs of this workflow for this same PR
concurrency: # Cancel any existing runs of this workflow for this same PR
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
on: # yamllint disable
on: # yamllint disable
push:
branches:
- "main"
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# Changelog

## v2.2.4 - 2023-07-12

- #230 - Swap out tzwhere for TimezoneFinder
- #234 - Added upper bound to pydantic dependency

### Changed

## v2.2.3 - 2023-03-21

### Changed

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

### Fixed

Expand Down
8 changes: 4 additions & 4 deletions circuit_maintenance_parser/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from geopy.exc import GeocoderUnavailable, GeocoderTimedOut, GeocoderServiceError # type: ignore
from geopy.geocoders import Nominatim # type: ignore
from tzwhere import tzwhere # type: ignore
from timezonefinder import TimezoneFinder # type: ignore
import backoff # type: ignore

from .errors import ParserError
Expand Down Expand Up @@ -39,7 +39,7 @@ class Geolocator:
def timezone(cls): # pylint: disable=no-self-argument
"""Load the timezone resolver."""
if cls._timezone is None:
cls._timezone = tzwhere.tzwhere()
cls._timezone = TimezoneFinder()
logger.info("Loaded local timezone resolver.")
return cls._timezone

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

if timezone:
logger.debug("Matched city %s to timezone %s", city, timezone)
Expand Down
1,185 changes: 914 additions & 271 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "circuit-maintenance-parser"
version = "2.2.3"
version = "2.2.4"
description = "Python library to parse Circuit Maintenance notifications and return a structured data back"
authors = ["Network to Code <[email protected]>"]
license = "Apache-2.0"
Expand All @@ -24,12 +24,12 @@ include = [
[tool.poetry.dependencies]
python = "^3.7"
click = ">=7.1, <9.0"
pydantic = {version = ">= 1.8.0, != 1.9.*, >= 1.10.4", extras = ["dotenv"]}
pydantic = {version = ">= 1.8.0, != 1.9.*, >= 1.10.4, < 2", extras = ["dotenv"]}
icalendar = "^5.0.0"
bs4 = "^0.0.1"
lxml = "^4.6.2"
geopy = "^2.1.0"
tzwhere = "^3.0.3"
timezonefinder = "^6.0.1"
backoff = "^1.11.1"
chardet = "^5"

Expand Down
17 changes: 16 additions & 1 deletion tasks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Tasks for use with Invoke."""
import os
import sys
from distutils.util import strtobool
from invoke import task # type: ignore

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


def strtobool(val):
"""
Convert a string representation of truth to a boolean.
True values are "y", "yes", "t", "true", "on", and "1".
False values are "n", "no", "f", "false", "off", and "0".
Raises ValueError if 'val' is anything else.
"""
val = val.lower()
if val in ("y", "yes", "t", "true", "on", "1"):
return True
if val in ("n", "no", "f", "false", "off", "0"):
return False
raise ValueError(f"invalid truth value {val}")


def is_truthy(arg):
"""Convert "truthy" strings into Booleans.
Expand Down

0 comments on commit f58f75e

Please sign in to comment.