Skip to content

Commit

Permalink
Drop Python 3.6 support (#180)
Browse files Browse the repository at this point in the history
* Drop Python 3.6 support

* update black to fix conflict with click

* Apply new black requirements

* run black
  • Loading branch information
chadell authored Oct 24, 2022
1 parent 6a917ff commit 998fcf7
Show file tree
Hide file tree
Showing 13 changed files with 418 additions and 486 deletions.
6 changes: 3 additions & 3 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 Expand Up @@ -109,7 +109,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10"]
runs-on: "ubuntu-20.04"
env:
INVOKE_LOCAL: "True"
Expand Down
7 changes: 6 additions & 1 deletion anonymize_ips.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
# RFC 5737
IPV4_DOCUMENTATION_ADDRESSES = ["192.0.2.0/24", "198.51.100.0/24", "203.0.113.0/24"]

anonymizer4 = IpAnonymizer(SALT, None, preserve_addresses=IPV4_DOCUMENTATION_ADDRESSES, preserve_suffix=None,)
anonymizer4 = IpAnonymizer(
SALT,
None,
preserve_addresses=IPV4_DOCUMENTATION_ADDRESSES,
preserve_suffix=None,
)
anonymizer6 = IpV6Anonymizer(SALT, preserve_suffix=None)


Expand Down
5 changes: 4 additions & 1 deletion circuit_maintenance_parser/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ class ProviderError(Exception):
"""Error in the Provider."""

def __init__(
self, *args, related_exceptions=None, **kwargs,
self,
*args,
related_exceptions=None,
**kwargs,
):
"""Extend init to add related_exceptions coming from multiple related errors."""
super().__init__(*args, **kwargs)
Expand Down
10 changes: 8 additions & 2 deletions circuit_maintenance_parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ def parse_ical(gcal: Calendar) -> List[Dict]:
]
else:
data["circuits"] = [
CircuitImpact(circuit_id=circuits, impact=Impact(component.get("X-MAINTNOTE-IMPACT")),)
CircuitImpact(
circuit_id=circuits,
impact=Impact(component.get("X-MAINTNOTE-IMPACT")),
)
]
result.append(data)
return result
Expand All @@ -167,7 +170,10 @@ def parser_hook(self, raw: bytes):

return result

def parse_html(self, soup: ResultSet,) -> List[Dict]:
def parse_html(
self,
soup: ResultSet,
) -> List[Dict]:
"""Custom HTML parsing."""
raise NotImplementedError

Expand Down
5 changes: 4 additions & 1 deletion circuit_maintenance_parser/parsers/equinix.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ def _parse_table(self, theader_elements, data, impact): # pylint: disable=no-se
if circuit_info:
account, _, circuit = circuit_info # pylint: disable=unused-variable
data["circuits"].append(
{"circuit_id": circuit.text, "impact": impact,}
{
"circuit_id": circuit.text,
"impact": impact,
}
)
data["account"] = account.text

Expand Down
24 changes: 21 additions & 3 deletions circuit_maintenance_parser/parsers/zayo.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,27 @@ def parse_tables(self, tables: ResultSet, data: Dict):

table_headers = [self.clean_line(line) for line in head_row[:5]]
expected_headers_ref = (
["Circuit Id", "Expected Impact", "A Location CLLI", "Z Location CLLI", "Legacy Circuit Id",],
["Circuit Id", "Expected Impact", "A Location Address", "Z Location Address", "Legacy Circuit Id",],
["Circuit Id", "Expected Impact", "A Location Address", "Z Location Address", "Customer Circuit ID",],
[
"Circuit Id",
"Expected Impact",
"A Location CLLI",
"Z Location CLLI",
"Legacy Circuit Id",
],
[
"Circuit Id",
"Expected Impact",
"A Location Address",
"Z Location Address",
"Legacy Circuit Id",
],
[
"Circuit Id",
"Expected Impact",
"A Location Address",
"Z Location Address",
"Customer Circuit ID",
],
)
if all(table_headers != expected_headers for expected_headers in expected_headers_ref):
logger.warning("Table headers are not as expected: %s", head_row)
Expand Down
10 changes: 8 additions & 2 deletions circuit_maintenance_parser/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ def get_location(self, city: str) -> Tuple[float, float]:
location_coordinates = self.get_location_from_api(city)

logger.debug(
"Resolved city %s to coordinates: lat %s - lon %s", city, location_coordinates[0], location_coordinates[1],
"Resolved city %s to coordinates: lat %s - lon %s",
city,
location_coordinates[0],
location_coordinates[1],
)
return location_coordinates

Expand All @@ -86,7 +89,10 @@ def get_location_from_local_file(self, city: str) -> Tuple[float, float]:

@staticmethod
@backoff.on_exception(
backoff.expo, (GeocoderUnavailable, GeocoderTimedOut, GeocoderServiceError), max_time=10, logger=logger,
backoff.expo,
(GeocoderUnavailable, GeocoderTimedOut, GeocoderServiceError),
max_time=10,
logger=logger,
)
def get_location_from_api(city: str) -> Tuple[float, float]:
"""Get location from API."""
Expand Down
Loading

0 comments on commit 998fcf7

Please sign in to comment.